RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

nanocoap: Add functions to handle etag options

Open bergzand opened this issue 2 years ago • 6 comments

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:

image

Issues/PRs references

None

bergzand avatar Oct 17 '23 19:10 bergzand

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.

chrysn avatar Oct 17 '23 21:10 chrysn

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

riot-ci avatar Oct 18 '23 11:10 riot-ci

@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?

bergzand avatar Oct 20 '23 08:10 bergzand

@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.

miri64 avatar Oct 20 '23 08:10 miri64

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?

Teufelchen1 avatar Jan 24 '24 15:01 Teufelchen1

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.

chrysn avatar Jan 24 '24 15:01 chrysn