Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a code generator to update CborKnownTags enum list from IANA #240

Open
mofosyne opened this issue Sep 24, 2023 · 2 comments
Open

Use a code generator to update CborKnownTags enum list from IANA #240

mofosyne opened this issue Sep 24, 2023 · 2 comments

Comments

@mofosyne
Copy link
Contributor

mofosyne commented Sep 24, 2023

Created https://github.com/mofosyne/iana-headers/blob/main/cbor/c/cbor-constants.h#L22-L31 but noticed that

tinycbor/src/cbor.h

Lines 105 to 128 in 04b306c

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
} CborKnownTags;
has a different naming approach so it's not directly adaptable to use my existing codegenerator (written in python).

Also it doesn't seem like the enum is directly referenced in the code so am proposing to add a iana-cbor-constant.h so you can still keep the existing CborKnownTags for backwards compatibility. Other option is to manually adapt the python code to match tinycbor naming convention.

@thiagomacieira
Copy link
Member

Adapting the naming from your generator shouldn't be too difficult, though.

@mofosyne
Copy link
Contributor Author

mofosyne commented Oct 1, 2023

Okay gave it a shot https://github.com/intel/tinycbor/pull/241/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants