nanocoap: Add functions to handle etag options
Contribution description
This adds 3 functions for adding entity-tags to coap packets. The first simply adds the option to the coap packet with the supplied etag value. The second functionallow for adding a dummy etag value which is to be replaced later by the last function. This allows for allocating space for the option up front when the etag value itself is generated based on the payload.
I also did a quick replace of coap_opt_add_opaque(pdu, COAP_OPT_ETAG…) in other sources.
Testing procedure
Added the option to one of the handlers of the gcoap_block_server example to test this.
The response result should look like this in wireshark:
Issues/PRs references
None
On Tue, Oct 17, 2023 at 01:18:21PM -0700, Koen Zandberg wrote:
You mean that my screenshot of wireshark is not good enough? :laughing:
Could have been clearer on severity: I'd prefer if there was a test, but the fact that it doesn't fault or corrupt the message is probably good enough practically -- hence the over-all ACK. A test would just be a nice touch.
Murdock results
:heavy_check_mark: PASSED
feaa2741f1c82a54d216057ee45760cdf7729cd7 fixup! fixup! fixup! fixup! fixup! fixup! nanocoap: Add functions to handle etag options
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 7937 | 0 | 7937 | 17m:26s |
Artifacts
@miri64 I don't really feel confident in patching the rest of the cache code to also use the coap_opt_replace_etag() there. Do you have a patch for me or do we leave that as is for now?
@miri64 I don't really feel confident in patching the rest of the cache code to also use the
coap_opt_replace_etag()there. Do you have a patch for me or do we leave that as is for now?
I don't have a patch, so let's leave it as is for now. Make very ephemeral mental note to fix this at some point.
Cheekily taking that audacity to ping; @chrysn is the unittest sufficient? Can your comment be resolved? @miri64 You also have two unresolved comments that seem to be addressed? @bergzand beside the unresolved comments; Is anything else blocking you here?
From my side all is resolved. It was an error of mine in the first place to use the "private" form in the wrappers, wjich has long been fixed now.