[][src]Function libcoap_sys::coap_new_error_response

pub unsafe extern "C" fn coap_new_error_response(
    request: *mut coap_pdu_t,
    code: c_uchar,
    opts: *mut u16
) -> *mut coap_pdu_t

Creates a new ACK PDU with specified error @p code. The options specified by the filter expression @p opts will be copied from the original request contained in @p request. Unless @c SHORT_ERROR_RESPONSE was defined at build time, the textual reason phrase for @p code will be added as payload, with Content-Type @c 0. This function returns a pointer to the new response message, or @c NULL on error. The storage allocated for the new message must be relased with coap_free().

@param request Specification of the received (confirmable) request. @param code The error code to set. @param opts An option filter that specifies which options to copy from the original request in @p node.

@return A pointer to the new message or @c NULL on error.