-
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
net/nanocoap: Buffer API Block helper functions #11024
Conversation
needs rebasing. |
Ah sorry, I was just trying to figure out why lost Confirmable messages were not send again, so I started looking if there was still something missing in RIOT's CoAP implementation. |
@benpicco, if you still have concerns about Confirmable retries, please open an issue. I'd be happy to work through it with you. |
Sorry for the confusion, it turned out the problem was entirely unrelated to CoAP. |
30dfd55
to
54d3898
Compare
Rebased |
unsigned blknum = _slicer_blknum(slicer); | ||
coap_block1_t block; | ||
|
||
coap_block_object_init(&block, _slicer_blknum(slicer), |
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.
Here coap_block_object_init
receives a bool more
but in it declaration its type is int
. Shouldn't it be a bool in both cases? Change the documentation accordingly if its the case.
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.
Thanks for reading closely. We specifically use coap_opt_put_block() when writing a block, so it's only useful for its more
parameter to be a bool. At the same time, coap_block_object_init() directly sets the struct attribute values, and the more
attribute can take on a value of -1, so it makes sense for the function to support that. I think this is a case where the declaration of coap_opt_put_block() and coap_block_object_init() make sense as they are, and it's OK to let the definition of bool
as 0 or 1 bridge the gap.
However, the doc comment for coap_block_object_init() only explicitly refers to use of 0 if we don't know if there are more blocks. I will extend the comment to be more precise about use of 1 and 0. However, I'd like to leave the use of -1 as unspecified because we don't expect anyone to use it for this purpose. That may change in the future, and if it does we won't need to change the API to accommodate it.
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.
OK!
I only have one comment regarding documentation, see above. |
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.
@kb2ma This looks good to me, I would say squash directly unless you want to wait for someone else to take a look. But ACK on my side.
Also please trigger the ci build once squashed. |
b72ff0b
to
64b4e0a
Compare
Contribution description
#11002 added client side implementations for Block for the Buffer API. This PR refines the implementation with helper functions.
You can see the client side functions in action in block_client.c in my RIOT apps repostiory.
Testing procedure
The nano-block-client RIOT app provides a command line with commands to generate CoAP requests for nanocoap_server example resources. So you can verify both client and server side.
/riot/ver
/sha256
Issues/PRs references
Partially implements #10732. Depends on #11002.