nanocoap_sock: add nanocoap_sock_block_request()#17958
nanocoap_sock: add nanocoap_sock_block_request()#17958benpicco merged 4 commits intoRIOT-OS:masterfrom
Conversation
3d23871 to
2688862
Compare
c255b51 to
a7f71d8
Compare
6a6d87a to
54a4272
Compare
153819f to
d2e5d9f
Compare
maribu
left a comment
There was a problem hiding this comment.
Code looks good to me.
I think that the semantics of coap_get_total_len are unclear when snips in a pkt are used. With the current documentation, I would assume that it would also take any payload snips into account, but the implementation doesn't. (In fact, the code here relies on the fact that it doesn't take the snips size into account.)
It is not directly related, but I am also a bit unhappy with the documentation of coap_pkt_t::payload. As I understand it, it really points to the end of the header (included the 0xff end of options marker, if present). So even when there is no payload at all, it must still not be NULL.
I also would like the documentation to have an opinion on whether (pkt->payload_len > 0) && (pkt->snips != NULL) is valid or not. And if it is valid, how the payload when assembled back into a single continuous buffer would look like. (E.g. would pkt->payload be put in front of pkt->snips, or the other way round.)
|
I added some documentation to
|
maribu
left a comment
There was a problem hiding this comment.
ACK. Code looks good and I trust your testing. Please squash the documentation nitpicks right in.
f98913a to
c20a1d0
Compare
This accounts for a C-nonbreaking-Rust-breaking change in RIOT APIs. Merges: https://gitlab.com/etonomy/riot-wrappers/-/merge_requests/10 See-Also: RIOT-OS/RIOT#17958
Contribution description
This implements a
nanocoap_sock_block_request()function for block-wise (block1) requests.The function is expected to be called in a loop and will transmit a block each time it's called.
As an alternative to #17544 I simple added a
iolist_t *snipstocoap_pkt_tso we don't have to copy the payload into a temporary buffer and can leveragesock_udp_sendv()instead.Testing procedure
The
tests/nanocoap_clihas been extended with a (crude)putcommand.It will simply upload the lyrics of the Free Software Song via blockwise PUT, it can be used with
with
on the other end.
This will be changed to instead integrate with
nanocoap_vfsto upload files and integrate with theurl put/postcommand, but I wanted to get some feedback on the API first.Issues/PRs references