[][src]Function libcoap_sys::coap_option_check_critical

pub unsafe extern "C" fn coap_option_check_critical(
    ctx: *mut coap_context_t,
    pdu: *mut coap_pdu_t,
    unknown: *mut u16
) -> c_int

Verifies that @p pdu contains no unknown critical options. Options must be registered at @p ctx, using the function coap_register_option(). A basic set of options is registered automatically by coap_new_context(). This function returns @c 1 if @p pdu is ok, @c 0 otherwise. The given filter object @p unknown will be updated with the unknown options. As only @c COAP_MAX_OPT options can be signalled this way, remaining options must be examined manually.

@code coap_opt_filter_t f = COAP_OPT_NONE; coap_opt_iterator_t opt_iter;

if (coap_option_check_critical(ctx, pdu, f) == 0) { coap_option_iterator_init(pdu, &opt_iter, f);

while (coap_option_next(&opt_iter)) { if (opt_iter.type & 0x01) { ... handle unknown critical option in opt_iter ... } } } @endcode

@param ctx The context where all known options are registered. @param pdu The PDU to check. @param unknown The output filter that will be updated to indicate the unknown critical options found in @p pdu.

@return @c 1 if everything was ok, @c 0 otherwise.