eclipse-wakaama / wakaama

Eclipse Wakaama is a C implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
BSD 3-Clause "New" or "Revised" License
501 stars 374 forks source link

Single UDP packet fragmentation #659

Open telemetrix opened 2 years ago

telemetrix commented 2 years ago

Hello, there is some way to read out in the lib the length of the COAP/LWM2M payload required for the single message?

We are implementing the lib where the external TCP/IP stack from the cellular module is used and some of the packets are coming to us fragmented. It generates the errors on Wakaama lib so maybe there is some way how to glue the fragmented packets into the single one or at least to how much data is still missed?

The same issue we can face when the two UPD packets are glued.

boaks commented 2 years ago

Not sure, If I understand your issue.

For UDP RFC768 the length is encoded in the UDP header. CoAP uses that length in the UDP header and don't add one on its own (CoAP over TCP does, but not over UDP). Usually the UDP stack only forwards a UDP message after reassembling, or at least, the information, if reassembling is required and fragments are missing is left to that IP-stack.

So, CoAP doesn't have that length, you need to search at your modems IP-stack.