[riot-notifications] [RIOT-OS/RIOT] net/nanocoap: Buffer API Block helper functions (#11024)

Ken Bannister notifications at github.com
Fri Feb 15 17:30:05 CET 2019

### Contribution description
#11002 added client side implementations for Block for the Buffer API. This PR refines the implementation with helper functions.

| Function | Description |
| ---------- | ------------- |
| coap_block2_finish() | Refactored as inline, added coap_block1_finish() as inline for client side, and coap_block_finish() implementation. |
| coap_block_object_init() | Added for client to init a block2 control request, and refactored coap_opt_put_block() to use it.  |
| coap_block_slicer_init() | Added for client to init a block1 descriptive request, and refactored coap_block2_init() to use it. |

You can see the client side functions in action in [block_client.c](https://github.com/kb2ma/riot-apps/blob/kb2ma-master/nano-block-client/block_client.c) in my RIOT apps repostiory.

### Testing procedure
The [nano-block-client](https://github.com/kb2ma/riot-apps/tree/kb2ma-master/nano-block-client) RIOT app provides a command line with commands to generate CoAP requests for nanocoap_server example resources. So you can verify both client and server side.

- _get_ creates a block2 request for `/riot/ver`
- _post_ creates a block1 request for `/sha256`

### Issues/PRs references
Partially implements #10732. Depends on #11002.
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

-- File Changes --

    M examples/cord_ep/main.c (8)
    M examples/cord_epsim/main.c (4)
    M examples/gcoap/gcoap_cli.c (40)
    M examples/nanocoap_server/coap_handler.c (4)
    M sys/include/net/gcoap.h (85)
    M sys/include/net/nanocoap.h (1220)
    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 (76)
    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/20190215/bdc5a093/attachment.html>

More information about the notifications mailing list