riot_sys::bindgen

Function coap_build_hdr

Source
pub unsafe extern "C" fn coap_build_hdr(
    hdr: *mut coap_hdr_t,
    type_: c_uint,
    token: *const c_void,
    token_len: size_t,
    code: c_uint,
    id: u16,
) -> ssize_t
Expand description

@brief Builds a CoAP header

Caller must ensure @p hdr can hold the header and the full token!

@param[out] hdr hdr to fill @param[in] type CoAP packet type (e.g., COAP_TYPE_CON, …) @param[in] token token @param[in] token_len length of @p token @param[in] code CoAP code (e.g., COAP_CODE_204, …) @param[in] id CoAP request id

@pre @p token is either not overlapping with the memory buffer @p hdr points to, or is already at the right offset (e.g. when building the response inside the buffer the contained the request).

@returns length of resulting header