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.
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.
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.
|
I only have one comment regarding documentation, see above. |
|
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/sha256Issues/PRs references
Partially implements #10732. Depends on #11002.