From bf51f35838dc10a4d623d5a56dc60db23a7bd6fb Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Thu, 18 Oct 2018 12:12:31 +0200 Subject: [PATCH 1/3] coap: update defines for rfc8132 Update the list of defines for methods and response codes with the new codes as defined in [rfc8132](https://tools.ietf.org/html/rfc8132) --- sys/include/net/coap.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/include/net/coap.h b/sys/include/net/coap.h index 942df1136d2a..1957f2708dcd 100644 --- a/sys/include/net/coap.h +++ b/sys/include/net/coap.h @@ -65,6 +65,9 @@ extern "C" { #define COAP_METHOD_POST (2) #define COAP_METHOD_PUT (3) #define COAP_METHOD_DELETE (4) +#define COAP_METHOD_FETCH (5) +#define COAP_METHOD_PATCH (6) +#define COAP_METHOD_IPATCH (7) /** @} */ /** @@ -104,9 +107,11 @@ extern "C" { #define COAP_CODE_METHOD_NOT_ALLOWED ((4 << 5) | 5) #define COAP_CODE_NOT_ACCEPTABLE ((4 << 5) | 6) #define COAP_CODE_REQUEST_ENTITY_INCOMPLETE ((4 << 5) | 8) +#define COAP_CODE_CONFLICT ((4 << 5) | 9) #define COAP_CODE_PRECONDITION_FAILED ((4 << 5) | 12) #define COAP_CODE_REQUEST_ENTITY_TOO_LARGE ((4 << 5) | 13) #define COAP_CODE_UNSUPPORTED_CONTENT_FORMAT ((4 << 5) | 15) +#define COAP_CODE_UNPROCESSABLE_ENTITY ((4 << 5) | 22) /** @} */ /** From c4e48ea5e0b490c8504e74e8ed4dbaa971dad11a Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Thu, 18 Oct 2018 12:13:49 +0200 Subject: [PATCH 2/3] coap: update defines for sen(s)ml format types --- sys/include/net/coap.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/include/net/coap.h b/sys/include/net/coap.h index 1957f2708dcd..1afe1d21dfb5 100644 --- a/sys/include/net/coap.h +++ b/sys/include/net/coap.h @@ -145,13 +145,23 @@ extern "C" { * @anchor net_coap_format * @{ */ -#define COAP_FORMAT_TEXT (0) -#define COAP_FORMAT_LINK (40) -#define COAP_FORMAT_XML (41) -#define COAP_FORMAT_OCTET (42) -#define COAP_FORMAT_EXI (47) -#define COAP_FORMAT_JSON (50) -#define COAP_FORMAT_CBOR (60) +#define COAP_FORMAT_TEXT (0) +#define COAP_FORMAT_LINK (40) +#define COAP_FORMAT_XML (41) +#define COAP_FORMAT_OCTET (42) +#define COAP_FORMAT_EXI (47) +#define COAP_FORMAT_JSON (50) +#define COAP_FORMAT_JSON_PATCH_JSON (51) +#define COAP_FORMAT_MERGE_PATCH_JSON (52) +#define COAP_FORMAT_CBOR (60) +#define COAP_FORMAT_SENML_JSON (110) +#define COAP_FORMAT_SENSML_JSON (111) +#define COAP_FORMAT_SENML_CBOR (112) +#define COAP_FORMAT_SENSML_CBOR (113) +#define COAP_FORMAT_SENML_EXI (114) +#define COAP_FORMAT_SENSML_EXI (115) +#define COAP_FORMAT_SENML_XML (310) +#define COAP_FORMAT_SENSML_XML (311) /** @} */ /** From 7bd9e68867b83b06b0b7274dfa8db0445eaddb1c Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Fri, 19 Oct 2018 23:23:31 +0200 Subject: [PATCH 3/3] nanocoap: Add method flags for rfc8132 --- sys/include/net/nanocoap.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index 213121fdf34e..79b2f55d2208 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -101,10 +101,13 @@ extern "C" { * @name Nanocoap specific CoAP method flags used in coap_handlers array * @{ */ -#define COAP_GET (0x1) -#define COAP_POST (0x2) -#define COAP_PUT (0x4) -#define COAP_DELETE (0x8) +#define COAP_GET (0x01) +#define COAP_POST (0x02) +#define COAP_PUT (0x04) +#define COAP_DELETE (0x08) +#define COAP_FETCH (0x10) +#define COAP_PATCH (0x20) +#define COAP_IPATCH (0x40) #define COAP_MATCH_SUBTREE (0x8000) /**< Path is considered as a prefix when matching */ /** @} */