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/gcoap: Add detailed message init options #7700

Closed
wants to merge 18 commits into from

Conversation

kb2ma
Copy link
Member

@kb2ma kb2ma commented Oct 9, 2017

This PR implements the fifth step in the confirmable messaging plan in #7192, and depends on #7548. Presently, the gcoap_xxx_init() functions accept parameters that can change from message to message, for example the message code (GET, PUT, etc). On the other hand, some parameters, like message type, expect a default value and are not included in the init functions.

For control over all useful parameters, this PR adds gcoap_req_init_opts() for requests and gcoap_obs_init_opts() for observe notifications. The init opts functions accept a gcoap_send_opts_t structure, which includes all of the available attributes. The documentation for each function describes which attributes are read. This infrastructure will be used in the remaining PRs for confirmable messaging -- synchronous messaging and separate ACK response PRs.

My approach with this PR has been to keep 'simple things easy' while allowing 'difficult things to be possible'. The existing (easy) ...init() functions are unchanged and still useful for many use cases, but when you need full control (difficult), all of the parameters are available to be set in ...init_opts(). The ...init() functions were refactored to use the ...init_opts() functions.

Add support for a confirmable request and standardize token match.
Also, create resend_bufs array to store PDU for resend.
Supports handling an empty message response.
Supports new uses where a coap_pkt_t PDU is not available.
Required if no ACK received, or if a reset (RST) received.
@kb2ma kb2ma mentioned this pull request Oct 9, 2017
6 tasks
@smlng smlng added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking State: waiting for other PR State: The PR requires another PR to be merged first labels Oct 14, 2017
@kYc0o kYc0o mentioned this pull request Oct 30, 2017
8 tasks
@kb2ma
Copy link
Member Author

kb2ma commented May 27, 2018

Closed in favor of #9156. For options, he flexibility and integration with nanocoap overrides the API simplicity. It still might be useful to define a compile-time macro for default messaging type. If you always send messages confirmably, it would save setting the message type.

@kb2ma kb2ma closed this May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking State: waiting for other PR State: The PR requires another PR to be merged first 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