libcoap  4.3.0rc2
coap_pdu_internal.h File Reference

CoAP PDU internal information. More...

#include <stdint.h>
+ Include dependency graph for coap_pdu_internal.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  coap_pdu_t
 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...
 

Macros

#define COAP_DEFAULT_VERSION   1 /* version of CoAP supported */
 
#define COAP_MESSAGE_SIZE_OFFSET_TCP8   13
 
#define COAP_MESSAGE_SIZE_OFFSET_TCP16   269 /* 13 + 256 */
 
#define COAP_MESSAGE_SIZE_OFFSET_TCP32   65805 /* 269 + 65536 */
 
#define COAP_MAX_MESSAGE_SIZE_TCP0   (COAP_MESSAGE_SIZE_OFFSET_TCP8-1) /* 12 */
 
#define COAP_MAX_MESSAGE_SIZE_TCP8   (COAP_MESSAGE_SIZE_OFFSET_TCP16-1) /* 268 */
 
#define COAP_MAX_MESSAGE_SIZE_TCP16   (COAP_MESSAGE_SIZE_OFFSET_TCP32-1) /* 65804 */
 
#define COAP_MAX_MESSAGE_SIZE_TCP32   (COAP_MESSAGE_SIZE_OFFSET_TCP32+0xFFFFFFFF)
 
#define COAP_DEBUG_BUF_SIZE   (8 + 1024 * 2)
 
#define COAP_DEFAULT_MAX_PDU_RX_SIZE   (8UL*1024*1024+256)
 
#define COAP_DROPPED_RESPONSE   -2
 Indicates that a response is suppressed. More...
 
#define COAP_PDU_DELAYED   -3
 
#define COAP_PAYLOAD_START   0xFF /* payload marker */
 
#define COAP_PDU_IS_EMPTY(pdu)   ((pdu)->code == 0)
 
#define COAP_PDU_IS_REQUEST(pdu)   (!COAP_PDU_IS_EMPTY(pdu) && (pdu)->code < 32)
 
#define COAP_PDU_IS_RESPONSE(pdu)   ((pdu)->code >= 64 && (pdu)->code < 224)
 
#define COAP_PDU_IS_SIGNALING(pdu)   ((pdu)->code >= 224)
 
#define COAP_PDU_MAX_UDP_HEADER_SIZE   4
 
#define COAP_PDU_MAX_TCP_HEADER_SIZE   6
 

Functions

int coap_pdu_resize (coap_pdu_t *pdu, size_t new_size)
 Dynamically grows the size of pdu to new_size. More...
 
int coap_pdu_check_resize (coap_pdu_t *pdu, size_t new_size)
 Dynamically grows the size of pdu to new_size if needed. More...
 
size_t coap_pdu_parse_header_size (coap_proto_t proto, const uint8_t *data)
 Interprets data to determine the number of bytes in the header. More...
 
size_t coap_pdu_parse_size (coap_proto_t proto, const uint8_t *data, size_t length)
 Parses data to extract the message size. More...
 
int coap_pdu_parse_header (coap_pdu_t *pdu, coap_proto_t proto)
 Decode the protocol specific header for the specified PDU. More...
 
int coap_pdu_parse_opt (coap_pdu_t *pdu)
 Verify consistency in the given CoAP PDU structure and locate the data. More...
 
int coap_pdu_parse (coap_proto_t proto, const uint8_t *data, size_t length, coap_pdu_t *pdu)
 Parses data into the CoAP PDU structure given in result. More...
 
void coap_pdu_clear (coap_pdu_t *pdu, size_t size)
 Clears any contents from pdu and resets used_size, and data pointers. More...
 
int coap_remove_option (coap_pdu_t *pdu, coap_option_num_t number)
 Removes (first) option of given number from the pdu. More...
 
size_t coap_insert_option (coap_pdu_t *pdu, coap_option_num_t number, size_t len, const uint8_t *data)
 Inserts option of given number in the pdu with the appropriate data. More...
 
size_t coap_update_option (coap_pdu_t *pdu, coap_option_num_t number, size_t len, const uint8_t *data)
 Updates existing first option of given number in the pdu with the new data. More...
 
size_t coap_pdu_encode_header (coap_pdu_t *pdu, coap_proto_t proto)
 Compose the protocol specific header for the specified PDU. More...
 
int coap_update_token (coap_pdu_t *pdu, size_t len, const uint8_t *data)
 Updates token in pdu with length len and data. More...
 

Detailed Description

CoAP PDU internal information.

Definition in file coap_pdu_internal.h.