From 7cf2da01dab59dc49f1381f628c648f3b692b30d Mon Sep 17 00:00:00 2001 From: mofosyne Date: Tue, 15 May 2018 01:06:08 +1000 Subject: [PATCH 1/3] Updated IANA Content Format enums https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats --- coap.h | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/coap.h b/coap.h index c67c7ce..c30f478 100644 --- a/coap.h +++ b/coap.h @@ -102,17 +102,41 @@ typedef enum COAP_RSPCODE_CHANGED = MAKE_RSPCODE(2, 4) } coap_responsecode_t; -//http://tools.ietf.org/html/rfc7252#section-12.3 +// https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats +// http://tools.ietf.org/html/rfc7252#section-12.3 typedef enum { COAP_CONTENTTYPE_NONE = -1, // bodge to allow us not to send option block - COAP_CONTENTTYPE_TEXT_PLAIN = 0, - COAP_CONTENTTYPE_APPLICATION_LINKFORMAT = 40, - COAP_CONTENTTYPE_APPLICATION_XML = 41, - COAP_CONTENTTYPE_APPLICATION_OCTECT_STREAM = 42, - COAP_CONTENTTYPE_APPLICATION_EXI = 47, - COAP_CONTENTTYPE_APPLICATION_JSON = 50, -} coap_content_type_t; + + /* 0-255 Expert Review */ + COAP_CONTENTTYPE_TEXT_PLAIN = 0 , // text/plain; charset=utf-8 /* Ref: [RFC2046][RFC3676][RFC5147] */ + COAP_CONTENTTYPE_APPLICATION_COSE_ENCRYPT0 = 16 , // application/cose; cose-type="cose-encrypt0" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_MAC0 = 17 , // application/cose; cose-type="cose-mac0" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_SIGN1 = 18 , // application/cose; cose-type="cose-sign1" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_LINKFORMAT = 40 , // application/link-format /* Ref: [RFC6690] */ + COAP_CONTENTTYPE_APPLICATION_XML = 41 , // application/xml /* Ref: [RFC3023] */ + COAP_CONTENTTYPE_APPLICATION_OCTECT_STREAM = 42 , // application/octet-stream /* Ref: [RFC2045][RFC2046] */ + COAP_CONTENTTYPE_APPLICATION_EXI = 47 , // application/exi /* Ref: ["Efficient XML Interchange (EXI) Format 1.0 (Second Edition)" ,February 2014] */ + COAP_CONTENTTYPE_APPLICATION_JSON = 50 , // application/json /* Ref: [RFC4627] */ + COAP_CONTENTTYPE_APPLICATION_JSON_PATCH_JSON = 51 , // application/json-patch+json /* Ref: [RFC6902] */ + COAP_CONTENTTYPE_APPLICATION_MERGE_PATCH_JSON = 52 , // application/merge-patch+json /* Ref: [RFC7396] */ + COAP_CONTENTTYPE_APPLICATION_CBOR = 60 , // application/cbor /* Ref: [RFC7049] */ + COAP_CONTENTTYPE_APPLICATION_CWT = 61 , // application/cwt /* Ref: [RFC8392] */ + COAP_CONTENTTYPE_APPLICATION_COSE_ENCRYPT = 96 , // application/cose; cose-type="cose-encrypt" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_MAC = 97 , // application/cose; cose-type="cose-mac" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_SIGN = 98 , // application/cose; cose-type="cose-sign" /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_KEY = 101 , // application/cose-key /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COSE_KEY_SET = 102 , // application/cose-key-set /* Ref: [RFC8152] */ + COAP_CONTENTTYPE_APPLICATION_COAP_GROUP_JSON = 256 , // application/coap-group+json /* Ref: [RFC7390] */ + /* 256-9999 IETF Review or IESG Approval */ + COAP_CONTENTTYPE_APPLICATION_OMA_TLV_OLD = 1542 , // Keep old value for backward-compatibility /* Ref: [OMA-TS-LightweightM2M-V1_0] */ + COAP_CONTENTTYPE_APPLICATION_OMA_JSON_OLD = 1543 , // Keep old value for backward-compatibility /* Ref: [OMA-TS-LightweightM2M-V1_0] */ + /* 10000-64999 First Come First Served */ + COAP_CONTENTTYPE_APPLICATION_VND_OCF_CBOR = 10000, // application/vnd.ocf+cbor /* Ref: [Michael_Koster] */ + COAP_CONTENTTYPE_APPLICATION_OMA_TLV = 11542, // application/vnd.oma.lwm2m+tlv /* Ref: [OMA-TS-LightweightM2M-V1_0] */ + COAP_CONTENTTYPE_APPLICATION_OMA_JSON = 11543, // application/vnd.oma.lwm2m+json /* Ref: [OMA-TS-LightweightM2M-V1_0] */ + /* 65000-65535 Experimental use (no operational use) */ +} /////////////////////// From 7e4bbf72df83030c2abfd3b94922f3a6d255a212 Mon Sep 17 00:00:00 2001 From: mofosyne Date: Tue, 15 May 2018 01:06:52 +1000 Subject: [PATCH 2/3] Update coap.h --- coap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coap.h b/coap.h index c30f478..37178d8 100644 --- a/coap.h +++ b/coap.h @@ -134,7 +134,7 @@ typedef enum /* 10000-64999 First Come First Served */ COAP_CONTENTTYPE_APPLICATION_VND_OCF_CBOR = 10000, // application/vnd.ocf+cbor /* Ref: [Michael_Koster] */ COAP_CONTENTTYPE_APPLICATION_OMA_TLV = 11542, // application/vnd.oma.lwm2m+tlv /* Ref: [OMA-TS-LightweightM2M-V1_0] */ - COAP_CONTENTTYPE_APPLICATION_OMA_JSON = 11543, // application/vnd.oma.lwm2m+json /* Ref: [OMA-TS-LightweightM2M-V1_0] */ + COAP_CONTENTTYPE_APPLICATION_OMA_JSON = 11543 // application/vnd.oma.lwm2m+json /* Ref: [OMA-TS-LightweightM2M-V1_0] */ /* 65000-65535 Experimental use (no operational use) */ } From 03745473f709ca5c359ceea96f0cafe253284d94 Mon Sep 17 00:00:00 2001 From: mofosyne Date: Tue, 15 May 2018 01:16:34 +1000 Subject: [PATCH 3/3] Update coap.h --- coap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coap.h b/coap.h index 37178d8..58d93b3 100644 --- a/coap.h +++ b/coap.h @@ -136,7 +136,7 @@ typedef enum COAP_CONTENTTYPE_APPLICATION_OMA_TLV = 11542, // application/vnd.oma.lwm2m+tlv /* Ref: [OMA-TS-LightweightM2M-V1_0] */ COAP_CONTENTTYPE_APPLICATION_OMA_JSON = 11543 // application/vnd.oma.lwm2m+json /* Ref: [OMA-TS-LightweightM2M-V1_0] */ /* 65000-65535 Experimental use (no operational use) */ -} +} coap_content_type_t; ///////////////////////