[riot-notifications] [RIOT-OS/RIOT] net/gcoap: add/use Packet API Block implementation (#11056)

Ken Bannister notifications at github.com
Sun Feb 24 14:51:31 CET 2019

### Contribution description
#11002 and #11024 completed the Blockwise implementation for the Buffer API, traditionally used with nanocoap sock's message send/receive functions . This PR completes the implementation for the Packet API, used by gcoap. It includes two pairs of functions:

- coap_opt_add_blockN() to send a blockwise payload (descriptive use)
- coap_opt_add_blockN_control() to request/ack a blockwise payload (control use)

_N_ is 1 when acting on a blockwise payload in a PUT/POST request, and 2 when acting on a blockwise payload in a GET response.

This PR also adds module documentation to describe typical use of these functions to send/receive blockwise content. Finally, this PR adds generic client side control use in the gcoap example to request blockwise content from a server. This use allows gcoap to retrieve the full response from the nanocoap_server example for the /.well-known/core resource.

### Testing procedure
The gcoap module doc references an example for each use:

- [gcoap-block-server](https://github.com/kb2ma/riot-apps/blob/kb2ma-master/gcoap-block-server/gcoap_block.c) app for server side descriptive and control use, like the nanocoap_server example
- [gcoap-block-client](https://github.com/kb2ma/riot-apps/blob/kb2ma-master/gcoap-block-client/gcoap_block.c) app for client side descriptive use
- the gcoap example for client side control use, as mentioned above

FWIW, I use these examples in my automated [functional tests](https://github.com/kb2ma/riot-coap-pytest).

### Issues/PRs references
Partially implements #10732.

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


-- Commit Summary --

  * net/nanocoap: add inline function for Content-Format
  * net/gcoap: use coap_opt_finish within gcoap
  * net/gcoap: use coap_opt_finish in unit tests
  * net/gcoap: update module doc for coap_opt_finish
  * examples/gcoap: use coap_opt_finish()
  * examples/cord_epsim: use coap_opt_finish()
  * examples/cord_ep: use coap_opt_finish()
  * net/nanocoap: Return error from coap_opt_add_xxx() if no space
  * net/nanocoap: return error from coap_opt_finish if no space
  * net/nanocoap: clarify API buffer space doc
  * tests/nanocoap: verify error when overfill buffer
  * net/gcoap: verify error when overfill on coap_opt_finish
  * net/nanocoap: create function groups in module doc
  * net/nanocoap: reference new function sections
  * net/nanocoap: rename Options APIs for clarity
  * net/nanocoap: move detailed module doc to nanocoap_sock
  * net/nanocoap: refactor block option put
  * net/nanocoap: refactor block option control use
  * examples/nanocoap: use refactored block control function
  * net/nanocoap: add block init helper function
  * net/nanocoap: use block init helper internally
  * net/nanocoap: refactor block2_finish()
  * net/nanocoap: add block slicer init function
  * net/nanocoap: add Packet API block write functions
  * examples/gcoap: handle block2 response
  * net/gcoap: add module documentation for block use

-- File Changes --

    M examples/cord_ep/main.c (8)
    M examples/cord_epsim/main.c (4)
    M examples/gcoap/Makefile (4)
    M examples/gcoap/gcoap_cli.c (74)
    M examples/nanocoap_server/coap_handler.c (4)
    M sys/include/net/gcoap.h (194)
    M sys/include/net/nanocoap.h (1356)
    M sys/include/net/nanocoap_sock.h (104)
    M sys/net/application_layer/cord/ep/cord_ep.c (4)
    M sys/net/application_layer/cord/epsim/cord_epsim.c (2)
    M sys/net/application_layer/gcoap/gcoap.c (35)
    M sys/net/application_layer/nanocoap/nanocoap.c (88)
    M tests/unittests/tests-gcoap/tests-gcoap.c (46)
    M tests/unittests/tests-nanocoap/tests-nanocoap.c (12)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190224/d767fdd6/attachment.html>

More information about the notifications mailing list