[−][src]Function libcoap_sys::coap_opt_encode
pub unsafe extern "C" fn coap_opt_encode(
opt: *mut coap_opt_t,
n: usize,
delta: u16,
val: *const u8,
length: usize
) -> usize
Encodes option with given @p delta into @p opt. This function returns the number of bytes written to @p opt or @c 0 on error. This happens especially when @p opt does not provide sufficient space to store the option value, delta, and option jumps when required.
@param opt The option buffer space where @p val is written. @param n Maximum length of @p opt. @param delta The option delta. @param val The option value to copy into @p opt. @param length The actual length of @p val.
@return The number of bytes that have been written to @p opt or @c 0 on error. The return value will always be less than @p n.