riot_sys::bindgen

Function coap_reply_simple

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

@brief Create CoAP reply (convenience function)

This is a simple wrapper that allows for building CoAP replies for simple use-cases.

The reply will be written to @p buf. If @p payload and @p payload_len are non-zero, the payload will be copied into the resulting reply packet.

@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 @param[in] payload ptr to payload @param[in] payload_len length of payload

@returns size of reply packet on success @returns <0 on error @returns -ENOSPC if @p buf too small