obgm / libcoap

A CoAP (RFC 7252) implementation in C
Other
793 stars 423 forks source link

Split coap_io.c into separate files #180

Open arabine opened 6 years ago

arabine commented 6 years ago

It could be more maintainable to separate coap_io.c into dedicated files, since it seems that it is your platform abstraction layer (sort of, because the core stack is still not agnostic with plenty of ifdef CONTIKI or LWIP stuff).

Example:

etc. For you information, I'm usign this file to implement libcoap on another exotic stack.

obgm commented 6 years ago

This would make sense if not too much code will be duplicated across platforms. Maybe we should move platform-dependent code into a sub-directory structure such as:

src
+---  platform
       +--- posix
       +--- lwig
       +--- contiki
       +---...

(This has been proposed and implemented earlier but did not get too much traction, though.)

arabine commented 6 years ago

Absolutely agree, but I don't think it is an enhancement, it is more than that. I think the whole ifdef CONTIKI/LWIP/WHATEVER is a kind of nightmare. I prefer "choosing" the implementation using my build system.

In that way, we can have a completely independent libcoap stack, purely C code. I'm currently porting the stack in a very specific embedded environment and I must heavily modify the stack itself, which is not good to keep it sync with the upstream code :/

I would start by defining, for instance, a libcoap dedicated ip address structure instead of using the underneath IP stack. We must brake the dependency with the IP stacks.