diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index 46e947dc50..da7f80e375 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -194,13 +194,27 @@ typedef struct { /** * @brief CoAP PDU parsing context structure + * + * When this struct is used to assemble the header, @p payload is used as the + * write pointer and @p payload_len contains the number of free bytes left in + * then packet buffer pointed to by @ref coap_pkt_t::hdr + * + * When the header was written, @p payload must not be changed, it must remain + * pointing to the end of the header. + * @p payload_len must then be set to the size of the payload that was further + * copied into the packet buffer, after the header. + * + * @ref coap_pkt_t::snips can be used to attach further payload buffers without copying them + * into the CoAP packet buffer. + * If there are any, they will be attached in order after the last payload byte + * (or header byte) in the original CoAP packet buffer. */ typedef struct { coap_hdr_t *hdr; /**< pointer to raw packet */ uint8_t *token; /**< pointer to token * @deprecated Use coap_get_token(), * Will be removed after 2022.10. */ - uint8_t *payload; /**< pointer to payload */ + uint8_t *payload; /**< pointer to end of the header */ iolist_t *snips; /**< payload snips (optional)*/ uint16_t payload_len; /**< length of payload */ uint16_t options_len; /**< length of options array */