QCBOR 2.0 alpha 1
Pre-releaseThis is a QCBOR 2.0 alpha release. It is suitable for testing and prototyping,
but not commercial use. The planned 2.0 changes are in, but they are
not fully tested or documented. The interface is also subject to change.
QCBOR 2.0 is compatible with 1.0 with one exception that can be overridden
with a call to QCBORDecode_Compatibilityv1().
Please file issues found with this release in GitHub.
Major Changes
-
While decoding, unexpected tag numbers generate an error rather than being silently ignored. This is more correct decoding behavior.
-
New API to explicitly decode tag numbers to make tag numbers easier to work with.
-
Plug-in API scheme for custom tag content processors.
-
Sort maps and check for duplicate labels when encoding.
-
Encode modes for dCBOR, CDE and Preferred Serialization.
-
Decode modes that check for conformance with dCBOR, CDE and Preferred Serialization.
-
Full support for preferred serialization of big numbers, decimal fractions and big numbers.
-
Full support for 65-bit negative integers.
-
The interfaces (and sources) are split into multiple files.
Compatibility with QCBOR v1
QCBOR v1 decoding does not error out when a tag number occurs where it is not
expected. QCBOR v2 does. Tag numbers really do change the type of an
item, so it is more correct to error out.
For many protocols, the v2 behavior produces a more correct implementation,
so it is often better to not return to QCBOR v1 behavior.
Another difference is that the tag content decoders for big numbers,
big floats, URIs and such are not enabled by default. These are
what notices the things like the big number and big float tags,
decodes them and turns them into QCBOR types for big numbers and floats.
QCBORDecode_Compatibilityv1() disables the error out on unprocessed
tag numbers and installs the same tag content decoders that v1 has.
The tag number decoders can be installed with the retention of
erroring out on unprocessed tag numbers by calling
QCBORDecode_InstallTagDecoders(pMe, QCBORDecode_TagDecoderTablev1, NULL);
QCBOR v2 requires tag numbers to be consumed in one of three ways.
It may be consumed explicitly with QCBORDecode_GetNextTagNumber().
It may be consumed by a tag content process or like QCBORDecode_DateEpochTagCB()
installed with QCBORDecode_InstallTagDecoders(). It may be
consumed with a spiffy decode function like QCBORDecode_GetTBigNumber().