Skip to content

Commit 8aef938

Browse files
committed
fixup! nanocoap: add server-side block1 support
1 parent 5136fcc commit 8aef938

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

sys/include/net/nanocoap.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,21 @@ size_t coap_put_option_uri(uint8_t *buf, uint16_t lastonum, const char *uri, uin
447447
int coap_get_blockopt(coap_pkt_t *pkt, uint16_t option, uint32_t *blknum, unsigned *szx);
448448

449449
/**
450-
* @brief Block1 helper
450+
* @brief Block1 option getter
451+
*
452+
* This function gets a CoAP packet's block1 option and parses it into a helper
453+
* structure.
454+
*
455+
* If no block1 option is present in @p pkt, the values in @p block1 will be
456+
* initialized with zero. That implies both block1->offset and block1->more are
457+
* also valid in that case, as packet with offset==0 and more==0 means it contains
458+
* all the payload for the corresponding request.
451459
*
452460
* @param[in] pkt pkt to work on
453461
* @param[out] block1 ptr to preallocated coap_block1_t structure
454462
*
455463
* @returns 0 if block1 option not present
456-
* @returns 1 if structure has been filles
464+
* @returns 1 if structure has been filled
457465
*/
458466
int coap_get_block1(coap_pkt_t *pkt, coap_block1_t *block1);
459467

@@ -517,11 +525,11 @@ unsigned coap_get_content_type(coap_pkt_t *pkt);
517525
int coap_get_uri(coap_pkt_t *pkt, uint8_t *target);
518526

519527
/**
520-
* @brief Helper to convert SZX value to size
528+
* @brief Helper to decode SZX value to size in bytes
521529
*
522-
* @param[in] szx SZX value to convert
530+
* @param[in] szx SZX value to decode
523531
*
524-
* @returns size
532+
* @returns SZX value decoded to bytes
525533
*/
526534
static inline unsigned coap_szx2size(unsigned szx)
527535
{

0 commit comments

Comments
 (0)