riot_sys

Function coap_payload_put_bytes

Source
pub unsafe extern "C" fn coap_payload_put_bytes(
    pkt: *mut coap_pkt_t,
    data: *const c_void,
    len: size_t,
) -> ssize_t
Expand description

@brief Add payload data to the CoAP request.

@pre @ref coap_opt_finish must have been called before with the @ref COAP_OPT_FINISH_PAYLOAD option.

The function copies @p data into the payload buffer of @p pkt and advances the payload pointer.

This is just a convenience function, you can also directly write to pkt->payload if you have a function that outputs payload to a buffer. In this case you should instead call @ref coap_payload_advance_bytes.

@param[out] pkt pkt to add payload to @param[in] data payload data @param[in] len length of payload

@returns number of payload bytes added on success @returns < 0 on error