-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nanocoap_sock: add nanocoap_sock_block_request() #17958
Conversation
3d23871
to
2688862
Compare
c255b51
to
a7f71d8
Compare
6a6d87a
to
54a4272
Compare
153819f
to
d2e5d9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 *snips
tocoap_pkt_t
so we don't have to copy the payload into a temporary buffer and can leveragesock_udp_sendv()
instead.Testing procedure
The
tests/nanocoap_cli
has been extended with a (crude)put
command.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_vfs
to upload files and integrate with theurl put/post
command, but I wanted to get some feedback on the API first.Issues/PRs references