namib-project / libcoap-rs

Rust bindings to and wrapper around the libcoap C library
BSD 2-Clause "Simplified" License
6 stars 1 forks source link

Improve support for blockwise transfer #3

Open pulsastrix opened 1 year ago

pulsastrix commented 1 year ago

Summary

Provide an API for users to directly send and receive data blocks when blockwise transfer is used.

Description

The current version of the binding delegates the handling of large requests and blockwise transfers to the underlying libcoap C library by setting the COAP_BLOCK_USE_LIBCOAP flag. While this is probably the best default approach to take, it should also be possible for library users to receive and resassemble the blocks separately if they so wish.

Additionally, the CoapMessage to coap_pdu_t conversion in libcoap/src/message.rs#431 has to be extended to support large/blockwise response messages. For this purpose, it might be necessary to keep the request PDU associated with the response Message, as the request PDU is required for coap_add_data_large_response.

Implementation steps

(Issue moved over from GitLab)