opnsense-src/contrib/libcbor/doc/source/api/encoding.rst
Ed Maste f55904f2f6 Import libcbor at 'contrib/libcbor/'
git-subtree-dir: contrib/libcbor
git-subtree-mainline: 293663f4da
git-subtree-split: 5b2defbd2a
(cherry picked from commit 10ff414c14)
2022-02-09 16:23:53 -05:00

23 lines
893 B
ReStructuredText

Encoding
=============================
The easiest way to encode data items is using the :func:`cbor_serialize` or :func:`cbor_serialize_alloc` functions:
.. doxygenfunction:: cbor_serialize
.. doxygenfunction:: cbor_serialize_alloc
Type-specific serializers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In case you know the type of the item you want to serialize beforehand, you can use one
of the type-specific serializers.
.. note:: Unless compiled in debug mode, these do not verify the type. Passing an incorrect item will result in an undefined behavior.
.. doxygenfunction:: cbor_serialize_uint
.. doxygenfunction:: cbor_serialize_negint
.. doxygenfunction:: cbor_serialize_bytestring
.. doxygenfunction:: cbor_serialize_string
.. doxygenfunction:: cbor_serialize_array
.. doxygenfunction:: cbor_serialize_map
.. doxygenfunction:: cbor_serialize_tag
.. doxygenfunction:: cbor_serialize_float_ctrl