riot_sys

Function coap_opt_get_string

Source
pub unsafe extern "C" fn coap_opt_get_string(
    pkt: *mut coap_pkt_t,
    optnum: u16,
    target: *mut u8,
    max_len: size_t,
    separator: c_char,
) -> ssize_t
Expand description

@brief Read a full option as null terminated string into the target buffer

This function is for reading and concatenating string based, multi-part CoAP options like COAP_OPT_URI_PATH or COAP_OPT_LOCATION_PATH. It will write all parts of the given option into the target buffer, separating the parts using the given @p separator. The resulting string is \0 terminated.

@param[in] pkt packet to read from @param[in] optnum absolute option number @param[out] target target buffer @param[in] max_len size of @p target @param[in] separator character used for separating the option parts

@return -ENOSPC if the complete option does not fit into @p target @return nr of bytes written to @p target (including ‘\0’)