libcoap  4.3.0rc1
coap_pdu_t Struct Reference

structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload marker (0xff), then the payload if stored inline. More...

#include <pdu.h>

+ Collaboration diagram for coap_pdu_t:

Data Fields

uint8_t type
 message type More...
 
uint8_t code
 request method (value 1–31) or response code (value 64-255) More...
 
uint8_t max_hdr_size
 space reserved for protocol-specific header More...
 
uint8_t hdr_size
 actual size used for protocol-specific header More...
 
uint8_t token_length
 length of Token More...
 
uint16_t mid
 message id, if any, in regular host byte order More...
 
uint16_t max_opt
 highest option number in PDU More...
 
size_t alloc_size
 allocated storage for token, options and payload More...
 
size_t used_size
 used bytes of storage for token, options and payload More...
 
size_t max_size
 maximum size for token, options and payload, or zero for variable size pdu More...
 
uint8_t * token
 first byte of token, if any, or options More...
 
uint8_t * data
 first byte of payload, if any More...
 
const uint8_t * body_data
 Holds ptr to re-assembled data or NULL. More...
 
size_t body_length
 Holds body data length. More...
 
size_t body_offset
 Holds body data offset. More...
 
size_t body_total
 Holds body data total size. More...
 
coap_lg_xmit_tlg_xmit
 Holds ptr to lg_xmit if sending a set of blocks. More...
 

Detailed Description

structure for CoAP PDUs token, if any, follows the fixed size header, then options until payload marker (0xff), then the payload if stored inline.

Memory layout is: <—header—>|<—token—><—options—>0xff<—payload—> header is addressed with a negative offset to token, its maximum size is max_hdr_size. options starts at token + token_length payload starts at data, its length is used_size - (data - token)

Definition at line 287 of file pdu.h.

Field Documentation

◆ alloc_size

size_t coap_pdu_t::alloc_size

allocated storage for token, options and payload

Definition at line 295 of file pdu.h.

◆ body_data

const uint8_t* coap_pdu_t::body_data

Holds ptr to re-assembled data or NULL.

Definition at line 310 of file pdu.h.

◆ body_length

size_t coap_pdu_t::body_length

Holds body data length.

Definition at line 311 of file pdu.h.

◆ body_offset

size_t coap_pdu_t::body_offset

Holds body data offset.

Definition at line 312 of file pdu.h.

◆ body_total

size_t coap_pdu_t::body_total

Holds body data total size.

Definition at line 313 of file pdu.h.

◆ code

uint8_t coap_pdu_t::code

request method (value 1–31) or response code (value 64-255)

Definition at line 289 of file pdu.h.

◆ data

uint8_t* coap_pdu_t::data

first byte of payload, if any

Definition at line 299 of file pdu.h.

◆ hdr_size

uint8_t coap_pdu_t::hdr_size

actual size used for protocol-specific header

Definition at line 291 of file pdu.h.

◆ lg_xmit

coap_lg_xmit_t* coap_pdu_t::lg_xmit

Holds ptr to lg_xmit if sending a set of blocks.

Definition at line 314 of file pdu.h.

◆ max_hdr_size

uint8_t coap_pdu_t::max_hdr_size

space reserved for protocol-specific header

Definition at line 290 of file pdu.h.

◆ max_opt

uint16_t coap_pdu_t::max_opt

highest option number in PDU

Definition at line 294 of file pdu.h.

◆ max_size

size_t coap_pdu_t::max_size

maximum size for token, options and payload, or zero for variable size pdu

Definition at line 297 of file pdu.h.

◆ mid

uint16_t coap_pdu_t::mid

message id, if any, in regular host byte order

Definition at line 293 of file pdu.h.

◆ token

uint8_t* coap_pdu_t::token

first byte of token, if any, or options

Definition at line 298 of file pdu.h.

◆ token_length

uint8_t coap_pdu_t::token_length

length of Token

Definition at line 292 of file pdu.h.

◆ type

uint8_t coap_pdu_t::type

message type

Definition at line 288 of file pdu.h.

◆ used_size

size_t coap_pdu_t::used_size

used bytes of storage for token, options and payload

Definition at line 296 of file pdu.h.


The documentation for this struct was generated from the following file: