Skip to main content

otCoapMessageInit

Function otCoapMessageInit 

Source
pub unsafe extern "C" fn otCoapMessageInit(
    aMessage: *mut otMessage,
    aType: otCoapType,
    aCode: otCoapCode,
) -> otError
Expand description

Initializes a CoAP message.

This function initializes the CoAP header, erasing any previously written content in the message. The Message ID is set to zero, and the token is empty (zero-length).

@param[in,out] aMessage A pointer to the CoAP message to initialize. @param[in] aType The CoAP Type. @param[in] aCode The CoAP Code.

@retval OT_ERROR_NONE Successfully initialized the message. @retval OT_ERROR_NO_BUFS Insufficient message buffers available to write the CoAP header.