iotaledger / entangled

enTangle'd is an amalgamation of all things Tangle
Apache License 2.0
113 stars 66 forks source link

CClient & cIRI: Targeted systems #799

Closed Citrullin closed 5 years ago

Citrullin commented 5 years ago

As I understood it cIRI should run on SBCs, while CClient should also run on MCUs. Sam mentioned this topic in IF Talk. I am a bit surprised, since the ESP toolchain is already integrated into the entangled project. There is also an issue which mentions this topic.

So, I thought it makes sense to discuss this topic openly, since we need some kind of library for MCUs. So, what is the goal of entangled? Especially what is the goal for the CClient? What are the targeted systems? It could also be an option to fork my c-library I wrote, so that we have one MCU focused library and one for Unix based operation systems.

oopsmonk commented 5 years ago

@Citrullin anwser your quetion in IF Talk.

Is the Cortex M series targeted by CClient?

I'd like to say CClient targeted Cortex-M which has network stack.

Citrullin commented 5 years ago

I'd like to say CClient targeted Cortex-M which has network stack.

@oopsmonk Which kind of network stack? Must it be TCP/IP on IPv4/IPv6? Or is 6LoWPAN & CCN Lite also fine? So basically: Should the network layer be replaceable?

Regarding the network stack: Since Microcontrollers have restricted resources, should it also be possible to replace the JSON protocol with a binary one? JSON on HTTP is a lot of overhead for such little devices. Also in terms of network bandwidth.

I just want to collect some information what the scope of CClient is.

oopsmonk commented 5 years ago

CClient talks to IRI & cIRI though TCP/IP, so the network layer depending on platforms.

As I know IRI/cIRI plan to have a binary protocol, but CClient is not the time to discuss it. JSON is the only way for communication, for now.

The short term goal for CClient is to support, optimize, and fit all client APIs into small devices. let's keep it simple on this stage.

thibault-martinez commented 5 years ago

should it also be possible to replace the JSON protocol with a binary one?

I just want to add that implementation-wise, replacing things like that should be fairly easy as they depend on enums and vtables.

e.g.

typedef enum serializer_type_e {
  SR_JSON = 0,
  SR_UNIMPLEMENTED,
} serializer_type_t;

typedef struct serializer_base {
  serializer_vtable vtable;
} serializer_base;
Citrullin commented 5 years ago

@oopsmonk Okay, fine for now. I just wanted to know if this is planned for the future. So, if I want to use BLE or another protocol, I need to implement the TCP/IP stack on it. So, it shouldn't be a problem to write a new network interface in Linux for it and using it together with cIRI or IRI. The Client (IRI & cIRI) shouldn't care about the underlying network layer.

What network is CClient expecting? POSIX socket? Haven't looked into the code yet. This is one of my next to dos. I thought I just ask, before I do it. :)

francescolavra commented 5 years ago

Yes, CClient expects the POSIX socket API to be available in the target system.

Citrullin commented 5 years ago

I think I have all information, I need. Thanks @francescolavra , @thibault-martinez and @oopsmonk :)