Skip to content
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

net/nanocoap: get option bytes #12075

Merged
merged 2 commits into from
Sep 12, 2019
Merged

Conversation

kb2ma
Copy link
Member

@kb2ma kb2ma commented Aug 24, 2019

Provides the ability to retrieve the value for an option as an opaque array of the bytes for the option. It is useful for an option with an opaque (byte array) data type. It also is useful to access any option as a byte array. For example, it can be convenient to replace the more attribute for a block option after it has been written to the packet.

In future PRs we plan to refactor the implementation of the internal coap_get_option_uint() to use coap_opt_get_opaque(), rename it to coap_opt_get_uint() and make it public. We also plan to refactor coap_get_blockopt() to use coap_opt_get_opaque().

Testing procedure

Added to the tests-nanocoap unit tests.

Issues/PRs references

Depends on #12074. Partially replaces #11437.

@kb2ma kb2ma added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: CoAP Area: Constrained Application Protocol implementations labels Aug 24, 2019
@smlng smlng added State: waiting for other PR State: The PR requires another PR to be merged first and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Sep 5, 2019
@smlng
Copy link
Member

smlng commented Sep 9, 2019

please rebase, #12074 is merged

@kb2ma kb2ma force-pushed the coap/options_get_opaque branch from d1be6e6 to 4ace366 Compare September 11, 2019 09:53
@kb2ma kb2ma added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 11, 2019
@kb2ma
Copy link
Member Author

kb2ma commented Sep 11, 2019

Rebased and engaged CI.

Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, nice addition

@chrysn
Copy link
Member

chrysn commented Sep 11, 2019

As a replacement for the coap_opt_get_next construction from a pointer, I suggest we add an option iteration initializer that'd work from coap_find_option. Thus, single options would be accessed using this coap_opt_get_opaque(pkt, optnum, ptr), but repeated ones using coap_opt_seek(pkt, optnum, &optpos), and can then be read single-file by coap_opt_get_next(pkt, &optpos, &value, false).

@kb2ma
Copy link
Member Author

kb2ma commented Sep 12, 2019

@chrysn and I discussed on PR 12074. No changes required at the moment.

@kb2ma kb2ma merged commit 1621cc1 into RIOT-OS:master Sep 12, 2019
@kb2ma kb2ma added this to the Release 2019.10 milestone Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants