opnsense-src/contrib/libcbor/doc/source/api/streaming_decoding.rst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.1 KiB
ReStructuredText
Raw Normal View History

2023-04-20 19:17:42 -04:00
Streaming Decoding
2021-10-01 19:46:00 -04:00
=============================
2023-04-20 19:17:42 -04:00
*libcbor* exposes a stateless decoder that reads a stream of input bytes from a buffer and invokes user-provided callbacks as it decodes the input:
2021-10-01 19:46:00 -04:00
.. doxygenfunction:: cbor_stream_decode
2023-04-20 19:17:42 -04:00
For example, when :func:`cbor_stream_decode` encounters a 1B unsigned integer, it will invoke the function pointer stored in ``cbor_callbacks.uint8``.
Complete usage example: `examples/streaming_parser.c <https://github.com/PJK/libcbor/blob/master/examples/streaming_parser.c>`_
2021-10-01 19:46:00 -04:00
The callbacks are defined by
.. doxygenstruct:: cbor_callbacks
:members:
When building custom sets of callbacks, feel free to start from
.. doxygenvariable:: cbor_empty_callbacks
Callback types definition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. doxygentypedef:: cbor_int8_callback
.. doxygentypedef:: cbor_int16_callback
.. doxygentypedef:: cbor_int32_callback
.. doxygentypedef:: cbor_int64_callback
.. doxygentypedef:: cbor_simple_callback
.. doxygentypedef:: cbor_string_callback
.. doxygentypedef:: cbor_collection_callback
.. doxygentypedef:: cbor_float_callback
.. doxygentypedef:: cbor_double_callback
.. doxygentypedef:: cbor_bool_callback