darconeous / libnyoci

A flexible CoAP stack for embedded devices and computers. RFC7252 compatible.
Other
27 stars 10 forks source link

Compatibility with lwIP and ESP-IDF #13

Open snej opened 6 years ago

snej commented 6 years ago

lwIP = Lightweight IP library http://savannah.nongnu.org/projects/lwip/

ESP-IDF = iOT Development Framework for Espressif's ESP32 chip https://github.com/espressif/esp-idf

New preprocessor flags for configuration:

Fixes #8

(I also added a one-line commit that fixes a recent regression on the master branch that I discovered when rebasing just now.)

darconeous commented 6 years ago

I think a better approach would be to create a net platform rather than modifying the posix platform in-place, even if the new platform is based on posix.

Maybe call it plat-net/lwip-sockets?

snej commented 6 years ago

I think a better approach would be to create a net platform rather than modifying the posix platform in-place, even if the new platform is based on posix.

But that would mean duplicating ~1200 lines of code, which I couldn't bring myself to do (I'm pretty strict about DRY.)

Consider also that most of the changes aren't specific to lwIP; they'll add support for any other POSIX-like platform that's missing poll and/or sendmsg.

But it is of course your call. I may just keep my fork, err, forked. In that case, mind if I submit a smaller PR for just the ESP32-specific changes (e.g. to logging?)

darconeous commented 6 years ago

I'll take another look over the changes. If there are other POSIX platforms that your changes help make LibNyoci build on (Solaris? QNX? Minix?), then I'd be inclined to accept it. QNX in particular might benefit from it.

But I may end up just going ahead and implementing support for native LWIP.

Travis is failing here with these changes:

../../../../src/plat-net/posix/nyoci-plat-net.c:922:4: error: field designator 'sin6_len' does not refer to any field in type 'struct sockaddr_in6'
                .sin6_len = sizeof(struct sockaddr_in6),
                 ^

But let me review this stuff before you spend any significant amount of time trying to address that.

darconeous commented 6 years ago

Good news: It looks like I'll be adding real native support for LWIP at some point between now and the end of November. I'll also be adding support for bare-bones OpenThread.

darconeous commented 6 years ago

You've got some good changes in this PR, so I'm going to keep this open for now.