pub unsafe extern "C" fn coap_opt_add_block(
pkt: *mut coap_pkt_t,
slicer: *mut coap_block_slicer_t,
more: bool,
option: u16,
) -> ssize_t
Expand description
@name Functions – Options Write Packet API @anchor net_nanocoap_opt_add
Use a coap_pkt_t struct to manage writing Options to the PDU.
The caller must monitor space remaining in the buffer; however, the API will not write past the end of the buffer, and returns -ENOSPC when it is full. / /@{*/ / @brief Add block option in descriptive use from a slicer object
When calling this function to initialize a packet with a block option, the more flag must be set to prevent the creation of an option with a length too small to contain the size bit.
@post pkt.payload advanced to first byte after option @post pkt.payload_len reduced by option length
@param[in,out] pkt pkt referencing target buffer @param[in] slicer coap blockwise slicer helper struct @param[in] more more flag (1 or 0) @param[in] option option number (block1 or block2)
@return number of bytes written to buffer @return <0 on error @return -ENOSPC if no available options or insufficient buffer space