--- /srv/rebuilderd/tmp/rebuilderdPsr7UE/inputs/libtinycbor-dev_7.0-1_arm64.deb +++ /srv/rebuilderd/tmp/rebuilderdPsr7UE/out/libtinycbor-dev_7.0-1_arm64.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2026-02-24 08:15:26.000000 debian-binary │ --rw-r--r-- 0 0 0 1888 2026-02-24 08:15:26.000000 control.tar.xz │ --rw-r--r-- 0 0 0 91876 2026-02-24 08:15:26.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 1884 2026-02-24 08:15:26.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 91756 2026-02-24 08:15:26.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ │ │ │ ├── line order │ │ │ │ @@ -6,19 +6,19 @@ │ │ │ │ usr/lib/aarch64-linux-gnu/cmake/tinycbor/TinyCBOR-targets.cmake │ │ │ │ usr/lib/aarch64-linux-gnu/cmake/tinycbor/tinycbor-config-version.cmake │ │ │ │ usr/lib/aarch64-linux-gnu/cmake/tinycbor/tinycbor-config.cmake │ │ │ │ usr/lib/aarch64-linux-gnu/pkgconfig/tinycbor.pc │ │ │ │ usr/share/doc-base/libtinycbor-dev.libtinycbor-dev │ │ │ │ usr/share/doc/libtinycbor-dev/changelog.Debian.gz │ │ │ │ usr/share/doc/libtinycbor-dev/copyright │ │ │ │ -usr/share/doc/libtinycbor-dev/html/a00005_source.html │ │ │ │ -usr/share/doc/libtinycbor-dev/html/a00029.html │ │ │ │ -usr/share/doc/libtinycbor-dev/html/a00029_source.html │ │ │ │ +usr/share/doc/libtinycbor-dev/html/a00026.html │ │ │ │ +usr/share/doc/libtinycbor-dev/html/a00026_source.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00044.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00044_source.html │ │ │ │ +usr/share/doc/libtinycbor-dev/html/a00047_source.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00051.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00052.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00053.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00054.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00055.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00059.html │ │ │ │ usr/share/doc/libtinycbor-dev/html/a00079.html ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -18,19 +18,19 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 239 2026-02-24 08:15:26.000000 ./usr/lib/aarch64-linux-gnu/pkgconfig/tinycbor.pc │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-24 08:15:26.000000 ./usr/share/ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-24 08:15:26.000000 ./usr/share/doc/ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/ │ │ │ -rw-r--r-- 0 root (0) root (0) 877 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/changelog.Debian.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 1397 2024-10-19 16:35:58.000000 ./usr/share/doc/libtinycbor-dev/copyright │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/ │ │ │ --rw-r--r-- 0 root (0) root (0) 7555 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00005_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4937 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00029.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13154 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00029_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 77238 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00044.html │ │ │ --rw-r--r-- 0 root (0) root (0) 169353 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00044_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 77238 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00026.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 169353 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00026_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4937 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00044.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13154 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00044_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7555 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00047_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6930 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00051.html │ │ │ -rw-r--r-- 0 root (0) root (0) 79713 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00052.html │ │ │ -rw-r--r-- 0 root (0) root (0) 147907 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00053.html │ │ │ -rw-r--r-- 0 root (0) root (0) 11936 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00054.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13667 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00055.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2577 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00059.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2797 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/a00079.html │ │ │ @@ -43,16 +43,16 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 3976 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/files.html │ │ │ -rw-r--r-- 0 root (0) root (0) 14067 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/globals.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13529 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/globals_func.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2663 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/globals_type.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2677 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/globals_vars.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6204 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/graph_legend.html │ │ │ -rw-r--r-- 0 root (0) root (0) 23327 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/graph_legend.png │ │ │ --rw-r--r-- 0 root (0) root (0) 3425 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.hhc.gz │ │ │ --rw-r--r-- 0 root (0) root (0) 4003 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.hhk.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 3424 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.hhc.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 4004 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.hhk.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 803 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.hhp │ │ │ -rw-r--r-- 0 root (0) root (0) 2696 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2189 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/menudata.js │ │ │ -rw-r--r-- 0 root (0) root (0) 5107 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/navtree.css │ │ │ -rw-r--r-- 0 root (0) root (0) 1276 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/tabs.css │ │ │ -rw-r--r-- 0 root (0) root (0) 3420 2026-02-24 08:15:26.000000 ./usr/share/doc/libtinycbor-dev/html/topics.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-24 08:15:26.000000 ./usr/share/doc-base/ │ │ ├── ./usr/share/doc/libtinycbor-dev/html/a00044.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -TinyCBOR 7.0 API: cbor.h File Reference │ │ │ +TinyCBOR 7.0 API: cborjson.h File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ @@ -43,417 +43,36 @@ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -Data Structures | │ │ │ -Typedefs | │ │ │ -Functions | │ │ │ -Variables
│ │ │ -
cbor.h File Reference
│ │ │ +Functions
│ │ │ +
cborjson.h File Reference
│ │ │
│ │ │
│ │ │ │ │ │ -

> The <cbor.h> is the main header in TinyCBOR and defines the constants used by most functions as well as the structures for encoding (CborEncoder) and decoding (CborValue). │ │ │ +

> The <cborjson.h> file contains the routines that are used to convert a CBOR data stream into JSON. │ │ │ More...

│ │ │ -
#include <assert.h>
│ │ │ -#include <limits.h>
│ │ │ -#include <stddef.h>
│ │ │ -#include <stdint.h>
│ │ │ -#include <string.h>
│ │ │ -#include <stdio.h>
│ │ │ -#include "tinycbor-export.h"
│ │ │ -#include "tinycbor-version.h"
│ │ │ -#include <stdbool.h>
│ │ │ +
#include "cbor.h"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Data Structures

struct  CborEncoder
 Structure used to encode to CBOR. More...
struct  CborValue
 This type contains one value parsed from the CBOR stream. More...
│ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Typedefs

typedef uint64_t CborTag
 This typedef is an unsigned 64-bit integer.
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ Functions

│ │ │ -CBOR_API const char * cbor_error_string (CborError error)
 Returns the error string corresponding to the CBOR error condition error.
CBOR_API void cbor_encoder_init (CborEncoder *encoder, uint8_t *buffer, size_t size, int flags)
 Initializes a CborEncoder structure encoder by pointing it to buffer buffer of size size.
CBOR_API CborError cbor_encode_uint (CborEncoder *encoder, uint64_t value)
 Appends the unsigned 64-bit integer value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_int (CborEncoder *encoder, int64_t value)
 Appends the signed 64-bit integer value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_negative_int (CborEncoder *encoder, uint64_t absolute_value)
 Appends the negative 64-bit integer whose absolute value is absolute_value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_simple_value (CborEncoder *encoder, uint8_t value)
 Appends the CBOR Simple Type of value value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_tag (CborEncoder *encoder, CborTag tag)
 Appends the CBOR tag tag to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_text_string (CborEncoder *encoder, const char *string, size_t length)
 Appends the text string string of length length to the CBOR stream provided by encoder.
CborError cbor_encode_text_stringz (CborEncoder *encoder, const char *string)
 Appends the null-terminated text string string to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_byte_string (CborEncoder *encoder, const uint8_t *string, size_t length)
 Appends the byte string string of length length to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_floating_point (CborEncoder *encoder, CborType fpType, const void *value)
 Appends the floating-point value of type fpType and pointed to by value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_raw (CborEncoder *encoder, const uint8_t *raw, size_t length)
 Puts the data of length length in raw into to the encoding buffer of encoder.
│ │ │ -CborError cbor_encode_boolean (CborEncoder *encoder, bool value)
 Appends the boolean value value to the CBOR stream provided by encoder.
CborError cbor_encode_null (CborEncoder *encoder)
 Appends the CBOR type representing a null value to the CBOR stream provided by encoder.
CborError cbor_encode_undefined (CborEncoder *encoder)
 Appends the CBOR type representing an undefined value to the CBOR stream provided by encoder.
CborError cbor_encode_half_float (CborEncoder *encoder, const void *value)
 Appends the IEEE 754 half-precision (16-bit) floating point value pointed to by value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encode_float_as_half_float (CborEncoder *encoder, float value)
 Convert the IEEE 754 single-precision (32-bit) floating point value value to the IEEE 754 half-precision (16-bit) floating point value and append it to the CBOR stream provided by encoder.
CborError cbor_encode_float (CborEncoder *encoder, float value)
 Appends the IEEE 754 single-precision (32-bit) floating point value value to the CBOR stream provided by encoder.
CborError cbor_encode_double (CborEncoder *encoder, double value)
 Appends the IEEE 754 double-precision (64-bit) floating point value value to the CBOR stream provided by encoder.
CBOR_API CborError cbor_encoder_create_array (CborEncoder *parentEncoder, CborEncoder *arrayEncoder, size_t length)
 Creates a CBOR array in the CBOR stream provided by parentEncoder and initializes arrayEncoder so that items can be added to the array using the CborEncoder functions.
CBOR_API CborError cbor_encoder_create_map (CborEncoder *parentEncoder, CborEncoder *mapEncoder, size_t length)
 Creates a CBOR map in the CBOR stream provided by parentEncoder and initializes mapEncoder so that items can be added to the map using the CborEncoder functions.
CBOR_API CborError cbor_encoder_close_container (CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
 Closes the CBOR container (array or map) provided by containerEncoder and updates the CBOR stream provided by encoder.
CBOR_API CborError cbor_encoder_close_container_checked (CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
size_t cbor_encoder_get_buffer_size (const CborEncoder *encoder, const uint8_t *buffer)
 Returns the total size of the buffer starting at buffer after the encoding finished without errors.
size_t cbor_encoder_get_extra_bytes_needed (const CborEncoder *encoder)
 Returns how many more bytes the original buffer supplied to cbor_encoder_init() needs to be extended by so that no CborErrorOutOfMemory condition will happen for the encoding.
CBOR_API CborError cbor_parser_init (const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it)
 Initializes the CBOR parser for parsing size bytes beginning at buffer.
CBOR_API CborError cbor_value_validate_basic (const CborValue *it)
 Performs a basic validation of the CBOR stream pointed by it and returns the error it found.
bool cbor_value_at_end (const CborValue *it)
 Returns true if it has reached the end of the iteration, usually when advancing after the last item in an array or map.
const uint8_t * cbor_value_get_next_byte (const CborValue *it)
 Returns a pointer to the next byte that would be decoded if this CborValue object were advanced.
CBOR_API CborError cbor_value_advance_fixed (CborValue *it)
 Advances the CBOR value it by one fixed-size position.
CBOR_API CborError cbor_value_advance (CborValue *it)
 Advances the CBOR value it by one element, skipping over containers.
│ │ │ -bool cbor_value_is_container (const CborValue *it)
 Returns true if the it value is a container and requires recursion in order to decode (maps and arrays), false otherwise.
CBOR_API CborError cbor_value_enter_container (const CborValue *it, CborValue *recursed)
 Creates a CborValue iterator pointing to the first element of the container represented by it and saves it in recursed.
CBOR_API CborError cbor_value_leave_container (CborValue *it, const CborValue *recursed)
 Updates it to point to the next element after the container.
bool cbor_value_is_valid (const CborValue *value)
 Returns true if the iterator it contains a valid value.
CborType cbor_value_get_type (const CborValue *value)
 Returns the type of the CBOR value that the iterator value points to.
bool cbor_value_is_null (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR null type.
bool cbor_value_is_undefined (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR undefined type.
bool cbor_value_is_boolean (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR boolean type (true or false).
CborError cbor_value_get_boolean (const CborValue *value, bool *result)
 Retrieves the boolean value that value points to and stores it in result.
bool cbor_value_is_simple_type (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR Simple Type type (other than true, false, null and undefined).
CborError cbor_value_get_simple_type (const CborValue *value, uint8_t *result)
 Retrieves the CBOR Simple Type value that value points to and stores it in result.
bool cbor_value_is_integer (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR integer type.
bool cbor_value_is_unsigned_integer (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR unsigned integer type (positive values or zero).
bool cbor_value_is_negative_integer (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR negative integer type.
CborError cbor_value_get_raw_integer (const CborValue *value, uint64_t *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
CborError cbor_value_get_uint64 (const CborValue *value, uint64_t *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
CborError cbor_value_get_int64 (const CborValue *value, int64_t *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
CborError cbor_value_get_int (const CborValue *value, int *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
CBOR_API CborError cbor_value_get_int64_checked (const CborValue *value, int64_t *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
CBOR_API CborError cbor_value_get_int_checked (const CborValue *value, int *result)
 Retrieves the CBOR integer value that value points to and stores it in result.
bool cbor_value_is_length_known (const CborValue *value)
 Returns true if the length of this type is known without calculation.
bool cbor_value_is_tag (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR tag.
CborError cbor_value_get_tag (const CborValue *value, CborTag *result)
 Retrieves the CBOR tag value that value points to and stores it in result.
CBOR_API CborError cbor_value_skip_tag (CborValue *it)
 Advances the CBOR value it until it no longer points to a tag.
bool cbor_value_is_byte_string (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR byte string.
bool cbor_value_is_text_string (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR text string.
CborError cbor_value_get_string_length (const CborValue *value, size_t *length)
 Extracts the length of the byte or text string that value points to and stores it in result.
CBOR_API CborError cbor_value_calculate_string_length (const CborValue *value, size_t *length)
 Calculates the length of the byte or text string that value points to and stores it in len.
CborError cbor_value_copy_text_string (const CborValue *value, char *buffer, size_t *buflen, CborValue *next)
 Copies the string pointed to by value into the buffer provided at buffer of buflen bytes.
CborError cbor_value_copy_byte_string (const CborValue *value, uint8_t *buffer, size_t *buflen, CborValue *next)
 Copies the string pointed by value into the buffer provided at buffer of buflen bytes.
CborError cbor_value_dup_text_string (const CborValue *value, char **buffer, size_t *buflen, CborValue *next)
 Allocates memory for the string pointed by value and copies it into this buffer.
CborError cbor_value_dup_byte_string (const CborValue *value, uint8_t **buffer, size_t *buflen, CborValue *next)
 Allocates memory for the string pointed by value and copies it into this buffer.
CborError cbor_value_get_text_string_chunk (const CborValue *value, const char **bufferptr, size_t *len, CborValue *next)
 Extracts one text string chunk pointed to by value and stores a pointer to the data in buffer and the size in len, which must not be null.
CBOR_API CborError cbor_value_text_string_equals (const CborValue *value, const char *string, bool *result)
 Compares the entry value with the string string and stores the result in result.
bool cbor_value_is_array (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR array.
bool cbor_value_is_map (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR map.
CborError cbor_value_get_array_length (const CborValue *value, size_t *length)
 Extracts the length of the CBOR array that value points to and stores it in result.
CborError cbor_value_get_map_length (const CborValue *value, size_t *length)
 Extracts the length of the CBOR map that value points to and stores it in result.
CBOR_API CborError cbor_value_map_find_value (const CborValue *map, const char *string, CborValue *element)
 Attempts to find the value in map map that corresponds to the text string entry string.
bool cbor_value_is_half_float (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR single-precision floating point (16-bit).
CBOR_API CborError cbor_value_get_half_float_as_float (const CborValue *value, float *result)
 Retrieves the CBOR half-precision floating point (16-bit) value that value points to, converts it to the float and store it in result.
CborError cbor_value_get_half_float (const CborValue *value, void *result)
 Retrieves the CBOR half-precision floating point (16-bit) value that value points to and stores it in result.
bool cbor_value_is_float (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR single-precision floating point (32-bit).
CborError cbor_value_get_float (const CborValue *value, float *result)
 Retrieves the CBOR single-precision floating point (32-bit) value that value points to and stores it in result.
bool cbor_value_is_double (const CborValue *value)
 Returns true if the iterator value is valid and points to a CBOR double-precision floating point (64-bit).
CBOR_API CborError cbor_value_validate (const CborValue *it, uint32_t flags)
 Performs a full validation, controlled by the flags options, of the CBOR stream pointed by it and returns the error it found.
CBOR_API CborError cbor_value_to_pretty_stream (CborStreamFunction streamFunction, void *token, CborValue *value, int flags)
 Converts the current CBOR type pointed by value to its textual representation and writes it to the stream by calling the streamFunction.
CBOR_API CborError cbor_value_to_pretty_advance_flags (FILE *out, CborValue *value, int flags)
 Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.
CBOR_API CborError cbor_value_to_pretty_advance (FILE *out, CborValue *value)
 Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.
CborError cbor_value_to_pretty (FILE *out, const CborValue *value)
 Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.
│ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ -Variables

static const size_t CborIndefiniteLength = ((size_t)-1)
 This variable is a constant used to indicate that the length of the map or array is not yet determined.
CBOR_API CborError cbor_value_to_json_advance (FILE *out, CborValue *value, int flags)
 Converts the current CBOR type pointed to by value to JSON and writes that to the out stream.
CborError cbor_value_to_json (FILE *out, const CborValue *value, int flags)
 Converts the current CBOR type pointed to by value to JSON and writes that to the out stream.
│ │ │

Detailed Description

│ │ │ -

> The <cbor.h> is the main header in TinyCBOR and defines the constants used by most functions as well as the structures for encoding (CborEncoder) and decoding (CborValue).

│ │ │ -
See also
<cborjson.h>
│ │ │ -

Function Documentation

│ │ │ - │ │ │ -

◆ cbor_value_dup_byte_string()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CborError cbor_value_dup_byte_string (const CborValue * value,
uint8_t ** buffer,
size_t * buflen,
CborValue * next )
│ │ │ -
│ │ │ - │ │ │ -

Allocates memory for the string pointed by value and copies it into this buffer.

│ │ │ -

The pointer to the buffer is stored in buffer and the number of bytes copied is stored in buflen (those variables must not be NULL).

│ │ │ -

If the iterator value does not point to a byte string, the behaviour is undefined, so checking with cbor_value_get_type or cbor_value_is_byte_string is recommended.

│ │ │ -

On success, *buffer will contain a valid pointer that must be freed by calling free(). This is the case even for zero-length strings. The next pointer, if not null, will be updated to point to the next item after this string. If value points to the last item, then next will be invalid.

│ │ │ -

If malloc returns a NULL pointer, this function will return error condition CborErrorOutOfMemory. In this case, *buflen should contain the number of bytes necessary to copy this string and value will be updated to point to the next element. On all other failure cases, the values contained in *buffer, *buflen and next are undefined and mustn't be used (for example, calling {free()}).

│ │ │ -

This function may not run in constant time (it will run in O(n) time on the number of chunks). It requires constant memory (O(1)) in addition to the malloc'ed block.

│ │ │ -
See also
cbor_value_get_text_string_chunk(), cbor_value_copy_byte_string(), cbor_value_dup_text_string()
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ cbor_value_dup_text_string()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CborError cbor_value_dup_text_string (const CborValue * value,
char ** buffer,
size_t * buflen,
CborValue * next )
│ │ │ -
│ │ │ - │ │ │ -

Allocates memory for the string pointed by value and copies it into this buffer.

│ │ │ -

The pointer to the buffer is stored in buffer and the number of bytes copied is stored in buflen (those variables must not be NULL).

│ │ │ -

If the iterator value does not point to a text string, the behaviour is undefined, so checking with cbor_value_get_type or cbor_value_is_text_string is recommended.

│ │ │ -

On success, *buffer will contain a valid pointer that must be freed by calling free(). This is the case even for zero-length strings. The next pointer, if not null, will be updated to point to the next item after this string. If value points to the last item, then next will be invalid.

│ │ │ -

If malloc returns a NULL pointer, this function will return error condition CborErrorOutOfMemory. In this case, *buflen should contain the number of bytes necessary to copy this string and value will be updated to point to the next element. On all other failure cases, the values contained in *buffer, *buflen and next are undefined and mustn't be used (for example, calling {free()}).

│ │ │ -

This function may not run in constant time (it will run in O(n) time on the number of chunks). It requires constant memory (O(1)) in addition to the malloc'ed block.

│ │ │ -
Note
This function does not perform UTF-8 validation on the incoming text string.
│ │ │ -
See also
cbor_value_get_text_string_chunk(), cbor_value_copy_text_string(), cbor_value_dup_byte_string()
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ cbor_value_get_half_float_as_float()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CBOR_API CborError cbor_value_get_half_float_as_float (const CborValue * value,
float * result )
│ │ │ -
│ │ │ - │ │ │ -

Retrieves the CBOR half-precision floating point (16-bit) value that value points to, converts it to the float and store it in result.

│ │ │ -

If the iterator value does not point to a half-precision floating point value, the behavior is undefined, so checking with cbor_value_get_type or with cbor_value_is_half_float is recommended.

See also
cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_half_float(), cbor_value_get_half_float(), cbor_value_get_float()
│ │ │ - │ │ │ -

Referenced by cbor_value_get_half_float_as_float().

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ cbor_value_to_pretty()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CborError cbor_value_to_pretty (FILE * out,
const CborValue * value )
│ │ │ -
│ │ │ - │ │ │ -

Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.

│ │ │ -

If an error occurs, this function returns an error code similar to CborParsing.

│ │ │ -
See also
cbor_value_to_pretty_advance(), cbor_value_to_json_advance()
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ cbor_value_to_pretty_advance()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CBOR_API CborError cbor_value_to_pretty_advance (FILE * out,
CborValue * value )
│ │ │ -
│ │ │ - │ │ │ -

Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.

│ │ │ -

If an error occurs, this function returns an error code similar to CborParsing.

│ │ │ -

If no error ocurred, this function advances value to the next element. Often, concatenating the text representation of multiple elements can be done by appending a comma to the output stream in between calls to this function.

│ │ │ -
See also
cbor_value_to_pretty(), cbor_value_to_pretty_stream(), cbor_value_to_json_advance()
│ │ │ - │ │ │ -

Referenced by cbor_value_to_pretty_advance().

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ cbor_value_to_pretty_advance_flags()

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
CBOR_API CborError cbor_value_to_pretty_advance_flags (FILE * out,
CborValue * value,
int flags )
│ │ │ -
│ │ │ - │ │ │ -

Converts the current CBOR type pointed to by value to its textual representation and writes it to the out stream.

│ │ │ -

If an error occurs, this function returns an error code similar to CborParsing.

│ │ │ -

The textual representation can be controlled by the flags parameter (see CborPrettyFlags for more information).

│ │ │ -

If no error ocurred, this function advances value to the next element. Often, concatenating the text representation of multiple elements can be done by appending a comma to the output stream in between calls to this function.

│ │ │ -
See also
cbor_value_to_pretty_stream(), cbor_value_to_pretty(), cbor_value_to_json_advance()
│ │ │ - │ │ │ -

Referenced by cbor_value_to_pretty(), and cbor_value_to_pretty_advance_flags().

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +

> The <cborjson.h> file contains the routines that are used to convert a CBOR data stream into JSON.

│ │ │ +
See also
<cbor.h>
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,462 +1,29 @@ │ │ │ │ TinyCBOR 7.0 API │ │ │ │ * _M_a_i_n_ _P_a_g_e │ │ │ │ * _T_o_p_i_c_s │ │ │ │ * _D_a_t_a_ _S_t_r_u_c_t_u_r_e_s │ │ │ │ * _F_i_l_e_s │ │ │ │ * _F_i_l_e_ _L_i_s_t │ │ │ │ * _G_l_o_b_a_l_s │ │ │ │ -_D_a_t_a_ _S_t_r_u_c_t_u_r_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s | _V_a_r_i_a_b_l_e_s │ │ │ │ -cbor.h File Reference │ │ │ │ -> The <_c_b_o_r_._h> is the main header in TinyCBOR and defines the constants used by │ │ │ │ -most functions as well as the structures for encoding (_C_b_o_r_E_n_c_o_d_e_r) and │ │ │ │ -decoding (_C_b_o_r_V_a_l_u_e). _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "tinycbor-export.h" │ │ │ │ -#include "tinycbor-version.h" │ │ │ │ -#include │ │ │ │ +_F_u_n_c_t_i_o_n_s │ │ │ │ +cborjson.h File Reference │ │ │ │ +> The <_c_b_o_r_j_s_o_n_._h> file contains the routines that are used to convert a CBOR │ │ │ │ +data stream into JSON. _M_o_r_e_._._. │ │ │ │ +#include "_c_b_o_r_._h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -DDaattaa SSttrruuccttuurreess │ │ │ │ -struct   _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -  Structure used to encode to CBOR. _M_o_r_e_._._. │ │ │ │ -struct   _C_b_o_r_V_a_l_u_e │ │ │ │ -  This type contains one value parsed from the CBOR stream. _M_o_r_e_._._. │ │ │ │ -TTyyppeeddeeffss │ │ │ │ -typedef uint64_t  _C_b_o_r_T_a_g │ │ │ │ -  This typedef is an unsigned 64-bit integer. │ │ │ │ FFuunnccttiioonnss │ │ │ │ -CBOR_API const char *  ccbboorr__eerrrroorr__ssttrriinngg (CborError error) │ │ │ │ -  Returns the error string corresponding to the CBOR error │ │ │ │ - condition eerrrroorr. │ │ │ │ - CBOR_API void  _c_b_o_r___e_n_c_o_d_e_r___i_n_i_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, uint8_t │ │ │ │ - *buffer, size_t size, int flags) │ │ │ │ -  Initializes a _C_b_o_r_E_n_c_o_d_e_r structure eennccooddeerr by pointing │ │ │ │ - it to buffer bbuuffffeerr of size ssiizzee. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___u_i_n_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, uint64_t value) │ │ │ │ -  Appends the unsigned 64-bit integer vvaalluuee to the CBOR │ │ │ │ - stream provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___i_n_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, int64_t value) │ │ │ │ -  Appends the signed 64-bit integer vvaalluuee to the CBOR │ │ │ │ - stream provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___n_e_g_a_t_i_v_e___i_n_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, uint64_t │ │ │ │ - absolute_value) │ │ │ │ - Appends the negative 64-bit integer whose absolute value │ │ │ │ -  is aabbssoolluuttee__vvaalluuee to the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e (_C_b_o_r_E_n_c_o_d_e_r *encoder, uint8_t │ │ │ │ - value) │ │ │ │ -  Appends the CBOR Simple Type of value vvaalluuee to the CBOR │ │ │ │ - stream provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___t_a_g (_C_b_o_r_E_n_c_o_d_e_r *encoder, _C_b_o_r_T_a_g tag) │ │ │ │ -  Appends the CBOR tag ttaagg to the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g (_C_b_o_r_E_n_c_o_d_e_r *encoder, const │ │ │ │ - char *string, size_t length) │ │ │ │ -  Appends the text string ssttrriinngg of length lleennggtthh to the │ │ │ │ - CBOR stream provided by eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g_z (_C_b_o_r_E_n_c_o_d_e_r *encoder, const │ │ │ │ - char *string) │ │ │ │ -  Appends the null-terminated text string ssttrriinngg to the │ │ │ │ - CBOR stream provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___b_y_t_e___s_t_r_i_n_g (_C_b_o_r_E_n_c_o_d_e_r *encoder, const │ │ │ │ - uint8_t *string, size_t length) │ │ │ │ -  Appends the byte string ssttrriinngg of length lleennggtthh to the │ │ │ │ - CBOR stream provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, │ │ │ │ - CborType fpType, const void *value) │ │ │ │ - Appends the floating-point value of type ffppTTyyppee and │ │ │ │ -  pointed to by vvaalluuee to the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___r_a_w (_C_b_o_r_E_n_c_o_d_e_r *encoder, const uint8_t │ │ │ │ - *raw, size_t length) │ │ │ │ -  Puts the data of length lleennggtthh in rraaww into to the │ │ │ │ - encoding buffer of eennccooddeerr. │ │ │ │ - CborError  ccbboorr__eennccooddee__bboooolleeaann (_C_b_o_r_E_n_c_o_d_e_r *encoder, bool value) │ │ │ │ -  Appends the boolean value vvaalluuee to the CBOR stream │ │ │ │ - provided by eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___n_u_l_l (_C_b_o_r_E_n_c_o_d_e_r *encoder) │ │ │ │ -  Appends the CBOR type representing a null value to the │ │ │ │ - CBOR stream provided by eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___u_n_d_e_f_i_n_e_d (_C_b_o_r_E_n_c_o_d_e_r *encoder) │ │ │ │ -  Appends the CBOR type representing an undefined value to │ │ │ │ - the CBOR stream provided by eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___h_a_l_f___f_l_o_a_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, const void │ │ │ │ - *value) │ │ │ │ - Appends the IEEE 754 half-precision (16-bit) floating │ │ │ │ -  point value pointed to by vvaalluuee to the CBOR stream │ │ │ │ - provided by eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t___a_s___h_a_l_f___f_l_o_a_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, │ │ │ │ - float value) │ │ │ │ - Convert the IEEE 754 single-precision (32-bit) floating │ │ │ │ -  point value vvaalluuee to the IEEE 754 half-precision (16- │ │ │ │ - bit) floating point value and append it to the CBOR │ │ │ │ - stream provided by eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t (_C_b_o_r_E_n_c_o_d_e_r *encoder, float value) │ │ │ │ - Appends the IEEE 754 single-precision (32-bit) floating │ │ │ │ -  point value vvaalluuee to the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CborError  _c_b_o_r___e_n_c_o_d_e___d_o_u_b_l_e (_C_b_o_r_E_n_c_o_d_e_r *encoder, double value) │ │ │ │ - Appends the IEEE 754 double-precision (64-bit) floating │ │ │ │ -  point value vvaalluuee to the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___a_r_r_a_y (_C_b_o_r_E_n_c_o_d_e_r *parentEncoder, │ │ │ │ - _C_b_o_r_E_n_c_o_d_e_r *arrayEncoder, size_t length) │ │ │ │ - Creates a CBOR array in the CBOR stream provided by │ │ │ │ -  ppaarreennttEEnnccooddeerr and initializes aarrrraayyEEnnccooddeerr so that items │ │ │ │ - can be added to the array using the _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ - functions. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___m_a_p (_C_b_o_r_E_n_c_o_d_e_r *parentEncoder, │ │ │ │ - _C_b_o_r_E_n_c_o_d_e_r *mapEncoder, size_t length) │ │ │ │ - Creates a CBOR map in the CBOR stream provided by │ │ │ │ -  ppaarreennttEEnnccooddeerr and initializes mmaappEEnnccooddeerr so that items │ │ │ │ - can be added to the map using the _C_b_o_r_E_n_c_o_d_e_r functions. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r (_C_b_o_r_E_n_c_o_d_e_r │ │ │ │ - *parentEncoder, const _C_b_o_r_E_n_c_o_d_e_r *containerEncoder) │ │ │ │ - Closes the CBOR container (array or map) provided by │ │ │ │ -  ccoonnttaaiinneerrEEnnccooddeerr and updates the CBOR stream provided by │ │ │ │ - eennccooddeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r___c_h_e_c_k_e_d (_C_b_o_r_E_n_c_o_d_e_r │ │ │ │ - *parentEncoder, const _C_b_o_r_E_n_c_o_d_e_r *containerEncoder) │ │ │ │ - size_t  _c_b_o_r___e_n_c_o_d_e_r___g_e_t___b_u_f_f_e_r___s_i_z_e (const _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ - *encoder, const uint8_t *buffer) │ │ │ │ -  Returns the total size of the buffer starting at bbuuffffeerr │ │ │ │ - after the encoding finished without errors. │ │ │ │ - size_t  _c_b_o_r___e_n_c_o_d_e_r___g_e_t___e_x_t_r_a___b_y_t_e_s___n_e_e_d_e_d (const _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ - *encoder) │ │ │ │ - Returns how many more bytes the original buffer supplied │ │ │ │ -  to _c_b_o_r___e_n_c_o_d_e_r___i_n_i_t_(_) needs to be extended by so that │ │ │ │ - no CborErrorOutOfMemory condition will happen for the │ │ │ │ - encoding. │ │ │ │ - CBOR_API CborError  _c_b_o_r___p_a_r_s_e_r___i_n_i_t (const uint8_t *buffer, size_t size, │ │ │ │ - uint32_t flags, CborParser *parser, _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Initializes the CBOR parser for parsing ssiizzee bytes │ │ │ │ - beginning at bbuuffffeerr. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e___b_a_s_i_c (const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Performs a basic validation of the CBOR stream pointed │ │ │ │ - by iitt and returns the error it found. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___a_t___e_n_d (const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ - Returns true if iitt has reached the end of the iteration, │ │ │ │ -  usually when advancing after the last item in an array │ │ │ │ - or map. │ │ │ │ - const uint8_t *  _c_b_o_r___v_a_l_u_e___g_e_t___n_e_x_t___b_y_t_e (const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Returns a pointer to the next byte that would be decoded │ │ │ │ - if this _C_b_o_r_V_a_l_u_e object were advanced. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e___f_i_x_e_d (_C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Advances the CBOR value iitt by one fixed-size position. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e (_C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Advances the CBOR value iitt by one element, skipping over │ │ │ │ - containers. │ │ │ │ - bool  ccbboorr__vvaalluuee__iiss__ccoonnttaaiinneerr (const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ - Returns true if the iitt value is a container and requires │ │ │ │ -  recursion in order to decode (maps and arrays), false │ │ │ │ - otherwise. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___e_n_t_e_r___c_o_n_t_a_i_n_e_r (const _C_b_o_r_V_a_l_u_e *it, │ │ │ │ - _C_b_o_r_V_a_l_u_e *recursed) │ │ │ │ - Creates a _C_b_o_r_V_a_l_u_e iterator pointing to the first │ │ │ │ -  element of the container represented by iitt and saves it │ │ │ │ - in rreeccuurrsseedd. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___l_e_a_v_e___c_o_n_t_a_i_n_e_r (_C_b_o_r_V_a_l_u_e *it, const │ │ │ │ - _C_b_o_r_V_a_l_u_e *recursed) │ │ │ │ -  Updates iitt to point to the next element after the │ │ │ │ - container. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___v_a_l_i_d (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator iitt contains a valid value. │ │ │ │ - CborType  _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns the type of the CBOR value that the iterator │ │ │ │ - vvaalluuee points to. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___n_u_l_l (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR null type. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___u_n_d_e_f_i_n_e_d (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR undefined type. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___b_o_o_l_e_a_n (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR boolean type (true or false). │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___b_o_o_l_e_a_n (const _C_b_o_r_V_a_l_u_e *value, bool │ │ │ │ - *result) │ │ │ │ -  Retrieves the boolean value that vvaalluuee points to and │ │ │ │ - stores it in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___s_i_m_p_l_e___t_y_p_e (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ - Returns true if the iterator vvaalluuee is valid and points │ │ │ │ -  to a CBOR Simple Type type (other than true, false, null │ │ │ │ - and undefined). │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___s_i_m_p_l_e___t_y_p_e (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - uint8_t *result) │ │ │ │ -  Retrieves the CBOR Simple Type value that vvaalluuee points │ │ │ │ - to and stores it in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR integer type. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___u_n_s_i_g_n_e_d___i_n_t_e_g_e_r (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ - Returns true if the iterator vvaalluuee is valid and points │ │ │ │ -  to a CBOR unsigned integer type (positive values or │ │ │ │ - zero). │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___n_e_g_a_t_i_v_e___i_n_t_e_g_e_r (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR negative integer type. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___r_a_w___i_n_t_e_g_e_r (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - uint64_t *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___u_i_n_t_6_4 (const _C_b_o_r_V_a_l_u_e *value, uint64_t │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4 (const _C_b_o_r_V_a_l_u_e *value, int64_t │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t (const _C_b_o_r_V_a_l_u_e *value, int *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4___c_h_e_c_k_e_d (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - int64_t *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t___c_h_e_c_k_e_d (const _C_b_o_r_V_a_l_u_e *value, int │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR integer value that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the length of this type is known without │ │ │ │ - calculation. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___t_a_g (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR tag. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___t_a_g (const _C_b_o_r_V_a_l_u_e *value, _C_b_o_r_T_a_g │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR tag value that vvaalluuee points to and │ │ │ │ - stores it in rreessuulltt. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___s_k_i_p___t_a_g (_C_b_o_r_V_a_l_u_e *it) │ │ │ │ -  Advances the CBOR value iitt until it no longer points to │ │ │ │ - a tag. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR byte string. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR text string. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___s_t_r_i_n_g___l_e_n_g_t_h (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - size_t *length) │ │ │ │ -  Extracts the length of the byte or text string that │ │ │ │ - vvaalluuee points to and stores it in rreessuulltt. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___c_a_l_c_u_l_a_t_e___s_t_r_i_n_g___l_e_n_g_t_h (const _C_b_o_r_V_a_l_u_e │ │ │ │ - *value, size_t *length) │ │ │ │ -  Calculates the length of the byte or text string that │ │ │ │ - vvaalluuee points to and stores it in lleenn. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___c_o_p_y___t_e_x_t___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - char *buffer, size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -  Copies the string pointed to by vvaalluuee into the buffer │ │ │ │ - provided at bbuuffffeerr of bbuufflleenn bytes. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___c_o_p_y___b_y_t_e___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - uint8_t *buffer, size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -  Copies the string pointed by vvaalluuee into the buffer │ │ │ │ - provided at bbuuffffeerr of bbuufflleenn bytes. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___d_u_p___t_e_x_t___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value, char │ │ │ │ - **buffer, size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -  Allocates memory for the string pointed by vvaalluuee and │ │ │ │ - copies it into this buffer. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___d_u_p___b_y_t_e___s_t_r_i_n_g (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - uint8_t **buffer, size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -  Allocates memory for the string pointed by vvaalluuee and │ │ │ │ - copies it into this buffer. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___t_e_x_t___s_t_r_i_n_g___c_h_u_n_k (const _C_b_o_r_V_a_l_u_e │ │ │ │ - *value, const char **bufferptr, size_t *len, _C_b_o_r_V_a_l_u_e │ │ │ │ - *next) │ │ │ │ - Extracts one text string chunk pointed to by vvaalluuee and │ │ │ │ -  stores a pointer to the data in bbuuffffeerr and the size in │ │ │ │ - lleenn, which must not be null. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___t_e_x_t___s_t_r_i_n_g___e_q_u_a_l_s (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - const char *string, bool *result) │ │ │ │ -  Compares the entry vvaalluuee with the string ssttrriinngg and │ │ │ │ - stores the result in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___a_r_r_a_y (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR array. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___m_a_p (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR map. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___a_r_r_a_y___l_e_n_g_t_h (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - size_t *length) │ │ │ │ -  Extracts the length of the CBOR array that vvaalluuee points │ │ │ │ - to and stores it in rreessuulltt. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___m_a_p___l_e_n_g_t_h (const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ - size_t *length) │ │ │ │ -  Extracts the length of the CBOR map that vvaalluuee points to │ │ │ │ - and stores it in rreessuulltt. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___m_a_p___f_i_n_d___v_a_l_u_e (const _C_b_o_r_V_a_l_u_e *map, const │ │ │ │ - char *string, _C_b_o_r_V_a_l_u_e *element) │ │ │ │ -  Attempts to find the value in map mmaapp that corresponds │ │ │ │ - to the text string entry ssttrriinngg. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR single-precision floating point (16-bit). │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t___a_s___f_l_o_a_t (const _C_b_o_r_V_a_l_u_e │ │ │ │ - *value, float *result) │ │ │ │ - Retrieves the CBOR half-precision floating point (16- │ │ │ │ -  bit) value that vvaalluuee points to, converts it to the │ │ │ │ - float and store it in rreessuulltt. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t (const _C_b_o_r_V_a_l_u_e *value, void │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR half-precision floating point (16- │ │ │ │ - bit) value that vvaalluuee points to and stores it in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___f_l_o_a_t (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR single-precision floating point (32-bit). │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___g_e_t___f_l_o_a_t (const _C_b_o_r_V_a_l_u_e *value, float │ │ │ │ - *result) │ │ │ │ -  Retrieves the CBOR single-precision floating point (32- │ │ │ │ - bit) value that vvaalluuee points to and stores it in rreessuulltt. │ │ │ │ - bool  _c_b_o_r___v_a_l_u_e___i_s___d_o_u_b_l_e (const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -  Returns true if the iterator vvaalluuee is valid and points │ │ │ │ - to a CBOR double-precision floating point (64-bit). │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e (const _C_b_o_r_V_a_l_u_e *it, uint32_t │ │ │ │ - flags) │ │ │ │ - Performs a full validation, controlled by the ffllaaggss │ │ │ │ -  options, of the CBOR stream pointed by iitt and returns │ │ │ │ - the error it found. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___s_t_r_e_a_m (CborStreamFunction │ │ │ │ - streamFunction, void *token, _C_b_o_r_V_a_l_u_e *value, int │ │ │ │ - flags) │ │ │ │ - Converts the current CBOR type pointed by vvaalluuee to its │ │ │ │ -  textual representation and writes it to the stream by │ │ │ │ - calling the ssttrreeaammFFuunnccttiioonn. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e___f_l_a_g_s (FILE *out, _C_b_o_r_V_a_l_u_e │ │ │ │ - *value, int flags) │ │ │ │ - Converts the current CBOR type pointed to by vvaalluuee to │ │ │ │ -  its textual representation and writes it to the oouutt │ │ │ │ - stream. │ │ │ │ - CBOR_API CborError  _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e (FILE *out, _C_b_o_r_V_a_l_u_e │ │ │ │ - *value) │ │ │ │ - Converts the current CBOR type pointed to by vvaalluuee to │ │ │ │ -  its textual representation and writes it to the oouutt │ │ │ │ - stream. │ │ │ │ - CborError  _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y (FILE *out, const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ - Converts the current CBOR type pointed to by vvaalluuee to │ │ │ │ -  its textual representation and writes it to the oouutt │ │ │ │ - stream. │ │ │ │ -VVaarriiaabblleess │ │ │ │ -static const size_t  _C_b_o_r_I_n_d_e_f_i_n_i_t_e_L_e_n_g_t_h = ((size_t)-1) │ │ │ │ -  This variable is a constant used to indicate that the │ │ │ │ - length of the map or array is not yet determined. │ │ │ │ +CBOR_API CborError  _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e (FILE *out, _C_b_o_r_V_a_l_u_e *value, │ │ │ │ + int flags) │ │ │ │ +  Converts the current CBOR type pointed to by vvaalluuee to JSON │ │ │ │ + and writes that to the oouutt stream. │ │ │ │ + CborError  _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n (FILE *out, const _C_b_o_r_V_a_l_u_e *value, int │ │ │ │ + flags) │ │ │ │ +  Converts the current CBOR type pointed to by vvaalluuee to JSON │ │ │ │ + and writes that to the oouutt stream. │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -> The <_c_b_o_r_._h> is the main header in TinyCBOR and defines the constants used by │ │ │ │ -most functions as well as the structures for encoding (_C_b_o_r_E_n_c_o_d_e_r) and │ │ │ │ -decoding (_C_b_o_r_V_a_l_u_e). │ │ │ │ +> The <_c_b_o_r_j_s_o_n_._h> file contains the routines that are used to convert a CBOR │ │ │ │ +data stream into JSON. │ │ │ │ See also │ │ │ │ - <_c_b_o_r_j_s_o_n_._h> │ │ │ │ -********** FFuunnccttiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__dduupp__bbyyttee__ssttrriinngg(()) ********** │ │ │ │ -CborError cbor_value_dup_byte_string ( const _C_b_o_r_V_a_l_u_e * vvaalluuee, │ │ │ │ - uint8_t ** bbuuffffeerr, │ │ │ │ - size_t * bbuufflleenn, │ │ │ │ - _C_b_o_r_V_a_l_u_e * nneexxtt ) │ │ │ │ -Allocates memory for the string pointed by vvaalluuee and copies it into this │ │ │ │ -buffer. │ │ │ │ -The pointer to the buffer is stored in bbuuffffeerr and the number of bytes copied is │ │ │ │ -stored in bbuufflleenn (those variables must not be NULL). │ │ │ │ -If the iterator vvaalluuee does not point to a byte string, the behaviour is │ │ │ │ -undefined, so checking with _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e or _c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g is │ │ │ │ -recommended. │ │ │ │ -On success, *buffer will contain a valid pointer that must be freed by calling │ │ │ │ -free(). This is the case even for zero-length strings. The nneexxtt pointer, if not │ │ │ │ -null, will be updated to point to the next item after this string. If vvaalluuee │ │ │ │ -points to the last item, then nneexxtt will be invalid. │ │ │ │ -If malloc returns a NULL pointer, this function will return error condition │ │ │ │ -CborErrorOutOfMemory. In this case, *buflen should contain the number of bytes │ │ │ │ -necessary to copy this string and vvaalluuee will be updated to point to the next │ │ │ │ -element. On all other failure cases, the values contained in *buffer, *buflen │ │ │ │ -and nneexxtt are undefined and mustn't be used (for example, calling {free()}). │ │ │ │ -This function may not run in constant time (it will run in O(n) time on the │ │ │ │ -number of chunks). It requires constant memory (O(1)) in addition to the │ │ │ │ -malloc'ed block. │ │ │ │ - See also │ │ │ │ - _c_b_o_r___v_a_l_u_e___g_e_t___t_e_x_t___s_t_r_i_n_g___c_h_u_n_k_(_), _c_b_o_r___v_a_l_u_e___c_o_p_y___b_y_t_e___s_t_r_i_n_g_(_), │ │ │ │ - _c_b_o_r___v_a_l_u_e___d_u_p___t_e_x_t___s_t_r_i_n_g_(_) │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__dduupp__tteexxtt__ssttrriinngg(()) ********** │ │ │ │ -CborError cbor_value_dup_text_string ( const _C_b_o_r_V_a_l_u_e * vvaalluuee, │ │ │ │ - char ** bbuuffffeerr, │ │ │ │ - size_t * bbuufflleenn, │ │ │ │ - _C_b_o_r_V_a_l_u_e * nneexxtt ) │ │ │ │ -Allocates memory for the string pointed by vvaalluuee and copies it into this │ │ │ │ -buffer. │ │ │ │ -The pointer to the buffer is stored in bbuuffffeerr and the number of bytes copied is │ │ │ │ -stored in bbuufflleenn (those variables must not be NULL). │ │ │ │ -If the iterator vvaalluuee does not point to a text string, the behaviour is │ │ │ │ -undefined, so checking with _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e or _c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g is │ │ │ │ -recommended. │ │ │ │ -On success, *buffer will contain a valid pointer that must be freed by calling │ │ │ │ -free(). This is the case even for zero-length strings. The nneexxtt pointer, if not │ │ │ │ -null, will be updated to point to the next item after this string. If vvaalluuee │ │ │ │ -points to the last item, then nneexxtt will be invalid. │ │ │ │ -If malloc returns a NULL pointer, this function will return error condition │ │ │ │ -CborErrorOutOfMemory. In this case, *buflen should contain the number of bytes │ │ │ │ -necessary to copy this string and vvaalluuee will be updated to point to the next │ │ │ │ -element. On all other failure cases, the values contained in *buffer, *buflen │ │ │ │ -and nneexxtt are undefined and mustn't be used (for example, calling {free()}). │ │ │ │ -This function may not run in constant time (it will run in O(n) time on the │ │ │ │ -number of chunks). It requires constant memory (O(1)) in addition to the │ │ │ │ -malloc'ed block. │ │ │ │ - Note │ │ │ │ - This function does not perform UTF-8 validation on the incoming text │ │ │ │ - string. │ │ │ │ - See also │ │ │ │ - _c_b_o_r___v_a_l_u_e___g_e_t___t_e_x_t___s_t_r_i_n_g___c_h_u_n_k_(_), _c_b_o_r___v_a_l_u_e___c_o_p_y___t_e_x_t___s_t_r_i_n_g_(_), │ │ │ │ - _c_b_o_r___v_a_l_u_e___d_u_p___b_y_t_e___s_t_r_i_n_g_(_) │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__ggeett__hhaallff__ffllooaatt__aass__ffllooaatt(()) ********** │ │ │ │ -CBOR_API CborError ( const _C_b_o_r_V_a_l_u_e * vvaalluuee, │ │ │ │ -cbor_value_get_half_float_as_float │ │ │ │ - float * rreessuulltt ) │ │ │ │ -Retrieves the CBOR half-precision floating point (16-bit) value that vvaalluuee │ │ │ │ -points to, converts it to the float and store it in rreessuulltt. │ │ │ │ -If the iterator vvaalluuee does not point to a half-precision floating point value, │ │ │ │ -the behavior is undefined, so checking with _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e or with │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t is recommended. │ │ │ │ - See also │ │ │ │ - _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e_(_), _c_b_o_r___v_a_l_u_e___i_s___v_a_l_i_d_(_), _c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t_(_), │ │ │ │ - _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t_(_), _c_b_o_r___v_a_l_u_e___g_e_t___f_l_o_a_t_(_) │ │ │ │ -Referenced by _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t___a_s___f_l_o_a_t_(_). │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__ttoo__pprreettttyy(()) ********** │ │ │ │ -CborError cbor_value_to_pretty ( FILE * oouutt, │ │ │ │ - const _C_b_o_r_V_a_l_u_e * vvaalluuee ) │ │ │ │ -Converts the current CBOR type pointed to by vvaalluuee to its textual │ │ │ │ -representation and writes it to the oouutt stream. │ │ │ │ -If an error occurs, this function returns an error code similar to CborParsing. │ │ │ │ - See also │ │ │ │ - cbor_value_to_pretty_advance(), _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e_(_) │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__ttoo__pprreettttyy__aaddvvaannccee(()) ********** │ │ │ │ -CBOR_API CborError cbor_value_to_pretty_advance ( FILE * oouutt, │ │ │ │ - _C_b_o_r_V_a_l_u_e * vvaalluuee ) │ │ │ │ -Converts the current CBOR type pointed to by vvaalluuee to its textual │ │ │ │ -representation and writes it to the oouutt stream. │ │ │ │ -If an error occurs, this function returns an error code similar to CborParsing. │ │ │ │ -If no error ocurred, this function advances vvaalluuee to the next element. Often, │ │ │ │ -concatenating the text representation of multiple elements can be done by │ │ │ │ -appending a comma to the output stream in between calls to this function. │ │ │ │ - See also │ │ │ │ - _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y_(_), _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___s_t_r_e_a_m_(_), │ │ │ │ - _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e_(_) │ │ │ │ -Referenced by _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e_(_). │ │ │ │ -********** _?◆_? ccbboorr__vvaalluuee__ttoo__pprreettttyy__aaddvvaannccee__ffllaaggss(()) ********** │ │ │ │ -CBOR_API CborError cbor_value_to_pretty_advance_flags ( FILE * oouutt, │ │ │ │ - _C_b_o_r_V_a_l_u_e * vvaalluuee, │ │ │ │ - int ffllaaggss ) │ │ │ │ -Converts the current CBOR type pointed to by vvaalluuee to its textual │ │ │ │ -representation and writes it to the oouutt stream. │ │ │ │ -If an error occurs, this function returns an error code similar to CborParsing. │ │ │ │ -The textual representation can be controlled by the ffllaaggss parameter (see │ │ │ │ -CborPrettyFlags for more information). │ │ │ │ -If no error ocurred, this function advances vvaalluuee to the next element. Often, │ │ │ │ -concatenating the text representation of multiple elements can be done by │ │ │ │ -appending a comma to the output stream in between calls to this function. │ │ │ │ - See also │ │ │ │ - _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___s_t_r_e_a_m_(_), _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y_(_), │ │ │ │ - _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e_(_) │ │ │ │ -Referenced by _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y_(_), and _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e___f_l_a_g_s_(_). │ │ │ │ + <_c_b_o_r_._h> │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libtinycbor-dev/html/a00044_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -TinyCBOR 7.0 API: cbor.h Source File │ │ │ +TinyCBOR 7.0 API: cborjson.h Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ @@ -42,20 +42,20 @@ │ │ │
  • Globals
  • │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │
    │ │ │
    │ │ │ -
    cbor.h
    │ │ │ +
    cborjson.h
    │ │ │
    │ │ │
    │ │ │ Go to the documentation of this file.
    1/****************************************************************************
    │ │ │
    2**
    │ │ │ -
    3** Copyright (C) 2021 Intel Corporation
    │ │ │ +
    3** Copyright (C) 2015 Intel Corporation
    │ │ │
    4**
    │ │ │
    5** Permission is hereby granted, free of charge, to any person obtaining a copy
    │ │ │
    6** of this software and associated documentation files (the "Software"), to deal
    │ │ │
    7** in the Software without restriction, including without limitation the rights
    │ │ │
    8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    │ │ │
    9** copies of the Software, and to permit persons to whom the Software is
    │ │ │
    10** furnished to do so, subject to the following conditions:
    │ │ │ @@ -69,801 +69,55 @@ │ │ │
    18** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    │ │ │
    19** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    │ │ │
    20** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    │ │ │
    21** THE SOFTWARE.
    │ │ │
    22**
    │ │ │
    23****************************************************************************/
    │ │ │
    24
    │ │ │ -
    25#ifndef CBOR_H
    │ │ │ -
    26#define CBOR_H
    │ │ │ +
    25#ifndef CBORJSON_H
    │ │ │ +
    26#define CBORJSON_H
    │ │ │
    27
    │ │ │ -
    28#ifndef assert
    │ │ │ -
    29#include <assert.h>
    │ │ │ -
    30#endif
    │ │ │ -
    31#include <limits.h>
    │ │ │ -
    32#include <stddef.h>
    │ │ │ -
    33#include <stdint.h>
    │ │ │ -
    34#include <string.h>
    │ │ │ -
    35#include <stdio.h>
    │ │ │ -
    36
    │ │ │ -
    37#ifdef CBOR_EXTERNAL_CFG
    │ │ │ -
    38#include "cbor_cfg.h"
    │ │ │ -
    39#endif
    │ │ │ +
    28#include "cbor.h"
    │ │ │ +
    29
    │ │ │ +
    30#ifdef __cplusplus
    │ │ │ +
    31extern "C" {
    │ │ │ +
    32#endif
    │ │ │ +
    33
    │ │ │ +
    34/* Conversion to JSON */
    │ │ │ +
    35enum CborToJsonFlags
    │ │ │ +
    36{
    │ │ │ +
    37 CborConvertAddMetadata = 1,
    │ │ │ +
    38 CborConvertTagsToObjects = 2,
    │ │ │ +
    39 CborConvertIgnoreTags = 0,
    │ │ │
    40
    │ │ │ -
    41#include "tinycbor-export.h"
    │ │ │ -
    42#include "tinycbor-version.h"
    │ │ │ +
    41 CborConvertObeyByteStringTags = 0,
    │ │ │ +
    42 CborConvertByteStringsToBase64Url = 4,
    │ │ │
    43
    │ │ │ -
    44#define TINYCBOR_VERSION ((TINYCBOR_VERSION_MAJOR << 16) | (TINYCBOR_VERSION_MINOR << 8) | TINYCBOR_VERSION_PATCH)
    │ │ │ -
    45
    │ │ │ -
    46#ifdef __cplusplus
    │ │ │ -
    47extern "C" {
    │ │ │ -
    48#else
    │ │ │ -
    49#include <stdbool.h>
    │ │ │ -
    50#endif
    │ │ │ -
    51
    │ │ │ -
    52#ifndef SIZE_MAX
    │ │ │ -
    53/* Some systems fail to define SIZE_MAX in <stdint.h>, even though C99 requires it...
    │ │ │ -
    54 * Conversion from signed to unsigned is defined in 6.3.1.3 (Signed and unsigned integers) p2,
    │ │ │ -
    55 * which says: "the value is converted by repeatedly adding or subtracting one more than the
    │ │ │ -
    56 * maximum value that can be represented in the new type until the value is in the range of the
    │ │ │ -
    57 * new type."
    │ │ │ -
    58 * So -1 gets converted to size_t by adding SIZE_MAX + 1, which results in SIZE_MAX.
    │ │ │ -
    59 */
    │ │ │ -
    60# define SIZE_MAX ((size_t)-1)
    │ │ │ -
    61#endif
    │ │ │ +
    44 CborConvertRequireMapStringKeys = 0,
    │ │ │ +
    45 CborConvertStringifyMapKeys = 8,
    │ │ │ +
    46
    │ │ │ +
    47 CborConvertDefaultFlags = 0
    │ │ │ +
    48};
    │ │ │ +
    49
    │ │ │ +
    50CBOR_API CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int flags);
    │ │ │ +
    51CBOR_INLINE_API CborError cbor_value_to_json(FILE *out, const CborValue *value, int flags)
    │ │ │ +
    52{
    │ │ │ +
    53 CborValue copy = *value;
    │ │ │ +
    54 return cbor_value_to_json_advance(out, &copy, flags);
    │ │ │ +
    55}
    │ │ │ +
    56
    │ │ │ +
    57#ifdef __cplusplus
    │ │ │ +
    58}
    │ │ │ +
    59#endif
    │ │ │ +
    60
    │ │ │ +
    61#endif /* CBORJSON_H */
    │ │ │
    62
    │ │ │ -
    63#ifndef CBOR_PRIVATE_API
    │ │ │ -
    64# define CBOR_PRIVATE_API CBOR_API
    │ │ │ -
    65#endif
    │ │ │ -
    66#ifndef CBOR_INLINE_API
    │ │ │ -
    67# if defined(__cplusplus)
    │ │ │ -
    68# define CBOR_INLINE inline
    │ │ │ -
    69# define CBOR_INLINE_API inline
    │ │ │ -
    70# else
    │ │ │ -
    71# define CBOR_INLINE_API static CBOR_INLINE
    │ │ │ -
    72# if defined(_MSC_VER)
    │ │ │ -
    73# define CBOR_INLINE __inline
    │ │ │ -
    74# elif defined(__GNUC__)
    │ │ │ -
    75# define CBOR_INLINE __inline__
    │ │ │ -
    76# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    │ │ │ -
    77# define CBOR_INLINE inline
    │ │ │ -
    78# else
    │ │ │ -
    79# define CBOR_INLINE
    │ │ │ -
    80# endif
    │ │ │ -
    81# endif
    │ │ │ -
    82#endif
    │ │ │ -
    83
    │ │ │ -
    84typedef enum CborType {
    │ │ │ -
    85 CborIntegerType = 0x00,
    │ │ │ -
    86 CborByteStringType = 0x40,
    │ │ │ -
    87 CborTextStringType = 0x60,
    │ │ │ -
    88 CborArrayType = 0x80,
    │ │ │ -
    89 CborMapType = 0xa0,
    │ │ │ -
    90 CborTagType = 0xc0,
    │ │ │ -
    91 CborSimpleType = 0xe0,
    │ │ │ -
    92 CborBooleanType = 0xf5,
    │ │ │ -
    93 CborNullType = 0xf6,
    │ │ │ -
    94 CborUndefinedType = 0xf7,
    │ │ │ -
    95 CborHalfFloatType = 0xf9,
    │ │ │ -
    96 CborFloatType = 0xfa,
    │ │ │ -
    97 CborDoubleType = 0xfb,
    │ │ │ -
    98
    │ │ │ -
    99 CborInvalidType = 0xff /* equivalent to the break byte, so it will never be used */
    │ │ │ -
    100} CborType;
    │ │ │ -
    101
    │ │ │ -
    102typedef uint64_t CborTag;
    │ │ │ -
    103typedef enum CborKnownTags {
    │ │ │ -
    104 CborDateTimeStringTag = 0,
    │ │ │ -
    105 CborUnixTime_tTag = 1,
    │ │ │ -
    106 CborPositiveBignumTag = 2,
    │ │ │ -
    107 CborNegativeBignumTag = 3,
    │ │ │ -
    108 CborDecimalTag = 4,
    │ │ │ -
    109 CborBigfloatTag = 5,
    │ │ │ -
    110 CborCOSE_Encrypt0Tag = 16,
    │ │ │ -
    111 CborCOSE_Mac0Tag = 17,
    │ │ │ -
    112 CborCOSE_Sign1Tag = 18,
    │ │ │ -
    113 CborExpectedBase64urlTag = 21,
    │ │ │ -
    114 CborExpectedBase64Tag = 22,
    │ │ │ -
    115 CborExpectedBase16Tag = 23,
    │ │ │ -
    116 CborEncodedCborTag = 24,
    │ │ │ -
    117 CborUrlTag = 32,
    │ │ │ -
    118 CborBase64urlTag = 33,
    │ │ │ -
    119 CborBase64Tag = 34,
    │ │ │ -
    120 CborRegularExpressionTag = 35,
    │ │ │ -
    121 CborMimeMessageTag = 36,
    │ │ │ -
    122 CborCOSE_EncryptTag = 96,
    │ │ │ -
    123 CborCOSE_MacTag = 97,
    │ │ │ -
    124 CborCOSE_SignTag = 98,
    │ │ │ -
    125 CborSignatureTag = 55799
    │ │ │ -
    126} CborKnownTags;
    │ │ │ -
    127
    │ │ │ -
    128/* #define the constants so we can check with #ifdef */
    │ │ │ -
    129#define CborDateTimeStringTag CborDateTimeStringTag
    │ │ │ -
    130#define CborUnixTime_tTag CborUnixTime_tTag
    │ │ │ -
    131#define CborPositiveBignumTag CborPositiveBignumTag
    │ │ │ -
    132#define CborNegativeBignumTag CborNegativeBignumTag
    │ │ │ -
    133#define CborDecimalTag CborDecimalTag
    │ │ │ -
    134#define CborBigfloatTag CborBigfloatTag
    │ │ │ -
    135#define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag
    │ │ │ -
    136#define CborCOSE_Mac0Tag CborCOSE_Mac0Tag
    │ │ │ -
    137#define CborCOSE_Sign1Tag CborCOSE_Sign1Tag
    │ │ │ -
    138#define CborExpectedBase64urlTag CborExpectedBase64urlTag
    │ │ │ -
    139#define CborExpectedBase64Tag CborExpectedBase64Tag
    │ │ │ -
    140#define CborExpectedBase16Tag CborExpectedBase16Tag
    │ │ │ -
    141#define CborEncodedCborTag CborEncodedCborTag
    │ │ │ -
    142#define CborUrlTag CborUrlTag
    │ │ │ -
    143#define CborBase64urlTag CborBase64urlTag
    │ │ │ -
    144#define CborBase64Tag CborBase64Tag
    │ │ │ -
    145#define CborRegularExpressionTag CborRegularExpressionTag
    │ │ │ -
    146#define CborMimeMessageTag CborMimeMessageTag
    │ │ │ -
    147#define CborCOSE_EncryptTag CborCOSE_EncryptTag
    │ │ │ -
    148#define CborCOSE_MacTag CborCOSE_MacTag
    │ │ │ -
    149#define CborCOSE_SignTag CborCOSE_SignTag
    │ │ │ -
    150#define CborSignatureTag CborSignatureTag
    │ │ │ -
    151
    │ │ │ -
    152/* Error API */
    │ │ │ -
    153
    │ │ │ -
    154typedef enum CborError {
    │ │ │ -
    155 CborNoError = 0,
    │ │ │ -
    156
    │ │ │ -
    157 /* errors in all modes */
    │ │ │ -
    158 CborUnknownError,
    │ │ │ -
    159 CborErrorUnknownLength, /* request for length in array, map, or string with indeterminate length */
    │ │ │ -
    160 CborErrorAdvancePastEOF,
    │ │ │ -
    161 CborErrorIO,
    │ │ │ -
    162
    │ │ │ -
    163 /* parser errors streaming errors */
    │ │ │ -
    164 CborErrorGarbageAtEnd = 256,
    │ │ │ -
    165 CborErrorUnexpectedEOF,
    │ │ │ -
    166 CborErrorUnexpectedBreak,
    │ │ │ -
    167 CborErrorUnknownType, /* can only happen in major type 7 */
    │ │ │ -
    168 CborErrorIllegalType, /* type not allowed here */
    │ │ │ -
    169 CborErrorIllegalNumber,
    │ │ │ -
    170 CborErrorIllegalSimpleType, /* types of value less than 32 encoded in two bytes */
    │ │ │ -
    171 CborErrorNoMoreStringChunks,
    │ │ │ -
    172
    │ │ │ -
    173 /* parser errors in strict mode parsing only */
    │ │ │ -
    174 CborErrorUnknownSimpleType = 512,
    │ │ │ -
    175 CborErrorUnknownTag,
    │ │ │ -
    176 CborErrorInappropriateTagForType,
    │ │ │ -
    177 CborErrorDuplicateObjectKeys,
    │ │ │ -
    178 CborErrorInvalidUtf8TextString,
    │ │ │ -
    179 CborErrorExcludedType,
    │ │ │ -
    180 CborErrorExcludedValue,
    │ │ │ -
    181 CborErrorImproperValue,
    │ │ │ -
    182 CborErrorOverlongEncoding,
    │ │ │ -
    183 CborErrorMapKeyNotString,
    │ │ │ -
    184 CborErrorMapNotSorted,
    │ │ │ -
    185 CborErrorMapKeysNotUnique,
    │ │ │ -
    186
    │ │ │ -
    187 /* encoder errors */
    │ │ │ -
    188 CborErrorTooManyItems = 768,
    │ │ │ -
    189 CborErrorTooFewItems,
    │ │ │ -
    190
    │ │ │ -
    191 /* internal implementation errors */
    │ │ │ -
    192 CborErrorDataTooLarge = 1024,
    │ │ │ -
    193 CborErrorNestingTooDeep,
    │ │ │ -
    194 CborErrorUnsupportedType,
    │ │ │ -
    195 CborErrorUnimplementedValidation,
    │ │ │ -
    196
    │ │ │ -
    197 /* errors in converting to JSON */
    │ │ │ -
    198 CborErrorJsonObjectKeyIsAggregate = 1280,
    │ │ │ -
    199 CborErrorJsonObjectKeyNotString,
    │ │ │ -
    200 CborErrorJsonNotImplemented,
    │ │ │ -
    201
    │ │ │ -
    202 CborErrorOutOfMemory = (int) (~0U / 2 + 1),
    │ │ │ -
    203 CborErrorInternalError = (int) (~0U / 2) /* INT_MAX on two's complement machines */
    │ │ │ -
    204} CborError;
    │ │ │ -
    205
    │ │ │ -
    206CBOR_API const char *cbor_error_string(CborError error);
    │ │ │ -
    207
    │ │ │ -
    208/* Encoder API */
    │ │ │ -
    209
    │ │ │ -
    210typedef enum CborEncoderAppendType
    │ │ │ -
    211{
    │ │ │ -
    212 CborEncoderAppendCborData = 0,
    │ │ │ -
    213 CborEncoderAppendStringData = 1,
    │ │ │ -
    214 CborEncoderAppendRawData = 2
    │ │ │ -
    215} CborEncoderAppendType;
    │ │ │ -
    216
    │ │ │ -
    217typedef CborError (*CborEncoderWriteFunction)(void *, const void *, size_t, CborEncoderAppendType);
    │ │ │ -
    218
    │ │ │ -
    219enum CborEncoderFlags
    │ │ │ -
    220{
    │ │ │ -
    221 CborIteratorFlag_WriterFunction = 0x01,
    │ │ │ -
    222 CborIteratorFlag_ContainerIsMap_ = 0x20
    │ │ │ -
    223};
    │ │ │ -
    224
    │ │ │ - │ │ │ -
    226{
    │ │ │ -
    227 union {
    │ │ │ -
    228 uint8_t *ptr;
    │ │ │ -
    229 ptrdiff_t bytes_needed;
    │ │ │ -
    230 CborEncoderWriteFunction writer;
    │ │ │ -
    231 } data;
    │ │ │ -
    232 uint8_t *end;
    │ │ │ -
    233 size_t remaining;
    │ │ │ -
    234 int flags;
    │ │ │ -
    235};
    │ │ │ -
    236typedef struct CborEncoder CborEncoder;
    │ │ │ -
    237
    │ │ │ -
    238static const size_t CborIndefiniteLength = SIZE_MAX;
    │ │ │ -
    239
    │ │ │ -
    240#ifndef CBOR_NO_ENCODER_API
    │ │ │ -
    241CBOR_API void cbor_encoder_init(CborEncoder *encoder, uint8_t *buffer, size_t size, int flags);
    │ │ │ -
    242CBOR_API void cbor_encoder_init_writer(CborEncoder *encoder, CborEncoderWriteFunction writer, void *);
    │ │ │ -
    243CBOR_API CborError cbor_encode_uint(CborEncoder *encoder, uint64_t value);
    │ │ │ -
    244CBOR_API CborError cbor_encode_int(CborEncoder *encoder, int64_t value);
    │ │ │ -
    245CBOR_API CborError cbor_encode_negative_int(CborEncoder *encoder, uint64_t absolute_value);
    │ │ │ -
    246CBOR_API CborError cbor_encode_simple_value(CborEncoder *encoder, uint8_t value);
    │ │ │ -
    247CBOR_API CborError cbor_encode_tag(CborEncoder *encoder, CborTag tag);
    │ │ │ -
    248CBOR_API CborError cbor_encode_text_string(CborEncoder *encoder, const char *string, size_t length);
    │ │ │ -
    249CBOR_INLINE_API CborError cbor_encode_text_stringz(CborEncoder *encoder, const char *string)
    │ │ │ -
    250{ return cbor_encode_text_string(encoder, string, strlen(string)); }
    │ │ │ -
    251CBOR_API CborError cbor_encode_byte_string(CborEncoder *encoder, const uint8_t *string, size_t length);
    │ │ │ -
    252CBOR_API CborError cbor_encode_floating_point(CborEncoder *encoder, CborType fpType, const void *value);
    │ │ │ -
    253CBOR_API CborError cbor_encode_raw(CborEncoder *encoder, const uint8_t *raw, size_t length);
    │ │ │ -
    254
    │ │ │ -
    255CBOR_INLINE_API CborError cbor_encode_boolean(CborEncoder *encoder, bool value)
    │ │ │ -
    256{ return cbor_encode_simple_value(encoder, (int)value - 1 + (CborBooleanType & 0x1f)); }
    │ │ │ -
    257CBOR_INLINE_API CborError cbor_encode_null(CborEncoder *encoder)
    │ │ │ -
    258{ return cbor_encode_simple_value(encoder, CborNullType & 0x1f); }
    │ │ │ -
    259CBOR_INLINE_API CborError cbor_encode_undefined(CborEncoder *encoder)
    │ │ │ -
    260{ return cbor_encode_simple_value(encoder, CborUndefinedType & 0x1f); }
    │ │ │ -
    261
    │ │ │ -
    262CBOR_INLINE_API CborError cbor_encode_half_float(CborEncoder *encoder, const void *value)
    │ │ │ -
    263{ return cbor_encode_floating_point(encoder, CborHalfFloatType, value); }
    │ │ │ -
    264CBOR_API CborError cbor_encode_float_as_half_float(CborEncoder *encoder, float value);
    │ │ │ -
    265CBOR_INLINE_API CborError cbor_encode_float(CborEncoder *encoder, float value)
    │ │ │ -
    266{ return cbor_encode_floating_point(encoder, CborFloatType, &value); }
    │ │ │ -
    267CBOR_INLINE_API CborError cbor_encode_double(CborEncoder *encoder, double value)
    │ │ │ -
    268{ return cbor_encode_floating_point(encoder, CborDoubleType, &value); }
    │ │ │ -
    269
    │ │ │ -
    270CBOR_API CborError cbor_encoder_create_array(CborEncoder *parentEncoder, CborEncoder *arrayEncoder, size_t length);
    │ │ │ -
    271CBOR_API CborError cbor_encoder_create_map(CborEncoder *parentEncoder, CborEncoder *mapEncoder, size_t length);
    │ │ │ -
    272CBOR_API CborError cbor_encoder_close_container(CborEncoder *parentEncoder, const CborEncoder *containerEncoder);
    │ │ │ -
    273CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder *parentEncoder, const CborEncoder *containerEncoder);
    │ │ │ -
    274
    │ │ │ -
    275CBOR_INLINE_API uint8_t *_cbor_encoder_get_buffer_pointer(const CborEncoder *encoder)
    │ │ │ -
    276{
    │ │ │ -
    277 return encoder->data.ptr;
    │ │ │ -
    278}
    │ │ │ -
    279
    │ │ │ -
    280CBOR_INLINE_API size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t *buffer)
    │ │ │ -
    281{
    │ │ │ -
    282 return (size_t)(encoder->data.ptr - buffer);
    │ │ │ -
    283}
    │ │ │ -
    284
    │ │ │ -
    285CBOR_INLINE_API size_t cbor_encoder_get_extra_bytes_needed(const CborEncoder *encoder)
    │ │ │ -
    286{
    │ │ │ -
    287 return encoder->end ? 0 : (size_t)encoder->data.bytes_needed;
    │ │ │ -
    288}
    │ │ │ -
    289#endif /* CBOR_NO_ENCODER_API */
    │ │ │ -
    290
    │ │ │ -
    291/* Parser API */
    │ │ │ -
    292
    │ │ │ -
    293enum CborParserGlobalFlags
    │ │ │ -
    294{
    │ │ │ -
    295 CborParserFlag_ExternalSource = 0x01
    │ │ │ -
    296};
    │ │ │ -
    297
    │ │ │ -
    298enum CborParserIteratorFlags
    │ │ │ -
    299{
    │ │ │ -
    300 /* used for all types, but not during string chunk iteration
    │ │ │ -
    301 * (values are static-asserted, don't change) */
    │ │ │ -
    302 CborIteratorFlag_IntegerValueIs64Bit = 0x01,
    │ │ │ -
    303 CborIteratorFlag_IntegerValueTooLarge = 0x02,
    │ │ │ -
    304
    │ │ │ -
    305 /* used only for CborIntegerType */
    │ │ │ -
    306 CborIteratorFlag_NegativeInteger = 0x04,
    │ │ │ -
    307
    │ │ │ -
    308 /* used only during string iteration */
    │ │ │ -
    309 CborIteratorFlag_BeforeFirstStringChunk = 0x04,
    │ │ │ -
    310 CborIteratorFlag_IteratingStringChunks = 0x08,
    │ │ │ -
    311
    │ │ │ -
    312 /* used for arrays, maps and strings, including during chunk iteration */
    │ │ │ -
    313 CborIteratorFlag_UnknownLength = 0x10,
    │ │ │ -
    314
    │ │ │ -
    315 /* used for maps, but must be kept for all types
    │ │ │ -
    316 * (ContainerIsMap value must be CborMapType - CborArrayType) */
    │ │ │ -
    317 CborIteratorFlag_ContainerIsMap = 0x20,
    │ │ │ -
    318 CborIteratorFlag_NextIsMapKey = 0x40
    │ │ │ -
    319};
    │ │ │ -
    320
    │ │ │ -
    321struct CborValue;
    │ │ │ -
    322struct CborParserOperations
    │ │ │ -
    323{
    │ │ │ -
    324 bool (*can_read_bytes)(void *token, size_t len);
    │ │ │ -
    325 void *(*read_bytes)(void *token, void *dst, size_t offset, size_t len);
    │ │ │ -
    326 void (*advance_bytes)(void *token, size_t len);
    │ │ │ -
    327 CborError (*transfer_string)(void *token, const void **userptr, size_t offset, size_t len);
    │ │ │ -
    328};
    │ │ │ -
    329
    │ │ │ -
    330struct CborParser
    │ │ │ -
    331{
    │ │ │ -
    332 union {
    │ │ │ -
    333 const uint8_t *end;
    │ │ │ -
    334 const struct CborParserOperations *ops;
    │ │ │ -
    335 } source;
    │ │ │ -
    336 enum CborParserGlobalFlags flags;
    │ │ │ -
    337};
    │ │ │ -
    338typedef struct CborParser CborParser;
    │ │ │ -
    339
    │ │ │ - │ │ │ -
    341{
    │ │ │ -
    342 const CborParser *parser;
    │ │ │ -
    343 union {
    │ │ │ -
    344 const uint8_t *ptr;
    │ │ │ -
    345 void *token;
    │ │ │ -
    346 } source;
    │ │ │ -
    347 uint32_t remaining;
    │ │ │ -
    348 uint16_t extra;
    │ │ │ -
    349 uint8_t type;
    │ │ │ -
    350 uint8_t flags;
    │ │ │ -
    351};
    │ │ │ -
    352typedef struct CborValue CborValue;
    │ │ │ -
    353
    │ │ │ -
    354#ifndef CBOR_NO_PARSER_API
    │ │ │ -
    355CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it);
    │ │ │ -
    356CBOR_API CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *token);
    │ │ │ -
    357
    │ │ │ -
    358CBOR_API CborError cbor_value_validate_basic(const CborValue *it);
    │ │ │ -
    359
    │ │ │ -
    360CBOR_INLINE_API bool cbor_value_at_end(const CborValue *it)
    │ │ │ -
    361{ return it->remaining == 0; }
    │ │ │ -
    362CBOR_INLINE_API const uint8_t *cbor_value_get_next_byte(const CborValue *it)
    │ │ │ -
    363{ return it->source.ptr; }
    │ │ │ -
    364CBOR_API CborError cbor_value_reparse(CborValue *it);
    │ │ │ -
    365CBOR_API CborError cbor_value_advance_fixed(CborValue *it);
    │ │ │ -
    366CBOR_API CborError cbor_value_advance(CborValue *it);
    │ │ │ -
    367CBOR_INLINE_API bool cbor_value_is_container(const CborValue *it)
    │ │ │ -
    368{ return it->type == CborArrayType || it->type == CborMapType; }
    │ │ │ -
    369CBOR_API CborError cbor_value_enter_container(const CborValue *it, CborValue *recursed);
    │ │ │ -
    370CBOR_API CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed);
    │ │ │ -
    371
    │ │ │ -
    372CBOR_PRIVATE_API uint64_t _cbor_value_decode_int64_internal(const CborValue *value);
    │ │ │ -
    373CBOR_INLINE_API uint64_t _cbor_value_extract_int64_helper(const CborValue *value)
    │ │ │ -
    374{
    │ │ │ -
    375 return value->flags & CborIteratorFlag_IntegerValueTooLarge ?
    │ │ │ -
    376 _cbor_value_decode_int64_internal(value) : value->extra;
    │ │ │ -
    377}
    │ │ │ -
    378
    │ │ │ -
    379CBOR_INLINE_API bool cbor_value_is_valid(const CborValue *value)
    │ │ │ -
    380{ return value && value->type != CborInvalidType; }
    │ │ │ -
    381CBOR_INLINE_API CborType cbor_value_get_type(const CborValue *value)
    │ │ │ -
    382{ return (CborType)value->type; }
    │ │ │ -
    383
    │ │ │ -
    384/* Null & undefined type */
    │ │ │ -
    385CBOR_INLINE_API bool cbor_value_is_null(const CborValue *value)
    │ │ │ -
    386{ return value->type == CborNullType; }
    │ │ │ -
    387CBOR_INLINE_API bool cbor_value_is_undefined(const CborValue *value)
    │ │ │ -
    388{ return value->type == CborUndefinedType; }
    │ │ │ -
    389
    │ │ │ -
    390/* Booleans */
    │ │ │ -
    391CBOR_INLINE_API bool cbor_value_is_boolean(const CborValue *value)
    │ │ │ -
    392{ return value->type == CborBooleanType; }
    │ │ │ -
    393CBOR_INLINE_API CborError cbor_value_get_boolean(const CborValue *value, bool *result)
    │ │ │ -
    394{
    │ │ │ -
    395 assert(cbor_value_is_boolean(value));
    │ │ │ -
    396 *result = !!value->extra;
    │ │ │ -
    397 return CborNoError;
    │ │ │ -
    398}
    │ │ │ -
    399
    │ │ │ -
    400/* Simple types */
    │ │ │ -
    401CBOR_INLINE_API bool cbor_value_is_simple_type(const CborValue *value)
    │ │ │ -
    402{ return value->type == CborSimpleType; }
    │ │ │ -
    403CBOR_INLINE_API CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result)
    │ │ │ -
    404{
    │ │ │ -
    405 assert(cbor_value_is_simple_type(value));
    │ │ │ -
    406 *result = (uint8_t)value->extra;
    │ │ │ -
    407 return CborNoError;
    │ │ │ -
    408}
    │ │ │ -
    409
    │ │ │ -
    410/* Integers */
    │ │ │ -
    411CBOR_INLINE_API bool cbor_value_is_integer(const CborValue *value)
    │ │ │ -
    412{ return value->type == CborIntegerType; }
    │ │ │ -
    413CBOR_INLINE_API bool cbor_value_is_unsigned_integer(const CborValue *value)
    │ │ │ -
    414{ return cbor_value_is_integer(value) && (value->flags & CborIteratorFlag_NegativeInteger) == 0; }
    │ │ │ -
    415CBOR_INLINE_API bool cbor_value_is_negative_integer(const CborValue *value)
    │ │ │ -
    416{ return cbor_value_is_integer(value) && (value->flags & CborIteratorFlag_NegativeInteger); }
    │ │ │ -
    417
    │ │ │ -
    418CBOR_INLINE_API CborError cbor_value_get_raw_integer(const CborValue *value, uint64_t *result)
    │ │ │ -
    419{
    │ │ │ -
    420 assert(cbor_value_is_integer(value));
    │ │ │ -
    421 *result = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    422 return CborNoError;
    │ │ │ -
    423}
    │ │ │ -
    424
    │ │ │ -
    425CBOR_INLINE_API CborError cbor_value_get_uint64(const CborValue *value, uint64_t *result)
    │ │ │ -
    426{
    │ │ │ -
    427 assert(cbor_value_is_unsigned_integer(value));
    │ │ │ -
    428 *result = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    429 return CborNoError;
    │ │ │ -
    430}
    │ │ │ -
    431
    │ │ │ -
    432CBOR_INLINE_API CborError cbor_value_get_int64(const CborValue *value, int64_t *result)
    │ │ │ -
    433{
    │ │ │ -
    434 assert(cbor_value_is_integer(value));
    │ │ │ -
    435 *result = (int64_t) _cbor_value_extract_int64_helper(value);
    │ │ │ -
    436 if (value->flags & CborIteratorFlag_NegativeInteger)
    │ │ │ -
    437 *result = -*result - 1;
    │ │ │ -
    438 return CborNoError;
    │ │ │ -
    439}
    │ │ │ -
    440
    │ │ │ -
    441CBOR_INLINE_API CborError cbor_value_get_int(const CborValue *value, int *result)
    │ │ │ -
    442{
    │ │ │ -
    443 assert(cbor_value_is_integer(value));
    │ │ │ -
    444 *result = (int) _cbor_value_extract_int64_helper(value);
    │ │ │ -
    445 if (value->flags & CborIteratorFlag_NegativeInteger)
    │ │ │ -
    446 *result = -*result - 1;
    │ │ │ -
    447 return CborNoError;
    │ │ │ -
    448}
    │ │ │ -
    449
    │ │ │ -
    450CBOR_API CborError cbor_value_get_int64_checked(const CborValue *value, int64_t *result);
    │ │ │ -
    451CBOR_API CborError cbor_value_get_int_checked(const CborValue *value, int *result);
    │ │ │ -
    452
    │ │ │ -
    453CBOR_INLINE_API bool cbor_value_is_length_known(const CborValue *value)
    │ │ │ -
    454{ return (value->flags & CborIteratorFlag_UnknownLength) == 0; }
    │ │ │ -
    455
    │ │ │ -
    456/* Tags */
    │ │ │ -
    457CBOR_INLINE_API bool cbor_value_is_tag(const CborValue *value)
    │ │ │ -
    458{ return value->type == CborTagType; }
    │ │ │ -
    459CBOR_INLINE_API CborError cbor_value_get_tag(const CborValue *value, CborTag *result)
    │ │ │ -
    460{
    │ │ │ -
    461 assert(cbor_value_is_tag(value));
    │ │ │ -
    462 *result = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    463 return CborNoError;
    │ │ │ -
    464}
    │ │ │ -
    465CBOR_API CborError cbor_value_skip_tag(CborValue *it);
    │ │ │ -
    466
    │ │ │ -
    467/* Strings */
    │ │ │ -
    468CBOR_INLINE_API bool cbor_value_is_byte_string(const CborValue *value)
    │ │ │ -
    469{ return value->type == CborByteStringType; }
    │ │ │ -
    470CBOR_INLINE_API bool cbor_value_is_text_string(const CborValue *value)
    │ │ │ -
    471{ return value->type == CborTextStringType; }
    │ │ │ -
    472
    │ │ │ -
    473CBOR_INLINE_API CborError cbor_value_get_string_length(const CborValue *value, size_t *length)
    │ │ │ -
    474{
    │ │ │ -
    475 uint64_t v;
    │ │ │ - │ │ │ -
    477 if (!cbor_value_is_length_known(value))
    │ │ │ -
    478 return CborErrorUnknownLength;
    │ │ │ -
    479 v = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    480 *length = (size_t)v;
    │ │ │ -
    481 if (*length != v)
    │ │ │ -
    482 return CborErrorDataTooLarge;
    │ │ │ -
    483 return CborNoError;
    │ │ │ -
    484}
    │ │ │ -
    485
    │ │ │ -
    486CBOR_PRIVATE_API CborError _cbor_value_copy_string(const CborValue *value, void *buffer,
    │ │ │ -
    487 size_t *buflen, CborValue *next);
    │ │ │ -
    488CBOR_PRIVATE_API CborError _cbor_value_dup_string(const CborValue *value, void **buffer,
    │ │ │ -
    489 size_t *buflen, CborValue *next);
    │ │ │ -
    490
    │ │ │ -
    491CBOR_API CborError cbor_value_calculate_string_length(const CborValue *value, size_t *length);
    │ │ │ -
    492
    │ │ │ -
    493CBOR_INLINE_API CborError cbor_value_copy_text_string(const CborValue *value, char *buffer,
    │ │ │ -
    494 size_t *buflen, CborValue *next)
    │ │ │ -
    495{
    │ │ │ -
    496 assert(cbor_value_is_text_string(value));
    │ │ │ -
    497 return _cbor_value_copy_string(value, buffer, buflen, next);
    │ │ │ -
    498}
    │ │ │ -
    499CBOR_INLINE_API CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer,
    │ │ │ -
    500 size_t *buflen, CborValue *next)
    │ │ │ -
    501{
    │ │ │ -
    502 assert(cbor_value_is_byte_string(value));
    │ │ │ -
    503 return _cbor_value_copy_string(value, buffer, buflen, next);
    │ │ │ -
    504}
    │ │ │ -
    505
    │ │ │ -
    506CBOR_INLINE_API CborError cbor_value_dup_text_string(const CborValue *value, char **buffer,
    │ │ │ -
    507 size_t *buflen, CborValue *next)
    │ │ │ -
    508{
    │ │ │ -
    509 assert(cbor_value_is_text_string(value));
    │ │ │ -
    510 return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
    │ │ │ -
    511}
    │ │ │ -
    512CBOR_INLINE_API CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer,
    │ │ │ -
    513 size_t *buflen, CborValue *next)
    │ │ │ -
    514{
    │ │ │ -
    515 assert(cbor_value_is_byte_string(value));
    │ │ │ -
    516 return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
    │ │ │ -
    517}
    │ │ │ -
    518
    │ │ │ -
    519CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk_size(const CborValue *value, size_t *len);
    │ │ │ -
    520CBOR_INLINE_API CborError cbor_value_get_string_chunk_size(const CborValue *value, size_t *len)
    │ │ │ -
    521{
    │ │ │ -
    522 assert(value->flags & CborIteratorFlag_IteratingStringChunks);
    │ │ │ -
    523 return _cbor_value_get_string_chunk_size(value, len);
    │ │ │ -
    524}
    │ │ │ -
    525
    │ │ │ -
    526CBOR_INLINE_API bool cbor_value_string_iteration_at_end(const CborValue *value)
    │ │ │ -
    527{
    │ │ │ -
    528 size_t dummy;
    │ │ │ -
    529 return cbor_value_get_string_chunk_size(value, &dummy) == CborErrorNoMoreStringChunks;
    │ │ │ -
    530}
    │ │ │ -
    531
    │ │ │ -
    532CBOR_PRIVATE_API CborError _cbor_value_begin_string_iteration(CborValue *value);
    │ │ │ -
    533CBOR_INLINE_API CborError cbor_value_begin_string_iteration(CborValue *value)
    │ │ │ -
    534{
    │ │ │ - │ │ │ -
    536 assert(!(value->flags & CborIteratorFlag_IteratingStringChunks));
    │ │ │ -
    537 return _cbor_value_begin_string_iteration(value);
    │ │ │ -
    538}
    │ │ │ -
    539
    │ │ │ -
    540CBOR_PRIVATE_API CborError _cbor_value_finish_string_iteration(CborValue *value);
    │ │ │ -
    541CBOR_INLINE_API CborError cbor_value_finish_string_iteration(CborValue *value)
    │ │ │ -
    542{
    │ │ │ -
    543 assert(cbor_value_string_iteration_at_end(value));
    │ │ │ -
    544 return _cbor_value_finish_string_iteration(value);
    │ │ │ -
    545}
    │ │ │ -
    546
    │ │ │ -
    547CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk(const CborValue *value, const void **bufferptr,
    │ │ │ -
    548 size_t *len, CborValue *next);
    │ │ │ -
    549CBOR_INLINE_API CborError cbor_value_get_text_string_chunk(const CborValue *value, const char **bufferptr,
    │ │ │ -
    550 size_t *len, CborValue *next)
    │ │ │ -
    551{
    │ │ │ -
    552 assert(cbor_value_is_text_string(value));
    │ │ │ -
    553 return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, next);
    │ │ │ -
    554}
    │ │ │ -
    555CBOR_INLINE_API CborError cbor_value_get_byte_string_chunk(const CborValue *value, const uint8_t **bufferptr,
    │ │ │ -
    556 size_t *len, CborValue *next)
    │ │ │ -
    557{
    │ │ │ -
    558 assert(cbor_value_is_byte_string(value));
    │ │ │ -
    559 return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, next);
    │ │ │ -
    560}
    │ │ │ -
    561
    │ │ │ -
    562CBOR_API CborError cbor_value_text_string_equals(const CborValue *value, const char *string, bool *result);
    │ │ │ -
    563
    │ │ │ -
    564/* Maps and arrays */
    │ │ │ -
    565CBOR_INLINE_API bool cbor_value_is_array(const CborValue *value)
    │ │ │ -
    566{ return value->type == CborArrayType; }
    │ │ │ -
    567CBOR_INLINE_API bool cbor_value_is_map(const CborValue *value)
    │ │ │ -
    568{ return value->type == CborMapType; }
    │ │ │ -
    569
    │ │ │ -
    570CBOR_INLINE_API CborError cbor_value_get_array_length(const CborValue *value, size_t *length)
    │ │ │ -
    571{
    │ │ │ -
    572 uint64_t v;
    │ │ │ -
    573 assert(cbor_value_is_array(value));
    │ │ │ -
    574 if (!cbor_value_is_length_known(value))
    │ │ │ -
    575 return CborErrorUnknownLength;
    │ │ │ -
    576 v = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    577 *length = (size_t)v;
    │ │ │ -
    578 if (*length != v)
    │ │ │ -
    579 return CborErrorDataTooLarge;
    │ │ │ -
    580 return CborNoError;
    │ │ │ -
    581}
    │ │ │ -
    582
    │ │ │ -
    583CBOR_INLINE_API CborError cbor_value_get_map_length(const CborValue *value, size_t *length)
    │ │ │ -
    584{
    │ │ │ -
    585 uint64_t v;
    │ │ │ -
    586 assert(cbor_value_is_map(value));
    │ │ │ -
    587 if (!cbor_value_is_length_known(value))
    │ │ │ -
    588 return CborErrorUnknownLength;
    │ │ │ -
    589 v = _cbor_value_extract_int64_helper(value);
    │ │ │ -
    590 *length = (size_t)v;
    │ │ │ -
    591 if (*length != v)
    │ │ │ -
    592 return CborErrorDataTooLarge;
    │ │ │ -
    593 return CborNoError;
    │ │ │ -
    594}
    │ │ │ -
    595
    │ │ │ -
    596CBOR_API CborError cbor_value_map_find_value(const CborValue *map, const char *string, CborValue *element);
    │ │ │ -
    597
    │ │ │ -
    598/* Floating point */
    │ │ │ -
    599CBOR_INLINE_API bool cbor_value_is_half_float(const CborValue *value)
    │ │ │ -
    600{ return value->type == CborHalfFloatType; }
    │ │ │ -
    601CBOR_API CborError cbor_value_get_half_float_as_float(const CborValue *value, float *result);
    │ │ │ -
    602CBOR_INLINE_API CborError cbor_value_get_half_float(const CborValue *value, void *result)
    │ │ │ -
    603{
    │ │ │ -
    604 assert(cbor_value_is_half_float(value));
    │ │ │ -
    605 assert((value->flags & CborIteratorFlag_IntegerValueTooLarge) == 0);
    │ │ │ -
    606
    │ │ │ -
    607 /* size has already been computed */
    │ │ │ -
    608 memcpy(result, &value->extra, sizeof(value->extra));
    │ │ │ -
    609 return CborNoError;
    │ │ │ -
    610}
    │ │ │ -
    611
    │ │ │ -
    612CBOR_INLINE_API bool cbor_value_is_float(const CborValue *value)
    │ │ │ -
    613{ return value->type == CborFloatType; }
    │ │ │ -
    614CBOR_INLINE_API CborError cbor_value_get_float(const CborValue *value, float *result)
    │ │ │ -
    615{
    │ │ │ -
    616 uint32_t data;
    │ │ │ -
    617 assert(cbor_value_is_float(value));
    │ │ │ -
    618 assert(value->flags & CborIteratorFlag_IntegerValueTooLarge);
    │ │ │ -
    619 data = (uint32_t)_cbor_value_decode_int64_internal(value);
    │ │ │ -
    620 memcpy(result, &data, sizeof(*result));
    │ │ │ -
    621 return CborNoError;
    │ │ │ -
    622}
    │ │ │ -
    623
    │ │ │ -
    624CBOR_INLINE_API bool cbor_value_is_double(const CborValue *value)
    │ │ │ -
    625{ return value->type == CborDoubleType; }
    │ │ │ -
    626CBOR_INLINE_API CborError cbor_value_get_double(const CborValue *value, double *result)
    │ │ │ -
    627{
    │ │ │ -
    628 uint64_t data;
    │ │ │ -
    629 assert(cbor_value_is_double(value));
    │ │ │ -
    630 assert(value->flags & CborIteratorFlag_IntegerValueTooLarge);
    │ │ │ -
    631 data = _cbor_value_decode_int64_internal(value);
    │ │ │ -
    632 memcpy(result, &data, sizeof(*result));
    │ │ │ -
    633 return CborNoError;
    │ │ │ -
    634}
    │ │ │ -
    635
    │ │ │ -
    636/* Validation API */
    │ │ │ -
    637#ifndef CBOR_NO_VALIDATION_API
    │ │ │ -
    638
    │ │ │ -
    639enum CborValidationFlags {
    │ │ │ -
    640 /* Bit mapping:
    │ │ │ -
    641 * bits 0-7 (8 bits): canonical format
    │ │ │ -
    642 * bits 8-11 (4 bits): canonical format & strict mode
    │ │ │ -
    643 * bits 12-20 (8 bits): strict mode
    │ │ │ -
    644 * bits 21-31 (10 bits): other
    │ │ │ -
    645 */
    │ │ │ -
    646
    │ │ │ -
    647 CborValidateShortestIntegrals = 0x0001,
    │ │ │ -
    648 CborValidateShortestFloatingPoint = 0x0002,
    │ │ │ -
    649 CborValidateShortestNumbers = CborValidateShortestIntegrals | CborValidateShortestFloatingPoint,
    │ │ │ -
    650 CborValidateNoIndeterminateLength = 0x0100,
    │ │ │ -
    651 CborValidateMapIsSorted = 0x0200 | CborValidateNoIndeterminateLength,
    │ │ │ -
    652
    │ │ │ -
    653 CborValidateCanonicalFormat = 0x0fff,
    │ │ │ -
    654
    │ │ │ -
    655 CborValidateMapKeysAreUnique = 0x1000 | CborValidateMapIsSorted,
    │ │ │ -
    656 CborValidateTagUse = 0x2000,
    │ │ │ -
    657 CborValidateUtf8 = 0x4000,
    │ │ │ -
    658
    │ │ │ -
    659 CborValidateStrictMode = 0xfff00,
    │ │ │ -
    660
    │ │ │ -
    661 CborValidateMapKeysAreString = 0x100000,
    │ │ │ -
    662 CborValidateNoUndefined = 0x200000,
    │ │ │ -
    663 CborValidateNoTags = 0x400000,
    │ │ │ -
    664 CborValidateFiniteFloatingPoint = 0x800000,
    │ │ │ -
    665 /* unused = 0x1000000, */
    │ │ │ -
    666 /* unused = 0x2000000, */
    │ │ │ -
    667
    │ │ │ -
    668 CborValidateNoUnknownSimpleTypesSA = 0x4000000,
    │ │ │ -
    669 CborValidateNoUnknownSimpleTypes = 0x8000000 | CborValidateNoUnknownSimpleTypesSA,
    │ │ │ -
    670 CborValidateNoUnknownTagsSA = 0x10000000,
    │ │ │ -
    671 CborValidateNoUnknownTagsSR = 0x20000000 | CborValidateNoUnknownTagsSA,
    │ │ │ -
    672 CborValidateNoUnknownTags = 0x40000000 | CborValidateNoUnknownTagsSR,
    │ │ │ -
    673
    │ │ │ -
    674 CborValidateCompleteData = (int)0x80000000,
    │ │ │ -
    675
    │ │ │ -
    676 CborValidateStrictest = (int)~0U,
    │ │ │ -
    677 CborValidateBasic = 0
    │ │ │ -
    678};
    │ │ │ -
    679
    │ │ │ -
    680CBOR_API CborError cbor_value_validate(const CborValue *it, uint32_t flags);
    │ │ │ -
    681#endif /* CBOR_NO_VALIDATION_API */
    │ │ │ -
    682
    │ │ │ -
    683/* Human-readable (dump) API */
    │ │ │ -
    684#ifndef CBOR_NO_PRETTY_API
    │ │ │ -
    685
    │ │ │ -
    686enum CborPrettyFlags {
    │ │ │ -
    687 CborPrettyNumericEncodingIndicators = 0x01,
    │ │ │ -
    688 CborPrettyTextualEncodingIndicators = 0,
    │ │ │ -
    689
    │ │ │ -
    690 CborPrettyIndicateIndeterminateLength = 0x02,
    │ │ │ -
    691 CborPrettyIndicateIndetermineLength = CborPrettyIndicateIndeterminateLength, /* deprecated */
    │ │ │ -
    692 CborPrettyIndicateOverlongNumbers = 0x04,
    │ │ │ -
    693
    │ │ │ -
    694 CborPrettyShowStringFragments = 0x100,
    │ │ │ -
    695 CborPrettyMergeStringFragments = 0,
    │ │ │ -
    696
    │ │ │ -
    697 CborPrettyDefaultFlags = CborPrettyIndicateIndeterminateLength
    │ │ │ -
    698};
    │ │ │ -
    699
    │ │ │ -
    700typedef CborError (*CborStreamFunction)(void *token, const char *fmt, ...)
    │ │ │ -
    701#ifdef __GNUC__
    │ │ │ -
    702 __attribute__((__format__(printf, 2, 3)))
    │ │ │ -
    703#endif
    │ │ │ -
    704;
    │ │ │ -
    705
    │ │ │ -
    706CBOR_API CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *token, CborValue *value, int flags);
    │ │ │ -
    707
    │ │ │ -
    708/* The following API requires a hosted C implementation (uses FILE*) */
    │ │ │ -
    709#if !defined(__STDC_HOSTED__) || __STDC_HOSTED__-0 == 1
    │ │ │ -
    710CBOR_API CborError cbor_value_to_pretty_advance_flags(FILE *out, CborValue *value, int flags);
    │ │ │ -
    711CBOR_API CborError cbor_value_to_pretty_advance(FILE *out, CborValue *value);
    │ │ │ -
    712CBOR_INLINE_API CborError cbor_value_to_pretty(FILE *out, const CborValue *value)
    │ │ │ -
    713{
    │ │ │ -
    714 CborValue copy = *value;
    │ │ │ -
    715 return cbor_value_to_pretty_advance_flags(out, &copy, CborPrettyDefaultFlags);
    │ │ │ -
    716}
    │ │ │ -
    717#endif /* __STDC_HOSTED__ check */
    │ │ │ -
    718
    │ │ │ -
    719#endif /* CBOR_NO_PRETTY_API */
    │ │ │ -
    720
    │ │ │ -
    721#endif /* CBOR_NO_PARSER_API */
    │ │ │ -
    722
    │ │ │ -
    723#ifdef __cplusplus
    │ │ │ -
    724}
    │ │ │ -
    725#endif
    │ │ │ -
    726
    │ │ │ -
    727#endif /* CBOR_H */
    │ │ │ -
    CborError cbor_value_to_pretty(FILE *out, const CborValue *value)
    Converts the current CBOR type pointed to by value to its textual representation and writes it to the...
    Definition cbor.h:712
    │ │ │ -
    CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, size_t *buflen, CborValue *next)
    Allocates memory for the string pointed by value and copies it into this buffer.
    Definition cbor.h:506
    │ │ │ -
    CBOR_API CborError cbor_value_get_half_float_as_float(const CborValue *value, float *result)
    Retrieves the CBOR half-precision floating point (16-bit) value that value points to,...
    Definition cborparser_float.c:40
    │ │ │ -
    CBOR_API CborError cbor_value_to_pretty_advance_flags(FILE *out, CborValue *value, int flags)
    Converts the current CBOR type pointed to by value to its textual representation and writes it to the...
    Definition cborpretty_stdio.c:83
    │ │ │ -
    CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer, size_t *buflen, CborValue *next)
    Allocates memory for the string pointed by value and copies it into this buffer.
    Definition cbor.h:512
    │ │ │ -
    CBOR_API CborError cbor_value_to_pretty_advance(FILE *out, CborValue *value)
    Converts the current CBOR type pointed to by value to its textual representation and writes it to the...
    Definition cborpretty_stdio.c:63
    │ │ │ -
    uint64_t CborTag
    This typedef is an unsigned 64-bit integer.
    Definition cbor.h:102
    │ │ │ -
    CBOR_API const char * cbor_error_string(CborError error)
    Returns the error string corresponding to the CBOR error condition error.
    Definition cborerrorstrings.c:80
    │ │ │ -
    static const size_t CborIndefiniteLength
    This variable is a constant used to indicate that the length of the map or array is not yet determine...
    Definition cbor.h:238
    │ │ │ -
    CBOR_API CborError cbor_encode_negative_int(CborEncoder *encoder, uint64_t absolute_value)
    Appends the negative 64-bit integer whose absolute value is absolute_value to the CBOR stream provide...
    Definition cborencoder.c:361
    │ │ │ -
    CBOR_API CborError cbor_encode_byte_string(CborEncoder *encoder, const uint8_t *string, size_t length)
    Appends the byte string string of length length to the CBOR stream provided by encoder.
    Definition cborencoder.c:463
    │ │ │ -
    CborError cbor_encode_double(CborEncoder *encoder, double value)
    Appends the IEEE 754 double-precision (64-bit) floating point value value to the CBOR stream provided...
    Definition cbor.h:267
    │ │ │ -
    CBOR_API void cbor_encoder_init(CborEncoder *encoder, uint8_t *buffer, size_t size, int flags)
    Initializes a CborEncoder structure encoder by pointing it to buffer buffer of size size.
    Definition cborencoder.c:195
    │ │ │ -
    CBOR_API CborError cbor_encode_uint(CborEncoder *encoder, uint64_t value)
    Appends the unsigned 64-bit integer value to the CBOR stream provided by encoder.
    Definition cborencoder.c:348
    │ │ │ -
    CborError cbor_encode_null(CborEncoder *encoder)
    Appends the CBOR type representing a null value to the CBOR stream provided by encoder.
    Definition cbor.h:257
    │ │ │ -
    CBOR_API CborError cbor_encode_raw(CborEncoder *encoder, const uint8_t *raw, size_t length)
    Puts the data of length length in raw into to the encoding buffer of encoder.
    Definition cborencoder.c:489
    │ │ │ -
    CBOR_API CborError cbor_encode_text_string(CborEncoder *encoder, const char *string, size_t length)
    Appends the text string string of length length to the CBOR stream provided by encoder.
    Definition cborencoder.c:475
    │ │ │ -
    CborError cbor_encode_text_stringz(CborEncoder *encoder, const char *string)
    Appends the null-terminated text string string to the CBOR stream provided by encoder.
    Definition cbor.h:249
    │ │ │ -
    CBOR_API CborError cbor_encoder_close_container(CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
    Closes the CBOR container (array or map) provided by containerEncoder and updates the CBOR stream pro...
    Definition cborencoder.c:580
    │ │ │ -
    size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t *buffer)
    Returns the total size of the buffer starting at buffer after the encoding finished without errors.
    Definition cbor.h:280
    │ │ │ -
    CBOR_API CborError cbor_encode_tag(CborEncoder *encoder, CborTag tag)
    Appends the CBOR tag tag to the CBOR stream provided by encoder.
    Definition cborencoder.c:432
    │ │ │ -
    CBOR_API CborError cbor_encode_float_as_half_float(CborEncoder *encoder, float value)
    Convert the IEEE 754 single-precision (32-bit) floating point value value to the IEEE 754 half-precis...
    Definition cborencoder_float.c:32
    │ │ │ -
    CborError cbor_encode_boolean(CborEncoder *encoder, bool value)
    Appends the boolean value value to the CBOR stream provided by encoder.
    Definition cbor.h:255
    │ │ │ -
    CBOR_API CborError cbor_encode_simple_value(CborEncoder *encoder, uint8_t value)
    Appends the CBOR Simple Type of value value to the CBOR stream provided by encoder.
    Definition cborencoder.c:388
    │ │ │ -
    CborError cbor_encode_undefined(CborEncoder *encoder)
    Appends the CBOR type representing an undefined value to the CBOR stream provided by encoder.
    Definition cbor.h:259
    │ │ │ -
    CBOR_API CborError cbor_encoder_create_array(CborEncoder *parentEncoder, CborEncoder *arrayEncoder, size_t length)
    Creates a CBOR array in the CBOR stream provided by parentEncoder and initializes arrayEncoder so tha...
    Definition cborencoder.c:537
    │ │ │ -
    CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
    Definition cborencoder_close_container_checked.c:48
    │ │ │ -
    CBOR_API CborError cbor_encoder_create_map(CborEncoder *parentEncoder, CborEncoder *mapEncoder, size_t length)
    Creates a CBOR map in the CBOR stream provided by parentEncoder and initializes mapEncoder so that it...
    Definition cborencoder.c:561
    │ │ │ -
    CBOR_API CborError cbor_encode_int(CborEncoder *encoder, int64_t value)
    Appends the signed 64-bit integer value to the CBOR stream provided by encoder.
    Definition cborencoder.c:372
    │ │ │ -
    CBOR_API CborError cbor_encode_floating_point(CborEncoder *encoder, CborType fpType, const void *value)
    Appends the floating-point value of type fpType and pointed to by value to the CBOR stream provided b...
    Definition cborencoder.c:409
    │ │ │ -
    CborError cbor_encode_half_float(CborEncoder *encoder, const void *value)
    Appends the IEEE 754 half-precision (16-bit) floating point value pointed to by value to the CBOR str...
    Definition cbor.h:262
    │ │ │ -
    CborError cbor_encode_float(CborEncoder *encoder, float value)
    Appends the IEEE 754 single-precision (32-bit) floating point value value to the CBOR stream provided...
    Definition cbor.h:265
    │ │ │ -
    size_t cbor_encoder_get_extra_bytes_needed(const CborEncoder *encoder)
    Returns how many more bytes the original buffer supplied to cbor_encoder_init() needs to be extended ...
    Definition cbor.h:285
    │ │ │ -
    CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, size_t *buflen, CborValue *next)
    Copies the string pointed to by value into the buffer provided at buffer of buflen bytes.
    Definition cbor.h:493
    │ │ │ -
    CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result)
    Retrieves the CBOR Simple Type value that value points to and stores it in result.
    Definition cbor.h:403
    │ │ │ -
    bool cbor_value_is_length_known(const CborValue *value)
    Returns true if the length of this type is known without calculation.
    Definition cbor.h:453
    │ │ │ -
    const uint8_t * cbor_value_get_next_byte(const CborValue *it)
    Returns a pointer to the next byte that would be decoded if this CborValue object were advanced.
    Definition cbor.h:362
    │ │ │ -
    CBOR_API CborError cbor_value_enter_container(const CborValue *it, CborValue *recursed)
    Creates a CborValue iterator pointing to the first element of the container represented by it and sav...
    Definition cborparser.c:569
    │ │ │ -
    bool cbor_value_is_boolean(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR boolean type (true or false).
    Definition cbor.h:391
    │ │ │ -
    bool cbor_value_is_undefined(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR undefined type.
    Definition cbor.h:387
    │ │ │ -
    bool cbor_value_is_null(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR null type.
    Definition cbor.h:385
    │ │ │ -
    CBOR_API CborError cbor_value_validate_basic(const CborValue *it)
    Performs a basic validation of the CBOR stream pointed by it and returns the error it found.
    Definition cborparser.c:433
    │ │ │ -
    bool cbor_value_is_map(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR map.
    Definition cbor.h:567
    │ │ │ -
    bool cbor_value_is_tag(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR tag.
    Definition cbor.h:457
    │ │ │ -
    CBOR_API CborError cbor_value_skip_tag(CborValue *it)
    Advances the CBOR value it until it no longer points to a tag.
    Definition cborparser.c:542
    │ │ │ -
    CborError cbor_value_get_raw_integer(const CborValue *value, uint64_t *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cbor.h:418
    │ │ │ -
    bool cbor_value_is_integer(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR integer type.
    Definition cbor.h:411
    │ │ │ -
    CborType cbor_value_get_type(const CborValue *value)
    Returns the type of the CBOR value that the iterator value points to.
    Definition cbor.h:381
    │ │ │ -
    bool cbor_value_at_end(const CborValue *it)
    Returns true if it has reached the end of the iteration, usually when advancing after the last item i...
    Definition cbor.h:360
    │ │ │ -
    CBOR_API CborError cbor_value_validate(const CborValue *it, uint32_t flags)
    Performs a full validation, controlled by the flags options, of the CBOR stream pointed by it and ret...
    Definition cborvalidation.c:640
    │ │ │ -
    CborError cbor_value_get_tag(const CborValue *value, CborTag *result)
    Retrieves the CBOR tag value that value points to and stores it in result.
    Definition cbor.h:459
    │ │ │ -
    CBOR_API CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
    Updates it to point to the next element after the container.
    Definition cborparser.c:618
    │ │ │ -
    CborError cbor_value_get_half_float(const CborValue *value, void *result)
    Retrieves the CBOR half-precision floating point (16-bit) value that value points to and stores it in...
    Definition cbor.h:602
    │ │ │ -
    CBOR_API CborError cbor_value_get_int64_checked(const CborValue *value, int64_t *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cborparser.c:803
    │ │ │ -
    CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it)
    Initializes the CBOR parser for parsing size bytes beginning at buffer.
    Definition cborparser.c:336
    │ │ │ -
    bool cbor_value_is_double(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR double-precision floating point (64-...
    Definition cbor.h:624
    │ │ │ -
    bool cbor_value_is_simple_type(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR Simple Type type (other than true,...
    Definition cbor.h:401
    │ │ │ -
    bool cbor_value_is_negative_integer(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR negative integer type.
    Definition cbor.h:415
    │ │ │ -
    bool cbor_value_is_half_float(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR single-precision floating point (16-...
    Definition cbor.h:599
    │ │ │ -
    CborError cbor_value_get_uint64(const CborValue *value, uint64_t *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cbor.h:425
    │ │ │ -
    CborError cbor_value_get_int(const CborValue *value, int *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cbor.h:441
    │ │ │ -
    CBOR_API CborError cbor_value_advance_fixed(CborValue *it)
    Advances the CBOR value it by one fixed-size position.
    Definition cborparser.c:454
    │ │ │ -
    CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer, size_t *buflen, CborValue *next)
    Copies the string pointed by value into the buffer provided at buffer of buflen bytes.
    Definition cbor.h:499
    │ │ │ -
    bool cbor_value_is_unsigned_integer(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR unsigned integer type (positive valu...
    Definition cbor.h:413
    │ │ │ -
    CBOR_API CborError cbor_value_text_string_equals(const CborValue *value, const char *string, bool *result)
    Compares the entry value with the string string and stores the result in result.
    Definition cborparser.c:1314
    │ │ │ -
    CborError cbor_value_get_text_string_chunk(const CborValue *value, const char **bufferptr, size_t *len, CborValue *next)
    Extracts one text string chunk pointed to by value and stores a pointer to the data in buffer and the...
    Definition cbor.h:549
    │ │ │ -
    CBOR_API CborError cbor_value_calculate_string_length(const CborValue *value, size_t *length)
    Calculates the length of the byte or text string that value points to and stores it in len.
    Definition cborparser.c:954
    │ │ │ -
    CborError cbor_value_get_map_length(const CborValue *value, size_t *length)
    Extracts the length of the CBOR map that value points to and stores it in result.
    Definition cbor.h:583
    │ │ │ -
    bool cbor_value_is_byte_string(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR byte string.
    Definition cbor.h:468
    │ │ │ -
    CborError cbor_value_get_boolean(const CborValue *value, bool *result)
    Retrieves the boolean value that value points to and stores it in result.
    Definition cbor.h:393
    │ │ │ -
    bool cbor_value_is_array(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR array.
    Definition cbor.h:565
    │ │ │ -
    CborError cbor_value_get_int64(const CborValue *value, int64_t *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cbor.h:432
    │ │ │ -
    CBOR_API CborError cbor_value_advance(CborValue *it)
    Advances the CBOR value it by one element, skipping over containers.
    Definition cborparser.c:506
    │ │ │ -
    CborError cbor_value_get_array_length(const CborValue *value, size_t *length)
    Extracts the length of the CBOR array that value points to and stores it in result.
    Definition cbor.h:570
    │ │ │ -
    bool cbor_value_is_valid(const CborValue *value)
    Returns true if the iterator it contains a valid value.
    Definition cbor.h:379
    │ │ │ -
    bool cbor_value_is_text_string(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR text string.
    Definition cbor.h:470
    │ │ │ -
    CBOR_API CborError cbor_value_map_find_value(const CborValue *map, const char *string, CborValue *element)
    Attempts to find the value in map map that corresponds to the text string entry string.
    Definition cborparser.c:1402
    │ │ │ -
    CborError cbor_value_get_string_length(const CborValue *value, size_t *length)
    Extracts the length of the byte or text string that value points to and stores it in result.
    Definition cbor.h:473
    │ │ │ -
    bool cbor_value_is_container(const CborValue *it)
    Returns true if the it value is a container and requires recursion in order to decode (maps and array...
    Definition cbor.h:367
    │ │ │ -
    CBOR_API CborError cbor_value_get_int_checked(const CborValue *value, int *result)
    Retrieves the CBOR integer value that value points to and stores it in result.
    Definition cborparser.c:843
    │ │ │ -
    CborError cbor_value_get_float(const CborValue *value, float *result)
    Retrieves the CBOR single-precision floating point (32-bit) value that value points to and stores it ...
    Definition cbor.h:614
    │ │ │ -
    bool cbor_value_is_float(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR single-precision floating point (32-...
    Definition cbor.h:612
    │ │ │ -
    CBOR_API CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *token, CborValue *value, int flags)
    Converts the current CBOR type pointed by value to its textual representation and writes it to the st...
    Definition cborpretty.c:576
    │ │ │ -
    Structure used to encode to CBOR.
    Definition cbor.h:226
    │ │ │ +
    > The <cbor.h> is the main header in TinyCBOR and defines the constants used by most functions as wel...
    │ │ │ +
    CborError cbor_value_to_json(FILE *out, const CborValue *value, int flags)
    Converts the current CBOR type pointed to by value to JSON and writes that to the out stream.
    Definition cborjson.h:51
    │ │ │ +
    CBOR_API CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int flags)
    Converts the current CBOR type pointed to by value to JSON and writes that to the out stream.
    Definition cbortojson.c:786
    │ │ │
    This type contains one value parsed from the CBOR stream.
    Definition cbor.h:341
    │ │ │
    │ │ │ │ │ │ │ │ │
    │ │ │ ├── html2text {} │ │ │ │ @@ -1,19 +1,19 @@ │ │ │ │ TinyCBOR 7.0 API │ │ │ │ * _M_a_i_n_ _P_a_g_e │ │ │ │ * _T_o_p_i_c_s │ │ │ │ * _D_a_t_a_ _S_t_r_u_c_t_u_r_e_s │ │ │ │ * _F_i_l_e_s │ │ │ │ * _F_i_l_e_ _L_i_s_t │ │ │ │ * _G_l_o_b_a_l_s │ │ │ │ -cbor.h │ │ │ │ +cborjson.h │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1/**************************************************************************** │ │ │ │ 2** │ │ │ │ -3** Copyright (C) 2021 Intel Corporation │ │ │ │ +3** Copyright (C) 2015 Intel Corporation │ │ │ │ 4** │ │ │ │ 5** Permission is hereby granted, free of charge, to any person obtaining a │ │ │ │ copy │ │ │ │ 6** of this software and associated documentation files (the "Software"), to │ │ │ │ deal │ │ │ │ 7** in the Software without restriction, including without limitation the │ │ │ │ rights │ │ │ │ @@ -32,1221 +32,66 @@ │ │ │ │ 19** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING │ │ │ │ FROM, │ │ │ │ 20** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN │ │ │ │ 21** THE SOFTWARE. │ │ │ │ 22** │ │ │ │ 23****************************************************************************/ │ │ │ │ 24 │ │ │ │ -25#ifndef CBOR_H │ │ │ │ -26#define CBOR_H │ │ │ │ +25#ifndef CBORJSON_H │ │ │ │ +26#define CBORJSON_H │ │ │ │ 27 │ │ │ │ -28#ifndef assert │ │ │ │ -29#include │ │ │ │ -30#endif │ │ │ │ -31#include │ │ │ │ -32#include │ │ │ │ -33#include │ │ │ │ -34#include │ │ │ │ -35#include │ │ │ │ -36 │ │ │ │ -37#ifdef CBOR_EXTERNAL_CFG │ │ │ │ -38#include "cbor_cfg.h" │ │ │ │ -39#endif │ │ │ │ +28#include "_c_b_o_r_._h" │ │ │ │ +29 │ │ │ │ +30#ifdef __cplusplus │ │ │ │ +31extern "C" { │ │ │ │ +32#endif │ │ │ │ +33 │ │ │ │ +34/* Conversion to JSON */ │ │ │ │ +35enum CborToJsonFlags │ │ │ │ +36{ │ │ │ │ +37 CborConvertAddMetadata = 1, │ │ │ │ +38 CborConvertTagsToObjects = 2, │ │ │ │ +39 CborConvertIgnoreTags = 0, │ │ │ │ 40 │ │ │ │ -41#include "tinycbor-export.h" │ │ │ │ -42#include "tinycbor-version.h" │ │ │ │ +41 CborConvertObeyByteStringTags = 0, │ │ │ │ +42 CborConvertByteStringsToBase64Url = 4, │ │ │ │ 43 │ │ │ │ -44#define TINYCBOR_VERSION ((TINYCBOR_VERSION_MAJOR << 16) | │ │ │ │ -(TINYCBOR_VERSION_MINOR << 8) | TINYCBOR_VERSION_PATCH) │ │ │ │ -45 │ │ │ │ -46#ifdef __cplusplus │ │ │ │ -47extern "C" { │ │ │ │ -48#else │ │ │ │ -49#include │ │ │ │ -50#endif │ │ │ │ -51 │ │ │ │ -52#ifndef SIZE_MAX │ │ │ │ -53/* Some systems fail to define SIZE_MAX in , even though C99 │ │ │ │ -requires it... │ │ │ │ -54 * Conversion from signed to unsigned is defined in 6.3.1.3 (Signed and │ │ │ │ -unsigned integers) p2, │ │ │ │ -55 * which says: "the value is converted by repeatedly adding or subtracting │ │ │ │ -one more than the │ │ │ │ -56 * maximum value that can be represented in the new type until the value is │ │ │ │ -in the range of the │ │ │ │ -57 * new type." │ │ │ │ -58 * So -1 gets converted to size_t by adding SIZE_MAX + 1, which results in │ │ │ │ -SIZE_MAX. │ │ │ │ -59 */ │ │ │ │ -60# define SIZE_MAX ((size_t)-1) │ │ │ │ -61#endif │ │ │ │ -62 │ │ │ │ -63#ifndef CBOR_PRIVATE_API │ │ │ │ -64# define CBOR_PRIVATE_API CBOR_API │ │ │ │ -65#endif │ │ │ │ -66#ifndef CBOR_INLINE_API │ │ │ │ -67# if defined(__cplusplus) │ │ │ │ -68# define CBOR_INLINE inline │ │ │ │ -69# define CBOR_INLINE_API inline │ │ │ │ -70# else │ │ │ │ -71# define CBOR_INLINE_API static CBOR_INLINE │ │ │ │ -72# if defined(_MSC_VER) │ │ │ │ -73# define CBOR_INLINE __inline │ │ │ │ -74# elif defined(__GNUC__) │ │ │ │ -75# define CBOR_INLINE __inline__ │ │ │ │ -76# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L │ │ │ │ -77# define CBOR_INLINE inline │ │ │ │ -78# else │ │ │ │ -79# define CBOR_INLINE │ │ │ │ -80# endif │ │ │ │ -81# endif │ │ │ │ -82#endif │ │ │ │ -83 │ │ │ │ -84typedef enum CborType { │ │ │ │ -85 CborIntegerType = 0x00, │ │ │ │ -86 CborByteStringType = 0x40, │ │ │ │ -87 CborTextStringType = 0x60, │ │ │ │ -88 CborArrayType = 0x80, │ │ │ │ -89 CborMapType = 0xa0, │ │ │ │ -90 CborTagType = 0xc0, │ │ │ │ -91 CborSimpleType = 0xe0, │ │ │ │ -92 CborBooleanType = 0xf5, │ │ │ │ -93 CborNullType = 0xf6, │ │ │ │ -94 CborUndefinedType = 0xf7, │ │ │ │ -95 CborHalfFloatType = 0xf9, │ │ │ │ -96 CborFloatType = 0xfa, │ │ │ │ -97 CborDoubleType = 0xfb, │ │ │ │ -98 │ │ │ │ -99 CborInvalidType = 0xff /* equivalent to the break byte, so it will never be │ │ │ │ -used */ │ │ │ │ -100} CborType; │ │ │ │ -101 │ │ │ │ -_1_0_2typedef uint64_t _C_b_o_r_T_a_g; │ │ │ │ -103typedef enum CborKnownTags { │ │ │ │ -104 CborDateTimeStringTag = 0, │ │ │ │ -105 CborUnixTime_tTag = 1, │ │ │ │ -106 CborPositiveBignumTag = 2, │ │ │ │ -107 CborNegativeBignumTag = 3, │ │ │ │ -108 CborDecimalTag = 4, │ │ │ │ -109 CborBigfloatTag = 5, │ │ │ │ -110 CborCOSE_Encrypt0Tag = 16, │ │ │ │ -111 CborCOSE_Mac0Tag = 17, │ │ │ │ -112 CborCOSE_Sign1Tag = 18, │ │ │ │ -113 CborExpectedBase64urlTag = 21, │ │ │ │ -114 CborExpectedBase64Tag = 22, │ │ │ │ -115 CborExpectedBase16Tag = 23, │ │ │ │ -116 CborEncodedCborTag = 24, │ │ │ │ -117 CborUrlTag = 32, │ │ │ │ -118 CborBase64urlTag = 33, │ │ │ │ -119 CborBase64Tag = 34, │ │ │ │ -120 CborRegularExpressionTag = 35, │ │ │ │ -121 CborMimeMessageTag = 36, │ │ │ │ -122 CborCOSE_EncryptTag = 96, │ │ │ │ -123 CborCOSE_MacTag = 97, │ │ │ │ -124 CborCOSE_SignTag = 98, │ │ │ │ -125 CborSignatureTag = 55799 │ │ │ │ -126} CborKnownTags; │ │ │ │ -127 │ │ │ │ -128/* #define the constants so we can check with #ifdef */ │ │ │ │ -129#define CborDateTimeStringTag CborDateTimeStringTag │ │ │ │ -130#define CborUnixTime_tTag CborUnixTime_tTag │ │ │ │ -131#define CborPositiveBignumTag CborPositiveBignumTag │ │ │ │ -132#define CborNegativeBignumTag CborNegativeBignumTag │ │ │ │ -133#define CborDecimalTag CborDecimalTag │ │ │ │ -134#define CborBigfloatTag CborBigfloatTag │ │ │ │ -135#define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag │ │ │ │ -136#define CborCOSE_Mac0Tag CborCOSE_Mac0Tag │ │ │ │ -137#define CborCOSE_Sign1Tag CborCOSE_Sign1Tag │ │ │ │ -138#define CborExpectedBase64urlTag CborExpectedBase64urlTag │ │ │ │ -139#define CborExpectedBase64Tag CborExpectedBase64Tag │ │ │ │ -140#define CborExpectedBase16Tag CborExpectedBase16Tag │ │ │ │ -141#define CborEncodedCborTag CborEncodedCborTag │ │ │ │ -142#define CborUrlTag CborUrlTag │ │ │ │ -143#define CborBase64urlTag CborBase64urlTag │ │ │ │ -144#define CborBase64Tag CborBase64Tag │ │ │ │ -145#define CborRegularExpressionTag CborRegularExpressionTag │ │ │ │ -146#define CborMimeMessageTag CborMimeMessageTag │ │ │ │ -147#define CborCOSE_EncryptTag CborCOSE_EncryptTag │ │ │ │ -148#define CborCOSE_MacTag CborCOSE_MacTag │ │ │ │ -149#define CborCOSE_SignTag CborCOSE_SignTag │ │ │ │ -150#define CborSignatureTag CborSignatureTag │ │ │ │ -151 │ │ │ │ -152/* Error API */ │ │ │ │ -153 │ │ │ │ -154typedef enum CborError { │ │ │ │ -155 CborNoError = 0, │ │ │ │ -156 │ │ │ │ -157 /* errors in all modes */ │ │ │ │ -158 CborUnknownError, │ │ │ │ -159 CborErrorUnknownLength, /* request for length in array, map, or string with │ │ │ │ -indeterminate length */ │ │ │ │ -160 CborErrorAdvancePastEOF, │ │ │ │ -161 CborErrorIO, │ │ │ │ -162 │ │ │ │ -163 /* parser errors streaming errors */ │ │ │ │ -164 CborErrorGarbageAtEnd = 256, │ │ │ │ -165 CborErrorUnexpectedEOF, │ │ │ │ -166 CborErrorUnexpectedBreak, │ │ │ │ -167 CborErrorUnknownType, /* can only happen in major type 7 */ │ │ │ │ -168 CborErrorIllegalType, /* type not allowed here */ │ │ │ │ -169 CborErrorIllegalNumber, │ │ │ │ -170 CborErrorIllegalSimpleType, /* types of value less than 32 encoded in two │ │ │ │ -bytes */ │ │ │ │ -171 CborErrorNoMoreStringChunks, │ │ │ │ -172 │ │ │ │ -173 /* parser errors in strict mode parsing only */ │ │ │ │ -174 CborErrorUnknownSimpleType = 512, │ │ │ │ -175 CborErrorUnknownTag, │ │ │ │ -176 CborErrorInappropriateTagForType, │ │ │ │ -177 CborErrorDuplicateObjectKeys, │ │ │ │ -178 CborErrorInvalidUtf8TextString, │ │ │ │ -179 CborErrorExcludedType, │ │ │ │ -180 CborErrorExcludedValue, │ │ │ │ -181 CborErrorImproperValue, │ │ │ │ -182 CborErrorOverlongEncoding, │ │ │ │ -183 CborErrorMapKeyNotString, │ │ │ │ -184 CborErrorMapNotSorted, │ │ │ │ -185 CborErrorMapKeysNotUnique, │ │ │ │ -186 │ │ │ │ -187 /* encoder errors */ │ │ │ │ -188 CborErrorTooManyItems = 768, │ │ │ │ -189 CborErrorTooFewItems, │ │ │ │ -190 │ │ │ │ -191 /* internal implementation errors */ │ │ │ │ -192 CborErrorDataTooLarge = 1024, │ │ │ │ -193 CborErrorNestingTooDeep, │ │ │ │ -194 CborErrorUnsupportedType, │ │ │ │ -195 CborErrorUnimplementedValidation, │ │ │ │ -196 │ │ │ │ -197 /* errors in converting to JSON */ │ │ │ │ -198 CborErrorJsonObjectKeyIsAggregate = 1280, │ │ │ │ -199 CborErrorJsonObjectKeyNotString, │ │ │ │ -200 CborErrorJsonNotImplemented, │ │ │ │ -201 │ │ │ │ -202 CborErrorOutOfMemory = (int) (~0U / 2 + 1), │ │ │ │ -203 CborErrorInternalError = (int) (~0U / 2) /* INT_MAX on two's complement │ │ │ │ -machines */ │ │ │ │ -204} CborError; │ │ │ │ -205 │ │ │ │ -206CBOR_API const char *_c_b_o_r___e_r_r_o_r___s_t_r_i_n_g(CborError error); │ │ │ │ -207 │ │ │ │ -208/* Encoder API */ │ │ │ │ -209 │ │ │ │ -210typedef enum CborEncoderAppendType │ │ │ │ -211{ │ │ │ │ -212 CborEncoderAppendCborData = 0, │ │ │ │ -213 CborEncoderAppendStringData = 1, │ │ │ │ -214 CborEncoderAppendRawData = 2 │ │ │ │ -215} CborEncoderAppendType; │ │ │ │ -216 │ │ │ │ -217typedef CborError (*CborEncoderWriteFunction)(void *, const void *, size_t, │ │ │ │ -CborEncoderAppendType); │ │ │ │ -218 │ │ │ │ -219enum CborEncoderFlags │ │ │ │ -220{ │ │ │ │ -221 CborIteratorFlag_WriterFunction = 0x01, │ │ │ │ -222 CborIteratorFlag_ContainerIsMap_ = 0x20 │ │ │ │ -223}; │ │ │ │ -224 │ │ │ │ -_2_2_5struct _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -226{ │ │ │ │ -227 union { │ │ │ │ -228 uint8_t *ptr; │ │ │ │ -229 ptrdiff_t bytes_needed; │ │ │ │ -230 CborEncoderWriteFunction writer; │ │ │ │ -231 } data; │ │ │ │ -232 uint8_t *end; │ │ │ │ -233 size_t remaining; │ │ │ │ -234 int flags; │ │ │ │ -235}; │ │ │ │ -236typedef struct _C_b_o_r_E_n_c_o_d_e_r _C_b_o_r_E_n_c_o_d_e_r; │ │ │ │ -237 │ │ │ │ -_2_3_8static const size_t _C_b_o_r_I_n_d_e_f_i_n_i_t_e_L_e_n_g_t_h = SIZE_MAX; │ │ │ │ -239 │ │ │ │ -240#ifndef CBOR_NO_ENCODER_API │ │ │ │ -241CBOR_API void _c_b_o_r___e_n_c_o_d_e_r___i_n_i_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, uint8_t *buffer, │ │ │ │ -size_t size, int flags); │ │ │ │ -242CBOR_API void cbor_encoder_init_writer(_C_b_o_r_E_n_c_o_d_e_r *encoder, │ │ │ │ -CborEncoderWriteFunction writer, void *); │ │ │ │ -243CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___u_i_n_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, uint64_t value); │ │ │ │ -244CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___i_n_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, int64_t value); │ │ │ │ -245CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___n_e_g_a_t_i_v_e___i_n_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, uint64_t │ │ │ │ -absolute_value); │ │ │ │ -246CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e(_C_b_o_r_E_n_c_o_d_e_r *encoder, uint8_t │ │ │ │ -value); │ │ │ │ -247CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___t_a_g(_C_b_o_r_E_n_c_o_d_e_r *encoder, _C_b_o_r_T_a_g tag); │ │ │ │ -248CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g(_C_b_o_r_E_n_c_o_d_e_r *encoder, const char │ │ │ │ -*string, size_t length); │ │ │ │ -_2_4_9CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g_z(_C_b_o_r_E_n_c_o_d_e_r *encoder, │ │ │ │ -const char *string) │ │ │ │ -250{ return _c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g(encoder, string, strlen(string)); } │ │ │ │ -251CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___b_y_t_e___s_t_r_i_n_g(_C_b_o_r_E_n_c_o_d_e_r *encoder, const │ │ │ │ -uint8_t *string, size_t length); │ │ │ │ -252CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, CborType │ │ │ │ -fpType, const void *value); │ │ │ │ -253CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___r_a_w(_C_b_o_r_E_n_c_o_d_e_r *encoder, const uint8_t *raw, │ │ │ │ -size_t length); │ │ │ │ -254 │ │ │ │ -_2_5_5CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___b_o_o_l_e_a_n(_C_b_o_r_E_n_c_o_d_e_r *encoder, bool │ │ │ │ -value) │ │ │ │ -256{ return _c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e(encoder, (int)value - 1 + (CborBooleanType │ │ │ │ -& 0x1f)); } │ │ │ │ -_2_5_7CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___n_u_l_l(_C_b_o_r_E_n_c_o_d_e_r *encoder) │ │ │ │ -258{ return _c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e(encoder, CborNullType & 0x1f); } │ │ │ │ -_2_5_9CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___u_n_d_e_f_i_n_e_d(_C_b_o_r_E_n_c_o_d_e_r *encoder) │ │ │ │ -260{ return _c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e(encoder, CborUndefinedType & 0x1f); } │ │ │ │ -261 │ │ │ │ -_2_6_2CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___h_a_l_f___f_l_o_a_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, const │ │ │ │ -void *value) │ │ │ │ -263{ return _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t(encoder, CborHalfFloatType, value); } │ │ │ │ -264CBOR_API CborError _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t___a_s___h_a_l_f___f_l_o_a_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, │ │ │ │ -float value); │ │ │ │ -_2_6_5CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t(_C_b_o_r_E_n_c_o_d_e_r *encoder, float │ │ │ │ -value) │ │ │ │ -266{ return _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t(encoder, CborFloatType, &value); } │ │ │ │ -_2_6_7CBOR_INLINE_API CborError _c_b_o_r___e_n_c_o_d_e___d_o_u_b_l_e(_C_b_o_r_E_n_c_o_d_e_r *encoder, double │ │ │ │ -value) │ │ │ │ -268{ return _c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t(encoder, CborDoubleType, &value); } │ │ │ │ -269 │ │ │ │ -270CBOR_API CborError _c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___a_r_r_a_y(_C_b_o_r_E_n_c_o_d_e_r *parentEncoder, │ │ │ │ -_C_b_o_r_E_n_c_o_d_e_r *arrayEncoder, size_t length); │ │ │ │ -271CBOR_API CborError _c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___m_a_p(_C_b_o_r_E_n_c_o_d_e_r *parentEncoder, │ │ │ │ -_C_b_o_r_E_n_c_o_d_e_r *mapEncoder, size_t length); │ │ │ │ -272CBOR_API CborError _c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r(_C_b_o_r_E_n_c_o_d_e_r *parentEncoder, │ │ │ │ -const _C_b_o_r_E_n_c_o_d_e_r *containerEncoder); │ │ │ │ -273CBOR_API CborError _c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r___c_h_e_c_k_e_d(_C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -*parentEncoder, const _C_b_o_r_E_n_c_o_d_e_r *containerEncoder); │ │ │ │ -274 │ │ │ │ -275CBOR_INLINE_API uint8_t *_cbor_encoder_get_buffer_pointer(const _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -*encoder) │ │ │ │ -276{ │ │ │ │ -277 return encoder->data.ptr; │ │ │ │ -278} │ │ │ │ -279 │ │ │ │ -_2_8_0CBOR_INLINE_API size_t _c_b_o_r___e_n_c_o_d_e_r___g_e_t___b_u_f_f_e_r___s_i_z_e(const _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -*encoder, const uint8_t *buffer) │ │ │ │ -281{ │ │ │ │ -282 return (size_t)(encoder->data.ptr - buffer); │ │ │ │ -283} │ │ │ │ -284 │ │ │ │ -_2_8_5CBOR_INLINE_API size_t _c_b_o_r___e_n_c_o_d_e_r___g_e_t___e_x_t_r_a___b_y_t_e_s___n_e_e_d_e_d(const _C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -*encoder) │ │ │ │ -286{ │ │ │ │ -287 return encoder->end ? 0 : (size_t)encoder->data.bytes_needed; │ │ │ │ -288} │ │ │ │ -289#endif /* CBOR_NO_ENCODER_API */ │ │ │ │ -290 │ │ │ │ -291/* Parser API */ │ │ │ │ -292 │ │ │ │ -293enum CborParserGlobalFlags │ │ │ │ -294{ │ │ │ │ -295 CborParserFlag_ExternalSource = 0x01 │ │ │ │ -296}; │ │ │ │ -297 │ │ │ │ -298enum CborParserIteratorFlags │ │ │ │ -299{ │ │ │ │ -300 /* used for all types, but not during string chunk iteration │ │ │ │ -301 * (values are static-asserted, don't change) */ │ │ │ │ -302 CborIteratorFlag_IntegerValueIs64Bit = 0x01, │ │ │ │ -303 CborIteratorFlag_IntegerValueTooLarge = 0x02, │ │ │ │ -304 │ │ │ │ -305 /* used only for CborIntegerType */ │ │ │ │ -306 CborIteratorFlag_NegativeInteger = 0x04, │ │ │ │ -307 │ │ │ │ -308 /* used only during string iteration */ │ │ │ │ -309 CborIteratorFlag_BeforeFirstStringChunk = 0x04, │ │ │ │ -310 CborIteratorFlag_IteratingStringChunks = 0x08, │ │ │ │ -311 │ │ │ │ -312 /* used for arrays, maps and strings, including during chunk iteration */ │ │ │ │ -313 CborIteratorFlag_UnknownLength = 0x10, │ │ │ │ -314 │ │ │ │ -315 /* used for maps, but must be kept for all types │ │ │ │ -316 * (ContainerIsMap value must be CborMapType - CborArrayType) */ │ │ │ │ -317 CborIteratorFlag_ContainerIsMap = 0x20, │ │ │ │ -318 CborIteratorFlag_NextIsMapKey = 0x40 │ │ │ │ -319}; │ │ │ │ -320 │ │ │ │ -321struct _C_b_o_r_V_a_l_u_e; │ │ │ │ -322struct CborParserOperations │ │ │ │ -323{ │ │ │ │ -324 bool (*can_read_bytes)(void *token, size_t len); │ │ │ │ -325 void *(*read_bytes)(void *token, void *dst, size_t offset, size_t len); │ │ │ │ -326 void (*advance_bytes)(void *token, size_t len); │ │ │ │ -327 CborError (*transfer_string)(void *token, const void **userptr, size_t │ │ │ │ -offset, size_t len); │ │ │ │ -328}; │ │ │ │ -329 │ │ │ │ -330struct CborParser │ │ │ │ -331{ │ │ │ │ -332 union { │ │ │ │ -333 const uint8_t *end; │ │ │ │ -334 const struct CborParserOperations *ops; │ │ │ │ -335 } source; │ │ │ │ -336 enum CborParserGlobalFlags flags; │ │ │ │ -337}; │ │ │ │ -338typedef struct CborParser CborParser; │ │ │ │ -339 │ │ │ │ -_3_4_0struct _C_b_o_r_V_a_l_u_e │ │ │ │ -341{ │ │ │ │ -342 const CborParser *parser; │ │ │ │ -343 union { │ │ │ │ -344 const uint8_t *ptr; │ │ │ │ -345 void *token; │ │ │ │ -346 } source; │ │ │ │ -347 uint32_t remaining; │ │ │ │ -348 uint16_t extra; │ │ │ │ -349 uint8_t type; │ │ │ │ -350 uint8_t flags; │ │ │ │ -351}; │ │ │ │ -352typedef struct _C_b_o_r_V_a_l_u_e _C_b_o_r_V_a_l_u_e; │ │ │ │ -353 │ │ │ │ -354#ifndef CBOR_NO_PARSER_API │ │ │ │ -355CBOR_API CborError _c_b_o_r___p_a_r_s_e_r___i_n_i_t(const uint8_t *buffer, size_t size, │ │ │ │ -uint32_t flags, CborParser *parser, _C_b_o_r_V_a_l_u_e *it); │ │ │ │ -356CBOR_API CborError cbor_parser_init_reader(const struct CborParserOperations │ │ │ │ -*ops, CborParser *parser, _C_b_o_r_V_a_l_u_e *it, void *token); │ │ │ │ -357 │ │ │ │ -358CBOR_API CborError _c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e___b_a_s_i_c(const _C_b_o_r_V_a_l_u_e *it); │ │ │ │ -359 │ │ │ │ -_3_6_0CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___a_t___e_n_d(const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -361{ return it->remaining == 0; } │ │ │ │ -_3_6_2CBOR_INLINE_API const uint8_t *_c_b_o_r___v_a_l_u_e___g_e_t___n_e_x_t___b_y_t_e(const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -363{ return it->source.ptr; } │ │ │ │ -364CBOR_API CborError cbor_value_reparse(_C_b_o_r_V_a_l_u_e *it); │ │ │ │ -365CBOR_API CborError _c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e___f_i_x_e_d(_C_b_o_r_V_a_l_u_e *it); │ │ │ │ -366CBOR_API CborError _c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e(_C_b_o_r_V_a_l_u_e *it); │ │ │ │ -_3_6_7CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___c_o_n_t_a_i_n_e_r(const _C_b_o_r_V_a_l_u_e *it) │ │ │ │ -368{ return it->type == CborArrayType || it->type == CborMapType; } │ │ │ │ -369CBOR_API CborError _c_b_o_r___v_a_l_u_e___e_n_t_e_r___c_o_n_t_a_i_n_e_r(const _C_b_o_r_V_a_l_u_e *it, _C_b_o_r_V_a_l_u_e │ │ │ │ -*recursed); │ │ │ │ -370CBOR_API CborError _c_b_o_r___v_a_l_u_e___l_e_a_v_e___c_o_n_t_a_i_n_e_r(_C_b_o_r_V_a_l_u_e *it, const _C_b_o_r_V_a_l_u_e │ │ │ │ -*recursed); │ │ │ │ -371 │ │ │ │ -372CBOR_PRIVATE_API uint64_t _cbor_value_decode_int64_internal(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value); │ │ │ │ -373CBOR_INLINE_API uint64_t _cbor_value_extract_int64_helper(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value) │ │ │ │ -374{ │ │ │ │ -375 return value->flags & CborIteratorFlag_IntegerValueTooLarge ? │ │ │ │ -376 _cbor_value_decode_int64_internal(value) : value->extra; │ │ │ │ -377} │ │ │ │ -378 │ │ │ │ -_3_7_9CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___v_a_l_i_d(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -380{ return value && value->type != CborInvalidType; } │ │ │ │ -_3_8_1CBOR_INLINE_API CborType _c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -382{ return (CborType)value->type; } │ │ │ │ -383 │ │ │ │ -384/* Null & undefined type */ │ │ │ │ -_3_8_5CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___n_u_l_l(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -386{ return value->type == CborNullType; } │ │ │ │ -_3_8_7CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___u_n_d_e_f_i_n_e_d(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -388{ return value->type == CborUndefinedType; } │ │ │ │ -389 │ │ │ │ -390/* Booleans */ │ │ │ │ -_3_9_1CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___b_o_o_l_e_a_n(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -392{ return value->type == CborBooleanType; } │ │ │ │ -_3_9_3CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___b_o_o_l_e_a_n(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -bool *result) │ │ │ │ -394{ │ │ │ │ -395 assert(_c_b_o_r___v_a_l_u_e___i_s___b_o_o_l_e_a_n(value)); │ │ │ │ -396 *result = !!value->extra; │ │ │ │ -397 return CborNoError; │ │ │ │ -398} │ │ │ │ -399 │ │ │ │ -400/* Simple types */ │ │ │ │ -_4_0_1CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___s_i_m_p_l_e___t_y_p_e(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -402{ return value->type == CborSimpleType; } │ │ │ │ -_4_0_3CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___s_i_m_p_l_e___t_y_p_e(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -uint8_t *result) │ │ │ │ -404{ │ │ │ │ -405 assert(_c_b_o_r___v_a_l_u_e___i_s___s_i_m_p_l_e___t_y_p_e(value)); │ │ │ │ -406 *result = (uint8_t)value->extra; │ │ │ │ -407 return CborNoError; │ │ │ │ -408} │ │ │ │ -409 │ │ │ │ -410/* Integers */ │ │ │ │ -_4_1_1CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -412{ return value->type == CborIntegerType; } │ │ │ │ -_4_1_3CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___u_n_s_i_g_n_e_d___i_n_t_e_g_e_r(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -414{ return _c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(value) && (value->flags & │ │ │ │ -CborIteratorFlag_NegativeInteger) == 0; } │ │ │ │ -_4_1_5CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___n_e_g_a_t_i_v_e___i_n_t_e_g_e_r(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -416{ return _c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(value) && (value->flags & │ │ │ │ -CborIteratorFlag_NegativeInteger); } │ │ │ │ -417 │ │ │ │ -_4_1_8CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___r_a_w___i_n_t_e_g_e_r(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -uint64_t *result) │ │ │ │ -419{ │ │ │ │ -420 assert(_c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(value)); │ │ │ │ -421 *result = _cbor_value_extract_int64_helper(value); │ │ │ │ -422 return CborNoError; │ │ │ │ -423} │ │ │ │ -424 │ │ │ │ -_4_2_5CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___u_i_n_t_6_4(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -uint64_t *result) │ │ │ │ -426{ │ │ │ │ -427 assert(_c_b_o_r___v_a_l_u_e___i_s___u_n_s_i_g_n_e_d___i_n_t_e_g_e_r(value)); │ │ │ │ -428 *result = _cbor_value_extract_int64_helper(value); │ │ │ │ -429 return CborNoError; │ │ │ │ -430} │ │ │ │ -431 │ │ │ │ -_4_3_2CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -int64_t *result) │ │ │ │ -433{ │ │ │ │ -434 assert(_c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(value)); │ │ │ │ -435 *result = (int64_t) _cbor_value_extract_int64_helper(value); │ │ │ │ -436 if (value->flags & CborIteratorFlag_NegativeInteger) │ │ │ │ -437 *result = -*result - 1; │ │ │ │ -438 return CborNoError; │ │ │ │ -439} │ │ │ │ -440 │ │ │ │ -_4_4_1CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t(const _C_b_o_r_V_a_l_u_e *value, int │ │ │ │ -*result) │ │ │ │ -442{ │ │ │ │ -443 assert(_c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r(value)); │ │ │ │ -444 *result = (int) _cbor_value_extract_int64_helper(value); │ │ │ │ -445 if (value->flags & CborIteratorFlag_NegativeInteger) │ │ │ │ -446 *result = -*result - 1; │ │ │ │ -447 return CborNoError; │ │ │ │ -448} │ │ │ │ -449 │ │ │ │ -450CBOR_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4___c_h_e_c_k_e_d(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -int64_t *result); │ │ │ │ -451CBOR_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___i_n_t___c_h_e_c_k_e_d(const _C_b_o_r_V_a_l_u_e *value, int │ │ │ │ -*result); │ │ │ │ -452 │ │ │ │ -_4_5_3CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -454{ return (value->flags & CborIteratorFlag_UnknownLength) == 0; } │ │ │ │ -455 │ │ │ │ -456/* Tags */ │ │ │ │ -_4_5_7CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___t_a_g(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -458{ return value->type == CborTagType; } │ │ │ │ -_4_5_9CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___t_a_g(const _C_b_o_r_V_a_l_u_e *value, _C_b_o_r_T_a_g │ │ │ │ -*result) │ │ │ │ -460{ │ │ │ │ -461 assert(_c_b_o_r___v_a_l_u_e___i_s___t_a_g(value)); │ │ │ │ -462 *result = _cbor_value_extract_int64_helper(value); │ │ │ │ -463 return CborNoError; │ │ │ │ -464} │ │ │ │ -465CBOR_API CborError _c_b_o_r___v_a_l_u_e___s_k_i_p___t_a_g(_C_b_o_r_V_a_l_u_e *it); │ │ │ │ -466 │ │ │ │ -467/* Strings */ │ │ │ │ -_4_6_8CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -469{ return value->type == CborByteStringType; } │ │ │ │ -_4_7_0CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -471{ return value->type == CborTextStringType; } │ │ │ │ -472 │ │ │ │ -_4_7_3CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___s_t_r_i_n_g___l_e_n_g_t_h(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, size_t *length) │ │ │ │ -474{ │ │ │ │ -475 uint64_t v; │ │ │ │ -476 assert(_c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g(value) || _c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g │ │ │ │ -(value)); │ │ │ │ -477 if (!_c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n(value)) │ │ │ │ -478 return CborErrorUnknownLength; │ │ │ │ -479 v = _cbor_value_extract_int64_helper(value); │ │ │ │ -480 *length = (size_t)v; │ │ │ │ -481 if (*length != v) │ │ │ │ -482 return CborErrorDataTooLarge; │ │ │ │ -483 return CborNoError; │ │ │ │ -484} │ │ │ │ -485 │ │ │ │ -486CBOR_PRIVATE_API CborError _cbor_value_copy_string(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -void *buffer, │ │ │ │ -487 size_t *buflen, _C_b_o_r_V_a_l_u_e *next); │ │ │ │ -488CBOR_PRIVATE_API CborError _cbor_value_dup_string(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -void **buffer, │ │ │ │ -489 size_t *buflen, _C_b_o_r_V_a_l_u_e *next); │ │ │ │ -490 │ │ │ │ -491CBOR_API CborError _c_b_o_r___v_a_l_u_e___c_a_l_c_u_l_a_t_e___s_t_r_i_n_g___l_e_n_g_t_h(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, size_t *length); │ │ │ │ -492 │ │ │ │ -_4_9_3CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___c_o_p_y___t_e_x_t___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, char *buffer, │ │ │ │ -494 size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -495{ │ │ │ │ -496 assert(_c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g(value)); │ │ │ │ -497 return _cbor_value_copy_string(value, buffer, buflen, next); │ │ │ │ -498} │ │ │ │ -_4_9_9CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___c_o_p_y___b_y_t_e___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, uint8_t *buffer, │ │ │ │ -500 size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -501{ │ │ │ │ -502 assert(_c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g(value)); │ │ │ │ -503 return _cbor_value_copy_string(value, buffer, buflen, next); │ │ │ │ -504} │ │ │ │ -505 │ │ │ │ -_5_0_6CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___d_u_p___t_e_x_t___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -char **buffer, │ │ │ │ -507 size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -508{ │ │ │ │ -509 assert(_c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g(value)); │ │ │ │ -510 return _cbor_value_dup_string(value, (void **)buffer, buflen, next); │ │ │ │ -511} │ │ │ │ -_5_1_2CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___d_u_p___b_y_t_e___s_t_r_i_n_g(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -uint8_t **buffer, │ │ │ │ -513 size_t *buflen, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -514{ │ │ │ │ -515 assert(_c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g(value)); │ │ │ │ -516 return _cbor_value_dup_string(value, (void **)buffer, buflen, next); │ │ │ │ -517} │ │ │ │ -518 │ │ │ │ -519CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk_size(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, size_t *len); │ │ │ │ -520CBOR_INLINE_API CborError cbor_value_get_string_chunk_size(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, size_t *len) │ │ │ │ -521{ │ │ │ │ -522 assert(value->flags & CborIteratorFlag_IteratingStringChunks); │ │ │ │ -523 return _cbor_value_get_string_chunk_size(value, len); │ │ │ │ -524} │ │ │ │ -525 │ │ │ │ -526CBOR_INLINE_API bool cbor_value_string_iteration_at_end(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value) │ │ │ │ -527{ │ │ │ │ -528 size_t dummy; │ │ │ │ -529 return cbor_value_get_string_chunk_size(value, &dummy) == │ │ │ │ -CborErrorNoMoreStringChunks; │ │ │ │ -530} │ │ │ │ -531 │ │ │ │ -532CBOR_PRIVATE_API CborError _cbor_value_begin_string_iteration(_C_b_o_r_V_a_l_u_e │ │ │ │ -*value); │ │ │ │ -533CBOR_INLINE_API CborError cbor_value_begin_string_iteration(_C_b_o_r_V_a_l_u_e │ │ │ │ -*value) │ │ │ │ -534{ │ │ │ │ -535 assert(_c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g(value) || _c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g │ │ │ │ -(value)); │ │ │ │ -536 assert(!(value->flags & CborIteratorFlag_IteratingStringChunks)); │ │ │ │ -537 return _cbor_value_begin_string_iteration(value); │ │ │ │ -538} │ │ │ │ -539 │ │ │ │ -540CBOR_PRIVATE_API CborError _cbor_value_finish_string_iteration(_C_b_o_r_V_a_l_u_e │ │ │ │ -*value); │ │ │ │ -541CBOR_INLINE_API CborError cbor_value_finish_string_iteration(_C_b_o_r_V_a_l_u_e │ │ │ │ -*value) │ │ │ │ -542{ │ │ │ │ -543 assert(cbor_value_string_iteration_at_end(value)); │ │ │ │ -544 return _cbor_value_finish_string_iteration(value); │ │ │ │ -545} │ │ │ │ -546 │ │ │ │ -547CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, const void **bufferptr, │ │ │ │ -548 size_t *len, _C_b_o_r_V_a_l_u_e *next); │ │ │ │ -_5_4_9CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___t_e_x_t___s_t_r_i_n_g___c_h_u_n_k(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, const char **bufferptr, │ │ │ │ -550 size_t *len, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -551{ │ │ │ │ -552 assert(_c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g(value)); │ │ │ │ -553 return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, │ │ │ │ -next); │ │ │ │ -554} │ │ │ │ -555CBOR_INLINE_API CborError cbor_value_get_byte_string_chunk(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, const uint8_t **bufferptr, │ │ │ │ -556 size_t *len, _C_b_o_r_V_a_l_u_e *next) │ │ │ │ -557{ │ │ │ │ -558 assert(_c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g(value)); │ │ │ │ -559 return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, │ │ │ │ -next); │ │ │ │ -560} │ │ │ │ -561 │ │ │ │ -562CBOR_API CborError _c_b_o_r___v_a_l_u_e___t_e_x_t___s_t_r_i_n_g___e_q_u_a_l_s(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -const char *string, bool *result); │ │ │ │ -563 │ │ │ │ -564/* Maps and arrays */ │ │ │ │ -_5_6_5CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___a_r_r_a_y(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -566{ return value->type == CborArrayType; } │ │ │ │ -_5_6_7CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___m_a_p(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -568{ return value->type == CborMapType; } │ │ │ │ -569 │ │ │ │ -_5_7_0CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___a_r_r_a_y___l_e_n_g_t_h(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, size_t *length) │ │ │ │ -571{ │ │ │ │ -572 uint64_t v; │ │ │ │ -573 assert(_c_b_o_r___v_a_l_u_e___i_s___a_r_r_a_y(value)); │ │ │ │ -574 if (!_c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n(value)) │ │ │ │ -575 return CborErrorUnknownLength; │ │ │ │ -576 v = _cbor_value_extract_int64_helper(value); │ │ │ │ -577 *length = (size_t)v; │ │ │ │ -578 if (*length != v) │ │ │ │ -579 return CborErrorDataTooLarge; │ │ │ │ -580 return CborNoError; │ │ │ │ -581} │ │ │ │ -582 │ │ │ │ -_5_8_3CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___m_a_p___l_e_n_g_t_h(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -size_t *length) │ │ │ │ -584{ │ │ │ │ -585 uint64_t v; │ │ │ │ -586 assert(_c_b_o_r___v_a_l_u_e___i_s___m_a_p(value)); │ │ │ │ -587 if (!_c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n(value)) │ │ │ │ -588 return CborErrorUnknownLength; │ │ │ │ -589 v = _cbor_value_extract_int64_helper(value); │ │ │ │ -590 *length = (size_t)v; │ │ │ │ -591 if (*length != v) │ │ │ │ -592 return CborErrorDataTooLarge; │ │ │ │ -593 return CborNoError; │ │ │ │ -594} │ │ │ │ -595 │ │ │ │ -596CBOR_API CborError _c_b_o_r___v_a_l_u_e___m_a_p___f_i_n_d___v_a_l_u_e(const _C_b_o_r_V_a_l_u_e *map, const │ │ │ │ -char *string, _C_b_o_r_V_a_l_u_e *element); │ │ │ │ -597 │ │ │ │ -598/* Floating point */ │ │ │ │ -_5_9_9CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -600{ return value->type == CborHalfFloatType; } │ │ │ │ -601CBOR_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t___a_s___f_l_o_a_t(const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, float *result); │ │ │ │ -_6_0_2CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -void *result) │ │ │ │ -603{ │ │ │ │ -604 assert(_c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t(value)); │ │ │ │ -605 assert((value->flags & CborIteratorFlag_IntegerValueTooLarge) == 0); │ │ │ │ -606 │ │ │ │ -607 /* size has already been computed */ │ │ │ │ -608 memcpy(result, &value->extra, sizeof(value->extra)); │ │ │ │ -609 return CborNoError; │ │ │ │ -610} │ │ │ │ -611 │ │ │ │ -_6_1_2CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___f_l_o_a_t(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -613{ return value->type == CborFloatType; } │ │ │ │ -_6_1_4CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___g_e_t___f_l_o_a_t(const _C_b_o_r_V_a_l_u_e *value, float │ │ │ │ -*result) │ │ │ │ -615{ │ │ │ │ -616 uint32_t data; │ │ │ │ -617 assert(_c_b_o_r___v_a_l_u_e___i_s___f_l_o_a_t(value)); │ │ │ │ -618 assert(value->flags & CborIteratorFlag_IntegerValueTooLarge); │ │ │ │ -619 data = (uint32_t)_cbor_value_decode_int64_internal(value); │ │ │ │ -620 memcpy(result, &data, sizeof(*result)); │ │ │ │ -621 return CborNoError; │ │ │ │ -622} │ │ │ │ -623 │ │ │ │ -_6_2_4CBOR_INLINE_API bool _c_b_o_r___v_a_l_u_e___i_s___d_o_u_b_l_e(const _C_b_o_r_V_a_l_u_e *value) │ │ │ │ -625{ return value->type == CborDoubleType; } │ │ │ │ -626CBOR_INLINE_API CborError cbor_value_get_double(const _C_b_o_r_V_a_l_u_e *value, │ │ │ │ -double *result) │ │ │ │ -627{ │ │ │ │ -628 uint64_t data; │ │ │ │ -629 assert(_c_b_o_r___v_a_l_u_e___i_s___d_o_u_b_l_e(value)); │ │ │ │ -630 assert(value->flags & CborIteratorFlag_IntegerValueTooLarge); │ │ │ │ -631 data = _cbor_value_decode_int64_internal(value); │ │ │ │ -632 memcpy(result, &data, sizeof(*result)); │ │ │ │ -633 return CborNoError; │ │ │ │ -634} │ │ │ │ -635 │ │ │ │ -636/* Validation API */ │ │ │ │ -637#ifndef CBOR_NO_VALIDATION_API │ │ │ │ -638 │ │ │ │ -639enum CborValidationFlags { │ │ │ │ -640 /* Bit mapping: │ │ │ │ -641 * bits 0-7 (8 bits): canonical format │ │ │ │ -642 * bits 8-11 (4 bits): canonical format & strict mode │ │ │ │ -643 * bits 12-20 (8 bits): strict mode │ │ │ │ -644 * bits 21-31 (10 bits): other │ │ │ │ -645 */ │ │ │ │ -646 │ │ │ │ -647 CborValidateShortestIntegrals = 0x0001, │ │ │ │ -648 CborValidateShortestFloatingPoint = 0x0002, │ │ │ │ -649 CborValidateShortestNumbers = CborValidateShortestIntegrals | │ │ │ │ -CborValidateShortestFloatingPoint, │ │ │ │ -650 CborValidateNoIndeterminateLength = 0x0100, │ │ │ │ -651 CborValidateMapIsSorted = 0x0200 | CborValidateNoIndeterminateLength, │ │ │ │ -652 │ │ │ │ -653 CborValidateCanonicalFormat = 0x0fff, │ │ │ │ -654 │ │ │ │ -655 CborValidateMapKeysAreUnique = 0x1000 | CborValidateMapIsSorted, │ │ │ │ -656 CborValidateTagUse = 0x2000, │ │ │ │ -657 CborValidateUtf8 = 0x4000, │ │ │ │ -658 │ │ │ │ -659 CborValidateStrictMode = 0xfff00, │ │ │ │ -660 │ │ │ │ -661 CborValidateMapKeysAreString = 0x100000, │ │ │ │ -662 CborValidateNoUndefined = 0x200000, │ │ │ │ -663 CborValidateNoTags = 0x400000, │ │ │ │ -664 CborValidateFiniteFloatingPoint = 0x800000, │ │ │ │ -665 /* unused = 0x1000000, */ │ │ │ │ -666 /* unused = 0x2000000, */ │ │ │ │ -667 │ │ │ │ -668 CborValidateNoUnknownSimpleTypesSA = 0x4000000, │ │ │ │ -669 CborValidateNoUnknownSimpleTypes = 0x8000000 | │ │ │ │ -CborValidateNoUnknownSimpleTypesSA, │ │ │ │ -670 CborValidateNoUnknownTagsSA = 0x10000000, │ │ │ │ -671 CborValidateNoUnknownTagsSR = 0x20000000 | CborValidateNoUnknownTagsSA, │ │ │ │ -672 CborValidateNoUnknownTags = 0x40000000 | CborValidateNoUnknownTagsSR, │ │ │ │ -673 │ │ │ │ -674 CborValidateCompleteData = (int)0x80000000, │ │ │ │ -675 │ │ │ │ -676 CborValidateStrictest = (int)~0U, │ │ │ │ -677 CborValidateBasic = 0 │ │ │ │ -678}; │ │ │ │ -679 │ │ │ │ -680CBOR_API CborError _c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e(const _C_b_o_r_V_a_l_u_e *it, uint32_t flags); │ │ │ │ -681#endif /* CBOR_NO_VALIDATION_API */ │ │ │ │ -682 │ │ │ │ -683/* Human-readable (dump) API */ │ │ │ │ -684#ifndef CBOR_NO_PRETTY_API │ │ │ │ -685 │ │ │ │ -686enum CborPrettyFlags { │ │ │ │ -687 CborPrettyNumericEncodingIndicators = 0x01, │ │ │ │ -688 CborPrettyTextualEncodingIndicators = 0, │ │ │ │ -689 │ │ │ │ -690 CborPrettyIndicateIndeterminateLength = 0x02, │ │ │ │ -691 CborPrettyIndicateIndetermineLength = │ │ │ │ -CborPrettyIndicateIndeterminateLength, /* deprecated */ │ │ │ │ -692 CborPrettyIndicateOverlongNumbers = 0x04, │ │ │ │ -693 │ │ │ │ -694 CborPrettyShowStringFragments = 0x100, │ │ │ │ -695 CborPrettyMergeStringFragments = 0, │ │ │ │ -696 │ │ │ │ -697 CborPrettyDefaultFlags = CborPrettyIndicateIndeterminateLength │ │ │ │ -698}; │ │ │ │ -699 │ │ │ │ -700typedef CborError (*CborStreamFunction)(void *token, const char *fmt, ...) │ │ │ │ -701#ifdef __GNUC__ │ │ │ │ -702 __attribute__((__format__(printf, 2, 3))) │ │ │ │ -703#endif │ │ │ │ -704; │ │ │ │ -705 │ │ │ │ -706CBOR_API CborError _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___s_t_r_e_a_m(CborStreamFunction │ │ │ │ -streamFunction, void *token, _C_b_o_r_V_a_l_u_e *value, int flags); │ │ │ │ -707 │ │ │ │ -708/* The following API requires a hosted C implementation (uses FILE*) */ │ │ │ │ -709#if !defined(__STDC_HOSTED__) || __STDC_HOSTED__-0 == 1 │ │ │ │ -710CBOR_API CborError _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e___f_l_a_g_s(FILE *out, _C_b_o_r_V_a_l_u_e │ │ │ │ -*value, int flags); │ │ │ │ -711CBOR_API CborError _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e(FILE *out, _C_b_o_r_V_a_l_u_e │ │ │ │ -*value); │ │ │ │ -_7_1_2CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y(FILE *out, const _C_b_o_r_V_a_l_u_e │ │ │ │ -*value) │ │ │ │ -713{ │ │ │ │ -714 _C_b_o_r_V_a_l_u_e copy = *value; │ │ │ │ -715 return _c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e___f_l_a_g_s(out, ©, │ │ │ │ -CborPrettyDefaultFlags); │ │ │ │ -716} │ │ │ │ -717#endif /* __STDC_HOSTED__ check */ │ │ │ │ -718 │ │ │ │ -719#endif /* CBOR_NO_PRETTY_API */ │ │ │ │ -720 │ │ │ │ -721#endif /* CBOR_NO_PARSER_API */ │ │ │ │ -722 │ │ │ │ -723#ifdef __cplusplus │ │ │ │ -724} │ │ │ │ -725#endif │ │ │ │ -726 │ │ │ │ -727#endif /* CBOR_H */ │ │ │ │ -_c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y │ │ │ │ -CborError cbor_value_to_pretty(FILE *out, const CborValue *value) │ │ │ │ -Converts the current CBOR type pointed to by value to its textual │ │ │ │ -representation and writes it to the... │ │ │ │ -DDeeffiinniittiioonn cbor.h:712 │ │ │ │ -_c_b_o_r___v_a_l_u_e___d_u_p___t_e_x_t___s_t_r_i_n_g │ │ │ │ -CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, │ │ │ │ -size_t *buflen, CborValue *next) │ │ │ │ -Allocates memory for the string pointed by value and copies it into this │ │ │ │ -buffer. │ │ │ │ -DDeeffiinniittiioonn cbor.h:506 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t___a_s___f_l_o_a_t │ │ │ │ -CBOR_API CborError cbor_value_get_half_float_as_float(const CborValue *value, │ │ │ │ -float *result) │ │ │ │ -Retrieves the CBOR half-precision floating point (16-bit) value that value │ │ │ │ -points to,... │ │ │ │ -DDeeffiinniittiioonn cborparser_float.c:40 │ │ │ │ -_c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e___f_l_a_g_s │ │ │ │ -CBOR_API CborError cbor_value_to_pretty_advance_flags(FILE *out, CborValue │ │ │ │ +44 CborConvertRequireMapStringKeys = 0, │ │ │ │ +45 CborConvertStringifyMapKeys = 8, │ │ │ │ +46 │ │ │ │ +47 CborConvertDefaultFlags = 0 │ │ │ │ +48}; │ │ │ │ +49 │ │ │ │ +50CBOR_API CborError _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e(FILE *out, _C_b_o_r_V_a_l_u_e *value, │ │ │ │ +int flags); │ │ │ │ +_5_1CBOR_INLINE_API CborError _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n(FILE *out, const _C_b_o_r_V_a_l_u_e │ │ │ │ *value, int flags) │ │ │ │ -Converts the current CBOR type pointed to by value to its textual │ │ │ │ -representation and writes it to the... │ │ │ │ -DDeeffiinniittiioonn cborpretty_stdio.c:83 │ │ │ │ -_c_b_o_r___v_a_l_u_e___d_u_p___b_y_t_e___s_t_r_i_n_g │ │ │ │ -CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer, │ │ │ │ -size_t *buflen, CborValue *next) │ │ │ │ -Allocates memory for the string pointed by value and copies it into this │ │ │ │ -buffer. │ │ │ │ -DDeeffiinniittiioonn cbor.h:512 │ │ │ │ -_c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___a_d_v_a_n_c_e │ │ │ │ -CBOR_API CborError cbor_value_to_pretty_advance(FILE *out, CborValue *value) │ │ │ │ -Converts the current CBOR type pointed to by value to its textual │ │ │ │ -representation and writes it to the... │ │ │ │ -DDeeffiinniittiioonn cborpretty_stdio.c:63 │ │ │ │ -_C_b_o_r_T_a_g │ │ │ │ -uint64_t CborTag │ │ │ │ -This typedef is an unsigned 64-bit integer. │ │ │ │ -DDeeffiinniittiioonn cbor.h:102 │ │ │ │ -_c_b_o_r___e_r_r_o_r___s_t_r_i_n_g │ │ │ │ -CBOR_API const char * cbor_error_string(CborError error) │ │ │ │ -Returns the error string corresponding to the CBOR error condition error. │ │ │ │ -DDeeffiinniittiioonn cborerrorstrings.c:80 │ │ │ │ -_C_b_o_r_I_n_d_e_f_i_n_i_t_e_L_e_n_g_t_h │ │ │ │ -static const size_t CborIndefiniteLength │ │ │ │ -This variable is a constant used to indicate that the length of the map or │ │ │ │ -array is not yet determine... │ │ │ │ -DDeeffiinniittiioonn cbor.h:238 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___n_e_g_a_t_i_v_e___i_n_t │ │ │ │ -CBOR_API CborError cbor_encode_negative_int(CborEncoder *encoder, uint64_t │ │ │ │ -absolute_value) │ │ │ │ -Appends the negative 64-bit integer whose absolute value is absolute_value to │ │ │ │ -the CBOR stream provide... │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:361 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___b_y_t_e___s_t_r_i_n_g │ │ │ │ -CBOR_API CborError cbor_encode_byte_string(CborEncoder *encoder, const uint8_t │ │ │ │ -*string, size_t length) │ │ │ │ -Appends the byte string string of length length to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:463 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___d_o_u_b_l_e │ │ │ │ -CborError cbor_encode_double(CborEncoder *encoder, double value) │ │ │ │ -Appends the IEEE 754 double-precision (64-bit) floating point value value to │ │ │ │ -the CBOR stream provided... │ │ │ │ -DDeeffiinniittiioonn cbor.h:267 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___i_n_i_t │ │ │ │ -CBOR_API void cbor_encoder_init(CborEncoder *encoder, uint8_t *buffer, size_t │ │ │ │ -size, int flags) │ │ │ │ -Initializes a CborEncoder structure encoder by pointing it to buffer buffer of │ │ │ │ -size size. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:195 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___u_i_n_t │ │ │ │ -CBOR_API CborError cbor_encode_uint(CborEncoder *encoder, uint64_t value) │ │ │ │ -Appends the unsigned 64-bit integer value to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:348 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___n_u_l_l │ │ │ │ -CborError cbor_encode_null(CborEncoder *encoder) │ │ │ │ -Appends the CBOR type representing a null value to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cbor.h:257 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___r_a_w │ │ │ │ -CBOR_API CborError cbor_encode_raw(CborEncoder *encoder, const uint8_t *raw, │ │ │ │ -size_t length) │ │ │ │ -Puts the data of length length in raw into to the encoding buffer of encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:489 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g │ │ │ │ -CBOR_API CborError cbor_encode_text_string(CborEncoder *encoder, const char │ │ │ │ -*string, size_t length) │ │ │ │ -Appends the text string string of length length to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:475 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___t_e_x_t___s_t_r_i_n_g_z │ │ │ │ -CborError cbor_encode_text_stringz(CborEncoder *encoder, const char *string) │ │ │ │ -Appends the null-terminated text string string to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cbor.h:249 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r │ │ │ │ -CBOR_API CborError cbor_encoder_close_container(CborEncoder *parentEncoder, │ │ │ │ -const CborEncoder *containerEncoder) │ │ │ │ -Closes the CBOR container (array or map) provided by containerEncoder and │ │ │ │ -updates the CBOR stream pro... │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:580 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___g_e_t___b_u_f_f_e_r___s_i_z_e │ │ │ │ -size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t │ │ │ │ -*buffer) │ │ │ │ -Returns the total size of the buffer starting at buffer after the encoding │ │ │ │ -finished without errors. │ │ │ │ -DDeeffiinniittiioonn cbor.h:280 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___t_a_g │ │ │ │ -CBOR_API CborError cbor_encode_tag(CborEncoder *encoder, CborTag tag) │ │ │ │ -Appends the CBOR tag tag to the CBOR stream provided by encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:432 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___f_l_o_a_t___a_s___h_a_l_f___f_l_o_a_t │ │ │ │ -CBOR_API CborError cbor_encode_float_as_half_float(CborEncoder *encoder, float │ │ │ │ -value) │ │ │ │ -Convert the IEEE 754 single-precision (32-bit) floating point value value to │ │ │ │ -the IEEE 754 half-precis... │ │ │ │ -DDeeffiinniittiioonn cborencoder_float.c:32 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___b_o_o_l_e_a_n │ │ │ │ -CborError cbor_encode_boolean(CborEncoder *encoder, bool value) │ │ │ │ -Appends the boolean value value to the CBOR stream provided by encoder. │ │ │ │ -DDeeffiinniittiioonn cbor.h:255 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___s_i_m_p_l_e___v_a_l_u_e │ │ │ │ -CBOR_API CborError cbor_encode_simple_value(CborEncoder *encoder, uint8_t │ │ │ │ -value) │ │ │ │ -Appends the CBOR Simple Type of value value to the CBOR stream provided by │ │ │ │ -encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:388 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___u_n_d_e_f_i_n_e_d │ │ │ │ -CborError cbor_encode_undefined(CborEncoder *encoder) │ │ │ │ -Appends the CBOR type representing an undefined value to the CBOR stream │ │ │ │ -provided by encoder. │ │ │ │ -DDeeffiinniittiioonn cbor.h:259 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___a_r_r_a_y │ │ │ │ -CBOR_API CborError cbor_encoder_create_array(CborEncoder *parentEncoder, │ │ │ │ -CborEncoder *arrayEncoder, size_t length) │ │ │ │ -Creates a CBOR array in the CBOR stream provided by parentEncoder and │ │ │ │ -initializes arrayEncoder so tha... │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:537 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___c_l_o_s_e___c_o_n_t_a_i_n_e_r___c_h_e_c_k_e_d │ │ │ │ -CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder │ │ │ │ -*parentEncoder, const CborEncoder *containerEncoder) │ │ │ │ -DDeeffiinniittiioonn cborencoder_close_container_checked.c:48 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___c_r_e_a_t_e___m_a_p │ │ │ │ -CBOR_API CborError cbor_encoder_create_map(CborEncoder *parentEncoder, │ │ │ │ -CborEncoder *mapEncoder, size_t length) │ │ │ │ -Creates a CBOR map in the CBOR stream provided by parentEncoder and initializes │ │ │ │ -mapEncoder so that it... │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:561 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___i_n_t │ │ │ │ -CBOR_API CborError cbor_encode_int(CborEncoder *encoder, int64_t value) │ │ │ │ -Appends the signed 64-bit integer value to the CBOR stream provided by encoder. │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:372 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___f_l_o_a_t_i_n_g___p_o_i_n_t │ │ │ │ -CBOR_API CborError cbor_encode_floating_point(CborEncoder *encoder, CborType │ │ │ │ -fpType, const void *value) │ │ │ │ -Appends the floating-point value of type fpType and pointed to by value to the │ │ │ │ -CBOR stream provided b... │ │ │ │ -DDeeffiinniittiioonn cborencoder.c:409 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___h_a_l_f___f_l_o_a_t │ │ │ │ -CborError cbor_encode_half_float(CborEncoder *encoder, const void *value) │ │ │ │ -Appends the IEEE 754 half-precision (16-bit) floating point value pointed to by │ │ │ │ -value to the CBOR str... │ │ │ │ -DDeeffiinniittiioonn cbor.h:262 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e___f_l_o_a_t │ │ │ │ -CborError cbor_encode_float(CborEncoder *encoder, float value) │ │ │ │ -Appends the IEEE 754 single-precision (32-bit) floating point value value to │ │ │ │ -the CBOR stream provided... │ │ │ │ -DDeeffiinniittiioonn cbor.h:265 │ │ │ │ -_c_b_o_r___e_n_c_o_d_e_r___g_e_t___e_x_t_r_a___b_y_t_e_s___n_e_e_d_e_d │ │ │ │ -size_t cbor_encoder_get_extra_bytes_needed(const CborEncoder *encoder) │ │ │ │ -Returns how many more bytes the original buffer supplied to cbor_encoder_init() │ │ │ │ -needs to be extended ... │ │ │ │ -DDeeffiinniittiioonn cbor.h:285 │ │ │ │ -_c_b_o_r___v_a_l_u_e___c_o_p_y___t_e_x_t___s_t_r_i_n_g │ │ │ │ -CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, │ │ │ │ -size_t *buflen, CborValue *next) │ │ │ │ -Copies the string pointed to by value into the buffer provided at buffer of │ │ │ │ -buflen bytes. │ │ │ │ -DDeeffiinniittiioonn cbor.h:493 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___s_i_m_p_l_e___t_y_p_e │ │ │ │ -CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result) │ │ │ │ -Retrieves the CBOR Simple Type value that value points to and stores it in │ │ │ │ -result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:403 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___l_e_n_g_t_h___k_n_o_w_n │ │ │ │ -bool cbor_value_is_length_known(const CborValue *value) │ │ │ │ -Returns true if the length of this type is known without calculation. │ │ │ │ -DDeeffiinniittiioonn cbor.h:453 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___n_e_x_t___b_y_t_e │ │ │ │ -const uint8_t * cbor_value_get_next_byte(const CborValue *it) │ │ │ │ -Returns a pointer to the next byte that would be decoded if this CborValue │ │ │ │ -object were advanced. │ │ │ │ -DDeeffiinniittiioonn cbor.h:362 │ │ │ │ -_c_b_o_r___v_a_l_u_e___e_n_t_e_r___c_o_n_t_a_i_n_e_r │ │ │ │ -CBOR_API CborError cbor_value_enter_container(const CborValue *it, CborValue │ │ │ │ -*recursed) │ │ │ │ -Creates a CborValue iterator pointing to the first element of the container │ │ │ │ -represented by it and sav... │ │ │ │ -DDeeffiinniittiioonn cborparser.c:569 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___b_o_o_l_e_a_n │ │ │ │ -bool cbor_value_is_boolean(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR boolean type │ │ │ │ -(true or false). │ │ │ │ -DDeeffiinniittiioonn cbor.h:391 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___u_n_d_e_f_i_n_e_d │ │ │ │ -bool cbor_value_is_undefined(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR undefined │ │ │ │ -type. │ │ │ │ -DDeeffiinniittiioonn cbor.h:387 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___n_u_l_l │ │ │ │ -bool cbor_value_is_null(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR null type. │ │ │ │ -DDeeffiinniittiioonn cbor.h:385 │ │ │ │ -_c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e___b_a_s_i_c │ │ │ │ -CBOR_API CborError cbor_value_validate_basic(const CborValue *it) │ │ │ │ -Performs a basic validation of the CBOR stream pointed by it and returns the │ │ │ │ -error it found. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:433 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___m_a_p │ │ │ │ -bool cbor_value_is_map(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR map. │ │ │ │ -DDeeffiinniittiioonn cbor.h:567 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___t_a_g │ │ │ │ -bool cbor_value_is_tag(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR tag. │ │ │ │ -DDeeffiinniittiioonn cbor.h:457 │ │ │ │ -_c_b_o_r___v_a_l_u_e___s_k_i_p___t_a_g │ │ │ │ -CBOR_API CborError cbor_value_skip_tag(CborValue *it) │ │ │ │ -Advances the CBOR value it until it no longer points to a tag. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:542 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___r_a_w___i_n_t_e_g_e_r │ │ │ │ -CborError cbor_value_get_raw_integer(const CborValue *value, uint64_t *result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:418 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___i_n_t_e_g_e_r │ │ │ │ -bool cbor_value_is_integer(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR integer type. │ │ │ │ -DDeeffiinniittiioonn cbor.h:411 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___t_y_p_e │ │ │ │ -CborType cbor_value_get_type(const CborValue *value) │ │ │ │ -Returns the type of the CBOR value that the iterator value points to. │ │ │ │ -DDeeffiinniittiioonn cbor.h:381 │ │ │ │ -_c_b_o_r___v_a_l_u_e___a_t___e_n_d │ │ │ │ -bool cbor_value_at_end(const CborValue *it) │ │ │ │ -Returns true if it has reached the end of the iteration, usually when advancing │ │ │ │ -after the last item i... │ │ │ │ -DDeeffiinniittiioonn cbor.h:360 │ │ │ │ -_c_b_o_r___v_a_l_u_e___v_a_l_i_d_a_t_e │ │ │ │ -CBOR_API CborError cbor_value_validate(const CborValue *it, uint32_t flags) │ │ │ │ -Performs a full validation, controlled by the flags options, of the CBOR stream │ │ │ │ -pointed by it and ret... │ │ │ │ -DDeeffiinniittiioonn cborvalidation.c:640 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___t_a_g │ │ │ │ -CborError cbor_value_get_tag(const CborValue *value, CborTag *result) │ │ │ │ -Retrieves the CBOR tag value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:459 │ │ │ │ -_c_b_o_r___v_a_l_u_e___l_e_a_v_e___c_o_n_t_a_i_n_e_r │ │ │ │ -CBOR_API CborError cbor_value_leave_container(CborValue *it, const CborValue │ │ │ │ -*recursed) │ │ │ │ -Updates it to point to the next element after the container. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:618 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___h_a_l_f___f_l_o_a_t │ │ │ │ -CborError cbor_value_get_half_float(const CborValue *value, void *result) │ │ │ │ -Retrieves the CBOR half-precision floating point (16-bit) value that value │ │ │ │ -points to and stores it in... │ │ │ │ -DDeeffiinniittiioonn cbor.h:602 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4___c_h_e_c_k_e_d │ │ │ │ -CBOR_API CborError cbor_value_get_int64_checked(const CborValue *value, int64_t │ │ │ │ -*result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:803 │ │ │ │ -_c_b_o_r___p_a_r_s_e_r___i_n_i_t │ │ │ │ -CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, │ │ │ │ -uint32_t flags, CborParser *parser, CborValue *it) │ │ │ │ -Initializes the CBOR parser for parsing size bytes beginning at buffer. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:336 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___d_o_u_b_l_e │ │ │ │ -bool cbor_value_is_double(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR double- │ │ │ │ -precision floating point (64-... │ │ │ │ -DDeeffiinniittiioonn cbor.h:624 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___s_i_m_p_l_e___t_y_p_e │ │ │ │ -bool cbor_value_is_simple_type(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR Simple Type │ │ │ │ -type (other than true,... │ │ │ │ -DDeeffiinniittiioonn cbor.h:401 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___n_e_g_a_t_i_v_e___i_n_t_e_g_e_r │ │ │ │ -bool cbor_value_is_negative_integer(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR negative │ │ │ │ -integer type. │ │ │ │ -DDeeffiinniittiioonn cbor.h:415 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___h_a_l_f___f_l_o_a_t │ │ │ │ -bool cbor_value_is_half_float(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR single- │ │ │ │ -precision floating point (16-... │ │ │ │ -DDeeffiinniittiioonn cbor.h:599 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___u_i_n_t_6_4 │ │ │ │ -CborError cbor_value_get_uint64(const CborValue *value, uint64_t *result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:425 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___i_n_t │ │ │ │ -CborError cbor_value_get_int(const CborValue *value, int *result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:441 │ │ │ │ -_c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e___f_i_x_e_d │ │ │ │ -CBOR_API CborError cbor_value_advance_fixed(CborValue *it) │ │ │ │ -Advances the CBOR value it by one fixed-size position. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:454 │ │ │ │ -_c_b_o_r___v_a_l_u_e___c_o_p_y___b_y_t_e___s_t_r_i_n_g │ │ │ │ -CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer, │ │ │ │ -size_t *buflen, CborValue *next) │ │ │ │ -Copies the string pointed by value into the buffer provided at buffer of buflen │ │ │ │ -bytes. │ │ │ │ -DDeeffiinniittiioonn cbor.h:499 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___u_n_s_i_g_n_e_d___i_n_t_e_g_e_r │ │ │ │ -bool cbor_value_is_unsigned_integer(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR unsigned │ │ │ │ -integer type (positive valu... │ │ │ │ -DDeeffiinniittiioonn cbor.h:413 │ │ │ │ -_c_b_o_r___v_a_l_u_e___t_e_x_t___s_t_r_i_n_g___e_q_u_a_l_s │ │ │ │ -CBOR_API CborError cbor_value_text_string_equals(const CborValue *value, const │ │ │ │ -char *string, bool *result) │ │ │ │ -Compares the entry value with the string string and stores the result in │ │ │ │ -result. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:1314 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___t_e_x_t___s_t_r_i_n_g___c_h_u_n_k │ │ │ │ -CborError cbor_value_get_text_string_chunk(const CborValue *value, const char │ │ │ │ -**bufferptr, size_t *len, CborValue *next) │ │ │ │ -Extracts one text string chunk pointed to by value and stores a pointer to the │ │ │ │ -data in buffer and the... │ │ │ │ -DDeeffiinniittiioonn cbor.h:549 │ │ │ │ -_c_b_o_r___v_a_l_u_e___c_a_l_c_u_l_a_t_e___s_t_r_i_n_g___l_e_n_g_t_h │ │ │ │ -CBOR_API CborError cbor_value_calculate_string_length(const CborValue *value, │ │ │ │ -size_t *length) │ │ │ │ -Calculates the length of the byte or text string that value points to and │ │ │ │ -stores it in len. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:954 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___m_a_p___l_e_n_g_t_h │ │ │ │ -CborError cbor_value_get_map_length(const CborValue *value, size_t *length) │ │ │ │ -Extracts the length of the CBOR map that value points to and stores it in │ │ │ │ -result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:583 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___b_y_t_e___s_t_r_i_n_g │ │ │ │ -bool cbor_value_is_byte_string(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR byte string. │ │ │ │ -DDeeffiinniittiioonn cbor.h:468 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___b_o_o_l_e_a_n │ │ │ │ -CborError cbor_value_get_boolean(const CborValue *value, bool *result) │ │ │ │ -Retrieves the boolean value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:393 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___a_r_r_a_y │ │ │ │ -bool cbor_value_is_array(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR array. │ │ │ │ -DDeeffiinniittiioonn cbor.h:565 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___i_n_t_6_4 │ │ │ │ -CborError cbor_value_get_int64(const CborValue *value, int64_t *result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:432 │ │ │ │ -_c_b_o_r___v_a_l_u_e___a_d_v_a_n_c_e │ │ │ │ -CBOR_API CborError cbor_value_advance(CborValue *it) │ │ │ │ -Advances the CBOR value it by one element, skipping over containers. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:506 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___a_r_r_a_y___l_e_n_g_t_h │ │ │ │ -CborError cbor_value_get_array_length(const CborValue *value, size_t *length) │ │ │ │ -Extracts the length of the CBOR array that value points to and stores it in │ │ │ │ -result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:570 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___v_a_l_i_d │ │ │ │ -bool cbor_value_is_valid(const CborValue *value) │ │ │ │ -Returns true if the iterator it contains a valid value. │ │ │ │ -DDeeffiinniittiioonn cbor.h:379 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___t_e_x_t___s_t_r_i_n_g │ │ │ │ -bool cbor_value_is_text_string(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR text string. │ │ │ │ -DDeeffiinniittiioonn cbor.h:470 │ │ │ │ -_c_b_o_r___v_a_l_u_e___m_a_p___f_i_n_d___v_a_l_u_e │ │ │ │ -CBOR_API CborError cbor_value_map_find_value(const CborValue *map, const char │ │ │ │ -*string, CborValue *element) │ │ │ │ -Attempts to find the value in map map that corresponds to the text string entry │ │ │ │ -string. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:1402 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___s_t_r_i_n_g___l_e_n_g_t_h │ │ │ │ -CborError cbor_value_get_string_length(const CborValue *value, size_t *length) │ │ │ │ -Extracts the length of the byte or text string that value points to and stores │ │ │ │ -it in result. │ │ │ │ -DDeeffiinniittiioonn cbor.h:473 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___c_o_n_t_a_i_n_e_r │ │ │ │ -bool cbor_value_is_container(const CborValue *it) │ │ │ │ -Returns true if the it value is a container and requires recursion in order to │ │ │ │ -decode (maps and array... │ │ │ │ -DDeeffiinniittiioonn cbor.h:367 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___i_n_t___c_h_e_c_k_e_d │ │ │ │ -CBOR_API CborError cbor_value_get_int_checked(const CborValue *value, int │ │ │ │ -*result) │ │ │ │ -Retrieves the CBOR integer value that value points to and stores it in result. │ │ │ │ -DDeeffiinniittiioonn cborparser.c:843 │ │ │ │ -_c_b_o_r___v_a_l_u_e___g_e_t___f_l_o_a_t │ │ │ │ -CborError cbor_value_get_float(const CborValue *value, float *result) │ │ │ │ -Retrieves the CBOR single-precision floating point (32-bit) value that value │ │ │ │ -points to and stores it ... │ │ │ │ -DDeeffiinniittiioonn cbor.h:614 │ │ │ │ -_c_b_o_r___v_a_l_u_e___i_s___f_l_o_a_t │ │ │ │ -bool cbor_value_is_float(const CborValue *value) │ │ │ │ -Returns true if the iterator value is valid and points to a CBOR single- │ │ │ │ -precision floating point (32-... │ │ │ │ -DDeeffiinniittiioonn cbor.h:612 │ │ │ │ -_c_b_o_r___v_a_l_u_e___t_o___p_r_e_t_t_y___s_t_r_e_a_m │ │ │ │ -CBOR_API CborError cbor_value_to_pretty_stream(CborStreamFunction │ │ │ │ -streamFunction, void *token, CborValue *value, int flags) │ │ │ │ -Converts the current CBOR type pointed by value to its textual representation │ │ │ │ -and writes it to the st... │ │ │ │ -DDeeffiinniittiioonn cborpretty.c:576 │ │ │ │ -_C_b_o_r_E_n_c_o_d_e_r │ │ │ │ -Structure used to encode to CBOR. │ │ │ │ -DDeeffiinniittiioonn cbor.h:226 │ │ │ │ +52{ │ │ │ │ +53 _C_b_o_r_V_a_l_u_e copy = *value; │ │ │ │ +54 return _c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e(out, ©, flags); │ │ │ │ +55} │ │ │ │ +56 │ │ │ │ +57#ifdef __cplusplus │ │ │ │ +58} │ │ │ │ +59#endif │ │ │ │ +60 │ │ │ │ +61#endif /* CBORJSON_H */ │ │ │ │ +62 │ │ │ │ +_c_b_o_r_._h │ │ │ │ +> The is the main header in TinyCBOR and defines the constants used by │ │ │ │ +most functions as wel... │ │ │ │ +_c_b_o_r___v_a_l_u_e___t_o___j_s_o_n │ │ │ │ +CborError cbor_value_to_json(FILE *out, const CborValue *value, int flags) │ │ │ │ +Converts the current CBOR type pointed to by value to JSON and writes that to │ │ │ │ +the out stream. │ │ │ │ +DDeeffiinniittiioonn cborjson.h:51 │ │ │ │ +_c_b_o_r___v_a_l_u_e___t_o___j_s_o_n___a_d_v_a_n_c_e │ │ │ │ +CBOR_API CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int │ │ │ │ +flags) │ │ │ │ +Converts the current CBOR type pointed to by value to JSON and writes that to │ │ │ │ +the out stream. │ │ │ │ +DDeeffiinniittiioonn cbortojson.c:786 │ │ │ │ _C_b_o_r_V_a_l_u_e │ │ │ │ This type contains one value parsed from the CBOR stream. │ │ │ │ DDeeffiinniittiioonn cbor.h:341 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libtinycbor-dev/html/a00053.html │ │ │ @@ -368,15 +368,15 @@ │ │ │

    Copies the string pointed by value into the buffer provided at buffer of buflen bytes.

    │ │ │

    If buffer is a NULL pointer, this function will not copy anything and will only update the next value.

    │ │ │

    If the iterator value does not point to a byte string, the behaviour is undefined, so checking with cbor_value_get_type or cbor_value_is_byte_string is recommended.

    │ │ │

    If the provided buffer length was too small, this function returns an error condition of CborErrorOutOfMemory. If you need to calculate the length of the string in order to preallocate a buffer, use cbor_value_calculate_string_length().

    │ │ │

    On success, this function sets the number of bytes copied to *buflen. If the buffer is large enough, this function will insert a null byte after the last copied byte, to facilitate manipulation of null-terminated strings. That byte is not included in the returned value of *buflen.

    │ │ │

    The next pointer, if not null, will be updated to point to the next item after this string. If value points to the last item, then next will be invalid.

    │ │ │

    This function may not run in constant time (it will run in O(n) time on the number of chunks). It requires constant memory (O(1)).

    │ │ │ -
    See also
    cbor_value_get_byte_string_chunk(), cbor_value_dup_text_string(), cbor_value_copy_text_string(), cbor_value_get_string_length(), cbor_value_calculate_string_length()
    │ │ │ +
    See also
    cbor_value_get_byte_string_chunk(), cbor_value_dup_text_string(), cbor_value_copy_text_string(), cbor_value_get_string_length(), cbor_value_calculate_string_length()
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    ◆ cbor_value_copy_text_string()

    │ │ │ │ │ │
    │ │ │ @@ -409,15 +409,15 @@ │ │ │

    If buffer is a NULL pointer, this function will not copy anything and will only update the next value.

    │ │ │

    If the iterator value does not point to a text string, the behaviour is undefined, so checking with cbor_value_get_type or cbor_value_is_text_string is recommended.

    │ │ │

    If the provided buffer length was too small, this function returns an error condition of CborErrorOutOfMemory. If you need to calculate the length of the string in order to preallocate a buffer, use cbor_value_calculate_string_length().

    │ │ │

    On success, this function sets the number of bytes copied to *buflen. If the buffer is large enough, this function will insert a null byte after the last copied byte, to facilitate manipulation of text strings. That byte is not included in the returned value of *buflen. If there was no space for the terminating null, no error is returned, so callers must check the value of *buflen after the call, before relying on the '\0'; if it has not been changed by the call, there is no '\0'-termination on the buffer's contents.

    │ │ │

    The next pointer, if not null, will be updated to point to the next item after this string. If value points to the last item, then next will be invalid.

    │ │ │

    This function may not run in constant time (it will run in O(n) time on the number of chunks). It requires constant memory (O(1)).

    │ │ │
    Note
    This function does not perform UTF-8 validation on the incoming text string.
    │ │ │ -
    See also
    cbor_value_get_text_string_chunk() cbor_value_dup_text_string(), cbor_value_copy_byte_string(), cbor_value_get_string_length(), cbor_value_calculate_string_length()
    │ │ │ +
    See also
    cbor_value_get_text_string_chunk() cbor_value_dup_text_string(), cbor_value_copy_byte_string(), cbor_value_get_string_length(), cbor_value_calculate_string_length()
    │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │

    ◆ cbor_value_enter_container()

    │ │ │ │ │ │
    │ │ │ @@ -540,17 +540,17 @@ │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │

    Retrieves the CBOR half-precision floating point (16-bit) value that value points to and stores it in result.

    │ │ │

    If the iterator value does not point to a half-precision floating point value, the behavior is undefined, so checking with cbor_value_get_type or with cbor_value_is_half_float is recommended.

    │ │ │

    Note: since the C language does not have a standard type for half-precision floating point, this function takes a void * as a parameter for the storage area, which must be at least 16 bits wide.

    │ │ │ -
    See also
    cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_half_float(), cbor_value_get_half_float_as_float(), cbor_value_get_float()
    │ │ │ +
    See also
    cbor_value_get_type(), cbor_value_is_valid(), cbor_value_is_half_float(), cbor_value_get_half_float_as_float(), cbor_value_get_float()
    │ │ │ │ │ │ -

    Referenced by cbor_value_get_half_float_as_float().

    │ │ │ +

    Referenced by cbor_value_get_half_float_as_float().

    │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │

    ◆ cbor_value_get_int()

    │ │ │ │ │ │
    │ │ │ @@ -852,15 +852,15 @@ │ │ │
    }
    │ │ │
    }
    │ │ │
    CborError cbor_value_get_text_string_chunk(const CborValue *value, const char **bufferptr, size_t *len, CborValue *next)
    Extracts one text string chunk pointed to by value and stores a pointer to the data in buffer and the...
    Definition cbor.h:549
    │ │ │
    bool cbor_value_is_text_string(const CborValue *value)
    Returns true if the iterator value is valid and points to a CBOR text string.
    Definition cbor.h:470
    │ │ │

    If the iterator value does not point to a text string, the behaviour is undefined, so checking with cbor_value_get_type or cbor_value_is_text_string is recommended.

    │ │ │

    The next pointer, if not null, will be updated to point to the next item after this string. During iteration, the pointer must only be passed back again to this function; passing it to any other function in this library results in undefined behavior. If there are no more chunks to be read from value, then next will be set to the next item after this string; if value points to the last item, then next will be invalid.

    │ │ │
    Note
    This function does not perform UTF-8 validation on the incoming text string.
    │ │ │ -
    See also
    cbor_value_dup_text_string(), cbor_value_copy_text_string(), cbor_value_caculate_string_length(), cbor_value_get_byte_string_chunk()
    │ │ │ +
    See also
    cbor_value_dup_text_string(), cbor_value_copy_text_string(), cbor_value_caculate_string_length(), cbor_value_get_byte_string_chunk()
    │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

    ◆ cbor_value_get_type()

    │ │ │ │ │ │
    │ │ │ @@ -966,17 +966,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │

    Returns true if the iterator value is valid and points to a CBOR byte string.

    │ │ │

    CBOR byte strings are binary data with no specified encoding or format.

    │ │ │ -
    See also
    cbor_value_is_valid(), cbor_value_get_string_length(), cbor_value_calculate_string_length(), cbor_value_copy_byte_string(), cbor_value_dup_byte_string()
    │ │ │ +
    See also
    cbor_value_is_valid(), cbor_value_get_string_length(), cbor_value_calculate_string_length(), cbor_value_copy_byte_string(), cbor_value_dup_byte_string()
    │ │ │ │ │ │ -

    Referenced by cbor_value_copy_byte_string(), cbor_value_dup_byte_string(), and cbor_value_get_string_length().

    │ │ │ +

    Referenced by cbor_value_copy_byte_string(), cbor_value_dup_byte_string(), and cbor_value_get_string_length().

    │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │

    ◆ cbor_value_is_double()

    │ │ │ │ │ │
    │ │ │ @@ -1204,17 +1204,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │

    ◆ cbor_value_is_undefined()

    │ │ │ │ │ │
    │ │ ├── ./usr/share/doc/libtinycbor-dev/html/a00054.html │ │ │ @@ -108,17 +108,17 @@ │ │ │
    │ │ │ │ │ │

    Converts the current CBOR type pointed by value to its textual representation and writes it to the stream by calling the streamFunction.

    │ │ │

    If an error occurs, this function returns an error code similar to Parsing CBOR streams.

    │ │ │

    The textual representation can be controlled by the flags parameter (see CborPrettyFlags for more information).

    │ │ │

    If no error ocurred, this function advances value to the next element. Often, concatenating the text representation of multiple elements can be done by appending a comma to the output stream in between calls to this function.

    │ │ │

    The streamFunction function will be called with the token value as the first parameter and a printf-style format string as the second, with a variable number of further parameters.

    │ │ │ -
    See also
    cbor_value_to_pretty(), cbor_value_to_json_advance()
    │ │ │ +
    See also
    cbor_value_to_pretty(), cbor_value_to_json_advance()
    │ │ │ │ │ │ -

    Referenced by cbor_value_to_pretty_advance(), and cbor_value_to_pretty_advance_flags().

    │ │ │ +

    Referenced by cbor_value_to_pretty_advance(), and cbor_value_to_pretty_advance_flags().

    │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │ │ │ │