From 1ba45e6834fdf215bc691a0920b8c716082f9eaf Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 1 Oct 2023 18:11:39 +1100 Subject: [PATCH 1/7] 240-CborKnownTagGenerator --- src/cbor.h | 498 +++++++++++++++++++++-- tools/iana/.gitignore | 1 + tools/iana/iana-cbor-c-header.py | 635 ++++++++++++++++++++++++++++++ tools/iana/iana-cbor-sources.json | 12 + 4 files changed, 1108 insertions(+), 38 deletions(-) create mode 100644 tools/iana/.gitignore create mode 100755 tools/iana/iana-cbor-c-header.py create mode 100644 tools/iana/iana-cbor-sources.json diff --git a/src/cbor.h b/src/cbor.h index 31b1036e..5aad05c4 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -101,55 +101,478 @@ typedef enum CborType { CborInvalidType = 0xff /* equivalent to the break byte, so it will never be used */ } CborType; +typedef enum CborSimpleValue { + /* Autogenerated IANA CBOR Content-Formats (Source: https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple) */ + + /* 0-19 : Standards Action */ + // False; Ref: [RFC8949] + CborSimpleValueFalse = 20, + // True; Ref: [RFC8949] + CborSimpleValueTrue = 21, + // Null; Ref: [RFC8949] + CborSimpleValueNull = 22, + // Undefined; Ref: [RFC8949] + CborSimpleValueUndefined = 23 + + /* 32-255 : Specification Required */ +} CborSimpleValue; + typedef uint64_t CborTag; typedef enum CborKnownTags { - CborDateTimeStringTag = 0, - CborUnixTime_tTag = 1, - CborPositiveBignumTag = 2, - CborNegativeBignumTag = 3, - CborDecimalTag = 4, - CborBigfloatTag = 5, - CborCOSE_Encrypt0Tag = 16, - CborCOSE_Mac0Tag = 17, - CborCOSE_Sign1Tag = 18, - CborExpectedBase64urlTag = 21, - CborExpectedBase64Tag = 22, - CborExpectedBase16Tag = 23, - CborEncodedCborTag = 24, - CborUrlTag = 32, - CborBase64urlTag = 33, - CborBase64Tag = 34, - CborRegularExpressionTag = 35, - CborMimeMessageTag = 36, - CborCOSE_EncryptTag = 96, - CborCOSE_MacTag = 97, - CborCOSE_SignTag = 98, - CborSignatureTag = 55799 + /* Autogenerated IANA CBOR Tags (Source: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags) */ + + /* 0-23 : Standards Action */ + // Standard date/time string; see Section 3.4.1; Ref: [RFC8949] + CborDateTimeStringTag = 0, + // Epoch-based date/time; see Section 3.4.2; Ref: [RFC8949] + CborUnixTime_tTag = 1, + // Unsigned bignum; see Section 3.4.3; Ref: [RFC8949] + CborPositiveBignumTag = 2, + // Negative bignum; see Section 3.4.3; Ref: [RFC8949] + CborNegativeBignumTag = 3, + // Decimal fraction; see Section 3.4.4; Ref: [RFC8949] + CborDecimalTag = 4, + // Bigfloat; see Section 3.4.4; Ref: [RFC8949] + CborBigfloatTag = 5, + // COSE Single Recipient Encrypted Data Object; Ref: [RFC9052] + CborCOSE_Encrypt0Tag = 16, + // COSE Mac w/o Recipients Object; Ref: [RFC9052] + CborCOSE_Mac0Tag = 17, + // COSE Single Signer Data Object; Ref: [RFC9052] + CborCOSE_Sign1Tag = 18, + // COSE standalone V2 countersignature; Ref: [RFC9338] + CborKnownTCoseStandaloneV2CountersignatureTag = 19, + // Expected conversion to base64url encoding; see Section 3.4.5.2; Ref: [RFC8949] + CborExpectedBase64urlTag = 21, + // Expected conversion to base64 encoding; see Section 3.4.5.2; Ref: [RFC8949] + CborExpectedBase64Tag = 22, + // Expected conversion to base16 encoding; see Section 3.4.5.2; Ref: [RFC8949] + CborExpectedBase16Tag = 23, + + /* 24-32767 : Specification Required */ + // Encoded CBOR data item; see Section 3.4.5.1; Ref: [RFC8949] + CborEncodedCborTag = 24, + // reference the nth previously seen string; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] + CborKnownTRefTheNthPrevSeenStringTag = 25, + // Serialised Perl object with classname and constructor arguments; Ref: [http://cbor.schmorp.de/perl-object][Marc_A._Lehmann] + CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag = 26, + // Serialised language-independent object with type name and constructor arguments; Ref: [http://cbor.schmorp.de/generic-object][Marc_A._Lehmann] + CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag = 27, + // mark value as (potentially) shared; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] + CborKnownTMarkValueAsSharedTag = 28, + // reference nth marked value; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] + CborKnownTRefNthMarkedValueTag = 29, + // Rational number; Ref: [http://peteroupc.github.io/CBOR/rational.html][Peter_Occil] + CborKnownTRationalNumberTag = 30, + // Absent value in a CBOR Array; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-absent-tag.rst][Sami_Vaarala] + CborKnownTAbsentValueInACborArrayTag = 31, + // URI; see Section 3.4.5.3; Ref: [RFC8949] + CborUrlTag = 32, + // base64url; see Section 3.4.5.3; Ref: [RFC8949] + CborBase64urlTag = 33, + // base64; see Section 3.4.5.3; Ref: [RFC8949] + CborBase64Tag = 34, + // Regular expression; see Section 2.4.4.3; Ref: [RFC7049] + CborRegularExpressionTag = 35, + // MIME message; see Section 3.4.5.3; Ref: [RFC8949] + CborMimeMessageTag = 36, + // Binary UUID ([RFC4122, Section 4.1.2]); Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md][Lucas_Clemente] + CborKnownTBinaryUuidTag = 37, + // Language-tagged string; Ref: [RFC9290, Appendix A] + CborKnownTLanguageTaggedStringTag = 38, + // Identifier; Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/id.md][Lucas_Clemente] + CborKnownTIdTag = 39, + // Multi-dimensional Array, row-major order; Ref: [RFC8746] + CborKnownTMultiDimensionalArrayRowMajorOrderTag = 40, + // Homogeneous Array; Ref: [RFC8746] + CborKnownTHomogeneousArrayTag = 41, + // IPLD content identifier; Ref: [https://github.com/ipld/cid-cbor/][Volker_Mische] + CborKnownTIpldContentIdTag = 42, + // YANG bits datatype; see Section 6.7.; Ref: [RFC9254] + CborKnownTYangBitsDatatypeTag = 43, + // YANG enumeration datatype; see Section 6.6.; Ref: [RFC9254] + CborKnownTYangEnumerationDatatypeTag = 44, + // YANG identityref datatype; see Section 6.10.; Ref: [RFC9254] + CborKnownTYangIdentityrefDatatypeTag = 45, + // YANG instance-identifier datatype; see Section 6.13.; Ref: [RFC9254] + CborKnownTYangInstanceIdDatatypeTag = 46, + // YANG Schema Item iDentifier (sid); see Section 3.2.; Ref: [RFC9254] + CborKnownTYangSchemaItemIdTag = 47, + // IPv4, [prefixlen,IPv4], [IPv4,prefixpart]; Ref: [RFC9164] + CborKnownTIpv4Tag = 52, + // IPv6, [prefixlen,IPv6], [IPv6,prefixpart]; Ref: [RFC9164] + CborKnownTIpv6Tag = 54, + // CBOR Web Token (CWT); Ref: [RFC8392][Michael_B._Jones] + CborKnownTCborWebTokenTag = 61, + // Encoded CBOR Sequence [RFC8742]; Ref: [draft-bormann-cbor-notable-tags-02, Section 2.1] + CborKnownTEncodedCborSequenceTag = 63, + // uint8 Typed Array; Ref: [RFC8746] + CborKnownTUint8TypedArrayTag = 64, + // uint16, big endian, Typed Array; Ref: [RFC8746] + CborKnownTUint16BigEndianTypedArrayTag = 65, + // uint32, big endian, Typed Array; Ref: [RFC8746] + CborKnownTUint32BigEndianTypedArrayTag = 66, + // uint64, big endian, Typed Array; Ref: [RFC8746] + CborKnownTUint64BigEndianTypedArrayTag = 67, + // uint8 Typed Array, clamped arithmetic; Ref: [RFC8746] + CborKnownTUint8TypedArrayClampedArithmeticTag = 68, + // uint16, little endian, Typed Array; Ref: [RFC8746] + CborKnownTUint16LittleEndianTypedArrayTag = 69, + // uint32, little endian, Typed Array; Ref: [RFC8746] + CborKnownTUint32LittleEndianTypedArrayTag = 70, + // uint64, little endian, Typed Array; Ref: [RFC8746] + CborKnownTUint64LittleEndianTypedArrayTag = 71, + // sint8 Typed Array; Ref: [RFC8746] + CborKnownTSint8TypedArrayTag = 72, + // sint16, big endian, Typed Array; Ref: [RFC8746] + CborKnownTSint16BigEndianTypedArrayTag = 73, + // sint32, big endian, Typed Array; Ref: [RFC8746] + CborKnownTSint32BigEndianTypedArrayTag = 74, + // sint64, big endian, Typed Array; Ref: [RFC8746] + CborKnownTSint64BigEndianTypedArrayTag = 75, + // sint16, little endian, Typed Array; Ref: [RFC8746] + CborKnownTSint16LittleEndianTypedArrayTag = 77, + // sint32, little endian, Typed Array; Ref: [RFC8746] + CborKnownTSint32LittleEndianTypedArrayTag = 78, + // sint64, little endian, Typed Array; Ref: [RFC8746] + CborKnownTSint64LittleEndianTypedArrayTag = 79, + // IEEE 754 binary16, big endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary16BigEndianTypedArrayTag = 80, + // IEEE 754 binary32, big endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary32BigEndianTypedArrayTag = 81, + // IEEE 754 binary64, big endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary64BigEndianTypedArrayTag = 82, + // IEEE 754 binary128, big endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary128BigEndianTypedArrayTag = 83, + // IEEE 754 binary16, little endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary16LittleEndianTypedArrayTag = 84, + // IEEE 754 binary32, little endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary32LittleEndianTypedArrayTag = 85, + // IEEE 754 binary64, little endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary64LittleEndianTypedArrayTag = 86, + // IEEE 754 binary128, little endian, Typed Array; Ref: [RFC8746] + CborKnownTIeee754Binary128LittleEndianTypedArrayTag = 87, + // COSE Encrypted Data Object; Ref: [RFC9052] + CborCOSE_EncryptTag = 96, + // COSE MACed Data Object; Ref: [RFC9052] + CborCOSE_MacTag = 97, + // COSE Signed Data Object; Ref: [RFC9052] + CborCOSE_SignTag = 98, + // Number of days since the epoch date 1970-01-01; Ref: [RFC8943] + CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag = 100, + // alternatives as given by the uint + 128; see Section 9.1; Ref: [draft-bormann-cbor-notable-tags-07] + CborKnownTAlternativesAsGivenByTheUintPlus128Tag = 101, + // Geographic Coordinates; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag103-Geographic-Coordinates.md][Danilo_Vidovic] + CborKnownTGeographicCoordinatesTag = 103, + // Geographic Coordinate Reference System WKT or EPSG number; Ref: [draft-clarke-cbor-crs] + CborKnownTGeoCoordRefSystemWktOrEpsgNumTag = 104, + // relative object identifier (BER encoding); SDNV [RFC6256] sequence; Ref: [RFC9090] + CborKnownTRelativeObjectIdTag = 110, + // object identifier (BER encoding); Ref: [RFC9090] + CborKnownTObjectIdTag = 111, + // object identifier (BER encoding), relative to 1.3.6.1.4.1; Ref: [RFC9090] + CborKnownTObjectIdRelativeTo136141Tag = 112, + // Internet of Things Data Point; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag120-Internet-of-Things-Data-Points.md][Danilo_Vidovic] + CborKnownTInternetOfThingsDataPointTag = 120, + // Gordian Envelope; Ref: [draft-mcnally-envelope-05] + CborKnownTGordianEnvelopeTag = 200, + // mark value as having string references; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] + CborKnownTMarkValueAsHavingStringReferencesTag = 256, + // Binary MIME message; Ref: [http://peteroupc.github.io/CBOR/binarymime.html][Peter_Occil] + CborKnownTBinaryMimeMsgTag = 257, + // Mathematical finite set; Ref: [https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md][Alfredo_Di_Napoli] + CborKnownTMathematicalFiniteSetTag = 258, + // Map datatype with key-value operations (e.g. `.get()/.set()/.delete()`); Ref: [https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec--explicit-maps.md][Shane_Holloway] + CborKnownTMapDatatypeWithKeyValOpSetDeleteTag = 259, + // Network Address (IPv4 or IPv6 or MAC Address) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [http://www.employees.org/~ravir/cbor-network.txt][Ravi_Raju][RFC9164] + CborKnownTNetworkAddressTag = 260, + // Network Address Prefix (IPv4 or IPv6 Address + Mask Length) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/networkPrefix.md][Ravi_Raju][RFC9164] + CborKnownTNetworkAddressPrefixTag = 261, + // Embedded JSON Object; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/embeddedJSON.md][Ravi_Raju] + CborKnownTEmbeddedJsonObjectTag = 262, + // Hexadecimal string; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/hexString.md][Ravi_Raju] + CborKnownTHexadecimalStringTag = 263, + // Decimal fraction with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] + CborKnownTDecimalFractionWithArbitraryExponentTag = 264, + // Bigfloat with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] + CborKnownTBigfloatWithArbitraryExponentTag = 265, + // Internationalized resource identifier (IRI); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] + CborKnownTInternationalizedResourceIdTag = 266, + // Internationalized resource identifier reference (IRI reference); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] + CborKnownTInternationalizedResourceIdRefTag = 267, + // Extended decimal fraction; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] + CborKnownTExtendedDecimalFractionTag = 268, + // Extended bigfloat; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] + CborKnownTExtendedBigfloatTag = 269, + // Extended rational number; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] + CborKnownTExtendedRationalNumberTag = 270, + // DDoS Open Threat Signaling (DOTS) signal channel object, as defined in [RFC9132]; Ref: [RFC9132] + CborKnownTDdosOpenThreatSignalingSigChnObjTag = 271, + // Non-UTF-8 CESU-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] + CborKnownTNonUtf8Cesu8StringTag = 272, + // Non-UTF-8 WTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] + CborKnownTNonUtf8Wtf8StringTag = 273, + // Non-UTF-8 MUTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] + CborKnownTNonUtf8Mutf8StringTag = 274, + // Map contains only keys that are of type Text String (major type 3); Ref: [https://github.com/ecorm/cbor-tag-text-key-map][Emile_Cormier] + CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag = 275, + // ERIS binary read capability; Ref: [http://purl.org/eris] + CborKnownTErisBinaryReadCapabilityTag = 276, + // Universal Geographical Area Description (GAD) shape; see Section 5; Ref: [TS 23.032][Mathew_Meins] + CborKnownTUniversalGeoAreaDescriptionShapeTag = 277, + // Universal Geographical Area Description (GAD) description of velocity; see Section 8; Ref: [TS 23.032][Mathew_Meins] + CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag = 278, + // extended time; Ref: [draft-bormann-cbor-time-tag-01] + CborKnownTExtendedTimeTag = 1001, + // duration; Ref: [draft-bormann-cbor-time-tag-01] + CborKnownTDurationTag = 1002, + // period; Ref: [draft-bormann-cbor-time-tag-01] + CborKnownTPeriodTag = 1003, + // [RFC3339] full-date string; Ref: [RFC8943] + CborKnownTFullDateStringTag = 1004, + // Object type identifier; Ref: [draft-rundgren-cotx-04] + CborKnownTObjectTypeIdTag = 1010, + // Multi-dimensional Array, column-major order; Ref: [RFC8746] + CborKnownTMultiDimensionalArrayColumnMajorOrderTag = 1040, + // [COSE algorithm identifier, Base Hash value]; Ref: [draft-bormann-cbor-notable-tags-09, Section 3.1.1] + CborKnownTCoseAlgorithmIdBaseHashValueTag = 18556, + // I-Regexp; Ref: [draft-bormann-cbor-notable-tags-09, Section 2.1][draft-ietf-jsonpath-iregexp-08] + CborKnownTIRegexpTag = 21065, + // ECMAScript RegExp [https://262.ecma-international.org/14.0/#sec-regexp-regular-expression-objects]; Ref: [https://github.com/hildjj/cbor-specs/blob/main/regexp.md][Joe_Hildebrand] + CborKnownTEcmascriptRegexpTag = 21066, + // hint that indicates an additional level of indirection; Ref: [http://cbor.schmorp.de/indirection][Marc_A._Lehmann] + CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag = 22098, + // Capture [3]; Ref: [https://github.com/japhb/cbor-specs/blob/main/capture.md][Geoffrey_Broadwell] + CborKnownTCaptureTag = 25441, + + /* 32768-18446744073709551615 : First Come First Served */ + // Identifier for a FHIR constant; Ref: [Stefan_Genchev] + CborKnownTIdForAFhirConstantTag = 32768, + // External reference; Ref: [https://gitlab.com/Hawk777/cbor-specs/-/blob/main/external-reference.md][Christopher_Head] + CborKnownTExternalRefTag = 32769, + // A confidentiality clearance. The key value pairs of the map are defined in ADatP-4774.4; Ref: [Aidan_Murdock] + CborKnownTAConfidentialityClearanceTag = 42600, + // A metadata binding. The elements of the array are defined in AdatP-4778.5. The tag is also used as part of the magic number in on-disk detached and encapsulating bindings.; Ref: [Aidan_Murdock] + CborKnownTAMetadataBindingTag = 42601, + // A collection of NCMS metadata elements. The key value pairs of the map are defined in AdatP-5636.4; Ref: [Aidan_Murdock] + CborKnownTACollectionOfNcmsMetadataElementsTag = 42602, + // Single complex number: array elements are real (I) and imaginary (Q) components; Ref: [Saajan_Chana] + CborKnownTSingleComplexNumberTag = 43000, + // Array of complex numbers in interleaved form: complex value k is stored with real (I) part at array index 2k and imaginary (Q) part at index (2k + 1); Ref: [Saajan_Chana] + CborKnownTArrayOfComplexNumbersInInterleavedFormTag = 43001, + // PlatformV_IS_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvIsIdTag = 50000, + // PlatformV_IS_NAME; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvIsNameTag = 50001, + // PlatformV_IS_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvIsValueTag = 50002, + // PlatformV_HAS_COMPOSITE_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasCompositeValueTag = 50003, + // PlatformV_HAS_MAPPED_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasMappedValueTag = 50004, + // PlatformV_HAS_OBJ_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasObjIdTag = 50005, + // PlatformV_HAS_OBJ_TAG; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasObjTagTag = 50006, + // PlatformV_HAS_CHILD; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasChildTag = 50007, + // PlatformV_HAS_PROPERTY; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasPropertyTag = 50008, + // PlatformV_HAS_META; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasMetaTag = 50009, + // PlatformV_HAS_EVENT; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasEventTag = 50010, + // PlatformV_HAS_ACTION; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvHasActionTag = 50011, + // PlatformV_IS_TYPE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] + CborKnownTPlatformvIsTypeTag = 50012, + // Self-described CBOR; see Section 3.4.6; Ref: [RFC8949] + CborSignatureTag = 55799, + // indicates that the file contains CBOR Sequences; Ref: [RFC9277] + CborKnownTIndicatesThatFileContainsCborSequencesTag = 55800, + // indicates that the file starts with a CBOR-Labeled Non-CBOR Data label.; Ref: [RFC9277] + CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag = 55801, + // Compressed byte string; Ref: [https://github.com/dectris/documentation/blob/main/cbor/dectris-compression-tag.md][Kal_Conley] + CborKnownTCompressedByteStringTag = 56500, + // Identify and define a set of record structures (each a sequence of property names) that can be referenced as tags in the included value (and the scope for the record tag definitions); Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] + CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag = 57342, + // Identify and define a record structure (a sequence of property names), and use that record structure definition to interpret the included values.; Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] + CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag = 57343, + // The tagged CBOR array contains attestation evidence data with an Intel TEE quote.; Ref: [Shanwei_Cen] + CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag = 60000, + // The tagged CBOR array contains attestation evidence data with an Intel TEE report.; Ref: [Shanwei_Cen] + CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, + // The tagged CBOR array contains attestation evidence data with an Intel SGX report.; Ref: [Shanwei_Cen] + CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, + // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] + CborKnownTAlwaysInvalidTag = 65535, + // RAINS Message; Ref: [https://britram.github.io/rains-prototype][Brian_Trammell] + CborKnownTRainsMsgTag = 15309736, + // A CBOR encoded Openswan configuration file, as stored on disk forunit test cases.; Ref: [Michael_Richardson][Samir_Hussain] + CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag = 1330664270, + // Concise Software Identifier (CoSWID); Ref: [RFC9393] + CborKnownTConciseSoftwareIdTag = 1398229316, + // Array of content-addressed blocks and ERIS read capabilities; Ref: [Endo_Renberg] + CborKnownTArrayOfContentAddrBlocksErisReadCapTag = 1701996915, + // ERIS-FS image header; Ref: [Endo_Renberg] + CborKnownTErisFsImageHeaderTag = 1701996916, + // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] + CborKnownTAlwaysInvalidTag = 4294967295, + // Intel FPGA SPDM Manifest; Ref: [Andrew_Draper] + CborKnownTIntelFpgaSpdmManifestTag = 4294967296, + // always invalid; Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] + CborKnownTAlwaysInvalidTag = 18446744073709551615 } CborKnownTags; +/* Start of cbor known tag feature flag autogenerated section */ /* #define the constants so we can check with #ifdef */ -#define CborDateTimeStringTag CborDateTimeStringTag -#define CborUnixTime_tTag CborUnixTime_tTag -#define CborPositiveBignumTag CborPositiveBignumTag -#define CborNegativeBignumTag CborNegativeBignumTag -#define CborDecimalTag CborDecimalTag +#define CborBase64Tag CborBase64Tag +#define CborBase64urlTag CborBase64urlTag #define CborBigfloatTag CborBigfloatTag #define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag +#define CborCOSE_EncryptTag CborCOSE_EncryptTag #define CborCOSE_Mac0Tag CborCOSE_Mac0Tag +#define CborCOSE_MacTag CborCOSE_MacTag #define CborCOSE_Sign1Tag CborCOSE_Sign1Tag -#define CborExpectedBase64urlTag CborExpectedBase64urlTag -#define CborExpectedBase64Tag CborExpectedBase64Tag -#define CborExpectedBase16Tag CborExpectedBase16Tag +#define CborCOSE_SignTag CborCOSE_SignTag +#define CborDateTimeStringTag CborDateTimeStringTag +#define CborDecimalTag CborDecimalTag #define CborEncodedCborTag CborEncodedCborTag -#define CborUrlTag CborUrlTag -#define CborBase64urlTag CborBase64urlTag -#define CborBase64Tag CborBase64Tag -#define CborRegularExpressionTag CborRegularExpressionTag +#define CborExpectedBase16Tag CborExpectedBase16Tag +#define CborExpectedBase64Tag CborExpectedBase64Tag +#define CborExpectedBase64urlTag CborExpectedBase64urlTag +#define CborKnownTACollectionOfNcmsMetadataElementsTag CborKnownTACollectionOfNcmsMetadataElementsTag +#define CborKnownTAConfidentialityClearanceTag CborKnownTAConfidentialityClearanceTag +#define CborKnownTAMetadataBindingTag CborKnownTAMetadataBindingTag +#define CborKnownTAbsentValueInACborArrayTag CborKnownTAbsentValueInACborArrayTag +#define CborKnownTAlternativesAsGivenByTheUintPlus128Tag CborKnownTAlternativesAsGivenByTheUintPlus128Tag +#define CborKnownTAlwaysInvalidTag CborKnownTAlwaysInvalidTag +#define CborKnownTArrayOfComplexNumbersInInterleavedFormTag CborKnownTArrayOfComplexNumbersInInterleavedFormTag +#define CborKnownTArrayOfContentAddrBlocksErisReadCapTag CborKnownTArrayOfContentAddrBlocksErisReadCapTag +#define CborKnownTBigfloatWithArbitraryExponentTag CborKnownTBigfloatWithArbitraryExponentTag +#define CborKnownTBinaryMimeMsgTag CborKnownTBinaryMimeMsgTag +#define CborKnownTBinaryUuidTag CborKnownTBinaryUuidTag +#define CborKnownTCaptureTag CborKnownTCaptureTag +#define CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag +#define CborKnownTCborWebTokenTag CborKnownTCborWebTokenTag +#define CborKnownTCompressedByteStringTag CborKnownTCompressedByteStringTag +#define CborKnownTConciseSoftwareIdTag CborKnownTConciseSoftwareIdTag +#define CborKnownTCoseAlgorithmIdBaseHashValueTag CborKnownTCoseAlgorithmIdBaseHashValueTag +#define CborKnownTCoseStandaloneV2CountersignatureTag CborKnownTCoseStandaloneV2CountersignatureTag +#define CborKnownTDdosOpenThreatSignalingSigChnObjTag CborKnownTDdosOpenThreatSignalingSigChnObjTag +#define CborKnownTDecimalFractionWithArbitraryExponentTag CborKnownTDecimalFractionWithArbitraryExponentTag +#define CborKnownTDurationTag CborKnownTDurationTag +#define CborKnownTEcmascriptRegexpTag CborKnownTEcmascriptRegexpTag +#define CborKnownTEmbeddedJsonObjectTag CborKnownTEmbeddedJsonObjectTag +#define CborKnownTEncodedCborSequenceTag CborKnownTEncodedCborSequenceTag +#define CborKnownTErisBinaryReadCapabilityTag CborKnownTErisBinaryReadCapabilityTag +#define CborKnownTErisFsImageHeaderTag CborKnownTErisFsImageHeaderTag +#define CborKnownTExtendedBigfloatTag CborKnownTExtendedBigfloatTag +#define CborKnownTExtendedDecimalFractionTag CborKnownTExtendedDecimalFractionTag +#define CborKnownTExtendedRationalNumberTag CborKnownTExtendedRationalNumberTag +#define CborKnownTExtendedTimeTag CborKnownTExtendedTimeTag +#define CborKnownTExternalRefTag CborKnownTExternalRefTag +#define CborKnownTFullDateStringTag CborKnownTFullDateStringTag +#define CborKnownTGeoCoordRefSystemWktOrEpsgNumTag CborKnownTGeoCoordRefSystemWktOrEpsgNumTag +#define CborKnownTGeographicCoordinatesTag CborKnownTGeographicCoordinatesTag +#define CborKnownTGordianEnvelopeTag CborKnownTGordianEnvelopeTag +#define CborKnownTHexadecimalStringTag CborKnownTHexadecimalStringTag +#define CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag +#define CborKnownTHomogeneousArrayTag CborKnownTHomogeneousArrayTag +#define CborKnownTIRegexpTag CborKnownTIRegexpTag +#define CborKnownTIdForAFhirConstantTag CborKnownTIdForAFhirConstantTag +#define CborKnownTIdTag CborKnownTIdTag +#define CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag +#define CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag +#define CborKnownTIeee754Binary128BigEndianTypedArrayTag CborKnownTIeee754Binary128BigEndianTypedArrayTag +#define CborKnownTIeee754Binary128LittleEndianTypedArrayTag CborKnownTIeee754Binary128LittleEndianTypedArrayTag +#define CborKnownTIeee754Binary16BigEndianTypedArrayTag CborKnownTIeee754Binary16BigEndianTypedArrayTag +#define CborKnownTIeee754Binary16LittleEndianTypedArrayTag CborKnownTIeee754Binary16LittleEndianTypedArrayTag +#define CborKnownTIeee754Binary32BigEndianTypedArrayTag CborKnownTIeee754Binary32BigEndianTypedArrayTag +#define CborKnownTIeee754Binary32LittleEndianTypedArrayTag CborKnownTIeee754Binary32LittleEndianTypedArrayTag +#define CborKnownTIeee754Binary64BigEndianTypedArrayTag CborKnownTIeee754Binary64BigEndianTypedArrayTag +#define CborKnownTIeee754Binary64LittleEndianTypedArrayTag CborKnownTIeee754Binary64LittleEndianTypedArrayTag +#define CborKnownTIndicatesThatFileContainsCborSequencesTag CborKnownTIndicatesThatFileContainsCborSequencesTag +#define CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag +#define CborKnownTIntelFpgaSpdmManifestTag CborKnownTIntelFpgaSpdmManifestTag +#define CborKnownTInternationalizedResourceIdRefTag CborKnownTInternationalizedResourceIdRefTag +#define CborKnownTInternationalizedResourceIdTag CborKnownTInternationalizedResourceIdTag +#define CborKnownTInternetOfThingsDataPointTag CborKnownTInternetOfThingsDataPointTag +#define CborKnownTIpldContentIdTag CborKnownTIpldContentIdTag +#define CborKnownTIpv4Tag CborKnownTIpv4Tag +#define CborKnownTIpv6Tag CborKnownTIpv6Tag +#define CborKnownTLanguageTaggedStringTag CborKnownTLanguageTaggedStringTag +#define CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag +#define CborKnownTMapDatatypeWithKeyValOpSetDeleteTag CborKnownTMapDatatypeWithKeyValOpSetDeleteTag +#define CborKnownTMarkValueAsHavingStringReferencesTag CborKnownTMarkValueAsHavingStringReferencesTag +#define CborKnownTMarkValueAsSharedTag CborKnownTMarkValueAsSharedTag +#define CborKnownTMathematicalFiniteSetTag CborKnownTMathematicalFiniteSetTag +#define CborKnownTMultiDimensionalArrayColumnMajorOrderTag CborKnownTMultiDimensionalArrayColumnMajorOrderTag +#define CborKnownTMultiDimensionalArrayRowMajorOrderTag CborKnownTMultiDimensionalArrayRowMajorOrderTag +#define CborKnownTNetworkAddressPrefixTag CborKnownTNetworkAddressPrefixTag +#define CborKnownTNetworkAddressTag CborKnownTNetworkAddressTag +#define CborKnownTNonUtf8Cesu8StringTag CborKnownTNonUtf8Cesu8StringTag +#define CborKnownTNonUtf8Mutf8StringTag CborKnownTNonUtf8Mutf8StringTag +#define CborKnownTNonUtf8Wtf8StringTag CborKnownTNonUtf8Wtf8StringTag +#define CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag +#define CborKnownTObjectIdRelativeTo136141Tag CborKnownTObjectIdRelativeTo136141Tag +#define CborKnownTObjectIdTag CborKnownTObjectIdTag +#define CborKnownTObjectTypeIdTag CborKnownTObjectTypeIdTag +#define CborKnownTPeriodTag CborKnownTPeriodTag +#define CborKnownTPlatformvHasActionTag CborKnownTPlatformvHasActionTag +#define CborKnownTPlatformvHasChildTag CborKnownTPlatformvHasChildTag +#define CborKnownTPlatformvHasCompositeValueTag CborKnownTPlatformvHasCompositeValueTag +#define CborKnownTPlatformvHasEventTag CborKnownTPlatformvHasEventTag +#define CborKnownTPlatformvHasMappedValueTag CborKnownTPlatformvHasMappedValueTag +#define CborKnownTPlatformvHasMetaTag CborKnownTPlatformvHasMetaTag +#define CborKnownTPlatformvHasObjIdTag CborKnownTPlatformvHasObjIdTag +#define CborKnownTPlatformvHasObjTagTag CborKnownTPlatformvHasObjTagTag +#define CborKnownTPlatformvHasPropertyTag CborKnownTPlatformvHasPropertyTag +#define CborKnownTPlatformvIsIdTag CborKnownTPlatformvIsIdTag +#define CborKnownTPlatformvIsNameTag CborKnownTPlatformvIsNameTag +#define CborKnownTPlatformvIsTypeTag CborKnownTPlatformvIsTypeTag +#define CborKnownTPlatformvIsValueTag CborKnownTPlatformvIsValueTag +#define CborKnownTRainsMsgTag CborKnownTRainsMsgTag +#define CborKnownTRationalNumberTag CborKnownTRationalNumberTag +#define CborKnownTRefNthMarkedValueTag CborKnownTRefNthMarkedValueTag +#define CborKnownTRefTheNthPrevSeenStringTag CborKnownTRefTheNthPrevSeenStringTag +#define CborKnownTRelativeObjectIdTag CborKnownTRelativeObjectIdTag +#define CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag +#define CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag +#define CborKnownTSingleComplexNumberTag CborKnownTSingleComplexNumberTag +#define CborKnownTSint16BigEndianTypedArrayTag CborKnownTSint16BigEndianTypedArrayTag +#define CborKnownTSint16LittleEndianTypedArrayTag CborKnownTSint16LittleEndianTypedArrayTag +#define CborKnownTSint32BigEndianTypedArrayTag CborKnownTSint32BigEndianTypedArrayTag +#define CborKnownTSint32LittleEndianTypedArrayTag CborKnownTSint32LittleEndianTypedArrayTag +#define CborKnownTSint64BigEndianTypedArrayTag CborKnownTSint64BigEndianTypedArrayTag +#define CborKnownTSint64LittleEndianTypedArrayTag CborKnownTSint64LittleEndianTypedArrayTag +#define CborKnownTSint8TypedArrayTag CborKnownTSint8TypedArrayTag +#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag +#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag +#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag +#define CborKnownTUint16BigEndianTypedArrayTag CborKnownTUint16BigEndianTypedArrayTag +#define CborKnownTUint16LittleEndianTypedArrayTag CborKnownTUint16LittleEndianTypedArrayTag +#define CborKnownTUint32BigEndianTypedArrayTag CborKnownTUint32BigEndianTypedArrayTag +#define CborKnownTUint32LittleEndianTypedArrayTag CborKnownTUint32LittleEndianTypedArrayTag +#define CborKnownTUint64BigEndianTypedArrayTag CborKnownTUint64BigEndianTypedArrayTag +#define CborKnownTUint64LittleEndianTypedArrayTag CborKnownTUint64LittleEndianTypedArrayTag +#define CborKnownTUint8TypedArrayClampedArithmeticTag CborKnownTUint8TypedArrayClampedArithmeticTag +#define CborKnownTUint8TypedArrayTag CborKnownTUint8TypedArrayTag +#define CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag +#define CborKnownTUniversalGeoAreaDescriptionShapeTag CborKnownTUniversalGeoAreaDescriptionShapeTag +#define CborKnownTYangBitsDatatypeTag CborKnownTYangBitsDatatypeTag +#define CborKnownTYangEnumerationDatatypeTag CborKnownTYangEnumerationDatatypeTag +#define CborKnownTYangIdentityrefDatatypeTag CborKnownTYangIdentityrefDatatypeTag +#define CborKnownTYangInstanceIdDatatypeTag CborKnownTYangInstanceIdDatatypeTag +#define CborKnownTYangSchemaItemIdTag CborKnownTYangSchemaItemIdTag #define CborMimeMessageTag CborMimeMessageTag -#define CborCOSE_EncryptTag CborCOSE_EncryptTag -#define CborCOSE_MacTag CborCOSE_MacTag -#define CborCOSE_SignTag CborCOSE_SignTag +#define CborNegativeBignumTag CborNegativeBignumTag +#define CborPositiveBignumTag CborPositiveBignumTag +#define CborRegularExpressionTag CborRegularExpressionTag #define CborSignatureTag CborSignatureTag +#define CborUnixTime_tTag CborUnixTime_tTag +#define CborUrlTag CborUrlTag +/* End of cbor known tag feature flag autogenerated section */ /* Error API */ @@ -725,4 +1148,3 @@ CBOR_INLINE_API CborError cbor_value_to_pretty(FILE *out, const CborValue *value #endif #endif /* CBOR_H */ - diff --git a/tools/iana/.gitignore b/tools/iana/.gitignore new file mode 100644 index 00000000..16f2dc5f --- /dev/null +++ b/tools/iana/.gitignore @@ -0,0 +1 @@ +*.csv \ No newline at end of file diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/iana-cbor-c-header.py new file mode 100755 index 00000000..7f13492c --- /dev/null +++ b/tools/iana/iana-cbor-c-header.py @@ -0,0 +1,635 @@ +#!/usr/bin/python3 + +''' +MIT License + +Copyright (c) 2023, Brian Khuu +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +''' + +""" +# IANA CBOR C Header Generator + +https://github.com/mofosyne/iana-headers + +Script Description: + +This Python script performs the following tasks: +- Download the latest registry data from IANA for the specified Internet protocol standard if it is outdated or missing in the cache. +- Parse the downloaded data and generate C enumeration values. +- Update or create the C header file with the generated enumeration values, preserving any existing values. +""" + +import requests +import csv +import os +import re +import email +import time +import json + +spacing_string = " " + +iana_cbor_c_header_file_path = 'src/cbor.h' +iana_cache_dir_path = 'tools/iana/cache/' + +# Override default to tiny cbor compatibility mode (History: https://github.com/intel/tinycbor/issues/240) +tiny_cbor_style_override = True + +# Default Source +# This is because this script should be as standalone as possible and the url is unlikely to change +iana_cbor_simple_value_settings = { + "name" : "cbor_simple_value", + "title" : "IANA CBOR Content-Formats", + "csv_url" : "https://www.iana.org/assignments/cbor-simple-values/simple.csv", + "source_url" : "https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple", +} + +iana_cbor_tag_settings = { + "name" : "cbor_tag", + "title" : "IANA CBOR Tags", + "csv_url" : "https://www.iana.org/assignments/cbor-tags/tags.csv", + "source_url" : "https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags", +} + +if tiny_cbor_style_override: + iana_cbor_simple_value_settings["name"] = "CborSimpleValue" + iana_cbor_tag_settings["name"] = "CborKnownTags" + +# Load the iana data sources from the JSON file if avaliable +try: + with open('iana-cbor-sources.json', 'r') as config_file: + config = json.load(config_file) + iana_cbor_simple_value_settings.update(config.get('iana_cbor_simple_value_settings', {})) + iana_cbor_tag_settings.update(config.get('iana_cbor_tag_settings', {})) + print("Info: IANA Source Settings Config File loaded") +except FileNotFoundError: + # Handle the case where the JSON file doesn't exist + print("Warning: IANA Source Settings Config File does not exist. Using default settings.") + +default_cbor_header_c = """ +// IANA CBOR Headers +// Source: https://github.com/mofosyne/iana-headers + +""" + + +############################################################################### +# Download Handler + +def read_or_download_csv(csv_url: str, cache_file: str): + """ + Load latest IANA registrations + """ + def download_csv(csv_url: str, cache_file: str): + print(f"Downloading CSV file {csv_url} to {cache_file}") + response = requests.get(csv_url) + if response.status_code != 200: + raise Exception(f"Failed to fetch CSV content from {csv_url} got http status code {str(response.status_code)}") + csv_content = response.text + os.makedirs(os.path.dirname(cache_file), exist_ok=True) + with open(cache_file, "w", encoding="utf-8") as file: + file.write(csv_content) + return csv_content + def read_cache_csv(cache_file: str): + """ + No change detected. Use cached file + """ + print("Read cache...") + with open(cache_file, "r", encoding="utf-8") as file: + return file.read() + raise Exception(f"Cache file not found {cache_file}") + + print(f"Checking {csv_url} (cache:{cache_file})") + + try: + if not os.path.exists(cache_file): + print("cache file not found...") + return download_csv(csv_url, cache_file) + + # Cache file already exist. Check if outdated + response = requests.head(csv_url) + + # Check if last modified is still present + if 'last-modified' not in response.headers: + print("cannot find last modified date time...") + return read_cache_csv(cache_file) + + # Get cache and remote timestamp + remote_last_modified = response.headers['last-modified'] + remote_timestamp = time.mktime(email.utils.parsedate_to_datetime(remote_last_modified).timetuple()) + cached_timestamp = os.path.getmtime(cache_file) + print(f"remote last modified: {remote_timestamp}") + print(f"cached last modified: {cached_timestamp}") + + # Check if cache is still valid + if remote_timestamp <= cached_timestamp: + print("Cache still valid...") + return read_cache_csv(cache_file) + + print("Outdated cache...") + return download_csv(csv_url, cache_file) + except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError) as err: + print(f"An error occurred: {err}") + if os.path.exists(cache_file): + return read_cache_csv(cache_file) + else: + raise Exception(f"Cache file not found") + except Exception as e: + raise Exception(f"An unexpected error occurred: {e}") + + +############################################################################### +# C Code Generation Utilities + +def get_content_of_typedef_enum(c_code: str, typedef_enum_name: str) -> str: + match = re.search(fr'typedef enum [^{{]*\{{([^}}]*)\}} {typedef_enum_name};', c_code, flags=re.DOTALL) + if not match: + return None + + return match.group(1) + +def override_enum_from_existing_typedef_enum(header_file_content: str, c_typedef_name: str, c_enum_list): + """ + Check for existing enum so we do not break it + """ + def extract_enum_values_from_typedef_enum(c_code: str, existing_enum_content: str) -> str: + matches = re.findall(r'(\w+)\s*=\s*(\d+)', existing_enum_content) + + enum_values = {} + for match in matches: + enum_name, enum_value = match + enum_values[int(enum_value)] = enum_name + + return enum_values + existing_enum_content = get_content_of_typedef_enum(header_file_content, c_typedef_name) + existing_enum_name = extract_enum_values_from_typedef_enum(header_file_content, existing_enum_content) + for id_value, row in sorted(existing_enum_name.items()): + if id_value in c_enum_list: # Override + c_enum_list[id_value]["enum_name"] = existing_enum_name[id_value] + else: # Add + c_enum_list[id_value] = {"enum_name" : existing_enum_name[id_value]} + return c_enum_list + +def generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker = None): + c_range_marker_index = 0 + def range_marker_render(c_range_marker, id_value=None): + nonlocal c_range_marker_index + if c_range_marker is None: + return '' + + range_marker_content = '' + while c_range_marker_index < len(c_range_marker): + start_range = c_range_marker[c_range_marker_index].get("start") + end_range = c_range_marker[c_range_marker_index].get("end") + range_comment = c_range_marker[c_range_marker_index].get("description") + if id_value is None or start_range <= id_value: + range_marker_content += '\n' + spacing_string + f'/* {start_range}-{end_range} : {range_comment} */\n' + c_range_marker_index += 1 + continue + break + + return range_marker_content + + c_enum_content = c_head_comment + + for id_value, row in sorted(c_enum_list.items()): + c_enum_content += range_marker_render(c_range_marker, id_value) + if "comment" in row: + c_enum_content += spacing_string + f'// {row.get("comment", "")}\n' + c_enum_content += spacing_string + f'{row.get("enum_name", "")} = {id_value}' + (',\n' if id_value != sorted(c_enum_list)[-1] else '\n') + + c_enum_content += range_marker_render(c_range_marker) + + return c_enum_content + +def update_c_typedef_enum(document_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker = None): + def search_and_replace_c_typedef_enum(document_content, c_enum_content, typename, enumname = None): + # Search and replace + enumname = "" if enumname is None else (enumname + " ") + pattern = fr'typedef enum [^{{]*\{{([^}}]*)\}} {typename};' + replacement = f'typedef enum {enumname}{{\n{c_enum_content}}} {typename};' + updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) + return updated_document_content + + # Check if already exist, if not then create one + if not get_content_of_typedef_enum(document_content, c_typedef_name): + document_content += f'typedef enum {{\n}} {c_typedef_name};\n\n' + + # Old name takes priority for backwards compatibility (unless overridden) + c_enum_content = override_enum_from_existing_typedef_enum(document_content, c_typedef_name, c_enum_list) + + # Generate enumeration header content + c_enum_content = generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker) + + # Search for typedef enum name and replace with new content + updated_document_content = search_and_replace_c_typedef_enum(document_content, c_enum_content, c_typedef_name, c_enum_name) + + return updated_document_content + +def get_content_of_const_macro(c_code: str, section_name: str) -> str: + pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\/\* End of {section_name} autogenerated section \*\/' + match = re.search(pattern, c_code, flags=re.DOTALL) + if not match: + return None + + return match.group(1) + +def update_c_const_macro(document_content, section_name, c_head_comment, c_macro_list): + def search_and_replace_c_const_macro(document_content, section_name, new_content): + # Search and replace + pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\n\/\* End of {section_name} autogenerated section \*\/' + replacement = f'/* Start of {section_name} autogenerated section */\n{new_content}/* End of {section_name} autogenerated section */' + updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) + return updated_document_content + + # Check if already exist, if not then create one + if not get_content_of_const_macro(document_content, section_name): + document_content += f'/* Start of {section_name} autogenerated section */\n' + document_content += f'/* End of {section_name} autogenerated section */' + + # Generate enumeration header content + c_const_macro_content = c_head_comment + for macro_name, macro_data in sorted(c_macro_list.items()): + c_const_macro_content += f"#define {macro_name} {macro_data.get('value')}" + if 'comment' in macro_data: + c_const_macro_content += f" // {macro_data.get('comment')}" + c_const_macro_content += "\n" + + # Search for typedef enum name and replace with new content + updated_document_content = search_and_replace_c_const_macro(document_content, section_name, c_const_macro_content) + + return updated_document_content + +############################################################################### +# Content Format Generation +def iana_cbor_simple_values_c_enum_name_generate(cbor_simple_value: str, semantics: str, typedef_enum_name: str, camel_case = False): + """ + This generates a c enum name based on cbor content type and content coding value + """ + # Do not include comments indicated by messages within `(...)` + semantics = re.sub(r'\s+\(.*\)', '', semantics) + variable_name_list = re.sub(r'[^a-zA-Z0-9_]', ' ', semantics).split() + + # Tiny Cbor Style Pascal Case Output + if camel_case: + capitalized_variable_name_list = [word.capitalize() for word in variable_name_list] + pascal_case_str = typedef_enum_name+''.join(capitalized_variable_name_list) + return pascal_case_str + + # Convert Into Screaming Snake Case Output + screaming_snake_case_str = f"{typedef_enum_name.upper()}_"+'_'.join(variable_name_list) + screaming_snake_case_str = screaming_snake_case_str.upper() + return screaming_snake_case_str + +def iana_cbor_simple_values_parse_csv(csv_content: str, typedef_enum_name: str): + """ + Parse and process IANA registration into enums + """ + csv_lines = csv_content.strip().split('\n') + csv_reader = csv.DictReader(csv_lines) + enum_list = {} + for row in csv_reader: + cbor_simple_value = row["Value"] + semantics = row["Semantics"] + reference = row["Reference"] + if cbor_simple_value.lower() == "value": # Skip first header + continue + if not cbor_simple_value or semantics.lower() == "unassigned" or semantics.lower() == "reserved": + continue + if "-" in cbor_simple_value: # is a range of value + continue + # Add to enum list + comment = '; '.join(filter(None, [semantics, f'Ref: {reference}'])) + enum_name = "" + if tiny_cbor_style_override: + enum_name = iana_cbor_simple_values_c_enum_name_generate(cbor_simple_value, semantics, typedef_enum_name, camel_case=True) + else: + enum_name = iana_cbor_simple_values_c_enum_name_generate(cbor_simple_value, semantics, typedef_enum_name) + enum_list[int(cbor_simple_value)] = {"enum_name": enum_name, "comment": comment} + return enum_list + +def iana_cbor_simple_values_c_typedef_enum_update(header_file_content: str) -> str: + typedef_enum_name = iana_cbor_simple_value_settings["name"] + source_name = iana_cbor_simple_value_settings["title"] + source_url = iana_cbor_simple_value_settings["source_url"] + csv_file_url = iana_cbor_simple_value_settings["csv_url"] + cache_file_path = iana_cache_dir_path + os.path.basename(csv_file_url) + + # Generate typedef name + c_typedef_name = f"{typedef_enum_name}_t" + + if tiny_cbor_style_override: + c_typedef_name = f"{typedef_enum_name}" + + c_enum_name = c_typedef_name + + # Generate head comment + c_head_comment = spacing_string + f"/* Autogenerated {source_name} (Source: {source_url}) */\n" + + # Load latest IANA registrations + csv_content = read_or_download_csv(csv_file_url, cache_file_path) + + # Parse and process IANA registration into enums + c_enum_list = iana_cbor_simple_values_parse_csv(csv_content, typedef_enum_name) + + # Generate enumeration header content + c_range_marker = [ + {"start":0, "end":19, "description":"Standards Action"}, + {"start":32, "end":255, "description":"Specification Required"} + ] + return update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker) + + +############################################################################### +# Content Format Generation + +def iana_cbor_tag_c_enum_name_generate(tag_value, semantics, typedef_enum_name, max_words_without_abbreviation = 6): + def clean_semantics(semantic_str): + # Handle special edge case e.g. `A confidentiality clearance. The key value pairs of the map are defined in ADatP-4774.4` + # Handle special edge case e.g. `DDoS Open Threat Signaling (DOTS) signal channel object, as defined in [RFC9132]` + semantic_str = re.sub(r'[.,].* defined in .*', '', semantic_str) + #semantic_str = re.sub(r', as defined in \[RFC\d+\]', '', semantic_str) + # Handle special edge case e.g. `[COSE algorithm identifier, Base Hash value]` + if (semantics[0] == '[' and semantics[-1] == ']') or (semantics[0] == '(' and semantics[-1] == ')') : + semantic_str = semantic_str[1:-1] # Remove the brackets + # Remove content within parentheses and square brackets + semantic_str = re.sub(r'\(.*?\)', '', semantic_str) + semantic_str = re.sub(r'\[.*?\]', '', semantic_str) + # Clear any straggling ) + semantic_str = re.sub(r'\(', ' ', semantic_str) + semantic_str = re.sub(r'\)', ' ', semantic_str) + # Clear any straggling ] + semantic_str = re.sub(r'\[', ' ', semantic_str) + semantic_str = re.sub(r'\]', ' ', semantic_str) + # Clear any extra spaces around + semantic_str = semantic_str.strip() + return semantic_str.strip() + + def variable_name_abbreviator(variable_name_list_input, camel_case = False): + # Split the variable name into words and process each word + variable_name_list = variable_name_list_input.split() + variable_name_list = [word.replace('+', 'PLUS') for word in variable_name_list] + variable_name_list = [word.strip('_') for word in variable_name_list] + + processed_variable_name_list = [] + for word in variable_name_list: + processed_variable_name_list.extend(re.sub(r'\W+', ' ', word).split()) + + variable_name_list = processed_variable_name_list + + # Abbreviate most commonly recognised + very_common_word_abbreviations = { + "standard": "std", + "identifier": "id", + "message": "msg", + "configuration": "config", + "reference": "ref", + "referenced": "ref", + "previously": "prev", + # Add more abbreviations as needed + } + variable_name_list = [very_common_word_abbreviations.get(term.lower(), term) for term in variable_name_list] + + # Calculate the total character count + descriptive_total_character_count = sum(len(term) for term in variable_name_list) + if descriptive_total_character_count >= 40: + # Apply lossy compression if variable name exceeds reasonable length + print(f"long semantic tag description detected ({' '.join(variable_name_list)})") + # Abbreviate common words + word_abbreviations = { + "number": "num", + "complex": "cplx", + "index": "idx", + "attribute": "attr", + "maximum": "max", + "minimum": "min", + "communication": "comm", + "protocol": "proto", + "information": "info", + "authentication": "auth", + "representation": "repr", + "algorithm": "algo", + "version": "ver", + "encoding": "enc", + "arguments": "arg", + "object": "obj", + "language": "lang", + "independent": "indep", + "alternatives": "alt", + "text": "txt", + "string": "str", + "integer": "int", + "signal": "sig", + "channel": "chn", + "structure": "strct", + "structures": "strct", + "attestation": "attest", + "identify": "ident", + "geographic": "geo", + "geographical": "geo", + "coordinate": "coord", + "included": "inc", + "value": "val", + "values": "vals", + "record": "rec", + "report": "rpt", + "definition": "def", + "addressed": "addr", + "capabilities": "cap", + "additional": "add", + "operation": "op", + "operations": "op", + "level": "lvl", + "levels": "lvls", + "encode": "enc", + "encoded": "enc", + "component": "comp", + "condition": "cond", + "database": "db", + "element": "elem", + "environment": "env", + "parameter": "param", + "variable": "var", + "variables": "var", + "resource": "res", + "exception": "excpt", + "instance": "inst", + "organization": "org", + "response": "resp", + "security": "sec", + # Add more abbreviations as needed + } + variable_name_list = [word_abbreviations.get(term.lower(), term) for term in variable_name_list] + # Remove common words that don't contribute to the name + common_words = ["algorithm", "and", "to", "a", "from", "the", "bare"] + variable_name_list = [term for term in variable_name_list if term.lower() not in common_words] + print(f"shrunken to ({' '.join(variable_name_list)})") + + # Tiny Cbor Style Pascal Case Output + if camel_case: + capitalized_variable_name_list = [word.capitalize() for word in variable_name_list] + pascal_case_str = ''.join(capitalized_variable_name_list) + return pascal_case_str + + # Default Macro Name Output as Screaming Snake Case + screaming_snake_case_str = "_".join(variable_name_list).upper() + return screaming_snake_case_str + + # Remove unnecessary '[' and '(' (if not at the beginning) + semantics = clean_semantics(semantics) + + # Remove descriptions after ':' (if present) + semantics = semantics.split(':', 1)[0].strip() + + # Remove descriptions after ';' (if present) + semantics = semantics.split(';', 1)[0].strip() + + # Clear any _ to space + semantics = re.sub(r'\_', ' ', semantics) + + # Clear any - to space + semantics = re.sub(r'\-', ' ', semantics) + + enum_name = "" + if tiny_cbor_style_override: + # Combine tag value and descriptive terms to form the enum name + if typedef_enum_name.endswith("Tags"): + enum_name += typedef_enum_name[:-3] + else: + enum_name += typedef_enum_name + enum_name += variable_name_abbreviator(semantics, camel_case=True) + if typedef_enum_name.endswith("Tags"): + enum_name += "Tag" + else: + # Combine tag value and descriptive terms to form the enum name + enum_name += f"{typedef_enum_name.upper()}_{tag_value}" + descriptive_terms = variable_name_abbreviator(semantics) + if descriptive_terms: + enum_name += "_" + descriptive_terms + + # Cleanup + # Replace multiple underscores with a single underscore + enum_name = re.sub(r'_{2,}', '_', enum_name) + enum_name = enum_name.strip('_') + enum_name = enum_name.upper() + + return enum_name + + +def iana_cbor_tag_parse_csv(csv_content: str, typedef_enum_name: str): + """ + Parse and process IANA registration into enums + """ + csv_lines = csv_content.strip().split('\n') + csv_reader = csv.DictReader(csv_lines) + c_enum_list = {} + for row in csv_reader: + cbor_tag = row["Tag"] + data_item = row["Data Item"] + semantics = row["Semantics"] + reference = row["Reference"] + template = row["Template"] + if cbor_tag.lower() == "tag": # Skip first header + continue + if not cbor_tag or "unassigned" in data_item.lower() or "reserved" in semantics.lower(): + continue + if "-" in cbor_tag: # is a range of value + continue + # Add to enum list + enum_name = iana_cbor_tag_c_enum_name_generate(cbor_tag, semantics, typedef_enum_name) + comment = '; '.join(filter(None, [semantics, f'Ref: {reference}'])) + c_enum_list[int(cbor_tag)] = {"enum_name": enum_name, "comment": comment} + return c_enum_list + +def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: + typedef_enum_name = iana_cbor_tag_settings["name"] + source_name = iana_cbor_tag_settings["title"] + source_url = iana_cbor_tag_settings["source_url"] + csv_file_url = iana_cbor_tag_settings["csv_url"] + cache_file_path = iana_cache_dir_path + os.path.basename(csv_file_url) + + # Generate typedef name + c_typedef_name = f"{typedef_enum_name}_t" + + if tiny_cbor_style_override: + c_typedef_name = f"{typedef_enum_name}" + + c_enum_name = c_typedef_name + + # Generate head comment + c_head_comment = spacing_string + f"/* Autogenerated {source_name} (Source: {source_url}) */\n" + + # Load latest IANA registrations + csv_content = read_or_download_csv(csv_file_url, cache_file_path) + + # Parse and process IANA registration into enums + c_enum_list = iana_cbor_tag_parse_csv(csv_content, typedef_enum_name) + + # Generate enumeration header content + c_range_marker = [ + {"start":0, "end":23, "description":"Standards Action"}, + {"start":24, "end":32767, "description":"Specification Required"}, + {"start":32768, "end":18446744073709551615, "description":"First Come First Served"} + ] + header_file_content = update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker) + + # Generate constants for cbor tag feature flag + # Note: Not convinced this is a good idea, so is restricted to tiny cbor compatibility mode + if tiny_cbor_style_override: + c_macro_list = {} + for id_value, row in c_enum_list.items(): + c_macro_list[row["enum_name"]] = {"value": row["enum_name"]} + header_file_content = update_c_const_macro(header_file_content, "cbor known tag feature flag", "/* #define the constants so we can check with #ifdef */\n", c_macro_list) + + return header_file_content + + +############################################################################### +# Create Header + +def iana_cbor_c_header_update(header_filepath: str): + # If file doesn't exist yet then write a new file + os.makedirs(os.path.dirname(header_filepath), exist_ok=True) + if not os.path.exists(header_filepath): + with open(header_filepath, 'w+') as file: + file.write(default_cbor_header_c) + + # Get latest header content + with open(header_filepath, 'r') as file: + header_file_content = file.read() + + # Resync All Values + header_file_content = iana_cbor_simple_values_c_typedef_enum_update(header_file_content) + header_file_content = iana_cbor_tag_c_typedef_enum_update(header_file_content) + + # Write new header content + with open(header_filepath, 'w') as file: + file.write(header_file_content) + + # Indicate header has been synced + print(f"C header file '{header_filepath}' updated successfully.") + +def main(): + iana_cbor_c_header_update(iana_cbor_c_header_file_path) + +if __name__ == "__main__": + main() diff --git a/tools/iana/iana-cbor-sources.json b/tools/iana/iana-cbor-sources.json new file mode 100644 index 00000000..9df13638 --- /dev/null +++ b/tools/iana/iana-cbor-sources.json @@ -0,0 +1,12 @@ +{ + "iana_cbor_simple_value_settings": { + "title": "IANA CBOR Content-Formats", + "csv_url": "https://www.iana.org/assignments/cbor-simple-values/simple.csv", + "source_url": "https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple" + }, + "iana_cbor_tag_settings": { + "title": "IANA CBOR Tags", + "csv_url": "https://www.iana.org/assignments/cbor-tags/tags.csv", + "source_url": "https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags" + } +} From cb280b53a0526916014db486f5d4abd8441aefe9 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 1 Oct 2023 18:24:48 +1100 Subject: [PATCH 2/7] fix name rendering --- src/cbor.h | 500 +++++++++++++++---------------- tools/iana/iana-cbor-c-header.py | 3 +- 2 files changed, 252 insertions(+), 251 deletions(-) diff --git a/src/cbor.h b/src/cbor.h index 5aad05c4..e9f94812 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -141,7 +141,7 @@ typedef enum CborKnownTags { // COSE Single Signer Data Object; Ref: [RFC9052] CborCOSE_Sign1Tag = 18, // COSE standalone V2 countersignature; Ref: [RFC9338] - CborKnownTCoseStandaloneV2CountersignatureTag = 19, + CborKnownCoseStandaloneV2CountersignatureTag = 19, // Expected conversion to base64url encoding; see Section 3.4.5.2; Ref: [RFC8949] CborExpectedBase64urlTag = 21, // Expected conversion to base64 encoding; see Section 3.4.5.2; Ref: [RFC8949] @@ -153,19 +153,19 @@ typedef enum CborKnownTags { // Encoded CBOR data item; see Section 3.4.5.1; Ref: [RFC8949] CborEncodedCborTag = 24, // reference the nth previously seen string; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] - CborKnownTRefTheNthPrevSeenStringTag = 25, + CborKnownRefTheNthPrevSeenStringTag = 25, // Serialised Perl object with classname and constructor arguments; Ref: [http://cbor.schmorp.de/perl-object][Marc_A._Lehmann] - CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag = 26, + CborKnownSerialisedPerlObjWithClassnameConstructorArgTag = 26, // Serialised language-independent object with type name and constructor arguments; Ref: [http://cbor.schmorp.de/generic-object][Marc_A._Lehmann] - CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag = 27, + CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag = 27, // mark value as (potentially) shared; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] - CborKnownTMarkValueAsSharedTag = 28, + CborKnownMarkValueAsSharedTag = 28, // reference nth marked value; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] - CborKnownTRefNthMarkedValueTag = 29, + CborKnownRefNthMarkedValueTag = 29, // Rational number; Ref: [http://peteroupc.github.io/CBOR/rational.html][Peter_Occil] - CborKnownTRationalNumberTag = 30, + CborKnownRationalNumberTag = 30, // Absent value in a CBOR Array; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-absent-tag.rst][Sami_Vaarala] - CborKnownTAbsentValueInACborArrayTag = 31, + CborKnownAbsentValueInACborArrayTag = 31, // URI; see Section 3.4.5.3; Ref: [RFC8949] CborUrlTag = 32, // base64url; see Section 3.4.5.3; Ref: [RFC8949] @@ -177,81 +177,81 @@ typedef enum CborKnownTags { // MIME message; see Section 3.4.5.3; Ref: [RFC8949] CborMimeMessageTag = 36, // Binary UUID ([RFC4122, Section 4.1.2]); Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md][Lucas_Clemente] - CborKnownTBinaryUuidTag = 37, + CborKnownBinaryUuidTag = 37, // Language-tagged string; Ref: [RFC9290, Appendix A] - CborKnownTLanguageTaggedStringTag = 38, + CborKnownLanguageTaggedStringTag = 38, // Identifier; Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/id.md][Lucas_Clemente] - CborKnownTIdTag = 39, + CborKnownIdTag = 39, // Multi-dimensional Array, row-major order; Ref: [RFC8746] - CborKnownTMultiDimensionalArrayRowMajorOrderTag = 40, + CborKnownMultiDimensionalArrayRowMajorOrderTag = 40, // Homogeneous Array; Ref: [RFC8746] - CborKnownTHomogeneousArrayTag = 41, + CborKnownHomogeneousArrayTag = 41, // IPLD content identifier; Ref: [https://github.com/ipld/cid-cbor/][Volker_Mische] - CborKnownTIpldContentIdTag = 42, + CborKnownIpldContentIdTag = 42, // YANG bits datatype; see Section 6.7.; Ref: [RFC9254] - CborKnownTYangBitsDatatypeTag = 43, + CborKnownYangBitsDatatypeTag = 43, // YANG enumeration datatype; see Section 6.6.; Ref: [RFC9254] - CborKnownTYangEnumerationDatatypeTag = 44, + CborKnownYangEnumerationDatatypeTag = 44, // YANG identityref datatype; see Section 6.10.; Ref: [RFC9254] - CborKnownTYangIdentityrefDatatypeTag = 45, + CborKnownYangIdentityrefDatatypeTag = 45, // YANG instance-identifier datatype; see Section 6.13.; Ref: [RFC9254] - CborKnownTYangInstanceIdDatatypeTag = 46, + CborKnownYangInstanceIdDatatypeTag = 46, // YANG Schema Item iDentifier (sid); see Section 3.2.; Ref: [RFC9254] - CborKnownTYangSchemaItemIdTag = 47, + CborKnownYangSchemaItemIdTag = 47, // IPv4, [prefixlen,IPv4], [IPv4,prefixpart]; Ref: [RFC9164] - CborKnownTIpv4Tag = 52, + CborKnownIpv4Tag = 52, // IPv6, [prefixlen,IPv6], [IPv6,prefixpart]; Ref: [RFC9164] - CborKnownTIpv6Tag = 54, + CborKnownIpv6Tag = 54, // CBOR Web Token (CWT); Ref: [RFC8392][Michael_B._Jones] - CborKnownTCborWebTokenTag = 61, + CborKnownCborWebTokenTag = 61, // Encoded CBOR Sequence [RFC8742]; Ref: [draft-bormann-cbor-notable-tags-02, Section 2.1] - CborKnownTEncodedCborSequenceTag = 63, + CborKnownEncodedCborSequenceTag = 63, // uint8 Typed Array; Ref: [RFC8746] - CborKnownTUint8TypedArrayTag = 64, + CborKnownUint8TypedArrayTag = 64, // uint16, big endian, Typed Array; Ref: [RFC8746] - CborKnownTUint16BigEndianTypedArrayTag = 65, + CborKnownUint16BigEndianTypedArrayTag = 65, // uint32, big endian, Typed Array; Ref: [RFC8746] - CborKnownTUint32BigEndianTypedArrayTag = 66, + CborKnownUint32BigEndianTypedArrayTag = 66, // uint64, big endian, Typed Array; Ref: [RFC8746] - CborKnownTUint64BigEndianTypedArrayTag = 67, + CborKnownUint64BigEndianTypedArrayTag = 67, // uint8 Typed Array, clamped arithmetic; Ref: [RFC8746] - CborKnownTUint8TypedArrayClampedArithmeticTag = 68, + CborKnownUint8TypedArrayClampedArithmeticTag = 68, // uint16, little endian, Typed Array; Ref: [RFC8746] - CborKnownTUint16LittleEndianTypedArrayTag = 69, + CborKnownUint16LittleEndianTypedArrayTag = 69, // uint32, little endian, Typed Array; Ref: [RFC8746] - CborKnownTUint32LittleEndianTypedArrayTag = 70, + CborKnownUint32LittleEndianTypedArrayTag = 70, // uint64, little endian, Typed Array; Ref: [RFC8746] - CborKnownTUint64LittleEndianTypedArrayTag = 71, + CborKnownUint64LittleEndianTypedArrayTag = 71, // sint8 Typed Array; Ref: [RFC8746] - CborKnownTSint8TypedArrayTag = 72, + CborKnownSint8TypedArrayTag = 72, // sint16, big endian, Typed Array; Ref: [RFC8746] - CborKnownTSint16BigEndianTypedArrayTag = 73, + CborKnownSint16BigEndianTypedArrayTag = 73, // sint32, big endian, Typed Array; Ref: [RFC8746] - CborKnownTSint32BigEndianTypedArrayTag = 74, + CborKnownSint32BigEndianTypedArrayTag = 74, // sint64, big endian, Typed Array; Ref: [RFC8746] - CborKnownTSint64BigEndianTypedArrayTag = 75, + CborKnownSint64BigEndianTypedArrayTag = 75, // sint16, little endian, Typed Array; Ref: [RFC8746] - CborKnownTSint16LittleEndianTypedArrayTag = 77, + CborKnownSint16LittleEndianTypedArrayTag = 77, // sint32, little endian, Typed Array; Ref: [RFC8746] - CborKnownTSint32LittleEndianTypedArrayTag = 78, + CborKnownSint32LittleEndianTypedArrayTag = 78, // sint64, little endian, Typed Array; Ref: [RFC8746] - CborKnownTSint64LittleEndianTypedArrayTag = 79, + CborKnownSint64LittleEndianTypedArrayTag = 79, // IEEE 754 binary16, big endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary16BigEndianTypedArrayTag = 80, + CborKnownIeee754Binary16BigEndianTypedArrayTag = 80, // IEEE 754 binary32, big endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary32BigEndianTypedArrayTag = 81, + CborKnownIeee754Binary32BigEndianTypedArrayTag = 81, // IEEE 754 binary64, big endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary64BigEndianTypedArrayTag = 82, + CborKnownIeee754Binary64BigEndianTypedArrayTag = 82, // IEEE 754 binary128, big endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary128BigEndianTypedArrayTag = 83, + CborKnownIeee754Binary128BigEndianTypedArrayTag = 83, // IEEE 754 binary16, little endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary16LittleEndianTypedArrayTag = 84, + CborKnownIeee754Binary16LittleEndianTypedArrayTag = 84, // IEEE 754 binary32, little endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary32LittleEndianTypedArrayTag = 85, + CborKnownIeee754Binary32LittleEndianTypedArrayTag = 85, // IEEE 754 binary64, little endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary64LittleEndianTypedArrayTag = 86, + CborKnownIeee754Binary64LittleEndianTypedArrayTag = 86, // IEEE 754 binary128, little endian, Typed Array; Ref: [RFC8746] - CborKnownTIeee754Binary128LittleEndianTypedArrayTag = 87, + CborKnownIeee754Binary128LittleEndianTypedArrayTag = 87, // COSE Encrypted Data Object; Ref: [RFC9052] CborCOSE_EncryptTag = 96, // COSE MACed Data Object; Ref: [RFC9052] @@ -259,169 +259,169 @@ typedef enum CborKnownTags { // COSE Signed Data Object; Ref: [RFC9052] CborCOSE_SignTag = 98, // Number of days since the epoch date 1970-01-01; Ref: [RFC8943] - CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag = 100, + CborKnownNumberOfDaysSinceTheEpochDate19700101Tag = 100, // alternatives as given by the uint + 128; see Section 9.1; Ref: [draft-bormann-cbor-notable-tags-07] - CborKnownTAlternativesAsGivenByTheUintPlus128Tag = 101, + CborKnownAlternativesAsGivenByTheUintPlus128Tag = 101, // Geographic Coordinates; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag103-Geographic-Coordinates.md][Danilo_Vidovic] - CborKnownTGeographicCoordinatesTag = 103, + CborKnownGeographicCoordinatesTag = 103, // Geographic Coordinate Reference System WKT or EPSG number; Ref: [draft-clarke-cbor-crs] - CborKnownTGeoCoordRefSystemWktOrEpsgNumTag = 104, + CborKnownGeoCoordRefSystemWktOrEpsgNumTag = 104, // relative object identifier (BER encoding); SDNV [RFC6256] sequence; Ref: [RFC9090] - CborKnownTRelativeObjectIdTag = 110, + CborKnownRelativeObjectIdTag = 110, // object identifier (BER encoding); Ref: [RFC9090] - CborKnownTObjectIdTag = 111, + CborKnownObjectIdTag = 111, // object identifier (BER encoding), relative to 1.3.6.1.4.1; Ref: [RFC9090] - CborKnownTObjectIdRelativeTo136141Tag = 112, + CborKnownObjectIdRelativeTo136141Tag = 112, // Internet of Things Data Point; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag120-Internet-of-Things-Data-Points.md][Danilo_Vidovic] - CborKnownTInternetOfThingsDataPointTag = 120, + CborKnownInternetOfThingsDataPointTag = 120, // Gordian Envelope; Ref: [draft-mcnally-envelope-05] - CborKnownTGordianEnvelopeTag = 200, + CborKnownGordianEnvelopeTag = 200, // mark value as having string references; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] - CborKnownTMarkValueAsHavingStringReferencesTag = 256, + CborKnownMarkValueAsHavingStringReferencesTag = 256, // Binary MIME message; Ref: [http://peteroupc.github.io/CBOR/binarymime.html][Peter_Occil] - CborKnownTBinaryMimeMsgTag = 257, + CborKnownBinaryMimeMsgTag = 257, // Mathematical finite set; Ref: [https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md][Alfredo_Di_Napoli] - CborKnownTMathematicalFiniteSetTag = 258, + CborKnownMathematicalFiniteSetTag = 258, // Map datatype with key-value operations (e.g. `.get()/.set()/.delete()`); Ref: [https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec--explicit-maps.md][Shane_Holloway] - CborKnownTMapDatatypeWithKeyValOpSetDeleteTag = 259, + CborKnownMapDatatypeWithKeyValOpSetDeleteTag = 259, // Network Address (IPv4 or IPv6 or MAC Address) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [http://www.employees.org/~ravir/cbor-network.txt][Ravi_Raju][RFC9164] - CborKnownTNetworkAddressTag = 260, + CborKnownNetworkAddressTag = 260, // Network Address Prefix (IPv4 or IPv6 Address + Mask Length) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/networkPrefix.md][Ravi_Raju][RFC9164] - CborKnownTNetworkAddressPrefixTag = 261, + CborKnownNetworkAddressPrefixTag = 261, // Embedded JSON Object; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/embeddedJSON.md][Ravi_Raju] - CborKnownTEmbeddedJsonObjectTag = 262, + CborKnownEmbeddedJsonObjectTag = 262, // Hexadecimal string; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/hexString.md][Ravi_Raju] - CborKnownTHexadecimalStringTag = 263, + CborKnownHexadecimalStringTag = 263, // Decimal fraction with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] - CborKnownTDecimalFractionWithArbitraryExponentTag = 264, + CborKnownDecimalFractionWithArbitraryExponentTag = 264, // Bigfloat with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] - CborKnownTBigfloatWithArbitraryExponentTag = 265, + CborKnownBigfloatWithArbitraryExponentTag = 265, // Internationalized resource identifier (IRI); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] - CborKnownTInternationalizedResourceIdTag = 266, + CborKnownInternationalizedResourceIdTag = 266, // Internationalized resource identifier reference (IRI reference); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] - CborKnownTInternationalizedResourceIdRefTag = 267, + CborKnownInternationalizedResourceIdRefTag = 267, // Extended decimal fraction; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownTExtendedDecimalFractionTag = 268, + CborKnownExtendedDecimalFractionTag = 268, // Extended bigfloat; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownTExtendedBigfloatTag = 269, + CborKnownExtendedBigfloatTag = 269, // Extended rational number; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownTExtendedRationalNumberTag = 270, + CborKnownExtendedRationalNumberTag = 270, // DDoS Open Threat Signaling (DOTS) signal channel object, as defined in [RFC9132]; Ref: [RFC9132] - CborKnownTDdosOpenThreatSignalingSigChnObjTag = 271, + CborKnownDdosOpenThreatSignalingSigChnObjTag = 271, // Non-UTF-8 CESU-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownTNonUtf8Cesu8StringTag = 272, + CborKnownNonUtf8Cesu8StringTag = 272, // Non-UTF-8 WTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownTNonUtf8Wtf8StringTag = 273, + CborKnownNonUtf8Wtf8StringTag = 273, // Non-UTF-8 MUTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownTNonUtf8Mutf8StringTag = 274, + CborKnownNonUtf8Mutf8StringTag = 274, // Map contains only keys that are of type Text String (major type 3); Ref: [https://github.com/ecorm/cbor-tag-text-key-map][Emile_Cormier] - CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag = 275, + CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag = 275, // ERIS binary read capability; Ref: [http://purl.org/eris] - CborKnownTErisBinaryReadCapabilityTag = 276, + CborKnownErisBinaryReadCapabilityTag = 276, // Universal Geographical Area Description (GAD) shape; see Section 5; Ref: [TS 23.032][Mathew_Meins] - CborKnownTUniversalGeoAreaDescriptionShapeTag = 277, + CborKnownUniversalGeoAreaDescriptionShapeTag = 277, // Universal Geographical Area Description (GAD) description of velocity; see Section 8; Ref: [TS 23.032][Mathew_Meins] - CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag = 278, + CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag = 278, // extended time; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownTExtendedTimeTag = 1001, + CborKnownExtendedTimeTag = 1001, // duration; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownTDurationTag = 1002, + CborKnownDurationTag = 1002, // period; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownTPeriodTag = 1003, + CborKnownPeriodTag = 1003, // [RFC3339] full-date string; Ref: [RFC8943] - CborKnownTFullDateStringTag = 1004, + CborKnownFullDateStringTag = 1004, // Object type identifier; Ref: [draft-rundgren-cotx-04] - CborKnownTObjectTypeIdTag = 1010, + CborKnownObjectTypeIdTag = 1010, // Multi-dimensional Array, column-major order; Ref: [RFC8746] - CborKnownTMultiDimensionalArrayColumnMajorOrderTag = 1040, + CborKnownMultiDimensionalArrayColumnMajorOrderTag = 1040, // [COSE algorithm identifier, Base Hash value]; Ref: [draft-bormann-cbor-notable-tags-09, Section 3.1.1] - CborKnownTCoseAlgorithmIdBaseHashValueTag = 18556, + CborKnownCoseAlgorithmIdBaseHashValueTag = 18556, // I-Regexp; Ref: [draft-bormann-cbor-notable-tags-09, Section 2.1][draft-ietf-jsonpath-iregexp-08] - CborKnownTIRegexpTag = 21065, + CborKnownIRegexpTag = 21065, // ECMAScript RegExp [https://262.ecma-international.org/14.0/#sec-regexp-regular-expression-objects]; Ref: [https://github.com/hildjj/cbor-specs/blob/main/regexp.md][Joe_Hildebrand] - CborKnownTEcmascriptRegexpTag = 21066, + CborKnownEcmascriptRegexpTag = 21066, // hint that indicates an additional level of indirection; Ref: [http://cbor.schmorp.de/indirection][Marc_A._Lehmann] - CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag = 22098, + CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag = 22098, // Capture [3]; Ref: [https://github.com/japhb/cbor-specs/blob/main/capture.md][Geoffrey_Broadwell] - CborKnownTCaptureTag = 25441, + CborKnownCaptureTag = 25441, /* 32768-18446744073709551615 : First Come First Served */ // Identifier for a FHIR constant; Ref: [Stefan_Genchev] - CborKnownTIdForAFhirConstantTag = 32768, + CborKnownIdForAFhirConstantTag = 32768, // External reference; Ref: [https://gitlab.com/Hawk777/cbor-specs/-/blob/main/external-reference.md][Christopher_Head] - CborKnownTExternalRefTag = 32769, + CborKnownExternalRefTag = 32769, // A confidentiality clearance. The key value pairs of the map are defined in ADatP-4774.4; Ref: [Aidan_Murdock] - CborKnownTAConfidentialityClearanceTag = 42600, + CborKnownAConfidentialityClearanceTag = 42600, // A metadata binding. The elements of the array are defined in AdatP-4778.5. The tag is also used as part of the magic number in on-disk detached and encapsulating bindings.; Ref: [Aidan_Murdock] - CborKnownTAMetadataBindingTag = 42601, + CborKnownAMetadataBindingTag = 42601, // A collection of NCMS metadata elements. The key value pairs of the map are defined in AdatP-5636.4; Ref: [Aidan_Murdock] - CborKnownTACollectionOfNcmsMetadataElementsTag = 42602, + CborKnownACollectionOfNcmsMetadataElementsTag = 42602, // Single complex number: array elements are real (I) and imaginary (Q) components; Ref: [Saajan_Chana] - CborKnownTSingleComplexNumberTag = 43000, + CborKnownSingleComplexNumberTag = 43000, // Array of complex numbers in interleaved form: complex value k is stored with real (I) part at array index 2k and imaginary (Q) part at index (2k + 1); Ref: [Saajan_Chana] - CborKnownTArrayOfComplexNumbersInInterleavedFormTag = 43001, + CborKnownArrayOfComplexNumbersInInterleavedFormTag = 43001, // PlatformV_IS_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvIsIdTag = 50000, + CborKnownPlatformvIsIdTag = 50000, // PlatformV_IS_NAME; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvIsNameTag = 50001, + CborKnownPlatformvIsNameTag = 50001, // PlatformV_IS_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvIsValueTag = 50002, + CborKnownPlatformvIsValueTag = 50002, // PlatformV_HAS_COMPOSITE_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasCompositeValueTag = 50003, + CborKnownPlatformvHasCompositeValueTag = 50003, // PlatformV_HAS_MAPPED_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasMappedValueTag = 50004, + CborKnownPlatformvHasMappedValueTag = 50004, // PlatformV_HAS_OBJ_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasObjIdTag = 50005, + CborKnownPlatformvHasObjIdTag = 50005, // PlatformV_HAS_OBJ_TAG; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasObjTagTag = 50006, + CborKnownPlatformvHasObjTagTag = 50006, // PlatformV_HAS_CHILD; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasChildTag = 50007, + CborKnownPlatformvHasChildTag = 50007, // PlatformV_HAS_PROPERTY; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasPropertyTag = 50008, + CborKnownPlatformvHasPropertyTag = 50008, // PlatformV_HAS_META; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasMetaTag = 50009, + CborKnownPlatformvHasMetaTag = 50009, // PlatformV_HAS_EVENT; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasEventTag = 50010, + CborKnownPlatformvHasEventTag = 50010, // PlatformV_HAS_ACTION; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvHasActionTag = 50011, + CborKnownPlatformvHasActionTag = 50011, // PlatformV_IS_TYPE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownTPlatformvIsTypeTag = 50012, + CborKnownPlatformvIsTypeTag = 50012, // Self-described CBOR; see Section 3.4.6; Ref: [RFC8949] CborSignatureTag = 55799, // indicates that the file contains CBOR Sequences; Ref: [RFC9277] - CborKnownTIndicatesThatFileContainsCborSequencesTag = 55800, + CborKnownIndicatesThatFileContainsCborSequencesTag = 55800, // indicates that the file starts with a CBOR-Labeled Non-CBOR Data label.; Ref: [RFC9277] - CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag = 55801, + CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag = 55801, // Compressed byte string; Ref: [https://github.com/dectris/documentation/blob/main/cbor/dectris-compression-tag.md][Kal_Conley] - CborKnownTCompressedByteStringTag = 56500, + CborKnownCompressedByteStringTag = 56500, // Identify and define a set of record structures (each a sequence of property names) that can be referenced as tags in the included value (and the scope for the record tag definitions); Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] - CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag = 57342, + CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag = 57342, // Identify and define a record structure (a sequence of property names), and use that record structure definition to interpret the included values.; Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] - CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag = 57343, + CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag = 57343, // The tagged CBOR array contains attestation evidence data with an Intel TEE quote.; Ref: [Shanwei_Cen] - CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag = 60000, + CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag = 60000, // The tagged CBOR array contains attestation evidence data with an Intel TEE report.; Ref: [Shanwei_Cen] - CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, + CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, // The tagged CBOR array contains attestation evidence data with an Intel SGX report.; Ref: [Shanwei_Cen] - CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, + CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownTAlwaysInvalidTag = 65535, + CborKnownAlwaysInvalidTag = 65535, // RAINS Message; Ref: [https://britram.github.io/rains-prototype][Brian_Trammell] - CborKnownTRainsMsgTag = 15309736, + CborKnownRainsMsgTag = 15309736, // A CBOR encoded Openswan configuration file, as stored on disk forunit test cases.; Ref: [Michael_Richardson][Samir_Hussain] - CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag = 1330664270, + CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag = 1330664270, // Concise Software Identifier (CoSWID); Ref: [RFC9393] - CborKnownTConciseSoftwareIdTag = 1398229316, + CborKnownConciseSoftwareIdTag = 1398229316, // Array of content-addressed blocks and ERIS read capabilities; Ref: [Endo_Renberg] - CborKnownTArrayOfContentAddrBlocksErisReadCapTag = 1701996915, + CborKnownArrayOfContentAddrBlocksErisReadCapTag = 1701996915, // ERIS-FS image header; Ref: [Endo_Renberg] - CborKnownTErisFsImageHeaderTag = 1701996916, + CborKnownErisFsImageHeaderTag = 1701996916, // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownTAlwaysInvalidTag = 4294967295, + CborKnownAlwaysInvalidTag = 4294967295, // Intel FPGA SPDM Manifest; Ref: [Andrew_Draper] - CborKnownTIntelFpgaSpdmManifestTag = 4294967296, + CborKnownIntelFpgaSpdmManifestTag = 4294967296, // always invalid; Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownTAlwaysInvalidTag = 18446744073709551615 + CborKnownAlwaysInvalidTag = 18446744073709551615 } CborKnownTags; /* Start of cbor known tag feature flag autogenerated section */ @@ -441,130 +441,130 @@ typedef enum CborKnownTags { #define CborExpectedBase16Tag CborExpectedBase16Tag #define CborExpectedBase64Tag CborExpectedBase64Tag #define CborExpectedBase64urlTag CborExpectedBase64urlTag -#define CborKnownTACollectionOfNcmsMetadataElementsTag CborKnownTACollectionOfNcmsMetadataElementsTag -#define CborKnownTAConfidentialityClearanceTag CborKnownTAConfidentialityClearanceTag -#define CborKnownTAMetadataBindingTag CborKnownTAMetadataBindingTag -#define CborKnownTAbsentValueInACborArrayTag CborKnownTAbsentValueInACborArrayTag -#define CborKnownTAlternativesAsGivenByTheUintPlus128Tag CborKnownTAlternativesAsGivenByTheUintPlus128Tag -#define CborKnownTAlwaysInvalidTag CborKnownTAlwaysInvalidTag -#define CborKnownTArrayOfComplexNumbersInInterleavedFormTag CborKnownTArrayOfComplexNumbersInInterleavedFormTag -#define CborKnownTArrayOfContentAddrBlocksErisReadCapTag CborKnownTArrayOfContentAddrBlocksErisReadCapTag -#define CborKnownTBigfloatWithArbitraryExponentTag CborKnownTBigfloatWithArbitraryExponentTag -#define CborKnownTBinaryMimeMsgTag CborKnownTBinaryMimeMsgTag -#define CborKnownTBinaryUuidTag CborKnownTBinaryUuidTag -#define CborKnownTCaptureTag CborKnownTCaptureTag -#define CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborKnownTCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag -#define CborKnownTCborWebTokenTag CborKnownTCborWebTokenTag -#define CborKnownTCompressedByteStringTag CborKnownTCompressedByteStringTag -#define CborKnownTConciseSoftwareIdTag CborKnownTConciseSoftwareIdTag -#define CborKnownTCoseAlgorithmIdBaseHashValueTag CborKnownTCoseAlgorithmIdBaseHashValueTag -#define CborKnownTCoseStandaloneV2CountersignatureTag CborKnownTCoseStandaloneV2CountersignatureTag -#define CborKnownTDdosOpenThreatSignalingSigChnObjTag CborKnownTDdosOpenThreatSignalingSigChnObjTag -#define CborKnownTDecimalFractionWithArbitraryExponentTag CborKnownTDecimalFractionWithArbitraryExponentTag -#define CborKnownTDurationTag CborKnownTDurationTag -#define CborKnownTEcmascriptRegexpTag CborKnownTEcmascriptRegexpTag -#define CborKnownTEmbeddedJsonObjectTag CborKnownTEmbeddedJsonObjectTag -#define CborKnownTEncodedCborSequenceTag CborKnownTEncodedCborSequenceTag -#define CborKnownTErisBinaryReadCapabilityTag CborKnownTErisBinaryReadCapabilityTag -#define CborKnownTErisFsImageHeaderTag CborKnownTErisFsImageHeaderTag -#define CborKnownTExtendedBigfloatTag CborKnownTExtendedBigfloatTag -#define CborKnownTExtendedDecimalFractionTag CborKnownTExtendedDecimalFractionTag -#define CborKnownTExtendedRationalNumberTag CborKnownTExtendedRationalNumberTag -#define CborKnownTExtendedTimeTag CborKnownTExtendedTimeTag -#define CborKnownTExternalRefTag CborKnownTExternalRefTag -#define CborKnownTFullDateStringTag CborKnownTFullDateStringTag -#define CborKnownTGeoCoordRefSystemWktOrEpsgNumTag CborKnownTGeoCoordRefSystemWktOrEpsgNumTag -#define CborKnownTGeographicCoordinatesTag CborKnownTGeographicCoordinatesTag -#define CborKnownTGordianEnvelopeTag CborKnownTGordianEnvelopeTag -#define CborKnownTHexadecimalStringTag CborKnownTHexadecimalStringTag -#define CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag CborKnownTHintThatIndicatesAnAddLvlOfIndirectionTag -#define CborKnownTHomogeneousArrayTag CborKnownTHomogeneousArrayTag -#define CborKnownTIRegexpTag CborKnownTIRegexpTag -#define CborKnownTIdForAFhirConstantTag CborKnownTIdForAFhirConstantTag -#define CborKnownTIdTag CborKnownTIdTag -#define CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag CborKnownTIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag -#define CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag CborKnownTIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag -#define CborKnownTIeee754Binary128BigEndianTypedArrayTag CborKnownTIeee754Binary128BigEndianTypedArrayTag -#define CborKnownTIeee754Binary128LittleEndianTypedArrayTag CborKnownTIeee754Binary128LittleEndianTypedArrayTag -#define CborKnownTIeee754Binary16BigEndianTypedArrayTag CborKnownTIeee754Binary16BigEndianTypedArrayTag -#define CborKnownTIeee754Binary16LittleEndianTypedArrayTag CborKnownTIeee754Binary16LittleEndianTypedArrayTag -#define CborKnownTIeee754Binary32BigEndianTypedArrayTag CborKnownTIeee754Binary32BigEndianTypedArrayTag -#define CborKnownTIeee754Binary32LittleEndianTypedArrayTag CborKnownTIeee754Binary32LittleEndianTypedArrayTag -#define CborKnownTIeee754Binary64BigEndianTypedArrayTag CborKnownTIeee754Binary64BigEndianTypedArrayTag -#define CborKnownTIeee754Binary64LittleEndianTypedArrayTag CborKnownTIeee754Binary64LittleEndianTypedArrayTag -#define CborKnownTIndicatesThatFileContainsCborSequencesTag CborKnownTIndicatesThatFileContainsCborSequencesTag -#define CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag CborKnownTIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag -#define CborKnownTIntelFpgaSpdmManifestTag CborKnownTIntelFpgaSpdmManifestTag -#define CborKnownTInternationalizedResourceIdRefTag CborKnownTInternationalizedResourceIdRefTag -#define CborKnownTInternationalizedResourceIdTag CborKnownTInternationalizedResourceIdTag -#define CborKnownTInternetOfThingsDataPointTag CborKnownTInternetOfThingsDataPointTag -#define CborKnownTIpldContentIdTag CborKnownTIpldContentIdTag -#define CborKnownTIpv4Tag CborKnownTIpv4Tag -#define CborKnownTIpv6Tag CborKnownTIpv6Tag -#define CborKnownTLanguageTaggedStringTag CborKnownTLanguageTaggedStringTag -#define CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag CborKnownTMapContainsOnlyKeysThatAreOfTypeTxtStrTag -#define CborKnownTMapDatatypeWithKeyValOpSetDeleteTag CborKnownTMapDatatypeWithKeyValOpSetDeleteTag -#define CborKnownTMarkValueAsHavingStringReferencesTag CborKnownTMarkValueAsHavingStringReferencesTag -#define CborKnownTMarkValueAsSharedTag CborKnownTMarkValueAsSharedTag -#define CborKnownTMathematicalFiniteSetTag CborKnownTMathematicalFiniteSetTag -#define CborKnownTMultiDimensionalArrayColumnMajorOrderTag CborKnownTMultiDimensionalArrayColumnMajorOrderTag -#define CborKnownTMultiDimensionalArrayRowMajorOrderTag CborKnownTMultiDimensionalArrayRowMajorOrderTag -#define CborKnownTNetworkAddressPrefixTag CborKnownTNetworkAddressPrefixTag -#define CborKnownTNetworkAddressTag CborKnownTNetworkAddressTag -#define CborKnownTNonUtf8Cesu8StringTag CborKnownTNonUtf8Cesu8StringTag -#define CborKnownTNonUtf8Mutf8StringTag CborKnownTNonUtf8Mutf8StringTag -#define CborKnownTNonUtf8Wtf8StringTag CborKnownTNonUtf8Wtf8StringTag -#define CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag CborKnownTNumberOfDaysSinceTheEpochDate19700101Tag -#define CborKnownTObjectIdRelativeTo136141Tag CborKnownTObjectIdRelativeTo136141Tag -#define CborKnownTObjectIdTag CborKnownTObjectIdTag -#define CborKnownTObjectTypeIdTag CborKnownTObjectTypeIdTag -#define CborKnownTPeriodTag CborKnownTPeriodTag -#define CborKnownTPlatformvHasActionTag CborKnownTPlatformvHasActionTag -#define CborKnownTPlatformvHasChildTag CborKnownTPlatformvHasChildTag -#define CborKnownTPlatformvHasCompositeValueTag CborKnownTPlatformvHasCompositeValueTag -#define CborKnownTPlatformvHasEventTag CborKnownTPlatformvHasEventTag -#define CborKnownTPlatformvHasMappedValueTag CborKnownTPlatformvHasMappedValueTag -#define CborKnownTPlatformvHasMetaTag CborKnownTPlatformvHasMetaTag -#define CborKnownTPlatformvHasObjIdTag CborKnownTPlatformvHasObjIdTag -#define CborKnownTPlatformvHasObjTagTag CborKnownTPlatformvHasObjTagTag -#define CborKnownTPlatformvHasPropertyTag CborKnownTPlatformvHasPropertyTag -#define CborKnownTPlatformvIsIdTag CborKnownTPlatformvIsIdTag -#define CborKnownTPlatformvIsNameTag CborKnownTPlatformvIsNameTag -#define CborKnownTPlatformvIsTypeTag CborKnownTPlatformvIsTypeTag -#define CborKnownTPlatformvIsValueTag CborKnownTPlatformvIsValueTag -#define CborKnownTRainsMsgTag CborKnownTRainsMsgTag -#define CborKnownTRationalNumberTag CborKnownTRationalNumberTag -#define CborKnownTRefNthMarkedValueTag CborKnownTRefNthMarkedValueTag -#define CborKnownTRefTheNthPrevSeenStringTag CborKnownTRefTheNthPrevSeenStringTag -#define CborKnownTRelativeObjectIdTag CborKnownTRelativeObjectIdTag -#define CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag CborKnownTSerialisedLangIndepObjWithTypeNameConstructorArgTag -#define CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag CborKnownTSerialisedPerlObjWithClassnameConstructorArgTag -#define CborKnownTSingleComplexNumberTag CborKnownTSingleComplexNumberTag -#define CborKnownTSint16BigEndianTypedArrayTag CborKnownTSint16BigEndianTypedArrayTag -#define CborKnownTSint16LittleEndianTypedArrayTag CborKnownTSint16LittleEndianTypedArrayTag -#define CborKnownTSint32BigEndianTypedArrayTag CborKnownTSint32BigEndianTypedArrayTag -#define CborKnownTSint32LittleEndianTypedArrayTag CborKnownTSint32LittleEndianTypedArrayTag -#define CborKnownTSint64BigEndianTypedArrayTag CborKnownTSint64BigEndianTypedArrayTag -#define CborKnownTSint64LittleEndianTypedArrayTag CborKnownTSint64LittleEndianTypedArrayTag -#define CborKnownTSint8TypedArrayTag CborKnownTSint8TypedArrayTag -#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag -#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag -#define CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborKnownTTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag -#define CborKnownTUint16BigEndianTypedArrayTag CborKnownTUint16BigEndianTypedArrayTag -#define CborKnownTUint16LittleEndianTypedArrayTag CborKnownTUint16LittleEndianTypedArrayTag -#define CborKnownTUint32BigEndianTypedArrayTag CborKnownTUint32BigEndianTypedArrayTag -#define CborKnownTUint32LittleEndianTypedArrayTag CborKnownTUint32LittleEndianTypedArrayTag -#define CborKnownTUint64BigEndianTypedArrayTag CborKnownTUint64BigEndianTypedArrayTag -#define CborKnownTUint64LittleEndianTypedArrayTag CborKnownTUint64LittleEndianTypedArrayTag -#define CborKnownTUint8TypedArrayClampedArithmeticTag CborKnownTUint8TypedArrayClampedArithmeticTag -#define CborKnownTUint8TypedArrayTag CborKnownTUint8TypedArrayTag -#define CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborKnownTUniversalGeoAreaDescriptionDescriptionOfVelocityTag -#define CborKnownTUniversalGeoAreaDescriptionShapeTag CborKnownTUniversalGeoAreaDescriptionShapeTag -#define CborKnownTYangBitsDatatypeTag CborKnownTYangBitsDatatypeTag -#define CborKnownTYangEnumerationDatatypeTag CborKnownTYangEnumerationDatatypeTag -#define CborKnownTYangIdentityrefDatatypeTag CborKnownTYangIdentityrefDatatypeTag -#define CborKnownTYangInstanceIdDatatypeTag CborKnownTYangInstanceIdDatatypeTag -#define CborKnownTYangSchemaItemIdTag CborKnownTYangSchemaItemIdTag +#define CborKnownACollectionOfNcmsMetadataElementsTag CborKnownACollectionOfNcmsMetadataElementsTag +#define CborKnownAConfidentialityClearanceTag CborKnownAConfidentialityClearanceTag +#define CborKnownAMetadataBindingTag CborKnownAMetadataBindingTag +#define CborKnownAbsentValueInACborArrayTag CborKnownAbsentValueInACborArrayTag +#define CborKnownAlternativesAsGivenByTheUintPlus128Tag CborKnownAlternativesAsGivenByTheUintPlus128Tag +#define CborKnownAlwaysInvalidTag CborKnownAlwaysInvalidTag +#define CborKnownArrayOfComplexNumbersInInterleavedFormTag CborKnownArrayOfComplexNumbersInInterleavedFormTag +#define CborKnownArrayOfContentAddrBlocksErisReadCapTag CborKnownArrayOfContentAddrBlocksErisReadCapTag +#define CborKnownBigfloatWithArbitraryExponentTag CborKnownBigfloatWithArbitraryExponentTag +#define CborKnownBinaryMimeMsgTag CborKnownBinaryMimeMsgTag +#define CborKnownBinaryUuidTag CborKnownBinaryUuidTag +#define CborKnownCaptureTag CborKnownCaptureTag +#define CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag +#define CborKnownCborWebTokenTag CborKnownCborWebTokenTag +#define CborKnownCompressedByteStringTag CborKnownCompressedByteStringTag +#define CborKnownConciseSoftwareIdTag CborKnownConciseSoftwareIdTag +#define CborKnownCoseAlgorithmIdBaseHashValueTag CborKnownCoseAlgorithmIdBaseHashValueTag +#define CborKnownCoseStandaloneV2CountersignatureTag CborKnownCoseStandaloneV2CountersignatureTag +#define CborKnownDdosOpenThreatSignalingSigChnObjTag CborKnownDdosOpenThreatSignalingSigChnObjTag +#define CborKnownDecimalFractionWithArbitraryExponentTag CborKnownDecimalFractionWithArbitraryExponentTag +#define CborKnownDurationTag CborKnownDurationTag +#define CborKnownEcmascriptRegexpTag CborKnownEcmascriptRegexpTag +#define CborKnownEmbeddedJsonObjectTag CborKnownEmbeddedJsonObjectTag +#define CborKnownEncodedCborSequenceTag CborKnownEncodedCborSequenceTag +#define CborKnownErisBinaryReadCapabilityTag CborKnownErisBinaryReadCapabilityTag +#define CborKnownErisFsImageHeaderTag CborKnownErisFsImageHeaderTag +#define CborKnownExtendedBigfloatTag CborKnownExtendedBigfloatTag +#define CborKnownExtendedDecimalFractionTag CborKnownExtendedDecimalFractionTag +#define CborKnownExtendedRationalNumberTag CborKnownExtendedRationalNumberTag +#define CborKnownExtendedTimeTag CborKnownExtendedTimeTag +#define CborKnownExternalRefTag CborKnownExternalRefTag +#define CborKnownFullDateStringTag CborKnownFullDateStringTag +#define CborKnownGeoCoordRefSystemWktOrEpsgNumTag CborKnownGeoCoordRefSystemWktOrEpsgNumTag +#define CborKnownGeographicCoordinatesTag CborKnownGeographicCoordinatesTag +#define CborKnownGordianEnvelopeTag CborKnownGordianEnvelopeTag +#define CborKnownHexadecimalStringTag CborKnownHexadecimalStringTag +#define CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag +#define CborKnownHomogeneousArrayTag CborKnownHomogeneousArrayTag +#define CborKnownIRegexpTag CborKnownIRegexpTag +#define CborKnownIdForAFhirConstantTag CborKnownIdForAFhirConstantTag +#define CborKnownIdTag CborKnownIdTag +#define CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag +#define CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag +#define CborKnownIeee754Binary128BigEndianTypedArrayTag CborKnownIeee754Binary128BigEndianTypedArrayTag +#define CborKnownIeee754Binary128LittleEndianTypedArrayTag CborKnownIeee754Binary128LittleEndianTypedArrayTag +#define CborKnownIeee754Binary16BigEndianTypedArrayTag CborKnownIeee754Binary16BigEndianTypedArrayTag +#define CborKnownIeee754Binary16LittleEndianTypedArrayTag CborKnownIeee754Binary16LittleEndianTypedArrayTag +#define CborKnownIeee754Binary32BigEndianTypedArrayTag CborKnownIeee754Binary32BigEndianTypedArrayTag +#define CborKnownIeee754Binary32LittleEndianTypedArrayTag CborKnownIeee754Binary32LittleEndianTypedArrayTag +#define CborKnownIeee754Binary64BigEndianTypedArrayTag CborKnownIeee754Binary64BigEndianTypedArrayTag +#define CborKnownIeee754Binary64LittleEndianTypedArrayTag CborKnownIeee754Binary64LittleEndianTypedArrayTag +#define CborKnownIndicatesThatFileContainsCborSequencesTag CborKnownIndicatesThatFileContainsCborSequencesTag +#define CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag +#define CborKnownIntelFpgaSpdmManifestTag CborKnownIntelFpgaSpdmManifestTag +#define CborKnownInternationalizedResourceIdRefTag CborKnownInternationalizedResourceIdRefTag +#define CborKnownInternationalizedResourceIdTag CborKnownInternationalizedResourceIdTag +#define CborKnownInternetOfThingsDataPointTag CborKnownInternetOfThingsDataPointTag +#define CborKnownIpldContentIdTag CborKnownIpldContentIdTag +#define CborKnownIpv4Tag CborKnownIpv4Tag +#define CborKnownIpv6Tag CborKnownIpv6Tag +#define CborKnownLanguageTaggedStringTag CborKnownLanguageTaggedStringTag +#define CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag +#define CborKnownMapDatatypeWithKeyValOpSetDeleteTag CborKnownMapDatatypeWithKeyValOpSetDeleteTag +#define CborKnownMarkValueAsHavingStringReferencesTag CborKnownMarkValueAsHavingStringReferencesTag +#define CborKnownMarkValueAsSharedTag CborKnownMarkValueAsSharedTag +#define CborKnownMathematicalFiniteSetTag CborKnownMathematicalFiniteSetTag +#define CborKnownMultiDimensionalArrayColumnMajorOrderTag CborKnownMultiDimensionalArrayColumnMajorOrderTag +#define CborKnownMultiDimensionalArrayRowMajorOrderTag CborKnownMultiDimensionalArrayRowMajorOrderTag +#define CborKnownNetworkAddressPrefixTag CborKnownNetworkAddressPrefixTag +#define CborKnownNetworkAddressTag CborKnownNetworkAddressTag +#define CborKnownNonUtf8Cesu8StringTag CborKnownNonUtf8Cesu8StringTag +#define CborKnownNonUtf8Mutf8StringTag CborKnownNonUtf8Mutf8StringTag +#define CborKnownNonUtf8Wtf8StringTag CborKnownNonUtf8Wtf8StringTag +#define CborKnownNumberOfDaysSinceTheEpochDate19700101Tag CborKnownNumberOfDaysSinceTheEpochDate19700101Tag +#define CborKnownObjectIdRelativeTo136141Tag CborKnownObjectIdRelativeTo136141Tag +#define CborKnownObjectIdTag CborKnownObjectIdTag +#define CborKnownObjectTypeIdTag CborKnownObjectTypeIdTag +#define CborKnownPeriodTag CborKnownPeriodTag +#define CborKnownPlatformvHasActionTag CborKnownPlatformvHasActionTag +#define CborKnownPlatformvHasChildTag CborKnownPlatformvHasChildTag +#define CborKnownPlatformvHasCompositeValueTag CborKnownPlatformvHasCompositeValueTag +#define CborKnownPlatformvHasEventTag CborKnownPlatformvHasEventTag +#define CborKnownPlatformvHasMappedValueTag CborKnownPlatformvHasMappedValueTag +#define CborKnownPlatformvHasMetaTag CborKnownPlatformvHasMetaTag +#define CborKnownPlatformvHasObjIdTag CborKnownPlatformvHasObjIdTag +#define CborKnownPlatformvHasObjTagTag CborKnownPlatformvHasObjTagTag +#define CborKnownPlatformvHasPropertyTag CborKnownPlatformvHasPropertyTag +#define CborKnownPlatformvIsIdTag CborKnownPlatformvIsIdTag +#define CborKnownPlatformvIsNameTag CborKnownPlatformvIsNameTag +#define CborKnownPlatformvIsTypeTag CborKnownPlatformvIsTypeTag +#define CborKnownPlatformvIsValueTag CborKnownPlatformvIsValueTag +#define CborKnownRainsMsgTag CborKnownRainsMsgTag +#define CborKnownRationalNumberTag CborKnownRationalNumberTag +#define CborKnownRefNthMarkedValueTag CborKnownRefNthMarkedValueTag +#define CborKnownRefTheNthPrevSeenStringTag CborKnownRefTheNthPrevSeenStringTag +#define CborKnownRelativeObjectIdTag CborKnownRelativeObjectIdTag +#define CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag +#define CborKnownSerialisedPerlObjWithClassnameConstructorArgTag CborKnownSerialisedPerlObjWithClassnameConstructorArgTag +#define CborKnownSingleComplexNumberTag CborKnownSingleComplexNumberTag +#define CborKnownSint16BigEndianTypedArrayTag CborKnownSint16BigEndianTypedArrayTag +#define CborKnownSint16LittleEndianTypedArrayTag CborKnownSint16LittleEndianTypedArrayTag +#define CborKnownSint32BigEndianTypedArrayTag CborKnownSint32BigEndianTypedArrayTag +#define CborKnownSint32LittleEndianTypedArrayTag CborKnownSint32LittleEndianTypedArrayTag +#define CborKnownSint64BigEndianTypedArrayTag CborKnownSint64BigEndianTypedArrayTag +#define CborKnownSint64LittleEndianTypedArrayTag CborKnownSint64LittleEndianTypedArrayTag +#define CborKnownSint8TypedArrayTag CborKnownSint8TypedArrayTag +#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag +#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag +#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag +#define CborKnownUint16BigEndianTypedArrayTag CborKnownUint16BigEndianTypedArrayTag +#define CborKnownUint16LittleEndianTypedArrayTag CborKnownUint16LittleEndianTypedArrayTag +#define CborKnownUint32BigEndianTypedArrayTag CborKnownUint32BigEndianTypedArrayTag +#define CborKnownUint32LittleEndianTypedArrayTag CborKnownUint32LittleEndianTypedArrayTag +#define CborKnownUint64BigEndianTypedArrayTag CborKnownUint64BigEndianTypedArrayTag +#define CborKnownUint64LittleEndianTypedArrayTag CborKnownUint64LittleEndianTypedArrayTag +#define CborKnownUint8TypedArrayClampedArithmeticTag CborKnownUint8TypedArrayClampedArithmeticTag +#define CborKnownUint8TypedArrayTag CborKnownUint8TypedArrayTag +#define CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag +#define CborKnownUniversalGeoAreaDescriptionShapeTag CborKnownUniversalGeoAreaDescriptionShapeTag +#define CborKnownYangBitsDatatypeTag CborKnownYangBitsDatatypeTag +#define CborKnownYangEnumerationDatatypeTag CborKnownYangEnumerationDatatypeTag +#define CborKnownYangIdentityrefDatatypeTag CborKnownYangIdentityrefDatatypeTag +#define CborKnownYangInstanceIdDatatypeTag CborKnownYangInstanceIdDatatypeTag +#define CborKnownYangSchemaItemIdTag CborKnownYangSchemaItemIdTag #define CborMimeMessageTag CborMimeMessageTag #define CborNegativeBignumTag CborNegativeBignumTag #define CborPositiveBignumTag CborPositiveBignumTag diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/iana-cbor-c-header.py index 7f13492c..db531d12 100755 --- a/tools/iana/iana-cbor-c-header.py +++ b/tools/iana/iana-cbor-c-header.py @@ -513,9 +513,10 @@ def variable_name_abbreviator(variable_name_list_input, camel_case = False): if tiny_cbor_style_override: # Combine tag value and descriptive terms to form the enum name if typedef_enum_name.endswith("Tags"): - enum_name += typedef_enum_name[:-3] + enum_name += typedef_enum_name[:-4] else: enum_name += typedef_enum_name + print(enum_name) enum_name += variable_name_abbreviator(semantics, camel_case=True) if typedef_enum_name.endswith("Tags"): enum_name += "Tag" From 585acd7d28285c276b7918f21bb3ba5480641ab4 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 1 Oct 2023 18:26:59 +1100 Subject: [PATCH 3/7] clean up print() --- tools/iana/iana-cbor-c-header.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/iana-cbor-c-header.py index db531d12..5965209b 100755 --- a/tools/iana/iana-cbor-c-header.py +++ b/tools/iana/iana-cbor-c-header.py @@ -516,7 +516,6 @@ def variable_name_abbreviator(variable_name_list_input, camel_case = False): enum_name += typedef_enum_name[:-4] else: enum_name += typedef_enum_name - print(enum_name) enum_name += variable_name_abbreviator(semantics, camel_case=True) if typedef_enum_name.endswith("Tags"): enum_name += "Tag" From aa810ba5fec15e455bee288ff1d81f3568f544ee Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 1 Oct 2023 18:30:51 +1100 Subject: [PATCH 4/7] adjust to match closer to tinycbor style --- src/cbor.h | 500 +++++++++++++++---------------- tools/iana/iana-cbor-c-header.py | 6 +- 2 files changed, 253 insertions(+), 253 deletions(-) diff --git a/src/cbor.h b/src/cbor.h index e9f94812..5f02a8bd 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -141,7 +141,7 @@ typedef enum CborKnownTags { // COSE Single Signer Data Object; Ref: [RFC9052] CborCOSE_Sign1Tag = 18, // COSE standalone V2 countersignature; Ref: [RFC9338] - CborKnownCoseStandaloneV2CountersignatureTag = 19, + CborCoseStandaloneV2CountersignatureTag = 19, // Expected conversion to base64url encoding; see Section 3.4.5.2; Ref: [RFC8949] CborExpectedBase64urlTag = 21, // Expected conversion to base64 encoding; see Section 3.4.5.2; Ref: [RFC8949] @@ -153,19 +153,19 @@ typedef enum CborKnownTags { // Encoded CBOR data item; see Section 3.4.5.1; Ref: [RFC8949] CborEncodedCborTag = 24, // reference the nth previously seen string; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] - CborKnownRefTheNthPrevSeenStringTag = 25, + CborRefTheNthPrevSeenStringTag = 25, // Serialised Perl object with classname and constructor arguments; Ref: [http://cbor.schmorp.de/perl-object][Marc_A._Lehmann] - CborKnownSerialisedPerlObjWithClassnameConstructorArgTag = 26, + CborSerialisedPerlObjWithClassnameConstructorArgTag = 26, // Serialised language-independent object with type name and constructor arguments; Ref: [http://cbor.schmorp.de/generic-object][Marc_A._Lehmann] - CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag = 27, + CborSerialisedLangIndepObjWithTypeNameConstructorArgTag = 27, // mark value as (potentially) shared; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] - CborKnownMarkValueAsSharedTag = 28, + CborMarkValueAsSharedTag = 28, // reference nth marked value; Ref: [http://cbor.schmorp.de/value-sharing][Marc_A._Lehmann] - CborKnownRefNthMarkedValueTag = 29, + CborRefNthMarkedValueTag = 29, // Rational number; Ref: [http://peteroupc.github.io/CBOR/rational.html][Peter_Occil] - CborKnownRationalNumberTag = 30, + CborRationalNumberTag = 30, // Absent value in a CBOR Array; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-absent-tag.rst][Sami_Vaarala] - CborKnownAbsentValueInACborArrayTag = 31, + CborAbsentValueInACborArrayTag = 31, // URI; see Section 3.4.5.3; Ref: [RFC8949] CborUrlTag = 32, // base64url; see Section 3.4.5.3; Ref: [RFC8949] @@ -177,81 +177,81 @@ typedef enum CborKnownTags { // MIME message; see Section 3.4.5.3; Ref: [RFC8949] CborMimeMessageTag = 36, // Binary UUID ([RFC4122, Section 4.1.2]); Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md][Lucas_Clemente] - CborKnownBinaryUuidTag = 37, + CborBinaryUuidTag = 37, // Language-tagged string; Ref: [RFC9290, Appendix A] - CborKnownLanguageTaggedStringTag = 38, + CborLanguageTaggedStringTag = 38, // Identifier; Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/id.md][Lucas_Clemente] - CborKnownIdTag = 39, + CborIdTag = 39, // Multi-dimensional Array, row-major order; Ref: [RFC8746] - CborKnownMultiDimensionalArrayRowMajorOrderTag = 40, + CborMultiDimensionalArrayRowMajorOrderTag = 40, // Homogeneous Array; Ref: [RFC8746] - CborKnownHomogeneousArrayTag = 41, + CborHomogeneousArrayTag = 41, // IPLD content identifier; Ref: [https://github.com/ipld/cid-cbor/][Volker_Mische] - CborKnownIpldContentIdTag = 42, + CborIpldContentIdTag = 42, // YANG bits datatype; see Section 6.7.; Ref: [RFC9254] - CborKnownYangBitsDatatypeTag = 43, + CborYangBitsDatatypeTag = 43, // YANG enumeration datatype; see Section 6.6.; Ref: [RFC9254] - CborKnownYangEnumerationDatatypeTag = 44, + CborYangEnumerationDatatypeTag = 44, // YANG identityref datatype; see Section 6.10.; Ref: [RFC9254] - CborKnownYangIdentityrefDatatypeTag = 45, + CborYangIdentityrefDatatypeTag = 45, // YANG instance-identifier datatype; see Section 6.13.; Ref: [RFC9254] - CborKnownYangInstanceIdDatatypeTag = 46, + CborYangInstanceIdDatatypeTag = 46, // YANG Schema Item iDentifier (sid); see Section 3.2.; Ref: [RFC9254] - CborKnownYangSchemaItemIdTag = 47, + CborYangSchemaItemIdTag = 47, // IPv4, [prefixlen,IPv4], [IPv4,prefixpart]; Ref: [RFC9164] - CborKnownIpv4Tag = 52, + CborIpv4Tag = 52, // IPv6, [prefixlen,IPv6], [IPv6,prefixpart]; Ref: [RFC9164] - CborKnownIpv6Tag = 54, + CborIpv6Tag = 54, // CBOR Web Token (CWT); Ref: [RFC8392][Michael_B._Jones] - CborKnownCborWebTokenTag = 61, + CborCborWebTokenTag = 61, // Encoded CBOR Sequence [RFC8742]; Ref: [draft-bormann-cbor-notable-tags-02, Section 2.1] - CborKnownEncodedCborSequenceTag = 63, + CborEncodedCborSequenceTag = 63, // uint8 Typed Array; Ref: [RFC8746] - CborKnownUint8TypedArrayTag = 64, + CborUint8TypedArrayTag = 64, // uint16, big endian, Typed Array; Ref: [RFC8746] - CborKnownUint16BigEndianTypedArrayTag = 65, + CborUint16BigEndianTypedArrayTag = 65, // uint32, big endian, Typed Array; Ref: [RFC8746] - CborKnownUint32BigEndianTypedArrayTag = 66, + CborUint32BigEndianTypedArrayTag = 66, // uint64, big endian, Typed Array; Ref: [RFC8746] - CborKnownUint64BigEndianTypedArrayTag = 67, + CborUint64BigEndianTypedArrayTag = 67, // uint8 Typed Array, clamped arithmetic; Ref: [RFC8746] - CborKnownUint8TypedArrayClampedArithmeticTag = 68, + CborUint8TypedArrayClampedArithmeticTag = 68, // uint16, little endian, Typed Array; Ref: [RFC8746] - CborKnownUint16LittleEndianTypedArrayTag = 69, + CborUint16LittleEndianTypedArrayTag = 69, // uint32, little endian, Typed Array; Ref: [RFC8746] - CborKnownUint32LittleEndianTypedArrayTag = 70, + CborUint32LittleEndianTypedArrayTag = 70, // uint64, little endian, Typed Array; Ref: [RFC8746] - CborKnownUint64LittleEndianTypedArrayTag = 71, + CborUint64LittleEndianTypedArrayTag = 71, // sint8 Typed Array; Ref: [RFC8746] - CborKnownSint8TypedArrayTag = 72, + CborSint8TypedArrayTag = 72, // sint16, big endian, Typed Array; Ref: [RFC8746] - CborKnownSint16BigEndianTypedArrayTag = 73, + CborSint16BigEndianTypedArrayTag = 73, // sint32, big endian, Typed Array; Ref: [RFC8746] - CborKnownSint32BigEndianTypedArrayTag = 74, + CborSint32BigEndianTypedArrayTag = 74, // sint64, big endian, Typed Array; Ref: [RFC8746] - CborKnownSint64BigEndianTypedArrayTag = 75, + CborSint64BigEndianTypedArrayTag = 75, // sint16, little endian, Typed Array; Ref: [RFC8746] - CborKnownSint16LittleEndianTypedArrayTag = 77, + CborSint16LittleEndianTypedArrayTag = 77, // sint32, little endian, Typed Array; Ref: [RFC8746] - CborKnownSint32LittleEndianTypedArrayTag = 78, + CborSint32LittleEndianTypedArrayTag = 78, // sint64, little endian, Typed Array; Ref: [RFC8746] - CborKnownSint64LittleEndianTypedArrayTag = 79, + CborSint64LittleEndianTypedArrayTag = 79, // IEEE 754 binary16, big endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary16BigEndianTypedArrayTag = 80, + CborIeee754Binary16BigEndianTypedArrayTag = 80, // IEEE 754 binary32, big endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary32BigEndianTypedArrayTag = 81, + CborIeee754Binary32BigEndianTypedArrayTag = 81, // IEEE 754 binary64, big endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary64BigEndianTypedArrayTag = 82, + CborIeee754Binary64BigEndianTypedArrayTag = 82, // IEEE 754 binary128, big endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary128BigEndianTypedArrayTag = 83, + CborIeee754Binary128BigEndianTypedArrayTag = 83, // IEEE 754 binary16, little endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary16LittleEndianTypedArrayTag = 84, + CborIeee754Binary16LittleEndianTypedArrayTag = 84, // IEEE 754 binary32, little endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary32LittleEndianTypedArrayTag = 85, + CborIeee754Binary32LittleEndianTypedArrayTag = 85, // IEEE 754 binary64, little endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary64LittleEndianTypedArrayTag = 86, + CborIeee754Binary64LittleEndianTypedArrayTag = 86, // IEEE 754 binary128, little endian, Typed Array; Ref: [RFC8746] - CborKnownIeee754Binary128LittleEndianTypedArrayTag = 87, + CborIeee754Binary128LittleEndianTypedArrayTag = 87, // COSE Encrypted Data Object; Ref: [RFC9052] CborCOSE_EncryptTag = 96, // COSE MACed Data Object; Ref: [RFC9052] @@ -259,319 +259,319 @@ typedef enum CborKnownTags { // COSE Signed Data Object; Ref: [RFC9052] CborCOSE_SignTag = 98, // Number of days since the epoch date 1970-01-01; Ref: [RFC8943] - CborKnownNumberOfDaysSinceTheEpochDate19700101Tag = 100, + CborNumberOfDaysSinceTheEpochDate19700101Tag = 100, // alternatives as given by the uint + 128; see Section 9.1; Ref: [draft-bormann-cbor-notable-tags-07] - CborKnownAlternativesAsGivenByTheUintPlus128Tag = 101, + CborAlternativesAsGivenByTheUintPlus128Tag = 101, // Geographic Coordinates; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag103-Geographic-Coordinates.md][Danilo_Vidovic] - CborKnownGeographicCoordinatesTag = 103, + CborGeographicCoordinatesTag = 103, // Geographic Coordinate Reference System WKT or EPSG number; Ref: [draft-clarke-cbor-crs] - CborKnownGeoCoordRefSystemWktOrEpsgNumTag = 104, + CborGeoCoordRefSystemWktOrEpsgNumTag = 104, // relative object identifier (BER encoding); SDNV [RFC6256] sequence; Ref: [RFC9090] - CborKnownRelativeObjectIdTag = 110, + CborRelativeObjectIdTag = 110, // object identifier (BER encoding); Ref: [RFC9090] - CborKnownObjectIdTag = 111, + CborObjectIdTag = 111, // object identifier (BER encoding), relative to 1.3.6.1.4.1; Ref: [RFC9090] - CborKnownObjectIdRelativeTo136141Tag = 112, + CborObjectIdRelativeTo136141Tag = 112, // Internet of Things Data Point; Ref: [https://github.com/allthingstalk/cbor/blob/master/CBOR-Tag120-Internet-of-Things-Data-Points.md][Danilo_Vidovic] - CborKnownInternetOfThingsDataPointTag = 120, + CborInternetOfThingsDataPointTag = 120, // Gordian Envelope; Ref: [draft-mcnally-envelope-05] - CborKnownGordianEnvelopeTag = 200, + CborGordianEnvelopeTag = 200, // mark value as having string references; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] - CborKnownMarkValueAsHavingStringReferencesTag = 256, + CborMarkValueAsHavingStringReferencesTag = 256, // Binary MIME message; Ref: [http://peteroupc.github.io/CBOR/binarymime.html][Peter_Occil] - CborKnownBinaryMimeMsgTag = 257, + CborBinaryMimeMsgTag = 257, // Mathematical finite set; Ref: [https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md][Alfredo_Di_Napoli] - CborKnownMathematicalFiniteSetTag = 258, + CborMathematicalFiniteSetTag = 258, // Map datatype with key-value operations (e.g. `.get()/.set()/.delete()`); Ref: [https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec--explicit-maps.md][Shane_Holloway] - CborKnownMapDatatypeWithKeyValOpSetDeleteTag = 259, + CborMapDatatypeWithKeyValOpSetDeleteTag = 259, // Network Address (IPv4 or IPv6 or MAC Address) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [http://www.employees.org/~ravir/cbor-network.txt][Ravi_Raju][RFC9164] - CborKnownNetworkAddressTag = 260, + CborNetworkAddressTag = 260, // Network Address Prefix (IPv4 or IPv6 Address + Mask Length) (DEPRECATED in favor of 52 and 54 for IP addresses); Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/networkPrefix.md][Ravi_Raju][RFC9164] - CborKnownNetworkAddressPrefixTag = 261, + CborNetworkAddressPrefixTag = 261, // Embedded JSON Object; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/embeddedJSON.md][Ravi_Raju] - CborKnownEmbeddedJsonObjectTag = 262, + CborEmbeddedJsonObjectTag = 262, // Hexadecimal string; Ref: [https://github.com/toravir/CBOR-Tag-Specs/blob/master/hexString.md][Ravi_Raju] - CborKnownHexadecimalStringTag = 263, + CborHexadecimalStringTag = 263, // Decimal fraction with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] - CborKnownDecimalFractionWithArbitraryExponentTag = 264, + CborDecimalFractionWithArbitraryExponentTag = 264, // Bigfloat with arbitrary exponent; Ref: [http://peteroupc.github.io/CBOR/bigfrac.html][Peter_Occil] - CborKnownBigfloatWithArbitraryExponentTag = 265, + CborBigfloatWithArbitraryExponentTag = 265, // Internationalized resource identifier (IRI); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] - CborKnownInternationalizedResourceIdTag = 266, + CborInternationalizedResourceIdTag = 266, // Internationalized resource identifier reference (IRI reference); Ref: [https://peteroupc.github.io/CBOR/iri.html][Peter_Occil] - CborKnownInternationalizedResourceIdRefTag = 267, + CborInternationalizedResourceIdRefTag = 267, // Extended decimal fraction; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownExtendedDecimalFractionTag = 268, + CborExtendedDecimalFractionTag = 268, // Extended bigfloat; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownExtendedBigfloatTag = 269, + CborExtendedBigfloatTag = 269, // Extended rational number; Ref: [https://peteroupc.github.io/CBOR/extended.html][Peter_Occil] - CborKnownExtendedRationalNumberTag = 270, + CborExtendedRationalNumberTag = 270, // DDoS Open Threat Signaling (DOTS) signal channel object, as defined in [RFC9132]; Ref: [RFC9132] - CborKnownDdosOpenThreatSignalingSigChnObjTag = 271, + CborDdosOpenThreatSignalingSigChnObjTag = 271, // Non-UTF-8 CESU-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownNonUtf8Cesu8StringTag = 272, + CborNonUtf8Cesu8StringTag = 272, // Non-UTF-8 WTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownNonUtf8Wtf8StringTag = 273, + CborNonUtf8Wtf8StringTag = 273, // Non-UTF-8 MUTF-8 string; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-nonutf8-string-tags.rst][Sami_Vaarala] - CborKnownNonUtf8Mutf8StringTag = 274, + CborNonUtf8Mutf8StringTag = 274, // Map contains only keys that are of type Text String (major type 3); Ref: [https://github.com/ecorm/cbor-tag-text-key-map][Emile_Cormier] - CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag = 275, + CborMapContainsOnlyKeysThatAreOfTypeTxtStrTag = 275, // ERIS binary read capability; Ref: [http://purl.org/eris] - CborKnownErisBinaryReadCapabilityTag = 276, + CborErisBinaryReadCapabilityTag = 276, // Universal Geographical Area Description (GAD) shape; see Section 5; Ref: [TS 23.032][Mathew_Meins] - CborKnownUniversalGeoAreaDescriptionShapeTag = 277, + CborUniversalGeoAreaDescriptionShapeTag = 277, // Universal Geographical Area Description (GAD) description of velocity; see Section 8; Ref: [TS 23.032][Mathew_Meins] - CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag = 278, + CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag = 278, // extended time; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownExtendedTimeTag = 1001, + CborExtendedTimeTag = 1001, // duration; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownDurationTag = 1002, + CborDurationTag = 1002, // period; Ref: [draft-bormann-cbor-time-tag-01] - CborKnownPeriodTag = 1003, + CborPeriodTag = 1003, // [RFC3339] full-date string; Ref: [RFC8943] - CborKnownFullDateStringTag = 1004, + CborFullDateStringTag = 1004, // Object type identifier; Ref: [draft-rundgren-cotx-04] - CborKnownObjectTypeIdTag = 1010, + CborObjectTypeIdTag = 1010, // Multi-dimensional Array, column-major order; Ref: [RFC8746] - CborKnownMultiDimensionalArrayColumnMajorOrderTag = 1040, + CborMultiDimensionalArrayColumnMajorOrderTag = 1040, // [COSE algorithm identifier, Base Hash value]; Ref: [draft-bormann-cbor-notable-tags-09, Section 3.1.1] - CborKnownCoseAlgorithmIdBaseHashValueTag = 18556, + CborCoseAlgorithmIdBaseHashValueTag = 18556, // I-Regexp; Ref: [draft-bormann-cbor-notable-tags-09, Section 2.1][draft-ietf-jsonpath-iregexp-08] - CborKnownIRegexpTag = 21065, + CborIRegexpTag = 21065, // ECMAScript RegExp [https://262.ecma-international.org/14.0/#sec-regexp-regular-expression-objects]; Ref: [https://github.com/hildjj/cbor-specs/blob/main/regexp.md][Joe_Hildebrand] - CborKnownEcmascriptRegexpTag = 21066, + CborEcmascriptRegexpTag = 21066, // hint that indicates an additional level of indirection; Ref: [http://cbor.schmorp.de/indirection][Marc_A._Lehmann] - CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag = 22098, + CborHintThatIndicatesAnAddLvlOfIndirectionTag = 22098, // Capture [3]; Ref: [https://github.com/japhb/cbor-specs/blob/main/capture.md][Geoffrey_Broadwell] - CborKnownCaptureTag = 25441, + CborCaptureTag = 25441, /* 32768-18446744073709551615 : First Come First Served */ // Identifier for a FHIR constant; Ref: [Stefan_Genchev] - CborKnownIdForAFhirConstantTag = 32768, + CborIdForAFhirConstantTag = 32768, // External reference; Ref: [https://gitlab.com/Hawk777/cbor-specs/-/blob/main/external-reference.md][Christopher_Head] - CborKnownExternalRefTag = 32769, + CborExternalRefTag = 32769, // A confidentiality clearance. The key value pairs of the map are defined in ADatP-4774.4; Ref: [Aidan_Murdock] - CborKnownAConfidentialityClearanceTag = 42600, + CborAConfidentialityClearanceTag = 42600, // A metadata binding. The elements of the array are defined in AdatP-4778.5. The tag is also used as part of the magic number in on-disk detached and encapsulating bindings.; Ref: [Aidan_Murdock] - CborKnownAMetadataBindingTag = 42601, + CborAMetadataBindingTag = 42601, // A collection of NCMS metadata elements. The key value pairs of the map are defined in AdatP-5636.4; Ref: [Aidan_Murdock] - CborKnownACollectionOfNcmsMetadataElementsTag = 42602, + CborACollectionOfNcmsMetadataElementsTag = 42602, // Single complex number: array elements are real (I) and imaginary (Q) components; Ref: [Saajan_Chana] - CborKnownSingleComplexNumberTag = 43000, + CborSingleComplexNumberTag = 43000, // Array of complex numbers in interleaved form: complex value k is stored with real (I) part at array index 2k and imaginary (Q) part at index (2k + 1); Ref: [Saajan_Chana] - CborKnownArrayOfComplexNumbersInInterleavedFormTag = 43001, + CborArrayOfComplexNumbersInInterleavedFormTag = 43001, // PlatformV_IS_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvIsIdTag = 50000, + CborPlatformvIsIdTag = 50000, // PlatformV_IS_NAME; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvIsNameTag = 50001, + CborPlatformvIsNameTag = 50001, // PlatformV_IS_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvIsValueTag = 50002, + CborPlatformvIsValueTag = 50002, // PlatformV_HAS_COMPOSITE_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasCompositeValueTag = 50003, + CborPlatformvHasCompositeValueTag = 50003, // PlatformV_HAS_MAPPED_VALUE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasMappedValueTag = 50004, + CborPlatformvHasMappedValueTag = 50004, // PlatformV_HAS_OBJ_ID; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasObjIdTag = 50005, + CborPlatformvHasObjIdTag = 50005, // PlatformV_HAS_OBJ_TAG; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasObjTagTag = 50006, + CborPlatformvHasObjTagTag = 50006, // PlatformV_HAS_CHILD; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasChildTag = 50007, + CborPlatformvHasChildTag = 50007, // PlatformV_HAS_PROPERTY; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasPropertyTag = 50008, + CborPlatformvHasPropertyTag = 50008, // PlatformV_HAS_META; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasMetaTag = 50009, + CborPlatformvHasMetaTag = 50009, // PlatformV_HAS_EVENT; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasEventTag = 50010, + CborPlatformvHasEventTag = 50010, // PlatformV_HAS_ACTION; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvHasActionTag = 50011, + CborPlatformvHasActionTag = 50011, // PlatformV_IS_TYPE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] - CborKnownPlatformvIsTypeTag = 50012, + CborPlatformvIsTypeTag = 50012, // Self-described CBOR; see Section 3.4.6; Ref: [RFC8949] CborSignatureTag = 55799, // indicates that the file contains CBOR Sequences; Ref: [RFC9277] - CborKnownIndicatesThatFileContainsCborSequencesTag = 55800, + CborIndicatesThatFileContainsCborSequencesTag = 55800, // indicates that the file starts with a CBOR-Labeled Non-CBOR Data label.; Ref: [RFC9277] - CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag = 55801, + CborIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag = 55801, // Compressed byte string; Ref: [https://github.com/dectris/documentation/blob/main/cbor/dectris-compression-tag.md][Kal_Conley] - CborKnownCompressedByteStringTag = 56500, + CborCompressedByteStringTag = 56500, // Identify and define a set of record structures (each a sequence of property names) that can be referenced as tags in the included value (and the scope for the record tag definitions); Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] - CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag = 57342, + CborIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag = 57342, // Identify and define a record structure (a sequence of property names), and use that record structure definition to interpret the included values.; Ref: [https://github.com/kriszyp/cbor-records][Kris_Zyp] - CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag = 57343, + CborIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag = 57343, // The tagged CBOR array contains attestation evidence data with an Intel TEE quote.; Ref: [Shanwei_Cen] - CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag = 60000, + CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag = 60000, // The tagged CBOR array contains attestation evidence data with an Intel TEE report.; Ref: [Shanwei_Cen] - CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, + CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, // The tagged CBOR array contains attestation evidence data with an Intel SGX report.; Ref: [Shanwei_Cen] - CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, + CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownAlwaysInvalidTag = 65535, + CborAlwaysInvalidTag = 65535, // RAINS Message; Ref: [https://britram.github.io/rains-prototype][Brian_Trammell] - CborKnownRainsMsgTag = 15309736, + CborRainsMsgTag = 15309736, // A CBOR encoded Openswan configuration file, as stored on disk forunit test cases.; Ref: [Michael_Richardson][Samir_Hussain] - CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag = 1330664270, + CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag = 1330664270, // Concise Software Identifier (CoSWID); Ref: [RFC9393] - CborKnownConciseSoftwareIdTag = 1398229316, + CborConciseSoftwareIdTag = 1398229316, // Array of content-addressed blocks and ERIS read capabilities; Ref: [Endo_Renberg] - CborKnownArrayOfContentAddrBlocksErisReadCapTag = 1701996915, + CborArrayOfContentAddrBlocksErisReadCapTag = 1701996915, // ERIS-FS image header; Ref: [Endo_Renberg] - CborKnownErisFsImageHeaderTag = 1701996916, + CborErisFsImageHeaderTag = 1701996916, // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownAlwaysInvalidTag = 4294967295, + CborAlwaysInvalidTag = 4294967295, // Intel FPGA SPDM Manifest; Ref: [Andrew_Draper] - CborKnownIntelFpgaSpdmManifestTag = 4294967296, + CborIntelFpgaSpdmManifestTag = 4294967296, // always invalid; Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborKnownAlwaysInvalidTag = 18446744073709551615 + CborAlwaysInvalidTag = 18446744073709551615 } CborKnownTags; /* Start of cbor known tag feature flag autogenerated section */ /* #define the constants so we can check with #ifdef */ +#define CborACollectionOfNcmsMetadataElementsTag CborACollectionOfNcmsMetadataElementsTag +#define CborAConfidentialityClearanceTag CborAConfidentialityClearanceTag +#define CborAMetadataBindingTag CborAMetadataBindingTag +#define CborAbsentValueInACborArrayTag CborAbsentValueInACborArrayTag +#define CborAlternativesAsGivenByTheUintPlus128Tag CborAlternativesAsGivenByTheUintPlus128Tag +#define CborAlwaysInvalidTag CborAlwaysInvalidTag +#define CborArrayOfComplexNumbersInInterleavedFormTag CborArrayOfComplexNumbersInInterleavedFormTag +#define CborArrayOfContentAddrBlocksErisReadCapTag CborArrayOfContentAddrBlocksErisReadCapTag #define CborBase64Tag CborBase64Tag #define CborBase64urlTag CborBase64urlTag #define CborBigfloatTag CborBigfloatTag +#define CborBigfloatWithArbitraryExponentTag CborBigfloatWithArbitraryExponentTag +#define CborBinaryMimeMsgTag CborBinaryMimeMsgTag +#define CborBinaryUuidTag CborBinaryUuidTag #define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag #define CborCOSE_EncryptTag CborCOSE_EncryptTag #define CborCOSE_Mac0Tag CborCOSE_Mac0Tag #define CborCOSE_MacTag CborCOSE_MacTag #define CborCOSE_Sign1Tag CborCOSE_Sign1Tag #define CborCOSE_SignTag CborCOSE_SignTag +#define CborCaptureTag CborCaptureTag +#define CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag +#define CborCborWebTokenTag CborCborWebTokenTag +#define CborCompressedByteStringTag CborCompressedByteStringTag +#define CborConciseSoftwareIdTag CborConciseSoftwareIdTag +#define CborCoseAlgorithmIdBaseHashValueTag CborCoseAlgorithmIdBaseHashValueTag +#define CborCoseStandaloneV2CountersignatureTag CborCoseStandaloneV2CountersignatureTag #define CborDateTimeStringTag CborDateTimeStringTag +#define CborDdosOpenThreatSignalingSigChnObjTag CborDdosOpenThreatSignalingSigChnObjTag +#define CborDecimalFractionWithArbitraryExponentTag CborDecimalFractionWithArbitraryExponentTag #define CborDecimalTag CborDecimalTag +#define CborDurationTag CborDurationTag +#define CborEcmascriptRegexpTag CborEcmascriptRegexpTag +#define CborEmbeddedJsonObjectTag CborEmbeddedJsonObjectTag +#define CborEncodedCborSequenceTag CborEncodedCborSequenceTag #define CborEncodedCborTag CborEncodedCborTag +#define CborErisBinaryReadCapabilityTag CborErisBinaryReadCapabilityTag +#define CborErisFsImageHeaderTag CborErisFsImageHeaderTag #define CborExpectedBase16Tag CborExpectedBase16Tag #define CborExpectedBase64Tag CborExpectedBase64Tag #define CborExpectedBase64urlTag CborExpectedBase64urlTag -#define CborKnownACollectionOfNcmsMetadataElementsTag CborKnownACollectionOfNcmsMetadataElementsTag -#define CborKnownAConfidentialityClearanceTag CborKnownAConfidentialityClearanceTag -#define CborKnownAMetadataBindingTag CborKnownAMetadataBindingTag -#define CborKnownAbsentValueInACborArrayTag CborKnownAbsentValueInACborArrayTag -#define CborKnownAlternativesAsGivenByTheUintPlus128Tag CborKnownAlternativesAsGivenByTheUintPlus128Tag -#define CborKnownAlwaysInvalidTag CborKnownAlwaysInvalidTag -#define CborKnownArrayOfComplexNumbersInInterleavedFormTag CborKnownArrayOfComplexNumbersInInterleavedFormTag -#define CborKnownArrayOfContentAddrBlocksErisReadCapTag CborKnownArrayOfContentAddrBlocksErisReadCapTag -#define CborKnownBigfloatWithArbitraryExponentTag CborKnownBigfloatWithArbitraryExponentTag -#define CborKnownBinaryMimeMsgTag CborKnownBinaryMimeMsgTag -#define CborKnownBinaryUuidTag CborKnownBinaryUuidTag -#define CborKnownCaptureTag CborKnownCaptureTag -#define CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborKnownCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag -#define CborKnownCborWebTokenTag CborKnownCborWebTokenTag -#define CborKnownCompressedByteStringTag CborKnownCompressedByteStringTag -#define CborKnownConciseSoftwareIdTag CborKnownConciseSoftwareIdTag -#define CborKnownCoseAlgorithmIdBaseHashValueTag CborKnownCoseAlgorithmIdBaseHashValueTag -#define CborKnownCoseStandaloneV2CountersignatureTag CborKnownCoseStandaloneV2CountersignatureTag -#define CborKnownDdosOpenThreatSignalingSigChnObjTag CborKnownDdosOpenThreatSignalingSigChnObjTag -#define CborKnownDecimalFractionWithArbitraryExponentTag CborKnownDecimalFractionWithArbitraryExponentTag -#define CborKnownDurationTag CborKnownDurationTag -#define CborKnownEcmascriptRegexpTag CborKnownEcmascriptRegexpTag -#define CborKnownEmbeddedJsonObjectTag CborKnownEmbeddedJsonObjectTag -#define CborKnownEncodedCborSequenceTag CborKnownEncodedCborSequenceTag -#define CborKnownErisBinaryReadCapabilityTag CborKnownErisBinaryReadCapabilityTag -#define CborKnownErisFsImageHeaderTag CborKnownErisFsImageHeaderTag -#define CborKnownExtendedBigfloatTag CborKnownExtendedBigfloatTag -#define CborKnownExtendedDecimalFractionTag CborKnownExtendedDecimalFractionTag -#define CborKnownExtendedRationalNumberTag CborKnownExtendedRationalNumberTag -#define CborKnownExtendedTimeTag CborKnownExtendedTimeTag -#define CborKnownExternalRefTag CborKnownExternalRefTag -#define CborKnownFullDateStringTag CborKnownFullDateStringTag -#define CborKnownGeoCoordRefSystemWktOrEpsgNumTag CborKnownGeoCoordRefSystemWktOrEpsgNumTag -#define CborKnownGeographicCoordinatesTag CborKnownGeographicCoordinatesTag -#define CborKnownGordianEnvelopeTag CborKnownGordianEnvelopeTag -#define CborKnownHexadecimalStringTag CborKnownHexadecimalStringTag -#define CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag CborKnownHintThatIndicatesAnAddLvlOfIndirectionTag -#define CborKnownHomogeneousArrayTag CborKnownHomogeneousArrayTag -#define CborKnownIRegexpTag CborKnownIRegexpTag -#define CborKnownIdForAFhirConstantTag CborKnownIdForAFhirConstantTag -#define CborKnownIdTag CborKnownIdTag -#define CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag CborKnownIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag -#define CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag CborKnownIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag -#define CborKnownIeee754Binary128BigEndianTypedArrayTag CborKnownIeee754Binary128BigEndianTypedArrayTag -#define CborKnownIeee754Binary128LittleEndianTypedArrayTag CborKnownIeee754Binary128LittleEndianTypedArrayTag -#define CborKnownIeee754Binary16BigEndianTypedArrayTag CborKnownIeee754Binary16BigEndianTypedArrayTag -#define CborKnownIeee754Binary16LittleEndianTypedArrayTag CborKnownIeee754Binary16LittleEndianTypedArrayTag -#define CborKnownIeee754Binary32BigEndianTypedArrayTag CborKnownIeee754Binary32BigEndianTypedArrayTag -#define CborKnownIeee754Binary32LittleEndianTypedArrayTag CborKnownIeee754Binary32LittleEndianTypedArrayTag -#define CborKnownIeee754Binary64BigEndianTypedArrayTag CborKnownIeee754Binary64BigEndianTypedArrayTag -#define CborKnownIeee754Binary64LittleEndianTypedArrayTag CborKnownIeee754Binary64LittleEndianTypedArrayTag -#define CborKnownIndicatesThatFileContainsCborSequencesTag CborKnownIndicatesThatFileContainsCborSequencesTag -#define CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag CborKnownIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag -#define CborKnownIntelFpgaSpdmManifestTag CborKnownIntelFpgaSpdmManifestTag -#define CborKnownInternationalizedResourceIdRefTag CborKnownInternationalizedResourceIdRefTag -#define CborKnownInternationalizedResourceIdTag CborKnownInternationalizedResourceIdTag -#define CborKnownInternetOfThingsDataPointTag CborKnownInternetOfThingsDataPointTag -#define CborKnownIpldContentIdTag CborKnownIpldContentIdTag -#define CborKnownIpv4Tag CborKnownIpv4Tag -#define CborKnownIpv6Tag CborKnownIpv6Tag -#define CborKnownLanguageTaggedStringTag CborKnownLanguageTaggedStringTag -#define CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag CborKnownMapContainsOnlyKeysThatAreOfTypeTxtStrTag -#define CborKnownMapDatatypeWithKeyValOpSetDeleteTag CborKnownMapDatatypeWithKeyValOpSetDeleteTag -#define CborKnownMarkValueAsHavingStringReferencesTag CborKnownMarkValueAsHavingStringReferencesTag -#define CborKnownMarkValueAsSharedTag CborKnownMarkValueAsSharedTag -#define CborKnownMathematicalFiniteSetTag CborKnownMathematicalFiniteSetTag -#define CborKnownMultiDimensionalArrayColumnMajorOrderTag CborKnownMultiDimensionalArrayColumnMajorOrderTag -#define CborKnownMultiDimensionalArrayRowMajorOrderTag CborKnownMultiDimensionalArrayRowMajorOrderTag -#define CborKnownNetworkAddressPrefixTag CborKnownNetworkAddressPrefixTag -#define CborKnownNetworkAddressTag CborKnownNetworkAddressTag -#define CborKnownNonUtf8Cesu8StringTag CborKnownNonUtf8Cesu8StringTag -#define CborKnownNonUtf8Mutf8StringTag CborKnownNonUtf8Mutf8StringTag -#define CborKnownNonUtf8Wtf8StringTag CborKnownNonUtf8Wtf8StringTag -#define CborKnownNumberOfDaysSinceTheEpochDate19700101Tag CborKnownNumberOfDaysSinceTheEpochDate19700101Tag -#define CborKnownObjectIdRelativeTo136141Tag CborKnownObjectIdRelativeTo136141Tag -#define CborKnownObjectIdTag CborKnownObjectIdTag -#define CborKnownObjectTypeIdTag CborKnownObjectTypeIdTag -#define CborKnownPeriodTag CborKnownPeriodTag -#define CborKnownPlatformvHasActionTag CborKnownPlatformvHasActionTag -#define CborKnownPlatformvHasChildTag CborKnownPlatformvHasChildTag -#define CborKnownPlatformvHasCompositeValueTag CborKnownPlatformvHasCompositeValueTag -#define CborKnownPlatformvHasEventTag CborKnownPlatformvHasEventTag -#define CborKnownPlatformvHasMappedValueTag CborKnownPlatformvHasMappedValueTag -#define CborKnownPlatformvHasMetaTag CborKnownPlatformvHasMetaTag -#define CborKnownPlatformvHasObjIdTag CborKnownPlatformvHasObjIdTag -#define CborKnownPlatformvHasObjTagTag CborKnownPlatformvHasObjTagTag -#define CborKnownPlatformvHasPropertyTag CborKnownPlatformvHasPropertyTag -#define CborKnownPlatformvIsIdTag CborKnownPlatformvIsIdTag -#define CborKnownPlatformvIsNameTag CborKnownPlatformvIsNameTag -#define CborKnownPlatformvIsTypeTag CborKnownPlatformvIsTypeTag -#define CborKnownPlatformvIsValueTag CborKnownPlatformvIsValueTag -#define CborKnownRainsMsgTag CborKnownRainsMsgTag -#define CborKnownRationalNumberTag CborKnownRationalNumberTag -#define CborKnownRefNthMarkedValueTag CborKnownRefNthMarkedValueTag -#define CborKnownRefTheNthPrevSeenStringTag CborKnownRefTheNthPrevSeenStringTag -#define CborKnownRelativeObjectIdTag CborKnownRelativeObjectIdTag -#define CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag CborKnownSerialisedLangIndepObjWithTypeNameConstructorArgTag -#define CborKnownSerialisedPerlObjWithClassnameConstructorArgTag CborKnownSerialisedPerlObjWithClassnameConstructorArgTag -#define CborKnownSingleComplexNumberTag CborKnownSingleComplexNumberTag -#define CborKnownSint16BigEndianTypedArrayTag CborKnownSint16BigEndianTypedArrayTag -#define CborKnownSint16LittleEndianTypedArrayTag CborKnownSint16LittleEndianTypedArrayTag -#define CborKnownSint32BigEndianTypedArrayTag CborKnownSint32BigEndianTypedArrayTag -#define CborKnownSint32LittleEndianTypedArrayTag CborKnownSint32LittleEndianTypedArrayTag -#define CborKnownSint64BigEndianTypedArrayTag CborKnownSint64BigEndianTypedArrayTag -#define CborKnownSint64LittleEndianTypedArrayTag CborKnownSint64LittleEndianTypedArrayTag -#define CborKnownSint8TypedArrayTag CborKnownSint8TypedArrayTag -#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag -#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag -#define CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborKnownTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag -#define CborKnownUint16BigEndianTypedArrayTag CborKnownUint16BigEndianTypedArrayTag -#define CborKnownUint16LittleEndianTypedArrayTag CborKnownUint16LittleEndianTypedArrayTag -#define CborKnownUint32BigEndianTypedArrayTag CborKnownUint32BigEndianTypedArrayTag -#define CborKnownUint32LittleEndianTypedArrayTag CborKnownUint32LittleEndianTypedArrayTag -#define CborKnownUint64BigEndianTypedArrayTag CborKnownUint64BigEndianTypedArrayTag -#define CborKnownUint64LittleEndianTypedArrayTag CborKnownUint64LittleEndianTypedArrayTag -#define CborKnownUint8TypedArrayClampedArithmeticTag CborKnownUint8TypedArrayClampedArithmeticTag -#define CborKnownUint8TypedArrayTag CborKnownUint8TypedArrayTag -#define CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborKnownUniversalGeoAreaDescriptionDescriptionOfVelocityTag -#define CborKnownUniversalGeoAreaDescriptionShapeTag CborKnownUniversalGeoAreaDescriptionShapeTag -#define CborKnownYangBitsDatatypeTag CborKnownYangBitsDatatypeTag -#define CborKnownYangEnumerationDatatypeTag CborKnownYangEnumerationDatatypeTag -#define CborKnownYangIdentityrefDatatypeTag CborKnownYangIdentityrefDatatypeTag -#define CborKnownYangInstanceIdDatatypeTag CborKnownYangInstanceIdDatatypeTag -#define CborKnownYangSchemaItemIdTag CborKnownYangSchemaItemIdTag +#define CborExtendedBigfloatTag CborExtendedBigfloatTag +#define CborExtendedDecimalFractionTag CborExtendedDecimalFractionTag +#define CborExtendedRationalNumberTag CborExtendedRationalNumberTag +#define CborExtendedTimeTag CborExtendedTimeTag +#define CborExternalRefTag CborExternalRefTag +#define CborFullDateStringTag CborFullDateStringTag +#define CborGeoCoordRefSystemWktOrEpsgNumTag CborGeoCoordRefSystemWktOrEpsgNumTag +#define CborGeographicCoordinatesTag CborGeographicCoordinatesTag +#define CborGordianEnvelopeTag CborGordianEnvelopeTag +#define CborHexadecimalStringTag CborHexadecimalStringTag +#define CborHintThatIndicatesAnAddLvlOfIndirectionTag CborHintThatIndicatesAnAddLvlOfIndirectionTag +#define CborHomogeneousArrayTag CborHomogeneousArrayTag +#define CborIRegexpTag CborIRegexpTag +#define CborIdForAFhirConstantTag CborIdForAFhirConstantTag +#define CborIdTag CborIdTag +#define CborIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag CborIdentDefineRecStrctUseThatRecStrctDefInterpretIncValsTag +#define CborIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag CborIdentDefineSetOfRecStrctThatCanBeRefAsTagsInIncValTag +#define CborIeee754Binary128BigEndianTypedArrayTag CborIeee754Binary128BigEndianTypedArrayTag +#define CborIeee754Binary128LittleEndianTypedArrayTag CborIeee754Binary128LittleEndianTypedArrayTag +#define CborIeee754Binary16BigEndianTypedArrayTag CborIeee754Binary16BigEndianTypedArrayTag +#define CborIeee754Binary16LittleEndianTypedArrayTag CborIeee754Binary16LittleEndianTypedArrayTag +#define CborIeee754Binary32BigEndianTypedArrayTag CborIeee754Binary32BigEndianTypedArrayTag +#define CborIeee754Binary32LittleEndianTypedArrayTag CborIeee754Binary32LittleEndianTypedArrayTag +#define CborIeee754Binary64BigEndianTypedArrayTag CborIeee754Binary64BigEndianTypedArrayTag +#define CborIeee754Binary64LittleEndianTypedArrayTag CborIeee754Binary64LittleEndianTypedArrayTag +#define CborIndicatesThatFileContainsCborSequencesTag CborIndicatesThatFileContainsCborSequencesTag +#define CborIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag CborIndicatesThatFileStartsWithCborLabeledNonCborDataLabelTag +#define CborIntelFpgaSpdmManifestTag CborIntelFpgaSpdmManifestTag +#define CborInternationalizedResourceIdRefTag CborInternationalizedResourceIdRefTag +#define CborInternationalizedResourceIdTag CborInternationalizedResourceIdTag +#define CborInternetOfThingsDataPointTag CborInternetOfThingsDataPointTag +#define CborIpldContentIdTag CborIpldContentIdTag +#define CborIpv4Tag CborIpv4Tag +#define CborIpv6Tag CborIpv6Tag +#define CborLanguageTaggedStringTag CborLanguageTaggedStringTag +#define CborMapContainsOnlyKeysThatAreOfTypeTxtStrTag CborMapContainsOnlyKeysThatAreOfTypeTxtStrTag +#define CborMapDatatypeWithKeyValOpSetDeleteTag CborMapDatatypeWithKeyValOpSetDeleteTag +#define CborMarkValueAsHavingStringReferencesTag CborMarkValueAsHavingStringReferencesTag +#define CborMarkValueAsSharedTag CborMarkValueAsSharedTag +#define CborMathematicalFiniteSetTag CborMathematicalFiniteSetTag #define CborMimeMessageTag CborMimeMessageTag +#define CborMultiDimensionalArrayColumnMajorOrderTag CborMultiDimensionalArrayColumnMajorOrderTag +#define CborMultiDimensionalArrayRowMajorOrderTag CborMultiDimensionalArrayRowMajorOrderTag #define CborNegativeBignumTag CborNegativeBignumTag +#define CborNetworkAddressPrefixTag CborNetworkAddressPrefixTag +#define CborNetworkAddressTag CborNetworkAddressTag +#define CborNonUtf8Cesu8StringTag CborNonUtf8Cesu8StringTag +#define CborNonUtf8Mutf8StringTag CborNonUtf8Mutf8StringTag +#define CborNonUtf8Wtf8StringTag CborNonUtf8Wtf8StringTag +#define CborNumberOfDaysSinceTheEpochDate19700101Tag CborNumberOfDaysSinceTheEpochDate19700101Tag +#define CborObjectIdRelativeTo136141Tag CborObjectIdRelativeTo136141Tag +#define CborObjectIdTag CborObjectIdTag +#define CborObjectTypeIdTag CborObjectTypeIdTag +#define CborPeriodTag CborPeriodTag +#define CborPlatformvHasActionTag CborPlatformvHasActionTag +#define CborPlatformvHasChildTag CborPlatformvHasChildTag +#define CborPlatformvHasCompositeValueTag CborPlatformvHasCompositeValueTag +#define CborPlatformvHasEventTag CborPlatformvHasEventTag +#define CborPlatformvHasMappedValueTag CborPlatformvHasMappedValueTag +#define CborPlatformvHasMetaTag CborPlatformvHasMetaTag +#define CborPlatformvHasObjIdTag CborPlatformvHasObjIdTag +#define CborPlatformvHasObjTagTag CborPlatformvHasObjTagTag +#define CborPlatformvHasPropertyTag CborPlatformvHasPropertyTag +#define CborPlatformvIsIdTag CborPlatformvIsIdTag +#define CborPlatformvIsNameTag CborPlatformvIsNameTag +#define CborPlatformvIsTypeTag CborPlatformvIsTypeTag +#define CborPlatformvIsValueTag CborPlatformvIsValueTag #define CborPositiveBignumTag CborPositiveBignumTag +#define CborRainsMsgTag CborRainsMsgTag +#define CborRationalNumberTag CborRationalNumberTag +#define CborRefNthMarkedValueTag CborRefNthMarkedValueTag +#define CborRefTheNthPrevSeenStringTag CborRefTheNthPrevSeenStringTag #define CborRegularExpressionTag CborRegularExpressionTag +#define CborRelativeObjectIdTag CborRelativeObjectIdTag +#define CborSerialisedLangIndepObjWithTypeNameConstructorArgTag CborSerialisedLangIndepObjWithTypeNameConstructorArgTag +#define CborSerialisedPerlObjWithClassnameConstructorArgTag CborSerialisedPerlObjWithClassnameConstructorArgTag #define CborSignatureTag CborSignatureTag +#define CborSingleComplexNumberTag CborSingleComplexNumberTag +#define CborSint16BigEndianTypedArrayTag CborSint16BigEndianTypedArrayTag +#define CborSint16LittleEndianTypedArrayTag CborSint16LittleEndianTypedArrayTag +#define CborSint32BigEndianTypedArrayTag CborSint32BigEndianTypedArrayTag +#define CborSint32LittleEndianTypedArrayTag CborSint32LittleEndianTypedArrayTag +#define CborSint64BigEndianTypedArrayTag CborSint64BigEndianTypedArrayTag +#define CborSint64LittleEndianTypedArrayTag CborSint64LittleEndianTypedArrayTag +#define CborSint8TypedArrayTag CborSint8TypedArrayTag +#define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag +#define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag +#define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag +#define CborUint16BigEndianTypedArrayTag CborUint16BigEndianTypedArrayTag +#define CborUint16LittleEndianTypedArrayTag CborUint16LittleEndianTypedArrayTag +#define CborUint32BigEndianTypedArrayTag CborUint32BigEndianTypedArrayTag +#define CborUint32LittleEndianTypedArrayTag CborUint32LittleEndianTypedArrayTag +#define CborUint64BigEndianTypedArrayTag CborUint64BigEndianTypedArrayTag +#define CborUint64LittleEndianTypedArrayTag CborUint64LittleEndianTypedArrayTag +#define CborUint8TypedArrayClampedArithmeticTag CborUint8TypedArrayClampedArithmeticTag +#define CborUint8TypedArrayTag CborUint8TypedArrayTag +#define CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag +#define CborUniversalGeoAreaDescriptionShapeTag CborUniversalGeoAreaDescriptionShapeTag #define CborUnixTime_tTag CborUnixTime_tTag #define CborUrlTag CborUrlTag +#define CborYangBitsDatatypeTag CborYangBitsDatatypeTag +#define CborYangEnumerationDatatypeTag CborYangEnumerationDatatypeTag +#define CborYangIdentityrefDatatypeTag CborYangIdentityrefDatatypeTag +#define CborYangInstanceIdDatatypeTag CborYangInstanceIdDatatypeTag +#define CborYangSchemaItemIdTag CborYangSchemaItemIdTag /* End of cbor known tag feature flag autogenerated section */ /* Error API */ diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/iana-cbor-c-header.py index 5965209b..3681849e 100755 --- a/tools/iana/iana-cbor-c-header.py +++ b/tools/iana/iana-cbor-c-header.py @@ -512,12 +512,12 @@ def variable_name_abbreviator(variable_name_list_input, camel_case = False): enum_name = "" if tiny_cbor_style_override: # Combine tag value and descriptive terms to form the enum name - if typedef_enum_name.endswith("Tags"): - enum_name += typedef_enum_name[:-4] + if typedef_enum_name.endswith("KnownTags"): + enum_name += typedef_enum_name[:-9] else: enum_name += typedef_enum_name enum_name += variable_name_abbreviator(semantics, camel_case=True) - if typedef_enum_name.endswith("Tags"): + if typedef_enum_name.endswith("KnownTags"): enum_name += "Tag" else: # Combine tag value and descriptive terms to form the enum name From 84376dc51716bfebc02e3b75d7f9c79b7a61097c Mon Sep 17 00:00:00 2001 From: brian khuu Date: Sun, 1 Oct 2023 21:11:56 +1100 Subject: [PATCH 5/7] account for always invalid tag which is specifically for internal usage --- src/cbor.h | 9 +-------- tools/iana/iana-cbor-c-header.py | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/cbor.h b/src/cbor.h index 5f02a8bd..1516514f 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -404,8 +404,6 @@ typedef enum CborKnownTags { CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag = 60001, // The tagged CBOR array contains attestation evidence data with an Intel SGX report.; Ref: [Shanwei_Cen] CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag = 60002, - // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborAlwaysInvalidTag = 65535, // RAINS Message; Ref: [https://britram.github.io/rains-prototype][Brian_Trammell] CborRainsMsgTag = 15309736, // A CBOR encoded Openswan configuration file, as stored on disk forunit test cases.; Ref: [Michael_Richardson][Samir_Hussain] @@ -416,12 +414,8 @@ typedef enum CborKnownTags { CborArrayOfContentAddrBlocksErisReadCapTag = 1701996915, // ERIS-FS image header; Ref: [Endo_Renberg] CborErisFsImageHeaderTag = 1701996916, - // always invalid; see Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborAlwaysInvalidTag = 4294967295, // Intel FPGA SPDM Manifest; Ref: [Andrew_Draper] - CborIntelFpgaSpdmManifestTag = 4294967296, - // always invalid; Section 10.1; Ref: [draft-bormann-cbor-notable-tags-02] - CborAlwaysInvalidTag = 18446744073709551615 + CborIntelFpgaSpdmManifestTag = 4294967296 } CborKnownTags; /* Start of cbor known tag feature flag autogenerated section */ @@ -431,7 +425,6 @@ typedef enum CborKnownTags { #define CborAMetadataBindingTag CborAMetadataBindingTag #define CborAbsentValueInACborArrayTag CborAbsentValueInACborArrayTag #define CborAlternativesAsGivenByTheUintPlus128Tag CborAlternativesAsGivenByTheUintPlus128Tag -#define CborAlwaysInvalidTag CborAlwaysInvalidTag #define CborArrayOfComplexNumbersInInterleavedFormTag CborArrayOfComplexNumbersInInterleavedFormTag #define CborArrayOfContentAddrBlocksErisReadCapTag CborArrayOfContentAddrBlocksErisReadCapTag #define CborBase64Tag CborBase64Tag diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/iana-cbor-c-header.py index 3681849e..8aa1cfeb 100755 --- a/tools/iana/iana-cbor-c-header.py +++ b/tools/iana/iana-cbor-c-header.py @@ -552,6 +552,10 @@ def iana_cbor_tag_parse_csv(csv_content: str, typedef_enum_name: str): continue if not cbor_tag or "unassigned" in data_item.lower() or "reserved" in semantics.lower(): continue + if "always invalid" in semantics.lower(): + # Always invalid; see Section 10.1,[draft-bormann-cbor-notable-tags-02] + # The purpose of these tag number registrations is to enable the tag numbers to be reserved for internal use by implementation + continue if "-" in cbor_tag: # is a range of value continue # Add to enum list From 8eaa4ef955a3e47881c6ef8103b027717576a712 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Mon, 16 Oct 2023 00:59:00 +1100 Subject: [PATCH 6/7] refactor iana generator --- src/cbor.h | 85 +++--- tools/iana/c/.gitignore | 176 +++++++++++ .../c_header_cbor.py} | 288 ++++-------------- tools/iana/c/iana_header_utils.py | 190 ++++++++++++ tools/iana/c/iana_settings.toml | 12 + tools/iana/iana-cbor-sources.json | 12 - tools/iana/iana_sources.toml | 46 +++ tools/iana/makefile | 9 + 8 files changed, 551 insertions(+), 267 deletions(-) create mode 100644 tools/iana/c/.gitignore rename tools/iana/{iana-cbor-c-header.py => c/c_header_cbor.py} (61%) create mode 100644 tools/iana/c/iana_header_utils.py create mode 100644 tools/iana/c/iana_settings.toml delete mode 100644 tools/iana/iana-cbor-sources.json create mode 100644 tools/iana/iana_sources.toml create mode 100644 tools/iana/makefile diff --git a/src/cbor.h b/src/cbor.h index 1516514f..eec13865 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -123,35 +123,46 @@ typedef enum CborKnownTags { /* 0-23 : Standards Action */ // Standard date/time string; see Section 3.4.1; Ref: [RFC8949] - CborDateTimeStringTag = 0, + CborStdDateTimeStringTag = 0, + CborDateTimeStringTag = 0 /* depreciated but identifier kept for backwards compatibility */, // Epoch-based date/time; see Section 3.4.2; Ref: [RFC8949] - CborUnixTime_tTag = 1, + CborEpochBasedDateTimeTag = 1, + CborUnixTime_tTag = 1 /* depreciated but identifier kept for backwards compatibility */, // Unsigned bignum; see Section 3.4.3; Ref: [RFC8949] - CborPositiveBignumTag = 2, + CborUnsignedBignumTag = 2, + CborPositiveBignumTag = 2 /* depreciated but identifier kept for backwards compatibility */, // Negative bignum; see Section 3.4.3; Ref: [RFC8949] CborNegativeBignumTag = 3, // Decimal fraction; see Section 3.4.4; Ref: [RFC8949] - CborDecimalTag = 4, + CborDecimalFractionTag = 4, + CborDecimalTag = 4 /* depreciated but identifier kept for backwards compatibility */, // Bigfloat; see Section 3.4.4; Ref: [RFC8949] CborBigfloatTag = 5, // COSE Single Recipient Encrypted Data Object; Ref: [RFC9052] - CborCOSE_Encrypt0Tag = 16, + CborCoseSingleRecipientEncryptedDataObjectTag = 16, + CborCOSE_Encrypt0Tag = 16 /* depreciated but identifier kept for backwards compatibility */, // COSE Mac w/o Recipients Object; Ref: [RFC9052] - CborCOSE_Mac0Tag = 17, + CborCoseMacWORecipientsObjectTag = 17, + CborCOSE_Mac0Tag = 17 /* depreciated but identifier kept for backwards compatibility */, // COSE Single Signer Data Object; Ref: [RFC9052] - CborCOSE_Sign1Tag = 18, + CborCoseSingleSignerDataObjectTag = 18, + CborCOSE_Sign1Tag = 18 /* depreciated but identifier kept for backwards compatibility */, // COSE standalone V2 countersignature; Ref: [RFC9338] CborCoseStandaloneV2CountersignatureTag = 19, // Expected conversion to base64url encoding; see Section 3.4.5.2; Ref: [RFC8949] - CborExpectedBase64urlTag = 21, + CborExpectedConversionToBase64urlEncodingTag = 21, + CborExpectedBase64urlTag = 21 /* depreciated but identifier kept for backwards compatibility */, // Expected conversion to base64 encoding; see Section 3.4.5.2; Ref: [RFC8949] - CborExpectedBase64Tag = 22, + CborExpectedConversionToBase64EncodingTag = 22, + CborExpectedBase64Tag = 22 /* depreciated but identifier kept for backwards compatibility */, // Expected conversion to base16 encoding; see Section 3.4.5.2; Ref: [RFC8949] - CborExpectedBase16Tag = 23, + CborExpectedConversionToBase16EncodingTag = 23, + CborExpectedBase16Tag = 23 /* depreciated but identifier kept for backwards compatibility */, /* 24-32767 : Specification Required */ // Encoded CBOR data item; see Section 3.4.5.1; Ref: [RFC8949] - CborEncodedCborTag = 24, + CborEncodedCborDataItemTag = 24, + CborEncodedCborTag = 24 /* depreciated but identifier kept for backwards compatibility */, // reference the nth previously seen string; Ref: [http://cbor.schmorp.de/stringref][Marc_A._Lehmann] CborRefTheNthPrevSeenStringTag = 25, // Serialised Perl object with classname and constructor arguments; Ref: [http://cbor.schmorp.de/perl-object][Marc_A._Lehmann] @@ -167,7 +178,8 @@ typedef enum CborKnownTags { // Absent value in a CBOR Array; Ref: [https://github.com/svaarala/cbor-specs/blob/master/cbor-absent-tag.rst][Sami_Vaarala] CborAbsentValueInACborArrayTag = 31, // URI; see Section 3.4.5.3; Ref: [RFC8949] - CborUrlTag = 32, + CborUriTag = 32, + CborUrlTag = 32 /* depreciated but identifier kept for backwards compatibility */, // base64url; see Section 3.4.5.3; Ref: [RFC8949] CborBase64urlTag = 33, // base64; see Section 3.4.5.3; Ref: [RFC8949] @@ -175,7 +187,8 @@ typedef enum CborKnownTags { // Regular expression; see Section 2.4.4.3; Ref: [RFC7049] CborRegularExpressionTag = 35, // MIME message; see Section 3.4.5.3; Ref: [RFC8949] - CborMimeMessageTag = 36, + CborMimeMsgTag = 36, + CborMimeMessageTag = 36 /* depreciated but identifier kept for backwards compatibility */, // Binary UUID ([RFC4122, Section 4.1.2]); Ref: [https://github.com/lucas-clemente/cbor-specs/blob/master/uuid.md][Lucas_Clemente] CborBinaryUuidTag = 37, // Language-tagged string; Ref: [RFC9290, Appendix A] @@ -253,11 +266,14 @@ typedef enum CborKnownTags { // IEEE 754 binary128, little endian, Typed Array; Ref: [RFC8746] CborIeee754Binary128LittleEndianTypedArrayTag = 87, // COSE Encrypted Data Object; Ref: [RFC9052] - CborCOSE_EncryptTag = 96, + CborCoseEncryptedDataObjectTag = 96, + CborCOSE_EncryptTag = 96 /* depreciated but identifier kept for backwards compatibility */, // COSE MACed Data Object; Ref: [RFC9052] - CborCOSE_MacTag = 97, + CborCoseMacedDataObjectTag = 97, + CborCOSE_MacTag = 97 /* depreciated but identifier kept for backwards compatibility */, // COSE Signed Data Object; Ref: [RFC9052] - CborCOSE_SignTag = 98, + CborCoseSignedDataObjectTag = 98, + CborCOSE_SignTag = 98 /* depreciated but identifier kept for backwards compatibility */, // Number of days since the epoch date 1970-01-01; Ref: [RFC8943] CborNumberOfDaysSinceTheEpochDate19700101Tag = 100, // alternatives as given by the uint + 128; see Section 9.1; Ref: [draft-bormann-cbor-notable-tags-07] @@ -387,7 +403,8 @@ typedef enum CborKnownTags { // PlatformV_IS_TYPE; Ref: [https://github.com/arthurwangtz/platformv-cbor][Wang_Tongzhou] CborPlatformvIsTypeTag = 50012, // Self-described CBOR; see Section 3.4.6; Ref: [RFC8949] - CborSignatureTag = 55799, + CborSelfDescribedCborTag = 55799, + CborSignatureTag = 55799 /* depreciated but identifier kept for backwards compatibility */, // indicates that the file contains CBOR Sequences; Ref: [RFC9277] CborIndicatesThatFileContainsCborSequencesTag = 55800, // indicates that the file starts with a CBOR-Labeled Non-CBOR Data label.; Ref: [RFC9277] @@ -433,33 +450,33 @@ typedef enum CborKnownTags { #define CborBigfloatWithArbitraryExponentTag CborBigfloatWithArbitraryExponentTag #define CborBinaryMimeMsgTag CborBinaryMimeMsgTag #define CborBinaryUuidTag CborBinaryUuidTag -#define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag -#define CborCOSE_EncryptTag CborCOSE_EncryptTag -#define CborCOSE_Mac0Tag CborCOSE_Mac0Tag -#define CborCOSE_MacTag CborCOSE_MacTag -#define CborCOSE_Sign1Tag CborCOSE_Sign1Tag -#define CborCOSE_SignTag CborCOSE_SignTag #define CborCaptureTag CborCaptureTag #define CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag #define CborCborWebTokenTag CborCborWebTokenTag #define CborCompressedByteStringTag CborCompressedByteStringTag #define CborConciseSoftwareIdTag CborConciseSoftwareIdTag #define CborCoseAlgorithmIdBaseHashValueTag CborCoseAlgorithmIdBaseHashValueTag +#define CborCoseEncryptedDataObjectTag CborCoseEncryptedDataObjectTag +#define CborCoseMacWORecipientsObjectTag CborCoseMacWORecipientsObjectTag +#define CborCoseMacedDataObjectTag CborCoseMacedDataObjectTag +#define CborCoseSignedDataObjectTag CborCoseSignedDataObjectTag +#define CborCoseSingleRecipientEncryptedDataObjectTag CborCoseSingleRecipientEncryptedDataObjectTag +#define CborCoseSingleSignerDataObjectTag CborCoseSingleSignerDataObjectTag #define CborCoseStandaloneV2CountersignatureTag CborCoseStandaloneV2CountersignatureTag -#define CborDateTimeStringTag CborDateTimeStringTag #define CborDdosOpenThreatSignalingSigChnObjTag CborDdosOpenThreatSignalingSigChnObjTag +#define CborDecimalFractionTag CborDecimalFractionTag #define CborDecimalFractionWithArbitraryExponentTag CborDecimalFractionWithArbitraryExponentTag -#define CborDecimalTag CborDecimalTag #define CborDurationTag CborDurationTag #define CborEcmascriptRegexpTag CborEcmascriptRegexpTag #define CborEmbeddedJsonObjectTag CborEmbeddedJsonObjectTag +#define CborEncodedCborDataItemTag CborEncodedCborDataItemTag #define CborEncodedCborSequenceTag CborEncodedCborSequenceTag -#define CborEncodedCborTag CborEncodedCborTag +#define CborEpochBasedDateTimeTag CborEpochBasedDateTimeTag #define CborErisBinaryReadCapabilityTag CborErisBinaryReadCapabilityTag #define CborErisFsImageHeaderTag CborErisFsImageHeaderTag -#define CborExpectedBase16Tag CborExpectedBase16Tag -#define CborExpectedBase64Tag CborExpectedBase64Tag -#define CborExpectedBase64urlTag CborExpectedBase64urlTag +#define CborExpectedConversionToBase16EncodingTag CborExpectedConversionToBase16EncodingTag +#define CborExpectedConversionToBase64EncodingTag CborExpectedConversionToBase64EncodingTag +#define CborExpectedConversionToBase64urlEncodingTag CborExpectedConversionToBase64urlEncodingTag #define CborExtendedBigfloatTag CborExtendedBigfloatTag #define CborExtendedDecimalFractionTag CborExtendedDecimalFractionTag #define CborExtendedRationalNumberTag CborExtendedRationalNumberTag @@ -500,7 +517,7 @@ typedef enum CborKnownTags { #define CborMarkValueAsHavingStringReferencesTag CborMarkValueAsHavingStringReferencesTag #define CborMarkValueAsSharedTag CborMarkValueAsSharedTag #define CborMathematicalFiniteSetTag CborMathematicalFiniteSetTag -#define CborMimeMessageTag CborMimeMessageTag +#define CborMimeMsgTag CborMimeMsgTag #define CborMultiDimensionalArrayColumnMajorOrderTag CborMultiDimensionalArrayColumnMajorOrderTag #define CborMultiDimensionalArrayRowMajorOrderTag CborMultiDimensionalArrayRowMajorOrderTag #define CborNegativeBignumTag CborNegativeBignumTag @@ -527,16 +544,15 @@ typedef enum CborKnownTags { #define CborPlatformvIsNameTag CborPlatformvIsNameTag #define CborPlatformvIsTypeTag CborPlatformvIsTypeTag #define CborPlatformvIsValueTag CborPlatformvIsValueTag -#define CborPositiveBignumTag CborPositiveBignumTag #define CborRainsMsgTag CborRainsMsgTag #define CborRationalNumberTag CborRationalNumberTag #define CborRefNthMarkedValueTag CborRefNthMarkedValueTag #define CborRefTheNthPrevSeenStringTag CborRefTheNthPrevSeenStringTag #define CborRegularExpressionTag CborRegularExpressionTag #define CborRelativeObjectIdTag CborRelativeObjectIdTag +#define CborSelfDescribedCborTag CborSelfDescribedCborTag #define CborSerialisedLangIndepObjWithTypeNameConstructorArgTag CborSerialisedLangIndepObjWithTypeNameConstructorArgTag #define CborSerialisedPerlObjWithClassnameConstructorArgTag CborSerialisedPerlObjWithClassnameConstructorArgTag -#define CborSignatureTag CborSignatureTag #define CborSingleComplexNumberTag CborSingleComplexNumberTag #define CborSint16BigEndianTypedArrayTag CborSint16BigEndianTypedArrayTag #define CborSint16LittleEndianTypedArrayTag CborSint16LittleEndianTypedArrayTag @@ -545,6 +561,7 @@ typedef enum CborKnownTags { #define CborSint64BigEndianTypedArrayTag CborSint64BigEndianTypedArrayTag #define CborSint64LittleEndianTypedArrayTag CborSint64LittleEndianTypedArrayTag #define CborSint8TypedArrayTag CborSint8TypedArrayTag +#define CborStdDateTimeStringTag CborStdDateTimeStringTag #define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelSgxRptTag #define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeQuoteTag #define CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag CborTaggedCborArrayContainsAttestEvidenceDataWithAnIntelTeeRptTag @@ -558,8 +575,8 @@ typedef enum CborKnownTags { #define CborUint8TypedArrayTag CborUint8TypedArrayTag #define CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag #define CborUniversalGeoAreaDescriptionShapeTag CborUniversalGeoAreaDescriptionShapeTag -#define CborUnixTime_tTag CborUnixTime_tTag -#define CborUrlTag CborUrlTag +#define CborUnsignedBignumTag CborUnsignedBignumTag +#define CborUriTag CborUriTag #define CborYangBitsDatatypeTag CborYangBitsDatatypeTag #define CborYangEnumerationDatatypeTag CborYangEnumerationDatatypeTag #define CborYangIdentityrefDatatypeTag CborYangIdentityrefDatatypeTag diff --git a/tools/iana/c/.gitignore b/tools/iana/c/.gitignore new file mode 100644 index 00000000..ad4a1f17 --- /dev/null +++ b/tools/iana/c/.gitignore @@ -0,0 +1,176 @@ +# Created by https://www.toptal.com/developers/gitignore/api/python +# Edit at https://www.toptal.com/developers/gitignore?templates=python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +# End of https://www.toptal.com/developers/gitignore/api/python diff --git a/tools/iana/iana-cbor-c-header.py b/tools/iana/c/c_header_cbor.py similarity index 61% rename from tools/iana/iana-cbor-c-header.py rename to tools/iana/c/c_header_cbor.py index 8aa1cfeb..1dbbcc14 100755 --- a/tools/iana/iana-cbor-c-header.py +++ b/tools/iana/c/c_header_cbor.py @@ -38,246 +38,92 @@ - Update or create the C header file with the generated enumeration values, preserving any existing values. """ -import requests import csv import os import re -import email -import time -import json +import tomllib + +import iana_header_utils as utils + +script_dir = os.path.dirname(__file__) spacing_string = " " +iana_cbor_c_header_file_path = './src/cbor-constants.h' +iana_cache_dir_path = './cache/cbor/' -iana_cbor_c_header_file_path = 'src/cbor.h' -iana_cache_dir_path = 'tools/iana/cache/' +iana_source_filepath = os.path.join(script_dir, "../iana_sources.toml") +iana_settings_filepath = os.path.join(script_dir, "iana_settings.toml") # Override default to tiny cbor compatibility mode (History: https://github.com/intel/tinycbor/issues/240) -tiny_cbor_style_override = True +tiny_cbor_style_override = False + +iana_cbor_settings = { + "simple_value" : { + "name" : "cbor_simple_value" + }, + "tag_source" : { + "name" : "cbor_tag" + } +} # Default Source # This is because this script should be as standalone as possible and the url is unlikely to change -iana_cbor_simple_value_settings = { - "name" : "cbor_simple_value", +iana_cbor_simple_value_source = { "title" : "IANA CBOR Content-Formats", "csv_url" : "https://www.iana.org/assignments/cbor-simple-values/simple.csv", "source_url" : "https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple", } -iana_cbor_tag_settings = { - "name" : "cbor_tag", +iana_cbor_tag_source = { "title" : "IANA CBOR Tags", "csv_url" : "https://www.iana.org/assignments/cbor-tags/tags.csv", "source_url" : "https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags", } -if tiny_cbor_style_override: - iana_cbor_simple_value_settings["name"] = "CborSimpleValue" - iana_cbor_tag_settings["name"] = "CborKnownTags" - -# Load the iana data sources from the JSON file if avaliable +# Load the iana data sources from the toml file if avaliable try: - with open('iana-cbor-sources.json', 'r') as config_file: - config = json.load(config_file) - iana_cbor_simple_value_settings.update(config.get('iana_cbor_simple_value_settings', {})) - iana_cbor_tag_settings.update(config.get('iana_cbor_tag_settings', {})) - print("Info: IANA Source Settings Config File loaded") + with open(iana_source_filepath, 'rb') as source_file: + config = tomllib.load(source_file) + iana_cbor_simple_value_source.update(config.get('iana_cbor_simple_value_source', {})) + iana_cbor_tag_source.update(config.get('iana_cbor_tag_source', {})) + print("Info: IANA Source Config File loaded") except FileNotFoundError: - # Handle the case where the JSON file doesn't exist - print("Warning: IANA Source Settings Config File does not exist. Using default settings.") - -default_cbor_header_c = """ -// IANA CBOR Headers -// Source: https://github.com/mofosyne/iana-headers - -""" - - -############################################################################### -# Download Handler - -def read_or_download_csv(csv_url: str, cache_file: str): - """ - Load latest IANA registrations - """ - def download_csv(csv_url: str, cache_file: str): - print(f"Downloading CSV file {csv_url} to {cache_file}") - response = requests.get(csv_url) - if response.status_code != 200: - raise Exception(f"Failed to fetch CSV content from {csv_url} got http status code {str(response.status_code)}") - csv_content = response.text - os.makedirs(os.path.dirname(cache_file), exist_ok=True) - with open(cache_file, "w", encoding="utf-8") as file: - file.write(csv_content) - return csv_content - def read_cache_csv(cache_file: str): - """ - No change detected. Use cached file - """ - print("Read cache...") - with open(cache_file, "r", encoding="utf-8") as file: - return file.read() - raise Exception(f"Cache file not found {cache_file}") - - print(f"Checking {csv_url} (cache:{cache_file})") - - try: - if not os.path.exists(cache_file): - print("cache file not found...") - return download_csv(csv_url, cache_file) - - # Cache file already exist. Check if outdated - response = requests.head(csv_url) - - # Check if last modified is still present - if 'last-modified' not in response.headers: - print("cannot find last modified date time...") - return read_cache_csv(cache_file) - - # Get cache and remote timestamp - remote_last_modified = response.headers['last-modified'] - remote_timestamp = time.mktime(email.utils.parsedate_to_datetime(remote_last_modified).timetuple()) - cached_timestamp = os.path.getmtime(cache_file) - print(f"remote last modified: {remote_timestamp}") - print(f"cached last modified: {cached_timestamp}") - - # Check if cache is still valid - if remote_timestamp <= cached_timestamp: - print("Cache still valid...") - return read_cache_csv(cache_file) - - print("Outdated cache...") - return download_csv(csv_url, cache_file) - except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError) as err: - print(f"An error occurred: {err}") - if os.path.exists(cache_file): - return read_cache_csv(cache_file) - else: - raise Exception(f"Cache file not found") - except Exception as e: - raise Exception(f"An unexpected error occurred: {e}") - + # Handle the case where the toml file doesn't exist + print(f"Warning: IANA Source Config File does not exist. Using default settings. {iana_source_filepath}") -############################################################################### -# C Code Generation Utilities - -def get_content_of_typedef_enum(c_code: str, typedef_enum_name: str) -> str: - match = re.search(fr'typedef enum [^{{]*\{{([^}}]*)\}} {typedef_enum_name};', c_code, flags=re.DOTALL) - if not match: - return None - - return match.group(1) - -def override_enum_from_existing_typedef_enum(header_file_content: str, c_typedef_name: str, c_enum_list): - """ - Check for existing enum so we do not break it - """ - def extract_enum_values_from_typedef_enum(c_code: str, existing_enum_content: str) -> str: - matches = re.findall(r'(\w+)\s*=\s*(\d+)', existing_enum_content) - - enum_values = {} - for match in matches: - enum_name, enum_value = match - enum_values[int(enum_value)] = enum_name - - return enum_values - existing_enum_content = get_content_of_typedef_enum(header_file_content, c_typedef_name) - existing_enum_name = extract_enum_values_from_typedef_enum(header_file_content, existing_enum_content) - for id_value, row in sorted(existing_enum_name.items()): - if id_value in c_enum_list: # Override - c_enum_list[id_value]["enum_name"] = existing_enum_name[id_value] - else: # Add - c_enum_list[id_value] = {"enum_name" : existing_enum_name[id_value]} - return c_enum_list - -def generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker = None): - c_range_marker_index = 0 - def range_marker_render(c_range_marker, id_value=None): - nonlocal c_range_marker_index - if c_range_marker is None: - return '' - - range_marker_content = '' - while c_range_marker_index < len(c_range_marker): - start_range = c_range_marker[c_range_marker_index].get("start") - end_range = c_range_marker[c_range_marker_index].get("end") - range_comment = c_range_marker[c_range_marker_index].get("description") - if id_value is None or start_range <= id_value: - range_marker_content += '\n' + spacing_string + f'/* {start_range}-{end_range} : {range_comment} */\n' - c_range_marker_index += 1 - continue - break - - return range_marker_content - - c_enum_content = c_head_comment - - for id_value, row in sorted(c_enum_list.items()): - c_enum_content += range_marker_render(c_range_marker, id_value) - if "comment" in row: - c_enum_content += spacing_string + f'// {row.get("comment", "")}\n' - c_enum_content += spacing_string + f'{row.get("enum_name", "")} = {id_value}' + (',\n' if id_value != sorted(c_enum_list)[-1] else '\n') - - c_enum_content += range_marker_render(c_range_marker) - - return c_enum_content - -def update_c_typedef_enum(document_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker = None): - def search_and_replace_c_typedef_enum(document_content, c_enum_content, typename, enumname = None): - # Search and replace - enumname = "" if enumname is None else (enumname + " ") - pattern = fr'typedef enum [^{{]*\{{([^}}]*)\}} {typename};' - replacement = f'typedef enum {enumname}{{\n{c_enum_content}}} {typename};' - updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) - return updated_document_content - - # Check if already exist, if not then create one - if not get_content_of_typedef_enum(document_content, c_typedef_name): - document_content += f'typedef enum {{\n}} {c_typedef_name};\n\n' - - # Old name takes priority for backwards compatibility (unless overridden) - c_enum_content = override_enum_from_existing_typedef_enum(document_content, c_typedef_name, c_enum_list) - - # Generate enumeration header content - c_enum_content = generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker) - - # Search for typedef enum name and replace with new content - updated_document_content = search_and_replace_c_typedef_enum(document_content, c_enum_content, c_typedef_name, c_enum_name) - return updated_document_content +# Load settings +try: + with open(iana_settings_filepath, 'rb') as config_file: + toml_data = tomllib.load(config_file) + cbor_settings = toml_data['cbor'] -def get_content_of_const_macro(c_code: str, section_name: str) -> str: - pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\/\* End of {section_name} autogenerated section \*\/' - match = re.search(pattern, c_code, flags=re.DOTALL) - if not match: - return None + spacing_string = cbor_settings.get('spacing_string', spacing_string) + iana_cbor_c_header_file_path = cbor_settings.get('generated_header_filepath') + iana_cache_dir_path = cbor_settings.get('cache_directory_path') - return match.group(1) + if cbor_settings.get('style_override', None) == "tiny_cbor": + tiny_cbor_style_override = True -def update_c_const_macro(document_content, section_name, c_head_comment, c_macro_list): - def search_and_replace_c_const_macro(document_content, section_name, new_content): - # Search and replace - pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\n\/\* End of {section_name} autogenerated section \*\/' - replacement = f'/* Start of {section_name} autogenerated section */\n{new_content}/* End of {section_name} autogenerated section */' - updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) - return updated_document_content + iana_cbor_settings["simple_value"].update(cbor_settings.get('simple_value', {})) + iana_cbor_settings["tag_source"].update(cbor_settings.get('tag_source', {})) - # Check if already exist, if not then create one - if not get_content_of_const_macro(document_content, section_name): - document_content += f'/* Start of {section_name} autogenerated section */\n' - document_content += f'/* End of {section_name} autogenerated section */' + print("Info: IANA Settings Config File loaded") +except FileNotFoundError: + # Handle the case where the toml file doesn't exist + print(f"Warning: IANA Settings Config File does not exist. Using default settings. {iana_settings_filepath}") - # Generate enumeration header content - c_const_macro_content = c_head_comment - for macro_name, macro_data in sorted(c_macro_list.items()): - c_const_macro_content += f"#define {macro_name} {macro_data.get('value')}" - if 'comment' in macro_data: - c_const_macro_content += f" // {macro_data.get('comment')}" - c_const_macro_content += "\n" +# Path is all relative to this script +# Note: This approach was chosen to keep things simple, as each project would only have one header file) +# (Admittely, if the script location changes, you have to update the settings, but if it's an issue, we can cross that bridge later) +iana_cbor_c_header_file_path = os.path.join(script_dir, iana_cbor_c_header_file_path) +iana_cache_dir_path = os.path.join(script_dir, iana_cache_dir_path) - # Search for typedef enum name and replace with new content - updated_document_content = search_and_replace_c_const_macro(document_content, section_name, c_const_macro_content) +default_cbor_header_c = """ +// IANA CBOR Headers +// Source: https://github.com/mofosyne/iana-headers - return updated_document_content +""" ############################################################################### # Content Format Generation @@ -328,10 +174,10 @@ def iana_cbor_simple_values_parse_csv(csv_content: str, typedef_enum_name: str): return enum_list def iana_cbor_simple_values_c_typedef_enum_update(header_file_content: str) -> str: - typedef_enum_name = iana_cbor_simple_value_settings["name"] - source_name = iana_cbor_simple_value_settings["title"] - source_url = iana_cbor_simple_value_settings["source_url"] - csv_file_url = iana_cbor_simple_value_settings["csv_url"] + typedef_enum_name = iana_cbor_settings["simple_value"]["name"] + source_name = iana_cbor_simple_value_source["title"] + source_url = iana_cbor_simple_value_source["source_url"] + csv_file_url = iana_cbor_simple_value_source["csv_url"] cache_file_path = iana_cache_dir_path + os.path.basename(csv_file_url) # Generate typedef name @@ -346,7 +192,7 @@ def iana_cbor_simple_values_c_typedef_enum_update(header_file_content: str) -> s c_head_comment = spacing_string + f"/* Autogenerated {source_name} (Source: {source_url}) */\n" # Load latest IANA registrations - csv_content = read_or_download_csv(csv_file_url, cache_file_path) + csv_content = utils.read_or_download_csv(csv_file_url, cache_file_path) # Parse and process IANA registration into enums c_enum_list = iana_cbor_simple_values_parse_csv(csv_content, typedef_enum_name) @@ -356,7 +202,7 @@ def iana_cbor_simple_values_c_typedef_enum_update(header_file_content: str) -> s {"start":0, "end":19, "description":"Standards Action"}, {"start":32, "end":255, "description":"Specification Required"} ] - return update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker) + return utils.update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker, spacing_string=spacing_string) ############################################################################### @@ -565,10 +411,10 @@ def iana_cbor_tag_parse_csv(csv_content: str, typedef_enum_name: str): return c_enum_list def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: - typedef_enum_name = iana_cbor_tag_settings["name"] - source_name = iana_cbor_tag_settings["title"] - source_url = iana_cbor_tag_settings["source_url"] - csv_file_url = iana_cbor_tag_settings["csv_url"] + typedef_enum_name = iana_cbor_settings["tag_source"]["name"] + source_name = iana_cbor_tag_source["title"] + source_url = iana_cbor_tag_source["source_url"] + csv_file_url = iana_cbor_tag_source["csv_url"] cache_file_path = iana_cache_dir_path + os.path.basename(csv_file_url) # Generate typedef name @@ -583,7 +429,7 @@ def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: c_head_comment = spacing_string + f"/* Autogenerated {source_name} (Source: {source_url}) */\n" # Load latest IANA registrations - csv_content = read_or_download_csv(csv_file_url, cache_file_path) + csv_content = utils.read_or_download_csv(csv_file_url, cache_file_path) # Parse and process IANA registration into enums c_enum_list = iana_cbor_tag_parse_csv(csv_content, typedef_enum_name) @@ -594,7 +440,7 @@ def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: {"start":24, "end":32767, "description":"Specification Required"}, {"start":32768, "end":18446744073709551615, "description":"First Come First Served"} ] - header_file_content = update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker) + header_file_content = utils.update_c_typedef_enum(header_file_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker, spacing_string=spacing_string) # Generate constants for cbor tag feature flag # Note: Not convinced this is a good idea, so is restricted to tiny cbor compatibility mode @@ -602,7 +448,7 @@ def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: c_macro_list = {} for id_value, row in c_enum_list.items(): c_macro_list[row["enum_name"]] = {"value": row["enum_name"]} - header_file_content = update_c_const_macro(header_file_content, "cbor known tag feature flag", "/* #define the constants so we can check with #ifdef */\n", c_macro_list) + header_file_content = utils.update_c_const_macro(header_file_content, "cbor known tag feature flag", "/* #define the constants so we can check with #ifdef */\n", c_macro_list) return header_file_content diff --git a/tools/iana/c/iana_header_utils.py b/tools/iana/c/iana_header_utils.py new file mode 100644 index 00000000..4db9cb78 --- /dev/null +++ b/tools/iana/c/iana_header_utils.py @@ -0,0 +1,190 @@ +import os +import re +import time +import email +import requests + + +############################################################################### +# CSV Handlers + +def _download_csv(csv_url: str, cache_file: str) -> str: + """Downloads CSV content from a URL and saves it to a cache file.""" + response = requests.get(csv_url) + response.raise_for_status() + + csv_content = response.text + os.makedirs(os.path.dirname(cache_file), exist_ok=True) + with open(cache_file, "w", encoding="utf-8") as file: + file.write(csv_content) + + return csv_content + +def _read_cache_csv(cache_file: str) -> str: + """Reads the cached CSV content from a file.""" + with open(cache_file, "r", encoding="utf-8") as file: + return file.read() + +def read_or_download_csv(csv_url: str, cache_file: str) -> str: + """ + Fetches CSV content either from a URL or from a cache file. + + Will only download and overwrite the cache file if the remote file has changed since last download. + """ + try: + response = requests.head(csv_url) + if not os.path.exists(cache_file) or 'last-modified' not in response.headers: + return _download_csv(csv_url, cache_file) + + remote_last_modified = response.headers['last-modified'] + remote_timestamp = time.mktime(email.utils.parsedate_to_datetime(remote_last_modified).timetuple()) + cached_timestamp = os.path.getmtime(cache_file) + if remote_timestamp > cached_timestamp: + return _download_csv(csv_url, cache_file) + + return _read_cache_csv(cache_file) + + except requests.RequestException as err: + if os.path.exists(cache_file): + return _read_cache_csv(cache_file) + raise Exception("Error fetching CSV and no cache available.") from err + +############################################################################### +# C Code Generation Utilities + +def get_content_of_typedef_enum(c_code: str, typedef_enum_name: str) -> str: + match = re.search(fr'typedef enum [^{{]*\{{([^}}]*)\}} {typedef_enum_name};', c_code, flags=re.DOTALL) + if not match: + return None + + return match.group(1) + +def override_enum_from_existing_typedef_enum(header_file_content: str, c_typedef_name: str, c_enum_list, depreciated_enum_support = True): + """ + Check for existing enum so we do not break it + """ + def extract_enum_values_from_typedef_enum(c_code: str, existing_enum_content: str) -> str: + matches = re.findall(r'(\w+)\s*=\s*(\d+)', existing_enum_content) + + enum_values = {} + for match in matches: + enum_name, enum_value = match + if int(enum_value) in enum_values: + enum_values[int(enum_value)].append(enum_name) + else: + enum_values[int(enum_value)] = [enum_name] + + return enum_values + + existing_enum_content = get_content_of_typedef_enum(header_file_content, c_typedef_name) + existing_enum_name_list = extract_enum_values_from_typedef_enum(header_file_content, existing_enum_content) + for id_value, existing_enum_name_list_entry in sorted(existing_enum_name_list.items()): + for existing_enum_name in existing_enum_name_list_entry: + # Check if we already have a generated value for this existing entry + if id_value in c_enum_list: # Override + expected_enum_name = c_enum_list[id_value]["enum_name"] + # Check if duplicated + if existing_enum_name != expected_enum_name: + # Existing Enum Name Does Not Match With This Name + if depreciated_enum_support: + # Preserve But Mark As Depreciated / Backward Compatible + c_enum_list[id_value]["depreciated_enum_name"] = existing_enum_name + else: + # Preserve But Override + c_enum_list[id_value]["enum_name"] = existing_enum_name + else: # Add + c_enum_list[id_value] = {"enum_name" : existing_enum_name} + return c_enum_list + +def generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker = None, spacing_string = " "): + c_range_marker_index = 0 + def range_marker_render(c_range_marker, id_value=None): + nonlocal c_range_marker_index + if c_range_marker is None: + return '' + + range_marker_content = '' + while c_range_marker_index < len(c_range_marker): + start_range = c_range_marker[c_range_marker_index].get("start") + end_range = c_range_marker[c_range_marker_index].get("end") + range_comment = c_range_marker[c_range_marker_index].get("description") + if id_value is None or start_range <= id_value: + range_marker_content += '\n' + spacing_string + f'/* {start_range}-{end_range} : {range_comment} */\n' + c_range_marker_index += 1 + continue + break + + return range_marker_content + + c_enum_content = c_head_comment + + for id_value, row in sorted(c_enum_list.items()): + c_enum_content += range_marker_render(c_range_marker, id_value) + if "comment" in row: + c_enum_content += spacing_string + f'// {row.get("comment", "")}\n' + c_enum_content += spacing_string + f'{row.get("enum_name", "")} = {id_value}' + if "depreciated_enum_name" in row: + c_enum_content += ',\n' + spacing_string + f'{row.get("depreciated_enum_name", "")} = {id_value} /* depreciated but identifier kept for backwards compatibility */' + c_enum_content += (',\n' if id_value != sorted(c_enum_list)[-1] else '\n') + + c_enum_content += range_marker_render(c_range_marker) + + return c_enum_content + +def update_c_typedef_enum(document_content, c_typedef_name, c_enum_name, c_head_comment, c_enum_list, c_range_marker = None, spacing_string = " "): + def search_and_replace_c_typedef_enum(document_content, c_enum_content, typename, enumname = None): + # Search and replace + enumname = "" if enumname is None else (enumname + " ") + pattern = fr'typedef enum [^{{]*\{{([^}}]*)\}} {typename};' + replacement = f'typedef enum {enumname}{{\n{c_enum_content}}} {typename};' + updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) + return updated_document_content + + # Check if already exist, if not then create one + if not get_content_of_typedef_enum(document_content, c_typedef_name): + document_content += f'typedef enum {{\n}} {c_typedef_name};\n\n' + + # Old name takes priority for backwards compatibility (unless overridden) + c_enum_content = override_enum_from_existing_typedef_enum(document_content, c_typedef_name, c_enum_list) + + # Generate enumeration header content + c_enum_content = generate_c_enum_content(c_head_comment, c_enum_list, c_range_marker, spacing_string=spacing_string) + + # Search for typedef enum name and replace with new content + updated_document_content = search_and_replace_c_typedef_enum(document_content, c_enum_content, c_typedef_name, c_enum_name) + + return updated_document_content + +def get_content_of_const_macro(c_code: str, section_name: str) -> str: + pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\/\* End of {section_name} autogenerated section \*\/' + match = re.search(pattern, c_code, flags=re.DOTALL) + if not match: + return None + + return match.group(1) + +def update_c_const_macro(document_content, section_name, c_head_comment, c_macro_list): + def search_and_replace_c_const_macro(document_content, section_name, new_content): + # Search and replace + pattern = fr'\/\* Start of {section_name} autogenerated section \*\/(.*?)\n\/\* End of {section_name} autogenerated section \*\/' + replacement = f'/* Start of {section_name} autogenerated section */\n{new_content}/* End of {section_name} autogenerated section */' + updated_document_content = re.sub(pattern, replacement, document_content, flags=re.DOTALL) + return updated_document_content + + # Check if already exist, if not then create one + if not get_content_of_const_macro(document_content, section_name): + document_content += f'/* Start of {section_name} autogenerated section */\n' + document_content += f'/* End of {section_name} autogenerated section */' + + # Generate enumeration header content + c_const_macro_content = c_head_comment + for macro_name, macro_data in sorted(c_macro_list.items()): + c_const_macro_content += f"#define {macro_name} {macro_data.get('value')}" + if 'comment' in macro_data: + c_const_macro_content += f" // {macro_data.get('comment')}" + c_const_macro_content += "\n" + + # Search for typedef enum name and replace with new content + updated_document_content = search_and_replace_c_const_macro(document_content, section_name, c_const_macro_content) + + return updated_document_content diff --git a/tools/iana/c/iana_settings.toml b/tools/iana/c/iana_settings.toml new file mode 100644 index 00000000..c39df12f --- /dev/null +++ b/tools/iana/c/iana_settings.toml @@ -0,0 +1,12 @@ + +[cbor] +spacing_string = " " +style_override = "tiny_cbor" +generated_header_filepath = '../../../src/cbor.h' +cache_directory_path = './cache/cbor/' + +[cbor.simple_value] +name = "CborSimpleValue" + +[cbor.tag_source] +name = "CborKnownTags" diff --git a/tools/iana/iana-cbor-sources.json b/tools/iana/iana-cbor-sources.json deleted file mode 100644 index 9df13638..00000000 --- a/tools/iana/iana-cbor-sources.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "iana_cbor_simple_value_settings": { - "title": "IANA CBOR Content-Formats", - "csv_url": "https://www.iana.org/assignments/cbor-simple-values/simple.csv", - "source_url": "https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple" - }, - "iana_cbor_tag_settings": { - "title": "IANA CBOR Tags", - "csv_url": "https://www.iana.org/assignments/cbor-tags/tags.csv", - "source_url": "https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags" - } -} diff --git a/tools/iana/iana_sources.toml b/tools/iana/iana_sources.toml new file mode 100644 index 00000000..121c3d3b --- /dev/null +++ b/tools/iana/iana_sources.toml @@ -0,0 +1,46 @@ +[iana_cbor_simple_value_source] +title = "IANA CBOR Content-Formats" +csv_url = "https://www.iana.org/assignments/cbor-simple-values/simple.csv" +source_url = "https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xhtml#simple" + +[iana_cbor_tag_source] +title = "IANA CBOR Tags" +csv_url = "https://www.iana.org/assignments/cbor-tags/tags.csv" +source_url = "https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml#tags" + +[iana_coap_request_response_source] +title = "IANA CoAP Request/Response" +# Method +request_csv_url = "https://www.iana.org/assignments/core-parameters/method-codes.csv" +request_source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#method-codes" +# Response +response_csv_url = "https://www.iana.org/assignments/core-parameters/response-codes.csv" +response_source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#response-codes" +# Signaling Codes +signaling_csv_url = "https://www.iana.org/assignments/core-parameters/signaling-codes.csv" +signaling_source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#signaling-codes" + +[iana_coap_option_source] +title = "IANA CoAP Option Numbers" +csv_url = "https://www.iana.org/assignments/core-parameters/option-numbers.csv" +source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#option-numbers" + +[iana_coap_content_format_source] +title = "IANA CoAP Content-Formats" +csv_url = "https://www.iana.org/assignments/core-parameters/content-formats.csv" +source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats" + +[iana_coap_signaling_option_numbers_source] +title = "IANA CoAP Option Numbers" +csv_url = "https://www.iana.org/assignments/core-parameters/signaling-option-numbers.csv" +source = "https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#signaling-option-numbers" + +[iana_http_status_code_source] +title = "IANA HTTP Status Code" +csv_url = "https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv" +source_url = "https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml#http-status-codes-1" + +[iana_http_field_name_source] +title = "IANA HTTP Field Name" +csv_url = "https://www.iana.org/assignments/http-fields/field-names.csv" +source_url = "https://www.iana.org/assignments/http-fields/http-fields.xhtml#field-names" diff --git a/tools/iana/makefile b/tools/iana/makefile new file mode 100644 index 00000000..1b7b2e34 --- /dev/null +++ b/tools/iana/makefile @@ -0,0 +1,9 @@ + +.PHONY: generate +generate: + @echo "Generating Headers" + cd c; python3.11 ./c_header_cbor.py + +.PHONY: clean +clean: + rm -rf ./c/cache/* From e655402bb2e1861d8aef152110f70c7a39939709 Mon Sep 17 00:00:00 2001 From: brian khuu Date: Mon, 16 Oct 2023 23:36:19 +1100 Subject: [PATCH 7/7] depreciated enum name supported in tag feature flag --- src/cbor.h | 17 +++++++++++++++++ tools/iana/c/c_header_cbor.py | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/cbor.h b/src/cbor.h index eec13865..7ddff0ca 100644 --- a/src/cbor.h +++ b/src/cbor.h @@ -450,6 +450,12 @@ typedef enum CborKnownTags { #define CborBigfloatWithArbitraryExponentTag CborBigfloatWithArbitraryExponentTag #define CborBinaryMimeMsgTag CborBinaryMimeMsgTag #define CborBinaryUuidTag CborBinaryUuidTag +#define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag +#define CborCOSE_EncryptTag CborCOSE_EncryptTag +#define CborCOSE_Mac0Tag CborCOSE_Mac0Tag +#define CborCOSE_MacTag CborCOSE_MacTag +#define CborCOSE_Sign1Tag CborCOSE_Sign1Tag +#define CborCOSE_SignTag CborCOSE_SignTag #define CborCaptureTag CborCaptureTag #define CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag CborCborEncOpenswanConfigFileAsStoredOnDiskForunitTestCasesTag #define CborCborWebTokenTag CborCborWebTokenTag @@ -463,17 +469,23 @@ typedef enum CborKnownTags { #define CborCoseSingleRecipientEncryptedDataObjectTag CborCoseSingleRecipientEncryptedDataObjectTag #define CborCoseSingleSignerDataObjectTag CborCoseSingleSignerDataObjectTag #define CborCoseStandaloneV2CountersignatureTag CborCoseStandaloneV2CountersignatureTag +#define CborDateTimeStringTag CborDateTimeStringTag #define CborDdosOpenThreatSignalingSigChnObjTag CborDdosOpenThreatSignalingSigChnObjTag #define CborDecimalFractionTag CborDecimalFractionTag #define CborDecimalFractionWithArbitraryExponentTag CborDecimalFractionWithArbitraryExponentTag +#define CborDecimalTag CborDecimalTag #define CborDurationTag CborDurationTag #define CborEcmascriptRegexpTag CborEcmascriptRegexpTag #define CborEmbeddedJsonObjectTag CborEmbeddedJsonObjectTag #define CborEncodedCborDataItemTag CborEncodedCborDataItemTag #define CborEncodedCborSequenceTag CborEncodedCborSequenceTag +#define CborEncodedCborTag CborEncodedCborTag #define CborEpochBasedDateTimeTag CborEpochBasedDateTimeTag #define CborErisBinaryReadCapabilityTag CborErisBinaryReadCapabilityTag #define CborErisFsImageHeaderTag CborErisFsImageHeaderTag +#define CborExpectedBase16Tag CborExpectedBase16Tag +#define CborExpectedBase64Tag CborExpectedBase64Tag +#define CborExpectedBase64urlTag CborExpectedBase64urlTag #define CborExpectedConversionToBase16EncodingTag CborExpectedConversionToBase16EncodingTag #define CborExpectedConversionToBase64EncodingTag CborExpectedConversionToBase64EncodingTag #define CborExpectedConversionToBase64urlEncodingTag CborExpectedConversionToBase64urlEncodingTag @@ -517,6 +529,7 @@ typedef enum CborKnownTags { #define CborMarkValueAsHavingStringReferencesTag CborMarkValueAsHavingStringReferencesTag #define CborMarkValueAsSharedTag CborMarkValueAsSharedTag #define CborMathematicalFiniteSetTag CborMathematicalFiniteSetTag +#define CborMimeMessageTag CborMimeMessageTag #define CborMimeMsgTag CborMimeMsgTag #define CborMultiDimensionalArrayColumnMajorOrderTag CborMultiDimensionalArrayColumnMajorOrderTag #define CborMultiDimensionalArrayRowMajorOrderTag CborMultiDimensionalArrayRowMajorOrderTag @@ -544,6 +557,7 @@ typedef enum CborKnownTags { #define CborPlatformvIsNameTag CborPlatformvIsNameTag #define CborPlatformvIsTypeTag CborPlatformvIsTypeTag #define CborPlatformvIsValueTag CborPlatformvIsValueTag +#define CborPositiveBignumTag CborPositiveBignumTag #define CborRainsMsgTag CborRainsMsgTag #define CborRationalNumberTag CborRationalNumberTag #define CborRefNthMarkedValueTag CborRefNthMarkedValueTag @@ -553,6 +567,7 @@ typedef enum CborKnownTags { #define CborSelfDescribedCborTag CborSelfDescribedCborTag #define CborSerialisedLangIndepObjWithTypeNameConstructorArgTag CborSerialisedLangIndepObjWithTypeNameConstructorArgTag #define CborSerialisedPerlObjWithClassnameConstructorArgTag CborSerialisedPerlObjWithClassnameConstructorArgTag +#define CborSignatureTag CborSignatureTag #define CborSingleComplexNumberTag CborSingleComplexNumberTag #define CborSint16BigEndianTypedArrayTag CborSint16BigEndianTypedArrayTag #define CborSint16LittleEndianTypedArrayTag CborSint16LittleEndianTypedArrayTag @@ -575,8 +590,10 @@ typedef enum CborKnownTags { #define CborUint8TypedArrayTag CborUint8TypedArrayTag #define CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag CborUniversalGeoAreaDescriptionDescriptionOfVelocityTag #define CborUniversalGeoAreaDescriptionShapeTag CborUniversalGeoAreaDescriptionShapeTag +#define CborUnixTime_tTag CborUnixTime_tTag #define CborUnsignedBignumTag CborUnsignedBignumTag #define CborUriTag CborUriTag +#define CborUrlTag CborUrlTag #define CborYangBitsDatatypeTag CborYangBitsDatatypeTag #define CborYangEnumerationDatatypeTag CborYangEnumerationDatatypeTag #define CborYangIdentityrefDatatypeTag CborYangIdentityrefDatatypeTag diff --git a/tools/iana/c/c_header_cbor.py b/tools/iana/c/c_header_cbor.py index 1dbbcc14..cc4d2b9b 100755 --- a/tools/iana/c/c_header_cbor.py +++ b/tools/iana/c/c_header_cbor.py @@ -448,6 +448,8 @@ def iana_cbor_tag_c_typedef_enum_update(header_file_content: str) -> str: c_macro_list = {} for id_value, row in c_enum_list.items(): c_macro_list[row["enum_name"]] = {"value": row["enum_name"]} + if "depreciated_enum_name" in row: + c_macro_list[row["depreciated_enum_name"]] = {"value": row["depreciated_enum_name"]} header_file_content = utils.update_c_const_macro(header_file_content, "cbor known tag feature flag", "/* #define the constants so we can check with #ifdef */\n", c_macro_list) return header_file_content