obgm / libcoap

A CoAP (RFC 7252) implementation in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is coaps+tcp client supported by lwip+mbedtls?

JimmyBaize opened this issue · comments

Is your feature request related to a problem? Please describe.
I plan to use lwip+mbedtls to implement the coaps+tcp client, Is this supported?

Because I looked at the LWIP section of the installation guide
https://libcoap.net/install.html
If using libcoap with LwIP, only TinyDTLS is supported?
Why does coap_socket_connect_tcp1 in coap_io_lwip.c always return 0?

The initial libcoap support for using LwIP was UDP based as CoAP over TCP was not around (but now is as per RFC8323. I would not expect adding in TCP support to be that difficult.

Adding in MbedTLS support would involve adding in the MbedTLS library source files for compilation - similar to how TinyDTLS support was added in. LwIP does support altcp with MbedTLS, but that too requires the MbedTLS library source files to be compiled in. However, altcp would not really help here as libcoap inserts the (D)TLS layer into the network stack depending on whether coap (or coap+tcp) is being used, or coaps (or coaps+tcp) is being used, so just using tcp in LwIp wold be better.

If I port lwip to the OS, libcoap only uses the POSIX socket API, is that okay?

To set LWIP_SOCKET to 1 requires that NO_SYS is set to 0, which has other ramifications.

Two ways forward for LwIP TCP support as I initially see it
Support NO_SYS ==0
Update libcoap code to support non-posix TCP calls.