-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add Unassigned, Reserved, and ExperimentalUse options holding opaque binary values #328
base: main
Are you sure you want to change the base?
Conversation
Let me mull on this for a bit. I'm not eager to implement a "catch-all" type — [assuming not a huge lift] being that CoAP Option Numbers (link you provided) has an exhaustive list of options, it seems it would be better to instead implement those types? |
That list also has wide ranges providing for new extensions and experimental use, so I think you would need some way to capture a general option number. Is essence, all numbers could potentially get used
Of course, it would be great to cover all options already defined with specific implementations. There might possibly be some upgrade issues if first the "Unknown" or general catch-all is added, and later on more specific implementations get added, for anyone using such options. On the other hand, there's no easy way to implement specific option handling before that option is added, and implementations could still pass on all options as is, and things like that. So maybe it is not too bad if a general catch-all is added first, and more specific implementations get added later? For my personal use case as an example, we are using the No-Response option that is in the list, which is how I noticed the issue. Now we are also about to add a custom option for internal use, and I wish the online KoAP parser to still be useful for all of our CoAP messages! Please mull over all this. Maybe some other naming is better, and maybe considerations for future upgrades are important. I'm still pushing for any encountered option to be handled in some way! 😄 |
My thinking is that we simply implement the handful of additional types defined in CoAP Option Numbers (e.g.
So, I guess |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #328 +/- ##
==========================================
+ Coverage 58.52% 59.87% +1.34%
==========================================
Files 8 8
Lines 639 648 +9
Branches 145 148 +3
==========================================
+ Hits 374 388 +14
+ Misses 228 210 -18
- Partials 37 50 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@zalenskivolt let me know if you want to tackle adding the few remaining options, or if you'd like me to take that on? |
Sounds like a plan! This would make future allocated option numbers parsed as "unassigned", but I guess that makes perfect sense until the code gets updated. Maybe both Reserved and ExperimentalUse could inherit from Unassigned? They are all unassigned too… Interesting that the reserved ones are just 5 numbers. The option 0 (zero), and four reserved for "more Location-*" options. From RFC7252(CoAP) 5.10.7. Location-Path and Location-Query
|
I'll see if I can make a start! |
If you can make the class hierarchy play nice, then that would be ideal. I'm also fine w/ them living alongside
Ya, the scattering of reserved options number is quite strange. I wonder if it has something to do w/ the bitfield? 🤷
|
from a quick google: stackoverflow/extend-data-class-in-kotlin
|
Looks like a great start! I'll try to find time this weekend to look it over. |
Started with 258 No-Response in #332, that I had already started on. Feel free to comment on that one, and I'll try to apply changes to any others… Missing ones are
TLS+ = TCP, TLS, and WebSockets and these are also listed without RFCs:
|
PRs for all 11 now:
All of them update the comments in |
Thanks so much for all your work on all this! Really incredible effort! ❤️ I'll follow up on this PR after #329 and #332 are merged. Apologies for all the rebasing that will likely ensue. 🙃 |
Add option classes to hold any option number encountered, with an opaque value.
Decode any unknown options into an Unassigned, Reserved or ExperimentalUse option instead of returning an error.
Format the value in hex in OptionSerializer.
This is to support handling any new or experimental option, for examples new entries in this list
https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#option-numbers
or any custom or experimental one.
The options are classified as:
See IANA CoAP Option Numbers
Closes #182