riot_sys

Function coap_build_reply_header

Source
pub unsafe extern "C" fn coap_build_reply_header(
    pkt: *mut coap_pkt_t,
    code: c_uint,
    buf: *mut c_void,
    len: size_t,
    ct: c_int,
    payload: *mut *mut c_void,
    payload_len_max: *mut size_t,
) -> ssize_t
Expand description

@brief Create CoAP reply header (convenience function)

This function generates the reply CoAP header and sets the payload pointer inside the response buffer to point to the start of the payload, so that it can be written directly after the header.

@param[in] pkt packet to reply to @param[in] code reply code (e.g., COAP_CODE_204) @param[out] buf buffer to write reply to @param[in] len size of @p buf @param[in] ct content type of payload if ct < 0 this will be ignored @param[out] payload Will be set to the start of the payload inside @p buf. May be set to NULL if no payload response is wanted (no-reply option) @param[out] payload_len_max max length of payload left in @p buf

@returns size of reply header on success @returns 0 if no reply should be sent @returns <0 on error @returns -ENOSPC if @p buf too small