[riot-notifications] [RIOT-OS/RIOT] CoAP: add remote annd local endpoint information to request and response handlers (#16429)

fabian18 notifications at github.com
Mon May 3 12:01:01 CEST 2021


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description
This PR adds a `const coap_ep_t *remote` and `const coap_ep_t *local` to the CoAP response and request handlers.
A `coap_ep_t *` is actually a `void *` because there is no full support for other sockets than UDP yet and maybe CoAP over TCP will be added some day.
The handlers in the `gcoap` example are caested to `(coap_handler_t)` to gain compatibility and still deal with  `sock_udp_ep_t *`.

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->
`examples/gcoap`

```
2021-05-03 09:57:26,415 # gcoap: remote [fe80::4c49:6fff:fe54:5c]:5683
2021-05-03 09:57:26,419 # gcoap: local [fe80::4c49:6fff:fe54:66]:5683
```
```
coap get fe80::4c49:6fff:fe54:66%6 5683 /.well-known/core
2021-05-03 09:57:17,508 # coap get fe80::4c49:6fff:fe54:66%6 5683 /.well-known/core
2021-05-03 09:57:17,512 # gcoap_cli: sending msg ID 51354, 23 bytes
2021-05-03 09:57:17,516 # gcoapgcoap: remote [fe80::4c49:6fff:fe54:66]:5683
2021-05-03 09:57:17,520 # gcoap: local [fe80::4c49:6fff:fe54:5c]:5683
2021-05-03 09:57:17,524 # gcoap: response Success, code 2.05, 46 bytes
2021-05-03 09:57:17,528 # </cli/stats>;ct=0;rt="count";obs,</riot/board>
coap get fe80::4c49:6fff:fe54:66%6 5683 /riot/board
2021-05-03 09:57:26,407 # _stats>;ct=0;rt="count";obs,</rio> coap get fe80::4c49:6fff:fe54:66%6 5683 /riot/board
2021-05-03 09:57:26,411 # gcoap_cli: sending msg ID 51355, 17 bytes
2021-05-03 09:57:26,415 # gcoap_cli: no observer for /cli/stats
> 2021-05-03 09:57:26,423 # gcoap: remote [fe80::4c49:6fff:fe54:66]:5683
2021-05-03 09:57:26,427 # gcoap: local [fe80::4c49:6fff:fe54:5c]:5683
2021-05-03 09:57:26,431 # gcoap: response Success, code 2.05, 18 bytes
2021-05-03 09:57:26,433 # nucleo-f767zi
```

### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

Trying to solve #15686

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16429

-- Commit Summary --

  * sock/udp: add aux_rx member access wrappers
  * net/nanocoap: add local endpoint information to handlers
  * examples/nanocoap_server: add local endpoint information to handlers
  * tests/nanocoap_cli: provide local=NULL to coap_handle_req
  * net/gcoap: add local endpoint information to handlers
  * examples/gcoap: add local endpoint information to handlers
  * net/cord_ep: add local endpoint information to handlers
  * net/cord_epsim: add local endpoint information to handlers
  * net/cord_lc: add local endpoint information to handlers
  * examples/gcoap: print endpoints in debug

-- File Changes --

    M examples/cord_ep/main.c (14)
    M examples/cord_epsim/main.c (12)
    M examples/gcoap/gcoap_cli.c (101)
    M examples/nanocoap_server/coap_handler.c (33)
    M sys/include/net/gcoap.h (3)
    M sys/include/net/nanocoap.h (28)
    M sys/include/net/sock/udp.h (72)
    M sys/net/application_layer/cord/ep/cord_ep.c (13)
    M sys/net/application_layer/cord/epsim/cord_epsim.c (3)
    M sys/net/application_layer/cord/lc/cord_lc.c (10)
    M sys/net/application_layer/gcoap/gcoap.c (47)
    M sys/net/application_layer/nanocoap/nanocoap.c (21)
    M sys/net/application_layer/nanocoap/sock.c (6)
    M tests/nanocoap_cli/nanocli_server.c (2)
    M tests/nanocoap_cli/request_handlers.c (8)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16429.patch
https://github.com/RIOT-OS/RIOT/pull/16429.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16429
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210503/2e6126b9/attachment.htm>


More information about the notifications mailing list