-
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
coap: Update list of defines for "PATCH and FETCH Methods" and SenML #10193
coap: Update list of defines for "PATCH and FETCH Methods" and SenML #10193
Conversation
Now with a sensible subject 😆 |
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.
Just took a quick look, and this looks straightforward and valuable. I agree that the use of decimal for response codes works better.
Give me a chance to browse the RFCs, and I'll provide a detailed review.
What to do about the nanocoap method flag macros for coap_resource_t, defined in nanocoap.h? All things being equal, I would add them in this PR like:
However, this need might be a good opportunity also to rename the prefix for these macros. IMO the current naming scheme is confusing relative to the COAP_METHOD_xxx macros. (I'm thinking @haukepetersen will agree here :-)). So, the new prefix could be NANOCOAP_FLAG_xxx, for example
For existing values we could deprecate the old names and add new names, and also add the new ones for fetch and patch at the same time. We could do this work in a separate commit in this PR, or in a separate PR for increased visibility since they are used extensively. What do you think? |
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.
When I first saw this PR, I thought "new macros, this should be easy". Oh well, it is what it is. :-) Definitely worth a little discussion.
Yeah, I was hoping to easily get this merged, but your points on the name and |
I think I agree with you here.
Yes please! I really don't want to piggy-back an API change here :) |
@kb2ma I've added a commit to add the flags to |
Sounds good -- agreed on separate PR to convert COAP_xxx macros to NANOCOAP_FLAG_xxx. |
Don't we also need to add COAP_FORMAT_xxx codes for json-patch+json and merge-patch+json defined in 8132? I have not looked closely, just noticed them in the IANA Considerations section. |
Yeah, nothing against adding them. I didn't bother with it in the first place because we don't use really use JSON a lot with RIOT |
After a second look, those are from a different RFC, I'll add them to the list here, but that's probably the original reason why I skipped them |
sys/include/net/coap.h
Outdated
#define COAP_FORMAT_JSON (50) | ||
#define COAP_FORMAT_JSON_PATCH_JSON (51) | ||
#define COAP_FORMAT_MERGE_PATCH_JSON (52) | ||
#define COAP_FORMAT_JSON (50) |
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.
Only need to define once ;-)
Except for the duplicate COAP_FORMAT_JSON, looks fine to me. Please squash with the fix, and I think we'll be good to go. I just did some automated testing on native -- unit tests and release specs. |
dc284a8
to
7730517
Compare
@kb2ma squashed and rebased! |
@bergzand ping As soon as you fix the duplicate COAP_FORMAT_JSON, and rebase and resolve the conflicts (easy), I am happy to ACK. |
Removed the duplicate define and fixed the alignment. Took a bit too long to fix it. I'll rework the commits to a sensible set of changes when squashing. |
Looks good to me. Please squash. I added a little code to the gcoap example to test making a FETCH request, and that worked. LwM2M is on my personal roadmap, and v1.1 uses FETCH and iPATCH. Looking forward to addition of support for these methods. |
I was too quick to ACK due to the merge conflict. Apologies for the confusion. |
Update the list of defines for methods and response codes with the new codes as defined in [rfc8132](https://tools.ietf.org/html/rfc8132)
ca36d54
to
1721739
Compare
Rebased |
1721739
to
7bd9e68
Compare
Squashed |
@kb2ma I think the set of should be good as they are now. Can you please check that I didn't mix different sets of defines in the single commit. |
@kb2ma Thanks! |
Contribution description
Updated our list of defines with the ones from rfc8132 (Fetch, patch and ipatch) and accompanying response codes. I decided to rewrite the existing hexadecimal response codes to decimal to better match the formatting of the IANA response code list
Also added content types from rfc8428 (senml).
Decided to bundle it in a single PR because it is defines only.
Testing procedure
Test if nanocoap and/or gcoap still compiles.
Issues/PRs references
None