]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libcbor/doc/source/api/streaming_decoding.rst
ssh: Update to OpenSSH 9.3p2
[FreeBSD/FreeBSD.git] / contrib / libcbor / doc / source / api / streaming_decoding.rst
1 Streaming Decoding
2 =============================
3
4 *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:
5
6 .. doxygenfunction:: cbor_stream_decode
7
8 For example, when :func:`cbor_stream_decode` encounters a 1B unsigned integer, it will invoke the function pointer stored in ``cbor_callbacks.uint8``.
9 Complete usage example: `examples/streaming_parser.c <https://github.com/PJK/libcbor/blob/master/examples/streaming_parser.c>`_
10
11 The callbacks are defined by
12
13 .. doxygenstruct:: cbor_callbacks
14     :members:
15
16 When building custom sets of callbacks, feel free to start from
17
18 .. doxygenvariable:: cbor_empty_callbacks
19
20
21 Callback types definition
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24
25 .. doxygentypedef:: cbor_int8_callback
26 .. doxygentypedef:: cbor_int16_callback
27 .. doxygentypedef:: cbor_int32_callback
28 .. doxygentypedef:: cbor_int64_callback
29 .. doxygentypedef:: cbor_simple_callback
30 .. doxygentypedef:: cbor_string_callback
31 .. doxygentypedef:: cbor_collection_callback
32 .. doxygentypedef:: cbor_float_callback
33 .. doxygentypedef:: cbor_double_callback
34 .. doxygentypedef:: cbor_bool_callback