49#define UNICOAP_PAYLOAD_MARKER (0xFF)
54#define UNICOAP_ETAG_LENGTH_MAX (8)
65#define UNICOAP_TOKEN_LENGTH_FIXED_WIDTH 4
76#define UNICOAP_RFC7252_MESSAGE_TYPE_FIXED_WIDTH 3
104#define UNICOAP_CODE_EMPTY (0)
111# define UNICOAP_CODE(suffix, detail) ((CONCAT(UNICOAP_CODE_CLASS_, suffix) << 5) | detail)
167 "Method enum is too wide, please file an issue.");
208 "Signal enum is too wide, please file an issue.");
399 "Status enum is too wide, please file an issue.");
690 "unicoap_option_number_t has unexpected size");
unicoap_code_class_t
Message code class.
unicoap_protocol_version_t
CoAP version number.
unicoap_status_t
CoAP response status codes.
unicoap_signal_t
CoAP Signal Message Codes (7.xx range)
unicoap_rfc7252_message_type_t
RFC 7252 message type.
unicoap_method_t
CoAP request method codes (0.xx range)
@ UNICOAP_CODE_CLASS_RESPONSE_SUCCESS
Message class for success responses.
@ UNICOAP_CODE_CLASS_RESPONSE_CLIENT_FAILURE
Message class for responses indicating a client error.
@ UNICOAP_CODE_CLASS_RESPONSE_SERVER_FAILURE
Message class for responses indicating a server error.
@ UNICOAP_CODE_CLASS_SIGNAL
Signaling message.
@ UNICOAP_CODE_CLASS_REQUEST
Message class for requests.
@ UNICOAP_COAP_VERSION_1
Identifier for CoAP version 1 (RFC 7252)
@ UNICOAP_STATUS_REQUEST_ENTITY_INCOMPLETE
4.08 Request Entity Incomplete
@ UNICOAP_STATUS_GATEWAY_TIMEOUT
5.04 Gateway Timeout
@ UNICOAP_STATUS_BAD_GATEWAY
5.02 Bad Gateway
@ UNICOAP_STATUS_FORBIDDEN
4.03 Forbidden
@ UNICOAP_STATUS_UNPROCESSABLE_ENTITY
Unprocessable Entity.
@ UNICOAP_STATUS_PATH_NOT_FOUND
4.04 Not Found
@ UNICOAP_STATUS_TOO_MANY_REQUESTS
4.29 Too Many Requests
@ UNICOAP_STATUS_CONTINUE
2.31 Continue
@ UNICOAP_STATUS_INTERNAL_SERVER_ERROR
5.00 Internal Server Error
@ UNICOAP_STATUS_PRECONDITION_FAILED
4.12 Precondition Failed
@ UNICOAP_STATUS_CONFLICT
4.09 Conflict
@ UNICOAP_STATUS_NOT_IMPLEMENTED
5.01 Not Implemented
@ UNICOAP_STATUS_METHOD_NOT_ALLOWED
4.05 Method Not Allowed
@ UNICOAP_STATUS_UNSUPPORTED_CONTENT_FORMAT
4.15 Unsupported Content Format
@ UNICOAP_STATUS_NOT_ACCEPTABLE
4.06 Not Acceptable
@ UNICOAP_STATUS_CONTENT
2.05 Content
@ UNICOAP_STATUS_DELETED
2.02 Deleted
@ UNICOAP_STATUS_SERVICE_UNAVAILABLE
5.03 Service Unavailable
@ UNICOAP_STATUS_REQUEST_ENTITY_TOO_LARGE
4.13 Request Entity Too Large
@ UNICOAP_STATUS_CHANGED
2.04 Changed
@ UNICOAP_STATUS_PROXYING_NOT_SUPPORTED
5.05 Proxying Not Supported
@ UNICOAP_STATUS_BAD_REQUEST
4.00 Bad Request
@ UNICOAP_STATUS_UNAUTHORIZED
4.01 Unauthorized
@ UNICOAP_STATUS_CREATED
2.01 Create
@ UNICOAP_STATUS_BAD_OPTION
4.02 Bad Option
@ UNICOAP_STATUS_VALID
2.03 Valid
@ UNICOAP_SIGNAL_PING
Ping message.
@ UNICOAP_SIGNAL_CAPABILITIES_SETTINGS
Capabilities and settings message (CSM)
@ UNICOAP_SIGNAL_PONG
Pong message.
@ UNICOAP_SIGNAL_RELEASE
Release message.
@ UNICOAP_SIGNAL_ABORT
Abort message.
@ UNICOAP_TYPE_RST
An reset message.
@ UNICOAP_TYPE_CON
A confirmable message.
@ UNICOAP_TYPE_ACK
An acknowledgement message.
@ UNICOAP_TYPE_NON
A non-confirmable message.
@ UNICOAP_METHOD_PATCH
PATCH request (RFC 8132)
@ UNICOAP_METHOD_GET
GET request (no paylod)
@ UNICOAP_METHOD_IPATCH
iPATCH request (RFC 8132)
@ UNICOAP_METHOD_DELETE
DELETE request (no payload, remove resource)
@ UNICOAP_METHOD_FETCH
FETCH request (RFC 8132)
@ UNICOAP_METHOD_PUT
PUT request (update resource with payload)
@ UNICOAP_METHOD_POST
POST request (resource processes payload)
static bool unicoap_content_format_is_xml(unicoap_content_format_t format)
Determines whether the given Content-Format is based on XML.
static bool unicoap_content_format_is_human_readable(unicoap_content_format_t format)
Determines whether the given Content-Format is human-readable.
static bool unicoap_content_format_is_cbor(unicoap_content_format_t format)
Determines whether the given Content-Format is based on CBOR.
unicoap_content_format_t
Content-Format option values
static bool unicoap_content_format_is_json(unicoap_content_format_t format)
Determines whether the given Content-Format is based on JSON.
@ UNICOAP_FORMAT_AIF_JSON
Content type application/aif+json
@ UNICOAP_FORMAT_JSON
Content type application/json
@ UNICOAP_FORMAT_EAT_CWT_PSA2019_PROFILE
Content type application/eat+cwt; eat_profile="tag:psacertified.org,2019:psa#legacy"
@ UNICOAP_FORMAT_SUIT_REPORT_COSE
Content type application/suit-report+cose
@ UNICOAP_FORMAT_TEXT
Content type text/plain; charset=utf-8
@ UNICOAP_FORMAT_ACE_GROUPCOMM_CBOR
Content type application/ace-groupcomm+cbor
@ UNICOAP_FORMAT_XML_ZSTD
Content type application/xml in zstd coding.
@ UNICOAP_FORMAT_TEXT_ZSTD
Content type text/plain;charset=utf-8 in zstd coding.
@ UNICOAP_FORMAT_OSCORE
Content type application/oscore
@ UNICOAP_FORMAT_MEASURED_COMPONENT_JSON
Content type application/measured-component+json
@ UNICOAP_FORMAT_SENSML_JSON
Content type application/sensml+json
@ UNICOAP_FORMAT_SENSML_EXI
Content type application/sensml-exi
@ UNICOAP_FORMAT_AIF_CBOR_CRI_LOCAL_PART
Content type application/aif+cbor;toid=CRI-local-part
@ UNICOAP_FORMAT_ACE_TRL_CBOR
Content type application/ace-trl+cbor
@ UNICOAP_FORMAT_UCCS_CBOR
Content type application/uccs+cbor
@ UNICOAP_FORMAT_MERGE_PATCH_JSON
Content type application/merge-patch+json
@ UNICOAP_FORMAT_VOUCHER_COSE_
Content type application/voucher+cose (TEMPORARY - registered 2022-04-12, extension registered 2026-0...
@ UNICOAP_FORMAT_EDHOC_CBOR_SEQ
Content type application/edhoc+cbor-seq
@ UNICOAP_FORMAT_CBOR_DEFLATE
Content type application/cbor in deflate coding.
@ UNICOAP_FORMAT_SENML_XML
Content type application/senml+xml
@ UNICOAP_FORMAT_COSE_SIGN1
Content type application/cose; cose-type="cose-sign1"
@ UNICOAP_FORMAT_OCF_CBOR
Content type application/vnd.ocf+cbor
@ UNICOAP_FORMAT_SDF_JSON
Content type application/sdf+json
@ UNICOAP_FORMAT_CBOR
Content type application/cbor
@ UNICOAP_FORMAT_YANG_DATA_CBOR_NAME
Content type application/yang-data+cbor; id=name
@ UNICOAP_FORMAT_EXI
Content type application/exi
@ UNICOAP_FORMAT_LINK
Content type application/link-format
@ UNICOAP_FORMAT_YANG_SID_JSON
Content type application/yang-sid+json
@ UNICOAP_FORMAT_SENSML_XML
Content type application/sensml+xml
@ UNICOAP_FORMAT_PKCS7_MIME_SERVER_GENERATED_KEY
Content type application/pkcs7-mime; smime-type=server-generated-key
@ UNICOAP_FORMAT_CMW_COSE
Content type application/cmw+cose
@ UNICOAP_FORMAT_TOC_CBOR_PROFILE
Content type application/toc+cbor;profile=2.16.840.1.113741.1.16.1
@ UNICOAP_FORMAT_COSE_ENCRYPT0
Content type application/cose; cose-type="cose-encrypt0"
@ UNICOAP_FORMAT_AIF_CBOR_OSCORE_GNAME_OSCORE_GPERM
Content type application/aif+cbor;toid=oscore-gname;tperm=oscore-gperm
@ UNICOAP_FORMAT_COSE_KEY_SET
Content type application/cose-key-set
@ UNICOAP_FORMAT_CID_EDHOC_CBOR_SEQ
Content type application/cid-edhoc+cbor-seq
@ UNICOAP_FORMAT_MEASURED_COMPONENT_CBOR
Content type application/measured-component+cbor
@ UNICOAP_FORMAT_EAT_UCS_CBOR
Content type application/eat-ucs+cbor
@ UNICOAP_FORMAT_TD_JSON
Content type application/td+json
@ UNICOAP_FORMAT_SCITT_STATEMENT_COSE
Content type application/scitt-statement+cose
@ UNICOAP_FORMAT_PKCS7_MIME_CERTS_ONLY
Content type application/pkcs7-mime; smime-type=certs-only
@ UNICOAP_FORMAT_SENML_ETCH_JSON
Content type application/senml-etch+json
@ UNICOAP_FORMAT_MISSING_BLOCKS_CBOR_SEQ
Content type application/missing-blocks+cbor-seq
@ UNICOAP_FORMAT_PKCS8
Content type application/pkcs8
@ UNICOAP_FORMAT_SENML_EXI
Content type application/senml-exi
@ UNICOAP_FORMAT_OMA_LWM2M_TLV
Content type application/vnd.oma.lwm2m+tlv
@ UNICOAP_FORMAT_STATUSLIST_CWT
Content type application/statuslist+cwt
@ UNICOAP_FORMAT_COAP_GROUP_JSON
Content type application/coap-group+json
@ UNICOAP_FORMAT_OMS_CELLULAR_COSE_CONTENT_CBOR
Content type application/vnd.oms.cellular-cose-content+cbor
@ UNICOAP_FORMAT_TEXT_CSS
Content type text/css
@ UNICOAP_FORMAT_IMAGE_JPEG
Content type image/jpeg
@ UNICOAP_FORMAT_SCITT_RECEIPT_COSE
Content type application/scitt-receipt+cose
@ UNICOAP_FORMAT_COSE_KEY
Content type application/cose-key
@ UNICOAP_FORMAT_JSON_PATCH_JSON
Content type application/json-patch+json
@ UNICOAP_FORMAT_AS207960_VAS_TAP_JER
Content type application/vnd.as207960.vas.tap+jer
@ UNICOAP_FORMAT_SD_CWT_
Content type application/sd-cwt (TEMPORARY - registered 2025-12-08, expires 2026-12-08)
@ UNICOAP_FORMAT_EAT_CWT_PSA2023_PROFILE
Content type application/eat+cwt; eat_profile="tag:psacertified.org,2023:psa#tfm"
@ UNICOAP_FORMAT_YANG_DATA_CBOR
Content type application/yang-data+cbor
@ UNICOAP_FORMAT_XML
Content type application/xml
@ UNICOAP_FORMAT_AS207960_VAS_CONFIG_JER
Content type application/vnd.as207960.vas.config+jer
@ UNICOAP_FORMAT_KB_CWT_
Content type application/kb+cwt (TEMPORARY - registered 2025-12-08, expires 2026-12-08)
@ UNICOAP_FORMAT_JSON_ZSTD
Content type application/json in zstd coding.
@ UNICOAP_FORMAT_PKIXCMP
Content type application/pkixcmp
@ UNICOAP_FORMAT_COSE_MAC0
Content type application/cose; cose-type="cose-mac0"
@ UNICOAP_FORMAT_IMAGE_PNG
Content type image/png
@ UNICOAP_FORMAT_CMW_JWS
Content type application/cmw+jws
@ UNICOAP_FORMAT_ACE_CBOR
Content type application/ace+cbor
@ UNICOAP_FORMAT_SENML_ETCH_CBOR
Content type application/senml-etch+cbor
@ UNICOAP_FORMAT_PKIX_CERT
Content type application/pkix-cert
@ UNICOAP_FORMAT_OMA_LWM2M_CBOR
Content type application/vnd.oma.lwm2m+cbor
@ UNICOAP_FORMAT_CMW_CBOR
Content type application/cmw+cbor
@ UNICOAP_FORMAT_JAVASCRIPT
Content type application/javascript
@ UNICOAP_FORMAT_SENML_CBOR
Content type application/senml+cbor
@ UNICOAP_FORMAT_SWID_CBOR
Content type application/swid+cbor
@ UNICOAP_FORMAT_CONCISE_PROBLEM_DETAILS_CBOR
Content type application/concise-problem-details+cbor
@ UNICOAP_FORMAT_AIF_CBOR
Content type application/aif+cbor
@ UNICOAP_FORMAT_IMAGE_GIF
Content type image/gif
@ UNICOAP_FORMAT_COSE_MAC
Content type application/cose; cose-type="cose-mac"
@ UNICOAP_FORMAT_COSE_SIGN
Content type application/cose; cose-type="cose-sign"
@ UNICOAP_FORMAT_YANG_DATA_CBOR_SID
Content type application/yang-data+cbor; id=sid
@ UNICOAP_FORMAT_IMAGE_SVG_XML
Content type image/svg+xml
@ UNICOAP_FORMAT_SENML_JSON
Content type application/senml+json
@ UNICOAP_FORMAT_AIF_JSON_OSCORE_GNAME_OSCORE_GPERM
Content type application/aif+json;toid=oscore-gname;tperm=oscore-gperm
@ UNICOAP_FORMAT_CBOR_SEQ
Content type application/cbor-seq
@ UNICOAP_FORMAT_DOTS_CBOR
Content type application/dots+cbor
@ UNICOAP_FORMAT_EAT_CWT
Content type application/eat+cwt
@ UNICOAP_FORMAT_PKCS10
Content type application/pkcs10
@ UNICOAP_FORMAT_COSE_ENCRYPT
Content type application/cose; cose-type="cose-encrypt"
@ UNICOAP_FORMAT_SYSLOG_MSG
Content type application/syslog-msg
@ UNICOAP_FORMAT_CMW_JSON
Content type application/cmw+json
@ UNICOAP_FORMAT_EAT_JWT
Content type application/eat+jwt
@ UNICOAP_FORMAT_OMA_LWM2M_JSON
Content type application/vnd.oma.lwm2m+json
@ UNICOAP_FORMAT_CE_CBOR
Content type application/ce+cbor
@ UNICOAP_FORMAT_CE_CBOR_PROFILE
Content type application/ce+cbor;profile=2.16.840.1.113741.1.16.1
@ UNICOAP_FORMAT_EAT_BUN_JSON
Content type application/eat-bun+json
@ UNICOAP_FORMAT_DNS_MESSAGE
Content type application/dns-message
@ UNICOAP_FORMAT_CWT
Content type application/cwt
@ UNICOAP_FORMAT_JSON_DEFLATE
Content type application/json in deflate coding.
@ UNICOAP_FORMAT_CSRATTRS
Content type application/csrattrs
@ UNICOAP_FORMAT_OCTET_STREAM
Content type application/octet-stream
@ UNICOAP_FORMAT_EAT_CWT_PROFILE_PROFILE
Content type application/eat+cwt; eat_profile=2.16.840.1.113741.1.16.1
@ UNICOAP_FORMAT_TOC_CBOR
Content type application/toc+cbor
@ UNICOAP_FORMAT_SENSML_CBOR
Content type application/sensml+cbor
@ UNICOAP_FORMAT_AS207960_VAS_TAP_UPER
Content type application/vnd.as207960.vas.tap+uper
@ UNICOAP_FORMAT_COAP_EAP
Content type application/coap-eap
@ UNICOAP_FORMAT_EAT_BUN_CBOR
Content type application/eat-bun+cbor
@ UNICOAP_FORMAT_MULTIPART_CORE
Content type application/multipart-core
@ UNICOAP_FORMAT_AS207960_VAS_CONFIG_UPER
Content type application/vnd.as207960.vas.config+uper
@ UNICOAP_FORMAT_TM_JSON
Content type application/tm+json
@ UNICOAP_FORMAT_EAT_UCS_JSON
Content type application/eat-ucs+json
unicoap_option_number_t
CoAP option number.
@ UNICOAP_OPTION_URI_PORT
Uri-Port
@ UNICOAP_OPTION_MAX_AGE
Max-Age option
@ UNICOAP_SIGNALING_ABORT_OPTION_BAD_CSM
Bad-CSM-Option option Applies to 7.05 UNICOAP_SIGNAL_ABORT message.
@ UNICOAP_OPTION_REQUEST_TAG
Request-Tag option.
@ UNICOAP_OPTION_URI_HOST
Uri-Host option
@ UNICOAP_OPTION_CONTENT_FORMAT
Content-Format option
@ UNICOAP_OPTION_OBSERVE
Observe option
@ UNICOAP_OPTION_ECHO
Echo option.
@ UNICOAP_OPTION_IF_MATCH
If-Match option
@ UNICOAP_OPTION_NO_RESPONSE
suppress CoAP response
@ UNICOAP_OPTION_PROXY_URI
Proxy-Uri option
@ UNICOAP_SIGNALING_RELEASE_OPTION_HOLD_OFF
Hold-Off option Applies to 7.04 UNICOAP_SIGNAL_RELEASE message.
@ UNICOAP_OPTION_Q_BLOCK2
Q-Block2 option.
@ UNICOAP_OPTION_EDHOC
EDHOC option.
@ UNICOAP_OPTION_OSCORE
OSCORE option.
@ UNICOAP_OPTION_BLOCK2
Block2 option
@ UNICOAP_SIGNALING_CSM_OPTION_BLOCKWISE_TRANSFER
Blockwise-Transfer option Applies to 7.01 UNICOAP_SIGNAL_CAPABILITIES_SETTINGS message.
@ UNICOAP_OPTION_SIZE2
Size2 option.
@ UNICOAP_OPTION_URI_PATH
Uri-Path option
@ UNICOAP_OPTION_BLOCK1
Block1 option
@ UNICOAP_OPTION_ETAG
ETag option
@ UNICOAP_OPTION_LOCATION_QUERY
Location-Query option
@ UNICOAP_OPTION_IF_NONE_MATCH
If-None-Match option
@ UNICOAP_SIGNALING_PING_PONG_OPTION_CUSTODY
Custody option Applies to 7.02 UNICOAP_SIGNAL_PING and 7.03 UNICOAP_SIGNAL_PONG message.
@ UNICOAP_OPTION_LOCATION_PATH
Location-Path option
@ UNICOAP_SIGNALING_RELEASE_OPTION_ALTERNATIVE_ADDRESS
Alternative-Address option Applies to 7.04 UNICOAP_SIGNAL_RELEASE message.
@ UNICOAP_OPTION_SIZE1
Size1 option.
@ UNICOAP_OPTION_Q_BLOCK1
Q-Block1 option
@ UNICOAP_OPTION_PROXY_SCHEME
Proxy-Scheme option
@ UNICOAP_OPTION_URI_QUERY
Uri-Query option
@ UNICOAP_SIGNALING_CSM_OPTION_MAX_MESSAGE_SIZE
Max-Message-Size option Applies to 7.01 UNICOAP_SIGNAL_CAPABILITIES_SETTINGS message.
@ UNICOAP_OPTION_HOP_LIMIT
Hop-Limit option
@ UNICOAP_OPTION_ACCEPT
Accept option
Compile-time configuration parameters.