Structure to hold the state for building a CoAP message. More...
Structure to hold the state for building a CoAP message.
pos member points to the current writing position. Before appending data, users must check if that operation would overflow, that is, if advancing pos by the amount of data to append would exceed the buffers capacity given by size.pos member for checking the message size, but use coap_builder_msg_size to do so with error checks!size member to 0 to indicate an overflow. This way subsequent appends will reliably fail even if they are smaller and would fit. A caller may decide to ignore the return value of all append calls except for the last without risking overflows, risking to create a corrupted message (with skipped parts), or missing to detect errors: They only need to either check the return value of the last function appending to the builder or - more conveniently - use coap_builder_msg_size to get the return value of the response handler. Definition at line 454 of file nanocoap.h.
#include <nanocoap.h>
Data Fields | |
| uint8_t * | buf |
| Buffer to build the message into. | |
| uint16_t | pos |
Position of the next byte to write within buf | |
| uint16_t | size |
Size of buf in bytes. | |
| uint16_t | last_opt_num |
| Number of the last option added (for delta-encoding) | |
| uint8_t* coap_builder_t::buf |
Buffer to build the message into.
Definition at line 455 of file nanocoap.h.
| uint16_t coap_builder_t::last_opt_num |
Number of the last option added (for delta-encoding)
Definition at line 458 of file nanocoap.h.
| uint16_t coap_builder_t::pos |
Position of the next byte to write within buf
Definition at line 456 of file nanocoap.h.
| uint16_t coap_builder_t::size |
Size of buf in bytes.
Definition at line 457 of file nanocoap.h.