riot_sys

Function coap_opt_add_chars

Source
pub unsafe extern "C" fn coap_opt_add_chars(
    pkt: *mut coap_pkt_t,
    optnum: u16,
    chars: *const c_char,
    chars_len: size_t,
    separator: c_char,
) -> ssize_t
Expand description

@brief Encode the given array of characters as option(s) into pkt

Use separator to split array of characters into multiple options.

@post pkt.payload advanced to first byte after option(s) @post pkt.payload_len reduced by option(s) length

@param[in,out] pkt pkt referencing target buffer @param[in] optnum option number to use @param[in] chars array of characters to encode as option @param[in] chars_len length of @p chars @param[in] separator character used in @p string to separate parts

@return number of bytes written to buffer @return <0 on error @return -ENOSPC if no available options or insufficient buffer space