Go to the documentation of this file.
31 #ifndef _COAP_COMMON_H
32 #define _COAP_COMMON_H
38 #define COAP_PORT 5683
40 #define COAPS_PORT 5684
43 #define COAP_HEADER_SIZE 4
45 #define COAP_MAX_TOKEN_LEN 8
48 #define COAP_PAYLOAD_MARKER 0xFF
51 #define COAP_CODE(c, d) ((((c) & 0x07U) << 5U) | ((d) & 0x1FU))
54 #define COAP_GET_CODE_CLASS(code) (((code) >> 5U) & 0x07U)
56 #define COAP_GET_CODE_SUBCLASS(code) ((code) & 0x1FU)
157 #if defined(__CCRX__)
159 #elif defined(__CWCC__) || defined(_WIN32)
160 #pragma pack(push, 1)
170 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
173 uint8_t tokenLen : 4;
175 uint8_t tokenLen : 4;
191 #if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
202 #if defined(__CCRX__)
204 #elif defined(__CWCC__) || defined(_WIN32)
typedef __packed_struct
CoAP message format.
@ COAP_CODE_REQUEST_ENTITY_INCOMPLETE
@ COAP_CODE_METHOD_NOT_ALLOWED
@ COAP_CODE_UNSUPPORTED_CONTENT_FORMAT
@ COAP_CODE_SERVICE_UNAVAILABLE
CoapCodeClass
CoAP code classes.
@ COAP_CODE_PROXYING_NOT_SUPPORTED
CoapProtocolLevel
CoAP version numbers.
@ COAP_CODE_HOP_LIMIT_REACHED
CoapTransportProtocol
CoAP transport protocols.
@ COAP_VERSION_1
CoAP version 1.
@ COAP_CODE_REQUEST_ENTITY_TO_LARGE
@ COAP_CODE_CLASS_SERVER_ERROR
@ COAP_CODE_PRECONDITION_FAILED
@ COAP_CODE_GATEWAY_TIMEOUT
@ COAP_CODE_UNPROCESSABLE_ENTITY
@ COAP_CODE_NOT_ACCEPTABLE
@ COAP_TRANSPORT_PROTOCOL_UDP
UDP protocol.
@ COAP_CODE_NOT_IMPLEMENTED
@ COAP_TYPE_ACK
Acknowledgment message.
@ COAP_TYPE_CON
Confirmable message.
@ COAP_TYPE_RST
Reset message.
@ COAP_CODE_CLASS_CLIENT_ERROR
@ COAP_TRANSPORT_PROTOCOL_DTLS
DTLS protocol.
CoapMessageType
CoAP message types.
@ COAP_CODE_INTERNAL_SERVER
@ COAP_CODE_CLASS_SUCCESS
@ COAP_TYPE_NON
Non-confirmable message.
CoapCode
CoAP method and response codes.