coap_message_header_t

nRF5 SDK v15.0.0

Structure to hold a CoAP message header. More...

#include <coap_api.h>

Data Fields

uint8_t version :2
uint8_t type :2
uint8_t token_len :4
uint8_t code
uint16_t id

Detailed Description

Structure to hold a CoAP message header.

This structure holds the 4-byte mandatory CoAP header. The structure uses bitfields to save memory footprint.

Field Documentation

uint8_t coap_message_header_t::code

Message code (definitions found in coap_msg_code_t ).

uint16_t coap_message_header_t::id

Message ID in little-endian format. Convertion to Network Byte Order will be handled by the library.

uint8_t coap_message_header_t::token_len

Length of the message token.

uint8_t coap_message_header_t::type

Message type: COAP_TYPE_CON, COAP_TYPE_NON, COAP_TYPE_ACK, or COAP_TYPE_RST.

uint8_t coap_message_header_t::version

CoAP version number. The current specification RFC7252 mandates this to be version 1. The version number can be modified in sdk_config.h.

  • components/iot/coap/coap_api.h