31 #define COAP_PORT               (5683) 
   36 #define COAPS_PORT              (5684) 
   44 #define COAP_OPT_IF_MATCH       (1) 
   45 #define COAP_OPT_URI_HOST       (3) 
   46 #define COAP_OPT_ETAG           (4) 
   47 #define COAP_OPT_IF_NONE_MATCH  (5) 
   48 #define COAP_OPT_OBSERVE        (6) 
   49 #define COAP_OPT_LOCATION_PATH  (8) 
   58 #define COAP_OPT_OSCORE         (9) 
   59 #define COAP_OPT_URI_PATH       (11) 
   60 #define COAP_OPT_CONTENT_FORMAT (12) 
   61 #define COAP_OPT_MAX_AGE        (14) 
   62 #define COAP_OPT_URI_QUERY      (15) 
   70 #define COAP_OPT_HOP_LIMIT      (16) 
   71 #define COAP_OPT_ACCEPT         (17) 
   79 #define COAP_OPT_Q_BLOCK1       (19) 
   80 #define COAP_OPT_LOCATION_QUERY (20) 
   89 #define COAP_OPT_EDHOC          (21) 
   90 #define COAP_OPT_BLOCK2         (23) 
   91 #define COAP_OPT_BLOCK1         (27) 
  102 #define COAP_OPT_SIZE2          (28) 
  110 #define COAP_OPT_Q_BLOCK2       (31) 
  111 #define COAP_OPT_PROXY_URI      (35) 
  112 #define COAP_OPT_PROXY_SCHEME   (39) 
  125 #define COAP_OPT_SIZE1          (60) 
  134 #define COAP_OPT_ECHO           (252) 
  139 #define COAP_OPT_NO_RESPONSE    (258) 
  148 #define COAP_OPT_REQUEST_TAG    (292) 
  155 #define COAP_TYPE_CON           (0) 
  156 #define COAP_TYPE_NON           (1) 
  157 #define COAP_TYPE_ACK           (2) 
  158 #define COAP_TYPE_RST           (3) 
  165 #define COAP_CLASS_REQ          (0)  
  185 #define COAP_CODE_EMPTY         (0) 
  192 #define COAP_CLASS_SUCCESS      (2) 
  193 #define COAP_CODE_CREATED      ((2 << 5) | 1) 
  194 #define COAP_CODE_DELETED      ((2 << 5) | 2) 
  195 #define COAP_CODE_VALID        ((2 << 5) | 3) 
  196 #define COAP_CODE_CHANGED      ((2 << 5) | 4) 
  197 #define COAP_CODE_204          ((2 << 5) | 4) 
  198 #define COAP_CODE_CONTENT      ((2 << 5) | 5) 
  199 #define COAP_CODE_205          ((2 << 5) | 5) 
  200 #define COAP_CODE_CONTINUE     ((2 << 5) | 31) 
  201 #define COAP_CODE_231          ((2 << 5) | 31) 
  208 #define COAP_CLASS_CLIENT_FAILURE             (4) 
  209 #define COAP_CODE_BAD_REQUEST                ((4 << 5) | 0) 
  210 #define COAP_CODE_UNAUTHORIZED               ((4 << 5) | 1) 
  211 #define COAP_CODE_BAD_OPTION                 ((4 << 5) | 2) 
  212 #define COAP_CODE_FORBIDDEN                  ((4 << 5) | 3) 
  213 #define COAP_CODE_PATH_NOT_FOUND             ((4 << 5) | 4) 
  214 #define COAP_CODE_404                        ((4 << 5) | 4) 
  215 #define COAP_CODE_METHOD_NOT_ALLOWED         ((4 << 5) | 5) 
  216 #define COAP_CODE_NOT_ACCEPTABLE             ((4 << 5) | 6) 
  217 #define COAP_CODE_REQUEST_ENTITY_INCOMPLETE  ((4 << 5) | 8) 
  218 #define COAP_CODE_CONFLICT                   ((4 << 5) | 9) 
  219 #define COAP_CODE_PRECONDITION_FAILED        ((4 << 5) | 12) 
  220 #define COAP_CODE_REQUEST_ENTITY_TOO_LARGE   ((4 << 5) | 13) 
  221 #define COAP_CODE_UNSUPPORTED_CONTENT_FORMAT ((4 << 5) | 15) 
  222 #define COAP_CODE_UNPROCESSABLE_ENTITY       ((4 << 5) | 22) 
  223 #define COAP_CODE_TOO_MANY_REQUESTS          ((4 << 5) | 29) 
  230 #define COAP_CLASS_SERVER_FAILURE             (5) 
  231 #define COAP_CODE_INTERNAL_SERVER_ERROR      ((5 << 5) | 0) 
  232 #define COAP_CODE_NOT_IMPLEMENTED            ((5 << 5) | 1) 
  233 #define COAP_CODE_BAD_GATEWAY                ((5 << 5) | 2) 
  234 #define COAP_CODE_SERVICE_UNAVAILABLE        ((5 << 5) | 3) 
  235 #define COAP_CODE_GATEWAY_TIMEOUT            ((5 << 5) | 4) 
  236 #define COAP_CODE_PROXYING_NOT_SUPPORTED     ((5 << 5) | 5) 
  244 #define COAP_FORMAT_TEXT                      (0) 
  249 #define COAP_FORMAT_COSE_ENCRYPT0            (16) 
  254 #define COAP_FORMAT_COSE_MAC0                (17) 
  259 #define COAP_FORMAT_COSE_SIGN1               (18) 
  264 #define COAP_FORMAT_ACE_CBOR                 (19) 
  269 #define COAP_FORMAT_IMAGE_GIF                (21) 
  274 #define COAP_FORMAT_IMAGE_JPEG               (22) 
  279 #define COAP_FORMAT_IMAGE_PNG                (23) 
  280 #define COAP_FORMAT_LINK                     (40) 
  281 #define COAP_FORMAT_XML                      (41) 
  282 #define COAP_FORMAT_OCTET                    (42) 
  283 #define COAP_FORMAT_EXI                      (47) 
  284 #define COAP_FORMAT_JSON                     (50) 
  285 #define COAP_FORMAT_JSON_PATCH_JSON          (51) 
  286 #define COAP_FORMAT_MERGE_PATCH_JSON         (52) 
  287 #define COAP_FORMAT_CBOR                     (60) 
  292 #define COAP_FORMAT_CWT                      (61) 
  297 #define COAP_FORMAT_MULTIPART_CORE           (62) 
  302 #define COAP_FORMAT_CBOR_SEQ                 (63) 
  307 #define COAP_FORMAT_COSE_ENCRYPT             (96) 
  312 #define COAP_FORMAT_COSE_MAC                 (97) 
  317 #define COAP_FORMAT_COSE_SIGN                (98) 
  322 #define COAP_FORMAT_COSE_KEY                (101) 
  327 #define COAP_FORMAT_COSE_KEY_SET            (102) 
  328 #define COAP_FORMAT_SENML_JSON              (110) 
  329 #define COAP_FORMAT_SENSML_JSON             (111) 
  330 #define COAP_FORMAT_SENML_CBOR              (112) 
  331 #define COAP_FORMAT_SENSML_CBOR             (113) 
  332 #define COAP_FORMAT_SENML_EXI               (114) 
  333 #define COAP_FORMAT_SENSML_EXI              (115) 
  338 #define COAP_FORMAT_YANG_DATA_CBOR_SID      (140) 
  343 #define COAP_FORMAT_COAP_GROUP_JSON         (256) 
  348 #define COAP_FORMAT_PROBLEM_DETAILS_CBOR    (257) 
  353 #define COAP_FORMAT_SWID_CBOR               (258) 
  359 #define COAP_FORMAT_PKIXCMP                 (259) 
  364 #define COAP_FORMAT_DOTS_CBOR               (271) 
  369 #define COAP_FORMAT_MISSING_BLOCKS_CBOR_SEQ (272) 
  376 #define COAP_FORMAT_PKCS7_MIME_SERVER_GEN   (280) 
  382 #define COAP_FORMAT_PKCS7_MIME_CERTS_ONLY   (281) 
  389 #define COAP_FORMAT_PKCS8                   (284) 
  395 #define COAP_FORMAT_CSRATTRS                (285) 
  402 #define COAP_FORMAT_PKCS10                  (286) 
  408 #define COAP_FORMAT_PKIX_CERT               (287) 
  413 #define COAP_FORMAT_AIF_CBOR                (290) 
  418 #define COAP_FORMAT_AIF_JSON                (291) 
  419 #define COAP_FORMAT_SENML_XML               (310) 
  420 #define COAP_FORMAT_SENSML_XML              (311) 
  425 #define COAP_FORMAT_SNML_ETCH_JSON          (320) 
  430 #define COAP_FORMAT_SNML_ETCH_CBOR          (322) 
  435 #define COAP_FORMAT_YAML_DATA_CBOR          (340) 
  440 #define COAP_FORMAT_YAML_DATA_CBOR_ID_NAME  (341) 
  445 #define COAP_FORMAT_TD_JSON                 (432) 
  450 #define COAP_FORMAT_TM_JSON                 (433) 
  455 #define COAP_FORMAT_DNS_MESSAGE             (553) 
  461 #define COAP_FORMAT_VOUCER_COSE_CBOR        (836) 
  465 #define COAP_FORMAT_VND_OCF_CBOR          (10000) 
  470 #define COAP_FORMAT_OSCORE                (10001) 
  475 #define COAP_FORMAT_JAVASCRIPT            (10002) 
  481 #define COAP_FORMAT_JSON_DEFLATE          (11050) 
  487 #define COAP_FORMAT_CBOR_DEFLATE          (11060) 
  492 #define COAP_FORMAT_VND_OMA_LWM2M_TLV     (11542) 
  497 #define COAP_FORMAT_VND_OMA_LWM2M_JSON    (11543) 
  502 #define COAP_FORMAT_VND_OMA_LWM2M_CBOR    (11544) 
  507 #define COAP_FORMAT_TEXT_CSS              (20000) 
  512 #define COAP_FORMAT_IMAGE_SVG_XML         (30000) 
  519 #define COAP_OBS_REGISTER        (0) 
  520 #define COAP_OBS_DEREGISTER      (1) 
  521 #define COAP_OBS_MAX_VALUE_MASK  (0xffffff)  
  528 #define COAP_TOKEN_LENGTH_MAX    (8) 
  535 #define COAP_ETAG_LENGTH_MAX     (8U)    
  541 #define COAP_PAYLOAD_MARKER      (0xFF) 
  542 #define COAP_PAYLOAD_MARKER_SIZE (1U)    
  566 #ifndef CONFIG_COAP_ACK_TIMEOUT_MS 
  567 #define CONFIG_COAP_ACK_TIMEOUT_MS     (2000) 
  579 #ifndef CONFIG_COAP_RANDOM_FACTOR_1000 
  580 #define CONFIG_COAP_RANDOM_FACTOR_1000      (1500) 
  587 #ifndef CONFIG_COAP_SEPARATE_RESPONSE_TIMEOUT_MS 
  588 #define CONFIG_COAP_SEPARATE_RESPONSE_TIMEOUT_MS    (10 * MS_PER_SEC) 
  592 #ifndef CONFIG_COAP_MAX_RETRANSMIT 
  593 #define CONFIG_COAP_MAX_RETRANSMIT     (4) 
  602 #define COAP_NSTART             (1) 
  603 #define COAP_DEFAULT_LEISURE    (5) 
  610 #define COAP_BLOCKWISE_NUM_OFF  (4) 
  611 #define COAP_BLOCKWISE_MORE_OFF (3) 
  612 #define COAP_BLOCKWISE_SZX_MASK (0x07) 
  613 #define COAP_BLOCKWISE_SZX_MAX  (7) 
  620     COAP_BLOCKSIZE_16 = 0,
 
coap_blksize_t
Coap block-wise-transfer size SZX.
 
coap_method_t
CoAP method codes used in request.
 
@ COAP_METHOD_GET
GET request (no paylod)
 
@ COAP_METHOD_IPATCH
iPATCH request (RFC 8132)
 
@ COAP_METHOD_PUT
PUT request (update resource with payload)
 
@ COAP_METHOD_POST
POST request (resource processes payload)
 
@ COAP_METHOD_PATCH
PATCH request (RFC 8132)
 
@ COAP_METHOD_DELETE
DELETE request (no payload, remove resource)
 
@ COAP_METHOD_FETCH
FETCH request (RFC 8132)