libcbor/libcbor.3

5849 lines
221 KiB
Groff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "LIBCBOR" "3" "Jan 16, 2023" "0.10" "libcbor"
.SH NAME
libcbor \- libcbor Documentation
.sp
Documentation for version 0.10.1, updated on Jan 16, 2023\&.
.SH OVERVIEW
.sp
\fIlibcbor\fP is a C library for parsing and generating \fI\%CBOR\fP, the general\-purpose schema\-less binary data format.
.INDENT 0.0
.TP
.B Main features
.INDENT 7.0
.IP \(bu 2
Complete RFC conformance [1]
.IP \(bu 2
Robust C99 implementation
.IP \(bu 2
Layered architecture offers both control and convenience
.IP \(bu 2
Flexible memory management
.IP \(bu 2
No shared global state \- threading friendly [2]
.IP \(bu 2
Proper handling of UTF\-8
.IP \(bu 2
Full support for streams & incremental processing
.IP \(bu 2
Extensive documentation and test suite
.IP \(bu 2
No runtime dependencies, small footprint
.UNINDENT
.UNINDENT
.IP [1] 5
See \fI\%RFC conformance\fP
.IP [2] 5
With the exception of custom memory allocators (see \fI\%Memory management and reference counting\fP)
.SH CONTENTS
.SS Getting started
.sp
Pre\-built Linux packages are available in most mainstream distributions
.sp
\fBUbuntu, Debian, etc.\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
apt\-get install libcbor\-dev
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBFedora, openSUSE, etc.\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
yum install libcbor\-devel
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBOS X\fP users can use \fI\%Homebrew\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
brew install libcbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
For other platforms, you will need to compile it from source.
.SS Building & installing libcbor
.INDENT 0.0
.TP
.B Prerequisites:
.INDENT 7.0
.IP \(bu 2
C99 compiler
.IP \(bu 2
\fI\%CMake\fP 2.8 or newer (might also be called \fBcmakesetup\fP, \fBcmake\-gui\fP or \fBccmake\fP depending on the installed version and system)
.IP \(bu 2
C build system CMake can target (make, Apple Xcode, MinGW, ...)
.UNINDENT
.UNINDENT
.sp
\fBConfiguration options\fP
.sp
A handful of configuration flags can be passed to \fIcmake\fP\&. The following table lists libcbor compile\-time directives and several important generic flags.
.TS
center;
|l|l|l|l|.
_
T{
Option
T} T{
Meaning
T} T{
Default
T} T{
Possible values
T}
_
T{
\fBCMAKE_C_COMPILER\fP
T} T{
C compiler to use
T} T{
\fBcc\fP
T} T{
\fBgcc\fP, \fBclang\fP, \fBclang\-3.5\fP, ...
T}
_
T{
\fBCMAKE_INSTALL_PREFIX\fP
T} T{
Installation prefix
T} T{
System\-dependent
T} T{
\fB/usr/local/lib\fP, ...
T}
_
T{
\fBBUILD_SHARED_LIBS\fP
T} T{
Build as a shared library
T} T{
\fBOFF\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
T{
\fBHUGE_FUZZ\fP
T} T{
\fI\%Fuzz test\fP with 8GB of data
T} T{
\fBOFF\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
T{
\fBSANE_MALLOC\fP
T} T{
Assume \fBmalloc\fP will refuse unreasonable allocations
T} T{
\fBOFF\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
T{
\fBCOVERAGE\fP
T} T{
Generate test coverage instrumentation
T} T{
\fBOFF\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
T{
\fBWITH_TESTS\fP
T} T{
Build unit tests (see \fI\%Development\fP)
T} T{
\fBOFF\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
.TE
.sp
The following configuration options will also be defined as macros [1] in \fB<cbor/common.h>\fP and can therefore be used in client code:
.TS
center;
|l|l|l|l|.
_
T{
Option
T} T{
Meaning
T} T{
Default
T} T{
Possible values
T}
_
T{
\fBCBOR_PRETTY_PRINTER\fP
T} T{
Include a pretty\-printing routine
T} T{
\fBON\fP
T} T{
\fBON\fP, \fBOFF\fP
T}
_
T{
\fBCBOR_BUFFER_GROWTH\fP
T} T{
Factor for buffer growth & shrinking
T} T{
\fB2\fP
T} T{
Decimals > 1
T}
_
.TE
.IP [1] 5
\fBON\fP & \fBOFF\fP will be translated to \fB1\fP and \fB0\fP using \fI\%cmakedefine\fP\&.
.sp
If you want to pass other custom configuration options, please refer to \fI\%http://www.cmake.org/Wiki/CMake_Useful_Variables\fP\&.
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
\fBCBOR_CUSTOM_ALLOC\fP has been \fI\%removed\fP\&.
Custom allocators (historically a controlled by a build flag) are always enabled.
.UNINDENT
.UNINDENT
.sp
\fBBuilding using make\fP
.sp
CMake will generate a Makefile and other configuration files for the build. As a rule of thumb, you should configure the
build \fIoutside of the source tree\fP in order to keep different configurations isolated. If you are unsure where to
execute the build, just use a temporary directory:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cd $(mktemp \-d /tmp/cbor_build.XXXX)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Now, assuming you are in the directory where you want to build, build libcbor as a \fBstatic library\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cmake \-DCMAKE_BUILD_TYPE=Release path_to_libcbor_dir
make cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\&... or as a \fBdynamic library\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cmake \-DCMAKE_BUILD_TYPE=Release \-DBUILD_SHARED_LIBS=ON path_to_libcbor_dir
make cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
To install locally:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
make install
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Root permissions are required on most systems when using the default installation prefix.
.sp
\fBPortability\fP
.sp
libcbor is highly portable and works on both little\- and big\-endian systems regardless of the operating system. After building
on an exotic platform, you might wish to verify the result by running the \fI\%test suite\fP\&. If you encounter any problems, please
report them to the \fI\%issue tracker\fP\&.
.sp
libcbor is known to successfully work on ARM Android devices. Cross\-compilation is possible with \fBarm\-linux\-gnueabi\-gcc\fP\&.
.SS Linking with libcbor
.sp
If you include and linker paths include the directories to which libcbor has been installed, compiling programs that uses libcbor requires
no extra considerations.
.sp
You can verify that everything has been set up properly by creating a file with the following contents
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include <cbor.h>
#include <stdio.h>
int main(int argc, char * argv[])
{
printf(\(dqHello from libcbor %s\en\(dq, CBOR_VERSION);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
and compiling it
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cc hello_cbor.c \-lcbor \-o hello_cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
libcbor also comes with \fI\%pkg\-config\fP support. If you install libcbor with a custom prefix, you can use pkg\-config to resolve the headers and objects:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cc $(pkg\-config \-\-cflags libcbor) hello_cbor.c $(pkg\-config \-\-libs libcbor) \-o hello_cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBA note on linkage\fP
.sp
libcbor is primarily intended to be linked statically. The shared library versioning scheme generally follows \fI\%SemVer\fP, but is irregular for the 0.X.Y development branch for historical reasons. The following version identifiers are used as a part of the SONAME (Linux) or the dylib \fI\%\(dqCompatibility version\(dq\fP (OS X):
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
0.Y for the 0.Y.Z branch. Patches are backwards compatible, minor releases are generally not and require re\-compilation of any dependent code.
.IP \(bu 2
X for the X.Y.Z stable versions starting 1.X.Y. All minor release of the major version are backwards compatible.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
Please note that releases up to and including v0.6.0 \fI\%may export misleading .so/.dylib version number\fP\&.
.UNINDENT
.UNINDENT
.SS Troubleshooting
.sp
\fBcbor.h not found\fP: The headers directory is probably not in your include path. First, verify the installation
location by checking the installation log. If you used make, it will look something like
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
\&...
\-\- Installing: /usr/local/include/cbor
\-\- Installing: /usr/local/include/cbor/callbacks.h
\-\- Installing: /usr/local/include/cbor/encoding.h
\&...
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Make sure that \fBCMAKE_INSTALL_PREFIX\fP (if you provided it) was correct. Including the path path during compilation should suffice, e.g.:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cc \-I/usr/local/include hello_cbor.c \-lcbor \-o hello_cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBcannot find \-lcbor during linking\fP: Most likely the same problem as before. Include the installation directory in the
linker shared path using \fB\-R\fP, e.g.:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cc \-Wl,\-rpath,/usr/local/lib \-lcbor \-o hello_cbor
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBshared library missing during execution\fP: Verify the linkage using \fBldd\fP, \fBotool\fP, or similar and adjust the compilation directives accordingly:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
⇒ ldd hello_cbor
linux\-vdso.so.1 => (0x00007ffe85585000)
libcbor.so => /usr/local/lib/libcbor.so (0x00007f9af69da000)
libc.so.6 => /lib/x86_64\-linux\-gnu/libc.so.6 (0x00007f9af65eb000)
/lib64/ld\-linux\-x86\-64.so.2 (0x00007f9af6be9000)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBcompilation failed\fP: If your compiler supports C99 yet the compilation has failed, please report the issue to the \fI\%issue tracker\fP\&.
.SS Usage & preliminaries
.SS Version information
.sp
libcbor exports its version using three self\-explanatory macros:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fBCBOR_MAJOR_VERSION\fP
.IP \(bu 2
\fBCBOR_MINOR_VERSION\fP
.IP \(bu 2
\fBCBOR_PATCH_VERSION\fP
.UNINDENT
.UNINDENT
.UNINDENT
.sp
The \fBCBOR_VERSION\fP is a string concatenating these three identifiers into one (e.g. \fB0.2.0\fP).
.sp
In order to simplify version comparisons, the version is also exported as
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#define CBOR_HEX_VERSION ((CBOR_MAJOR_VERSION << 16) | (CBOR_MINOR_VERSION << 8) | CBOR_PATCH_VERSION)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Since macros are difficult to work with through FFIs, the same information is also available through three \fBuint8_t\fP constants,
namely
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fBcbor_major_version\fP
.IP \(bu 2
\fBcbor_minor_version\fP
.IP \(bu 2
\fBcbor_patch_version\fP
.UNINDENT
.UNINDENT
.UNINDENT
.SS Headers to include
.sp
The \fBcbor.h\fP header includes all the symbols. If, for any reason, you don\(aqt want to include all the exported symbols,
feel free to use just some of the \fBcbor/*.h\fP headers:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fBcbor/arrays.h\fP \- \fI\%Type 4 Arrays\fP
.IP \(bu 2
\fBcbor/bytestrings.h\fP \- \fI\%Type 2 Byte strings\fP
.IP \(bu 2
\fBcbor/callbacks.h\fP \- Callbacks used for \fI\%Streaming Decoding\fP
.IP \(bu 2
\fBcbor/common.h\fP \- Common utilities \- always transitively included
.IP \(bu 2
\fBcbor/data.h\fP \- Data types definitions \- always transitively included
.IP \(bu 2
\fBcbor/encoding.h\fP \- Streaming encoders for \fI\%Streaming Encoding\fP
.IP \(bu 2
\fBcbor/floats_ctrls.h\fP \- \fI\%Type 7 Floats & control tokens\fP
.IP \(bu 2
\fBcbor/ints.h\fP \- \fI\%Types 0 & 1 Positive and negative integers\fP
.IP \(bu 2
\fBcbor/maps.h\fP \- \fI\%Type 5 Maps\fP
.IP \(bu 2
\fBcbor/serialization.h\fP \- High level serialization such as \fBcbor_serialize()\fP
.IP \(bu 2
\fBcbor/streaming.h\fP \- Home of \fBcbor_stream_decode()\fP
.IP \(bu 2
\fBcbor/strings.h\fP \- \fI\%Type 3 UTF\-8 strings\fP
.IP \(bu 2
\fBcbor/tags.h\fP \- \fI\%Type 6 Semantic tags\fP
.UNINDENT
.UNINDENT
.UNINDENT
.SS Using libcbor
.sp
If you want to get more familiar with CBOR, we recommend the \fI\%cbor.io\fP website. Once you get the grasp
of what is it CBOR does, the examples (located in the \fBexamples\fP directory) should give you a good feel of the API. The
\fI\%API documentation\fP should then provide with all the information you may need.
.sp
\fBCreating and serializing items\fP
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include \(dqcbor.h\(dq
#include <stdio.h>
int main(int argc, char * argv[])
{
/* Preallocate the map structure */
cbor_item_t * root = cbor_new_definite_map(2);
/* Add the content */
cbor_map_add(root, (struct cbor_pair) {
.key = cbor_move(cbor_build_string(\(dqIs CBOR awesome?\(dq)),
.value = cbor_move(cbor_build_bool(true))
});
cbor_map_add(root, (struct cbor_pair) {
.key = cbor_move(cbor_build_uint8(42)),
.value = cbor_move(cbor_build_string(\(dqIs the answer\(dq))
});
/* Output: \(gabuffer_size\(ga bytes of data in the \(gabuffer\(ga */
unsigned char * buffer;
size_t buffer_size;
cbor_serialize_alloc(root, &buffer, &buffer_size);
fwrite(buffer, 1, buffer_size, stdout);
free(buffer);
fflush(stdout);
cbor_decref(&root);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBReading serialized data\fP
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include \(dqcbor.h\(dq
#include <stdio.h>
/*
* Reads data from a file. Example usage:
* $ ./examples/readfile examples/data/nested_array.cbor
*/
int main(int argc, char * argv[])
{
FILE * f = fopen(argv[1], \(dqrb\(dq);
fseek(f, 0, SEEK_END);
size_t length = (size_t)ftell(f);
fseek(f, 0, SEEK_SET);
unsigned char * buffer = malloc(length);
fread(buffer, length, 1, f);
/* Assuming \(gabuffer\(ga contains \(gainfo.st_size\(ga bytes of input data */
struct cbor_load_result result;
cbor_item_t * item = cbor_load(buffer, length, &result);
/* Pretty\-print the result */
cbor_describe(item, stdout);
fflush(stdout);
/* Deallocate the result */
cbor_decref(&item);
fclose(f);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBUsing the streaming parser\fP
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include \(dqcbor.h\(dq
#include <stdio.h>
#include <string.h>
/*
* Illustrates how one might skim through a map (which is assumed to have
* string keys and values only), looking for the value of a specific key
*
* Use the examples/data/map.cbor input to test this.
*/
const char * key = \(dqa secret key\(dq;
bool key_found = false;
void find_string(void * _ctx, cbor_data buffer, size_t len)
{
if (key_found) {
printf(\(dqFound the value: %*s\en\(dq, (int) len, buffer);
key_found = false;
} else if (len == strlen(key)) {
key_found = (memcmp(key, buffer, len) == 0);
}
}
int main(int argc, char * argv[])
{
FILE * f = fopen(argv[1], \(dqrb\(dq);
fseek(f, 0, SEEK_END);
size_t length = (size_t)ftell(f);
fseek(f, 0, SEEK_SET);
unsigned char * buffer = malloc(length);
fread(buffer, length, 1, f);
struct cbor_callbacks callbacks = cbor_empty_callbacks;
struct cbor_decoder_result decode_result;
size_t bytes_read = 0;
callbacks.string = find_string;
while (bytes_read < length) {
decode_result = cbor_stream_decode(buffer + bytes_read,
length \- bytes_read,
&callbacks, NULL);
bytes_read += decode_result.read;
}
fclose(f);
}
.ft P
.fi
.UNINDENT
.UNINDENT
.SS API
.sp
The data API is centered around \fI\%cbor_item_t\fP, a generic handle for any CBOR item. There are functions to
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
create items,
.IP \(bu 2
set items\(aq data,
.IP \(bu 2
parse serialized data into items,
.IP \(bu 2
manage, move, and links item together.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
The single most important thing to keep in mind is: \fI\%cbor_item_t\fP \fBis an opaque type and should only be manipulated using the appropriate functions!\fP Think of it as an object.
.sp
The \fIlibcbor\fP API closely follows the semantics outlined by \fI\%CBOR standard\fP\&. This part of the documentation provides a short overview of the CBOR constructs, as well as a general introduction to the \fIlibcbor\fP API. Remaining reference can be found in the following files structured by data types.
.sp
The API is designed to allow both very tight control & flexibility and general convenience with sane defaults. [1] For example, client with very specific requirements (constrained environment, custom application protocol built on top of CBOR, etc.) may choose to take full control (and responsibility) of memory and data structures management by interacting directly with the decoder. Other clients might want to take control of specific aspects (streamed collections, hash maps storage), but leave other responsibilities to \fIlibcbor\fP\&. More general clients might prefer to be abstracted away from all aforementioned details and only be presented complete data structures.
.INDENT 0.0
.TP
.B \fIlibcbor\fP provides
.INDENT 7.0
.IP \(bu 2
stateless encoders and decoders
.IP \(bu 2
encoding and decoding \fIdrivers\fP, routines that coordinate encoding and decoding of complex structures
.IP \(bu 2
data structures to represent and transform CBOR structures
.IP \(bu 2
routines for building and manipulating these structures
.IP \(bu 2
utilities for inspection and debugging
.UNINDENT
.UNINDENT
.SS Types of items
.sp
Every \fI\%cbor_item_t\fP has a \fI\%cbor_type\fP associated with it \- these constants correspond to the types specified by the \fI\%CBOR standard\fP:
.INDENT 0.0
.TP
.B enum cbor_type
Specifies the Major type of cbor_item_t\&.
.sp
\fIValues:\fP
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_UINT
0 \- positive integers
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_NEGINT
1 \- negative integers
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_BYTESTRING
2 \- byte strings
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_STRING
3 \- strings
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_ARRAY
4 \- arrays
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_MAP
5 \- maps
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_TAG
6 \- tags
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_TYPE_FLOAT_CTRL
7 \- decimals and special values (true, false, nil, ...)
.UNINDENT
.UNINDENT
.sp
To find out the type of an item, one can use
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_typeof\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_type cbor_typeof (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 26]
_CBOR_NODISCARD cbor_type cbor_typeof (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 26]
_CBOR_NODISCARD cbor_type cbor_typeof (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
Please note the distinction between functions like \fBcbor_isa_uint()\fP and \fBcbor_is_int()\fP\&. The following functions work solely with the major type value.
.SS Binary queries
.sp
Alternatively, there are functions to query each particular type.
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
Passing an invalid \fI\%cbor_item_t\fP reference to any of these functions results in undefined behavior.
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_uint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_uint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_uint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_uint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_negint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_negint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_negint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_negint (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_bytestring\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_bytestring (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_bytestring (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_bytestring (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_string\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_string (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_string (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_string (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_array\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_array (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_array (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_array (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_map\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_map (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_map (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_map (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_tag\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_tag (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_tag (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_tag (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_isa_float_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_isa_float_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_float_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_isa_float_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Logical queries
.sp
These functions provide information about the item type from a more high\-level perspective
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_is_int\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_is_int (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_int (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_int (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_is_float\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_is_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_is_bool\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_is_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_is_null\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_is_null (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_null (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_null (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_is_undef\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_is_undef (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_undef (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_is_undef (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Memory management and reference counting
.sp
Due to the nature of its domain, \fIlibcbor\fP will need to work with heap memory. The stateless decoder and encoder doesn\(aqt allocate any memory.
.sp
If you have specific requirements, you should consider rolling your own driver for the stateless API.
.SS Using custom allocator
.sp
\fIlibcbor\fP gives you with the ability to provide your own implementations of \fBmalloc\fP, \fBrealloc\fP, and \fBfree\fP\&.
This can be useful if you are using a custom allocator throughout your application,
or if you want to implement custom policies (e.g. tighter restrictions on the amount of allocated memory).
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cbor_set_allocs(malloc, realloc, free);
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_allocs(_cbor_malloc_t custom_malloc, _cbor_realloc_t custom_realloc, _cbor_free_t custom_free)
Sets the memory management routines to use.
.sp
\fBNOTE:\fP
.INDENT 7.0
.INDENT 3.5
\fIrealloc\fP implementation must correctly support \fINULL\fP reallocation
(see e.g. \fI\%http://en.cppreference.com/w/c/memory/realloc\fP)
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 7.0
.INDENT 3.5
This function modifies the global state and should therefore be
used accordingly. Changing the memory handlers while allocated items exist
will result in a \fBfree\fP/\fBmalloc\fP mismatch. This function is not thread
safe with respect to both itself and all the other \fIlibcbor\fP functions that
work with the heap.
.UNINDENT
.UNINDENT
.INDENT 7.0
.TP
.B param custom_malloc
malloc implementation
.TP
.B param custom_realloc
realloc implementation
.TP
.B param custom_free
free implementation
.UNINDENT
.UNINDENT
.SS Reference counting
.sp
As CBOR items may require complex cleanups at the end of their lifetime, there is a reference counting mechanism in place. This also enables a very simple GC when integrating \fIlibcbor\fP into a managed environment. Every item starts its life (by either explicit creation, or as a result of parsing) with reference count set to 1. When the refcount reaches zero, it will be destroyed.
.sp
Items containing nested items will be destroyed recursively \- the refcount of every nested item will be decreased by one.
.sp
The destruction is synchronous and renders any pointers to items with refcount zero invalid immediately after calling \fI\%cbor_decref()\fP\&.
.INDENT 0.0
.TP
.B \fI\%cbor_item_t\fP *cbor_incref(\fI\%cbor_item_t\fP *item)
Increases the reference count by one.
.sp
No dependent items are affected.
.INDENT 7.0
.TP
.B param item[incref]
item the item
.TP
.B return
the input reference
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_decref(\fI\%cbor_item_t\fP **item)
Decreases the reference count by one, deallocating the item if needed.
.sp
In case the item is deallocated, the reference count of any dependent items is adjusted accordingly in a recursive manner.
.INDENT 7.0
.TP
.B param item[take]
the item. Set to \fBNULL\fP if deallocated
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_intermediate_decref(\fI\%cbor_item_t\fP *item)
Decreases the reference count by one, deallocating the item if needed.
.sp
Convenience wrapper for \fI\%cbor_decref\fP when its set\-to\-null behavior is not needed
.INDENT 7.0
.TP
.B param item[take]
the item
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_refcount\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_refcount (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_refcount (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_refcount (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_move\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_move (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_move (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_move (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_copy\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_copy (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_copy (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_copy (cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Decoding
.sp
The following diagram illustrates the relationship among different parts of libcbor from the decoding standpoint.
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ Client application │
│ │
│ ┌────────────────────────────────────────────┘
│ │ ↕
│ │ ┌──────────────────────────────────────────┐
│ │ │ │
│ │ │ Manipulation routines │
│ │ │ │
│ ┌─────────────────────────────────────┘ └──────────────────────────────────────────┘
│ │ ↑ ↑ ↑ ↑
│ │ │ │ ┌─────────────╫──────────┬───────────────────┴─┐
│ │ │ CDS │ ║ │ │
│ │ │ │ PDS ║ PDS PDS
│ │ ↓ ↓ ↓ ↓ ↓ ↓
│ │ ┌─────────────────┐ ┌────────────────────┐ ┌────────────────────────────┐
│ │ │ │ │ │ │ │
│ │ │ Custom driver │ ↔ │ Streaming driver │ ↔ │ Default driver │ ↔ CD
│ │ │ │ │ │ │ │
└───────────┘ └─────────────────┘ └────────────────────┘ └────────────────────────────┘
↕ ↕ ↕ ↕
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ Stateless event─driven decoder │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────┘
(PSD = Provided Data Structures, CDS = Custom Data Structures)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
This section will deal with the API that is labeled as the \(dqDefault driver\(dq in the diagram. That is, routines that
decode complete libcbor data items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_load\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_load (cbor_data source, size_t source_size, struct cbor_load_result *result)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_load (cbor_data source, size_t source_size, struct cbor_load_result *result)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_load (cbor_data source, size_t source_size, struct cbor_load_result *result)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Associated data structures
.INDENT 0.0
.TP
.B enum cbor_error_code
Possible decoding errors.
.sp
\fIValues:\fP
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_NONE
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_NOTENOUGHDATA
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_NODATA
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_MALFORMATED
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_MEMERROR
Memory error \- item allocation failed.
.sp
Is it too big for your allocator?
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_ERR_SYNTAXERROR
Stack parsing algorithm failed.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B struct cbor_load_result
High\-level decoding result.
.sp
Public Members
.INDENT 7.0
.TP
.B struct \fI\%cbor_error\fP error
Error indicator.
.UNINDENT
.INDENT 7.0
.TP
.B size_t read
Number of bytes read.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B struct cbor_error
High\-level decoding error.
.sp
Public Members
.INDENT 7.0
.TP
.B size_t position
Approximate position.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_error_code\fP code
Description.
.UNINDENT
.UNINDENT
.SS Encoding
.sp
The easiest way to encode data items is using the \fBcbor_serialize()\fP or \fI\%cbor_serialize_alloc()\fP functions:
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B size_t cbor_serialize_alloc(const \fI\%cbor_item_t\fP *item, cbor_mutable_data *buffer, size_t *buffer_size)
Serialize the given item, allocating buffers as needed.
.sp
Since libcbor v0.10, the return value is always the same as \fBbuffer_size\fP (if provided, see \fI\%https://github.com/PJK/libcbor/pull/251/\fP). New clients should ignore the return value.
.sp
\fBWARNING:\fP
.INDENT 7.0
.INDENT 3.5
It is the caller\(aqs responsibility to free the buffer using an
appropriate \fBfree\fP implementation.
.UNINDENT
.UNINDENT
.INDENT 7.0
.TP
.B param item[borrow]
A data item
.TP
.B param buffer[out]
Buffer containing the result
.TP
.B param buffer_size[out]
Size of the \fBbuffer\fP, or \fBNULL\fP
.TP
.B return
Length of the result. 0 on failure, in which case \fBbuffer\fP is \fBNULL\fP\&.
.UNINDENT
.UNINDENT
.sp
To determine the number of bytes needed to serialize an item, use \fBcbor_serialized_size()\fP:
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialized_size\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialized_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialized_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialized_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type\-specific serializers
.sp
In case you know the type of the item you want to serialize beforehand, you can use one
of the type\-specific serializers.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
Unless compiled in debug mode, these do not verify the type. Passing an incorrect item will result in an undefined behavior.
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_uint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_uint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_uint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_uint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_negint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_negint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_negint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_negint (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_bytestring\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_bytestring (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_bytestring (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_bytestring (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_string\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_string (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_string (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_string (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_array\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_array (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_array (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_array (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_map\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_map (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_map (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_map (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_tag\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_tag (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_tag (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_tag (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_serialize_float_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_serialize_float_ctrl (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_float_ctrl (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_serialize_float_ctrl (const cbor_item_t *, cbor_mutable_data, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Streaming Decoding
.sp
\fIlibcbor\fP exposes a stateless decoder that reads a stream of input bytes from a buffer and invokes user\-provided callbacks as it decodes the input:
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_stream_decode\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD struct cbor_decoder_result cbor_stream_decode (cbor_data source, size_t source_size, const struct cbor_callbacks *callbacks, void *context)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: struct [error at 22]
_CBOR_NODISCARD struct cbor_decoder_result cbor_stream_decode (cbor_data source, size_t source_size, const struct cbor_callbacks *callbacks, void *context)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: struct [error at 22]
_CBOR_NODISCARD struct cbor_decoder_result cbor_stream_decode (cbor_data source, size_t source_size, const struct cbor_callbacks *callbacks, void *context)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
For example, when \fBcbor_stream_decode()\fP encounters a 1B unsigned integer, it will invoke the function pointer stored in \fBcbor_callbacks.uint8\fP\&.
Complete usage example: \fI\%examples/streaming_parser.c\fP
.sp
The callbacks are defined by
.INDENT 0.0
.TP
.B struct cbor_callbacks
Callback bundle &#8212; passed to the decoder.
.sp
Public Members
.INDENT 7.0
.TP
.B \fI\%cbor_int8_callback\fP uint8
Unsigned int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int16_callback\fP uint16
Unsigned int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int32_callback\fP uint32
Unsigned int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int64_callback\fP uint64
Unsigned int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int64_callback\fP negint64
Negative int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int32_callback\fP negint32
Negative int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int16_callback\fP negint16
Negative int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int8_callback\fP negint8
Negative int.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP byte_string_start
Definite byte string.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_string_callback\fP byte_string
Indefinite byte string start.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_string_callback\fP string
Definite string.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP string_start
Indefinite string start.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP indef_array_start
Definite array.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_collection_callback\fP array_start
Indefinite array.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP indef_map_start
Definite map.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_collection_callback\fP map_start
Indefinite map.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_int64_callback\fP tag
Tags.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_float_callback\fP float2
Half float.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_float_callback\fP float4
Single float.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_double_callback\fP float8
Double float.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP undefined
Undef.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP null
Null.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_bool_callback\fP boolean
Bool.
.UNINDENT
.INDENT 7.0
.TP
.B \fI\%cbor_simple_callback\fP indef_break
Indefinite item break.
.UNINDENT
.UNINDENT
.sp
When building custom sets of callbacks, feel free to start from
.INDENT 0.0
.TP
.B const struct \fI\%cbor_callbacks\fP cbor_empty_callbacks
Dummy callback bundle \- does nothing.
.UNINDENT
.SS Callback types definition
.INDENT 0.0
.TP
.B typedef void (*cbor_int8_callback)(void*, uint8_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_int16_callback)(void*, uint16_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_int32_callback)(void*, uint32_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_int64_callback)(void*, uint64_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_simple_callback)(void*)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_string_callback)(void*, cbor_data, uint64_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_collection_callback)(void*, uint64_t)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_float_callback)(void*, float)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_double_callback)(void*, double)
Callback prototype.
.UNINDENT
.INDENT 0.0
.TP
.B typedef void (*cbor_bool_callback)(void*, bool)
Callback prototype.
.UNINDENT
.SS Streaming Encoding
.sp
\fI\%cbor/encoding.h\fP
exposes a low\-level encoding API to encode CBOR objects on the fly. Unlike
\fBcbor_serialize()\fP, these functions take logical values (integers, floats,
strings, etc.) instead of \fI\%cbor_item_t\fP\&. The client is responsible for
constructing the compound types correctly (e.g. terminating arrays).
.sp
Streaming encoding is typically used to create an streaming (indefinite length) CBOR \fI\%strings\fP, \fI\%byte strings\fP, \fI\%arrays\fP, and \fI\%maps\fP\&. Complete example: \fI\%examples/streaming_array.c\fP
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_uint8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_uint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_uint16\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_uint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_uint32\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_uint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_uint64\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_uint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_uint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_uint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_uint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_negint8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_negint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint8 (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_negint16\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_negint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint16 (uint16_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_negint32\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_negint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint32 (uint32_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_negint64\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_negint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint64 (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_negint\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_negint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_negint (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_bytestring_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_bytestring_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_bytestring_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_bytestring_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_indef_bytestring_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_indef_bytestring_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_bytestring_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_bytestring_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_string_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_string_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_string_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_string_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_indef_string_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_indef_string_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_string_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_string_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_array_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_array_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_array_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_array_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_indef_array_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_indef_array_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_array_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_array_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_map_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_map_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_map_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_map_start (size_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_indef_map_start\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_indef_map_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_map_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_indef_map_start (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_tag\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_tag (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_tag (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_tag (uint64_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_bool\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_bool (bool, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_bool (bool, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_bool (bool, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_null\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_null (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_null (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_null (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_undef\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_undef (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_undef (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_undef (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_half\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_half (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_half (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_half (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_single\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_single (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_single (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_single (float, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_double\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_double (double, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_double (double, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_double (double, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_break\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_break (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_break (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_break (unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_encode_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_encode_ctrl (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_encode_ctrl (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_encode_ctrl (uint8_t, unsigned char *, size_t)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Types 0 & 1 Positive and negative integers
.sp
\fICBOR\fP has two types of integers positive (which may be effectively regarded as unsigned), and negative. There are four possible widths for an integer 1, 2, 4, or 8 bytes. These are represented by
.INDENT 0.0
.TP
.B enum cbor_int_width
Possible widths of \fI\%CBOR_TYPE_UINT\fP items.
.sp
\fIValues:\fP
.INDENT 7.0
.TP
.B enumerator CBOR_INT_8
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_INT_16
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_INT_32
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_INT_64
.UNINDENT
.UNINDENT
.SS Type 0 \- positive integers
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_UINT\fP
T}
_
T{
Number of allocations
T} T{
One per lifetime
T}
_
T{
Storage requirements
T} T{
\fBsizeof(cbor_item_t) + sizeof(uint*_t)\fP
T}
_
.TE
.sp
\fBNote:\fP once a positive integer has been created, its width \fIcannot\fP be changed.
.SS Type 1 \- negative integers
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_NEGINT\fP
T}
_
T{
Number of allocations
T} T{
One per lifetime
T}
_
T{
Storage requirements
T} T{
\fBsizeof(cbor_item_t) + sizeof(uint*_t)\fP
T}
_
.TE
.sp
\fBNote:\fP once a positive integer has been created, its width \fIcannot\fP be changed.
.SS Type 0 & 1
.sp
Due to their largely similar semantics, the following functions can be used for both Type 0 and Type 1 items. One can convert between them freely using \fI\%the conversion functions\fP\&.
.sp
Actual Type of the integer can be checked using \fI\%item types API\fP\&.
.sp
An integer item is created with one of the four widths. Because integers\(aq \fI\%storage is bundled together with the handle\fP, the width cannot be changed over its lifetime.
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
Due to the fact that CBOR negative integers represent integers in the range [\-1, \-2^N], \fBcbor_set_uint\fP API is somewhat counter\-intuitive as the resulting logical value is 1 less. This behavior is necessary in order to permit uniform manipulation with the full range of permitted values. For example, the following snippet
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cbor_item_t * item = cbor_new_int8();
cbor_mark_negint(item);
cbor_set_uint8(0);
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
will produce an item with the logical value of \-1\&. There is, however, an upside to this as well: There is only one representation of zero.
.UNINDENT
.UNINDENT
.SS Building new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_uint8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint8 (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint8 (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint8 (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_uint16\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint16 (uint16_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint16 (uint16_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint16 (uint16_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_uint32\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint32 (uint32_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint32 (uint32_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint32 (uint32_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_uint64\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint64 (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint64 (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_uint64 (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Retrieving values
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_get_uint8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint8_t cbor_get_uint8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 24]
_CBOR_NODISCARD uint8_t cbor_get_uint8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 24]
_CBOR_NODISCARD uint8_t cbor_get_uint8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_get_uint16\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint16_t cbor_get_uint16 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 25]
_CBOR_NODISCARD uint16_t cbor_get_uint16 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 25]
_CBOR_NODISCARD uint16_t cbor_get_uint16 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_get_uint32\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint32_t cbor_get_uint32 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 25]
_CBOR_NODISCARD uint32_t cbor_get_uint32 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 25]
_CBOR_NODISCARD uint32_t cbor_get_uint32 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_get_uint64\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint64_t cbor_get_uint64 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 25]
_CBOR_NODISCARD uint64_t cbor_get_uint64 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 25]
_CBOR_NODISCARD uint64_t cbor_get_uint64 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Setting values
.INDENT 0.0
.TP
.B void cbor_set_uint8(\fI\%cbor_item_t\fP *item, uint8_t value)
Assigns the integer value.
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.TP
.B param value
the value to assign. For negative integer, the logical value is \fB\-value \- 1\fP
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_uint16(\fI\%cbor_item_t\fP *item, uint16_t value)
Assigns the integer value.
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.TP
.B param value
the value to assign. For negative integer, the logical value is \fB\-value \- 1\fP
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_uint32(\fI\%cbor_item_t\fP *item, uint32_t value)
Assigns the integer value.
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.TP
.B param value
the value to assign. For negative integer, the logical value is \fB\-value \- 1\fP
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_uint64(\fI\%cbor_item_t\fP *item, uint64_t value)
Assigns the integer value.
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.TP
.B param value
the value to assign. For negative integer, the logical value is \fB\-value \- 1\fP
.UNINDENT
.UNINDENT
.SS Dealing with width
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_int_get_width\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_int_width cbor_int_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 31]
_CBOR_NODISCARD cbor_int_width cbor_int_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 31]
_CBOR_NODISCARD cbor_int_width cbor_int_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Dealing with signedness
.INDENT 0.0
.TP
.B void cbor_mark_uint(\fI\%cbor_item_t\fP *item)
Marks the integer item as a positive integer.
.sp
The data value is not changed
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_mark_negint(\fI\%cbor_item_t\fP *item)
Marks the integer item as a negative integer.
.sp
The data value is not changed
.INDENT 7.0
.TP
.B param item[borrow]
positive or negative integer item
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_int8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_int8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_int16\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_int16 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int16 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int16 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_int32\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_int32 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int32 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int32 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_int64\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_int64 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int64 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_int64 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type 2 Byte strings
.sp
CBOR byte strings are just (ordered) series of bytes without further interpretation (unless there is a \fI\%tag\fP). Byte string\(aqs length may or may not be known during encoding. These two kinds of byte strings can be distinguished using \fBcbor_bytestring_is_definite()\fP and \fBcbor_bytestring_is_indefinite()\fP respectively.
.sp
In case a byte string is indefinite, it is encoded as a series of definite byte strings. These are called \(dqchunks\(dq. For example, the encoded item
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
0xf5 Start indefinite byte string
0x41 Byte string (1B long)
0x00
0x41 Byte string (1B long)
0xff
0xff \(dqBreak\(dq control token
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
represents two bytes, \fB0x00\fP and \fB0xff\fP\&. This on one hand enables streaming messages even before they are fully generated, but on the other hand it adds more complexity to the client code.
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_BYTESTRING\fP
T}
_
T{
Number of allocations (definite)
T} T{
One plus any manipulations with the data
T}
_
T{
Number of allocations (indefinite)
T} T{
One plus logarithmically many
reallocations relative to chunk count
T}
_
T{
Storage requirements (definite)
T} T{
\fBsizeof(cbor_item_t) + length(handle)\fP
T}
_
T{
Storage requirements (indefinite)
T} T{
\fBsizeof(cbor_item_t) * (1 + chunk_count) + chunks\fP
T}
_
.TE
.SS Getting metadata
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_length\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_bytestring_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_bytestring_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_bytestring_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_is_definite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_bytestring_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_is_indefinite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_bytestring_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_chunk_count\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_bytestring_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_bytestring_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_bytestring_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Reading data
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_mutable_data cbor_bytestring_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 34]
_CBOR_NODISCARD cbor_mutable_data cbor_bytestring_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 34]
_CBOR_NODISCARD cbor_mutable_data cbor_bytestring_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_chunks_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t ** cbor_bytestring_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_bytestring_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_bytestring_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_definite_bytestring\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_indefinite_bytestring\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_bytestring (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Building items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_bytestring\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_bytestring (cbor_data handle, size_t length)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_bytestring (cbor_data handle, size_t length)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_bytestring (cbor_data handle, size_t length)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Manipulating existing items
.INDENT 0.0
.TP
.B void cbor_bytestring_set_handle(\fI\%cbor_item_t\fP *item, cbor_mutable_data data, size_t length)
Set the handle to the binary data.
.INDENT 7.0
.TP
.B param item[borrow]
A definite byte string
.TP
.B param data
The memory block. The caller gives up the ownership of the block. libcbor will deallocate it when appropriate using its free function
.TP
.B param length
Length of the data block
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_bytestring_add_chunk\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_bytestring_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_bytestring_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type 3 UTF\-8 strings
.sp
CBOR strings have the same structure as \fI\%Type 2 Byte strings\fP\&.
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_STRING\fP
T}
_
T{
Number of allocations (definite)
T} T{
One plus any manipulations with the data
T}
_
T{
Number of allocations (indefinite)
T} T{
One plus logarithmically many
reallocations relative to chunk count
T}
_
T{
Storage requirements (definite)
T} T{
\fBsizeof(cbor_item_t) + length(handle)\fP
T}
_
T{
Storage requirements (indefinite)
T} T{
\fBsizeof(cbor_item_t) * (1 + chunk_count) + chunks\fP
T}
_
.TE
.SS UTF\-8 encoding validation
.sp
\fIlibcbor\fP considers UTF\-8 encoding validity to be a part of the well\-formedness notion of CBOR and therefore invalid UTF\-8 strings will be rejected by the parser. Strings created by the user are not checked.
.SS Getting metadata
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_length\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_string_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_string_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_string_length (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_is_definite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_string_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_is_indefinite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_string_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_chunk_count\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_string_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_string_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_string_chunk_count (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Reading data
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_mutable_data cbor_string_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 34]
_CBOR_NODISCARD cbor_mutable_data cbor_string_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 34]
_CBOR_NODISCARD cbor_mutable_data cbor_string_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_chunks_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t ** cbor_string_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_string_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_string_chunks_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_definite_string\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_indefinite_string\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_string (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Building items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_string\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_string (const char *val)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_string (const char *val)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_string (const char *val)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Manipulating existing items
.INDENT 0.0
.TP
.B void cbor_string_set_handle(\fI\%cbor_item_t\fP *item, cbor_mutable_data data, size_t length)
Set the handle to the underlying string.
.sp
\fBWARNING:\fP
.INDENT 7.0
.INDENT 3.5
Using a pointer to a stack allocated constant is a common
mistake. Lifetime of the string will expire when it goes out of scope and
the CBOR item will be left inconsistent.
.UNINDENT
.UNINDENT
.INDENT 7.0
.TP
.B param item[borrow]
A definite string
.TP
.B param data
The memory block. The caller gives up the ownership of the block. libcbor will deallocate it when appropriate using its free function
.TP
.B param length
Length of the data block
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_string_add_chunk\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_string_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_string_add_chunk (cbor_item_t *item, cbor_item_t *chunk)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type 4 Arrays
.sp
CBOR arrays, just like \fI\%byte strings\fP and \fI\%strings\fP, can be encoded either as definite, or as indefinite.
Definite arrays have a fixed size which is stored in the header, whereas indefinite arrays do not and are terminated by a special \(dqbreak\(dq byte instead.
.sp
Arrays are explicitly created or decoded as definite or indefinite and will be encoded using the corresponding wire representation, regardless of whether the actual size is known at the time of encoding.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
Indefinite arrays can be conveniently used with streaming \fI\%decoding\fP and \fI\%encoding\fP\&.
.UNINDENT
.UNINDENT
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_ARRAY\fP
T}
_
T{
Number of allocations (definite)
T} T{
Two plus any manipulations with the data
T}
_
T{
Number of allocations (indefinite)
T} T{
Two plus logarithmically many
reallocations relative to additions
T}
_
T{
Storage requirements (definite)
T} T{
\fB(sizeof(cbor_item_t) + 1) * size\fP
T}
_
T{
Storage requirements (indefinite)
T} T{
\fB<= sizeof(cbor_item_t) + sizeof(cbor_item_t) * size * BUFFER_GROWTH\fP
T}
_
.TE
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
0x9f Start indefinite array
0x01 Unsigned integer 1
0xff \(dqBreak\(dq control token
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
0x9f Start array, 1B length follows
0x20 Unsigned integer 32
... 32 items follow
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Getting metadata
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_size\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_array_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_array_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_array_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_allocated\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_array_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_array_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_array_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_is_definite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_array_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_is_indefinite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_array_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Reading data
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t ** cbor_array_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_array_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t ** cbor_array_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_get\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_array_get (const cbor_item_t *item, size_t index)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_array_get (const cbor_item_t *item, size_t index)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_array_get (const cbor_item_t *item, size_t index)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_definite_array\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_array (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_array (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_array (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_indefinite_array\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_array (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_array (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_array (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Modifying items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_push\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_array_push (cbor_item_t *array, cbor_item_t *pushee)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_push (cbor_item_t *array, cbor_item_t *pushee)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_push (cbor_item_t *array, cbor_item_t *pushee)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_replace\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_array_replace (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_replace (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_replace (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_array_set\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_array_set (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_set (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_array_set (cbor_item_t *item, size_t index, cbor_item_t *value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type 5 Maps
.sp
CBOR maps are the plain old associative maps similar JSON objects or Python dictionaries.
.sp
Definite maps have a fixed size which is stored in the header, whereas indefinite maps do not and are terminated by a special \(dqbreak\(dq byte instead.
.sp
Map are explicitly created or decoded as definite or indefinite and will be encoded using the corresponding wire representation, regardless of whether the actual size is known at the time of encoding.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
Indefinite maps can be conveniently used with streaming \fI\%decoding\fP and \fI\%encoding\fP\&.
Keys and values can simply be output one by one, alternating keys and values.
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
Any CBOR data item is a legal map key (not just strings).
.UNINDENT
.UNINDENT
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_MAP\fP
T}
_
T{
Number of allocations (definite)
T} T{
Two plus any manipulations with the data
T}
_
T{
Number of allocations (indefinite)
T} T{
Two plus logarithmically many
reallocations relative to additions
T}
_
T{
Storage requirements (definite)
T} T{
\fBsizeof(cbor_pair) * size + sizeof(cbor_item_t)\fP
T}
_
T{
Storage requirements (indefinite)
T} T{
\fB<= sizeof(cbor_item_t) + sizeof(cbor_pair) * size * BUFFER_GROWTH\fP
T}
_
.TE
.SS Examples
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
0xbf Start indefinite map (represents {1: 2})
0x01 Unsigned integer 1 (key)
0x02 Unsigned integer 2 (value)
0xff \(dqBreak\(dq control token
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
0xa0 Map of size 0
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Getting metadata
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_size\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_map_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_map_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_map_size (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_allocated\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD size_t cbor_map_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 23]
_CBOR_NODISCARD size_t cbor_map_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 23]
_CBOR_NODISCARD size_t cbor_map_allocated (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_is_definite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_map_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_is_definite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_is_indefinite\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_map_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_is_indefinite (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Reading data
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_handle\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD struct cbor_pair * cbor_map_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: struct [error at 22]
_CBOR_NODISCARD struct cbor_pair * cbor_map_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: struct [error at 22]
_CBOR_NODISCARD struct cbor_pair * cbor_map_handle (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_definite_map\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_map (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_map (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_definite_map (size_t size)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_indefinite_map\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_map (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_map (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_indefinite_map (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Modifying items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_map_add\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_map_add (cbor_item_t *item, struct cbor_pair pair)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_add (cbor_item_t *item, struct cbor_pair pair)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_map_add (cbor_item_t *item, struct cbor_pair pair)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Type 6 Semantic tags
.sp
Tag are additional metadata that can be used to extend or specialize the meaning or interpretation of the other data items.
.sp
For example, one might tag an array of numbers to communicate that it should be interpreted as a vector.
.sp
Please consult the official \fI\%IANA repository of CBOR tags\fP before inventing new ones.
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_TAG\fP
T}
_
T{
Number of allocations
T} T{
One plus any manipulations with the data
reallocations relative to chunk count
T}
_
T{
Storage requirements
T} T{
\fBsizeof(cbor_item_t) + the tagged item\fP
T}
_
.TE
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_tag\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_tag (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_tag (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_tag (uint64_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_tag_item\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_tag_item (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_tag_item (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_tag_item (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_tag_value\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint64_t cbor_tag_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 25]
_CBOR_NODISCARD uint64_t cbor_tag_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 25]
_CBOR_NODISCARD uint64_t cbor_tag_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_tag_set_item(\fI\%cbor_item_t\fP *item, \fI\%cbor_item_t\fP *tagged_item)
Set the tagged item.
.INDENT 7.0
.TP
.B param item[borrow]
A tag
.TP
.B param tagged_item[incref]
The item to tag
.UNINDENT
.UNINDENT
.SS Type 7 Floats & control tokens
.sp
This type combines two completely unrelated types of items \-\- floating point numbers and special values such as true, false, null, etc. We refer to these special values as \(aqcontrol values\(aq or \(aqctrls\(aq for short throughout the code.
.sp
Just like integers, they have different possible width (resulting in different value ranges and precisions).
.INDENT 0.0
.TP
.B enum cbor_float_width
Possible widths of \fI\%CBOR_TYPE_FLOAT_CTRL\fP items.
.sp
\fIValues:\fP
.INDENT 7.0
.TP
.B enumerator CBOR_FLOAT_0
Internal use \- ctrl and special values.
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_FLOAT_16
Half float.
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_FLOAT_32
Single float.
.UNINDENT
.INDENT 7.0
.TP
.B enumerator CBOR_FLOAT_64
Double.
.UNINDENT
.UNINDENT
.TS
center;
|l|l|.
_
T{
Corresponding \fI\%cbor_type\fP
T} T{
\fBCBOR_TYPE_FLOAT_CTRL\fP
T}
_
T{
Number of allocations
T} T{
One per lifetime
T}
_
T{
Storage requirements
T} T{
\fBsizeof(cbor_item_t) + 1/4/8\fP
T}
_
.TE
.SS Getting metadata
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_ctrl_is_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_float_ctrl_is_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_float_ctrl_is_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_float_ctrl_is_ctrl (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_get_width\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_float_width cbor_float_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 33]
_CBOR_NODISCARD cbor_float_width cbor_float_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 33]
_CBOR_NODISCARD cbor_float_width cbor_float_get_width (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Reading data
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_get_float2\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD float cbor_float_get_float2 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 21]
_CBOR_NODISCARD float cbor_float_get_float2 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 21]
_CBOR_NODISCARD float cbor_float_get_float2 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_get_float4\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD float cbor_float_get_float4 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 21]
_CBOR_NODISCARD float cbor_float_get_float4 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 21]
_CBOR_NODISCARD float cbor_float_get_float4 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_get_float8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD double cbor_float_get_float8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: double [error at 22]
_CBOR_NODISCARD double cbor_float_get_float8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: double [error at 22]
_CBOR_NODISCARD double cbor_float_get_float8 (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_float_get_float\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD double cbor_float_get_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: double [error at 22]
_CBOR_NODISCARD double cbor_float_get_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: double [error at 22]
_CBOR_NODISCARD double cbor_float_get_float (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_ctrl_value\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD uint8_t cbor_ctrl_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 24]
_CBOR_NODISCARD uint8_t cbor_ctrl_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 24]
_CBOR_NODISCARD uint8_t cbor_ctrl_value (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_get_bool\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD bool cbor_get_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_get_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 20]
_CBOR_NODISCARD bool cbor_get_bool (const cbor_item_t *item)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Creating new items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_ctrl (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_ctrl (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_ctrl (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_float2\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_float2 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float2 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float2 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_float4\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_float4 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float4 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float4 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_float8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_float8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_float8 (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_null\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_null (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_null (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_null (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_new_undef\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_new_undef (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_undef (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_new_undef (void)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Building items
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_bool\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_bool (bool value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_bool (bool value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_bool (bool value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_ctrl\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_ctrl (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_ctrl (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_ctrl (uint8_t value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_float2\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_float2 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float2 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float2 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_float4\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_float4 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float4 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float4 (float value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
doxygenfunction: Unable to resolve function \(dqcbor_build_float8\(dq with arguments \(dqNone\(dq.
Candidate function could not be parsed. Parsing error is
Error when parsing function declaration.
If the function has no return type:
Error in declarator or parameters\-and\-qualifiers
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 16]
_CBOR_NODISCARD cbor_item_t * cbor_build_float8 (double value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If the function has a return type:
Error in declarator or parameters\-and\-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected \(aq::\(aq in pointer to member (function). [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float8 (double value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
If declarator\-id:
Invalid C++ declaration: Expecting \(dq(\(dq in parameters\-and\-qualifiers. [error at 28]
_CBOR_NODISCARD cbor_item_t * cbor_build_float8 (double value)
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-^
.UNINDENT
.UNINDENT
.SS Manipulating existing items
.INDENT 0.0
.TP
.B void cbor_set_ctrl(\fI\%cbor_item_t\fP *item, uint8_t value)
Assign a control value.
.sp
\fBWARNING:\fP
.INDENT 7.0
.INDENT 3.5
It is possible to produce an invalid CBOR value by assigning a
invalid value using this mechanism. Please consult the standard before use.
.UNINDENT
.UNINDENT
.INDENT 7.0
.TP
.B param item[borrow]
A ctrl item
.TP
.B param value
The simple value to assign. Please consult the standard for allowed values
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_bool(\fI\%cbor_item_t\fP *item, bool value)
Assign a boolean value to a boolean ctrl item.
.INDENT 7.0
.TP
.B param item[borrow]
A ctrl item
.TP
.B param value
The simple value to assign.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_float2(\fI\%cbor_item_t\fP *item, float value)
Assigns a float value.
.INDENT 7.0
.TP
.B param item[borrow]
A half precision float
.TP
.B param value
The value to assign
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_float4(\fI\%cbor_item_t\fP *item, float value)
Assigns a float value.
.INDENT 7.0
.TP
.B param item[borrow]
A single precision float
.TP
.B param value
The value to assign
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B void cbor_set_float8(\fI\%cbor_item_t\fP *item, double value)
Assigns a float value.
.INDENT 7.0
.TP
.B param item[borrow]
A double precision float
.TP
.B param value
The value to assign
.UNINDENT
.UNINDENT
.SS Half floats
.sp
CBOR supports two \fI\%bytes wide (\(dqhalf\-precision\(dq)\fP
floats which are not supported by the C language. \fIlibcbor\fP represents them using \fIfloat <https://en.cppreference.com/w/c/language/type>\fP values throughout the API. Encoding will be performed by \fBcbor_encode_half()\fP, which will handle any values that cannot be represented as a half\-float.
.IP [1] 5
\fI\%http://softwareengineering.vazexqi.com/files/pattern.html\fP
.SS Tests
.SS Unit tests
.sp
There is a comprehensive test suite employing \fI\%CMocka\fP\&. You can run all of them using \fBctest\fP in the build directory. Individual tests are themselves runnable. Please refer to \fI\%CTest\fP documentation for detailed information on how to specify particular subset of tests.
.SS Testing for memory leaks
.sp
Every release is tested for memory correctness. You can run these tests by passing the \fB\-T memcheck\fP flag to \fBctest\fP\&. [1]
.IP [1] 5
Project should be configured with \fB\-DCMAKE_BUILD_TYPE=Debug\fP to obtain meaningful description of location of the leak. You might also need \fB\-\-dsymutil=yes\fP on OS X.
.SS Code coverage
.sp
Every release is inspected using \fI\%GCOV/LCOV\fP\&. Platform\-independent code should be fully covered by the test suite. Simply run
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
make coverage
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
or alternatively run \fBlcov\fP by hand using
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
lcov \-\-capture \-\-directory . \-\-output\-file coverage.info
genhtml coverage.info \-\-output\-directory out
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Fuzz testing
.sp
Every release is tested using a fuzz test. In this test, a huge buffer filled with random data is passed to the decoder. We require that it either succeeds or fail with a sensible error, without leaking any memory. This is intended to simulate real\-world situations where data received from the network are CBOR\-decoded before any further processing.
.SS RFC conformance
.sp
\fIlibcbor\fP is, generally speaking, very faithful implementation of \fI\%RFC 7049\fP\&. There are, however, some limitations imposed by technical constraints.
.SS Bytestring length
.sp
There is no explicit limitation of indefinite length byte strings. [1] \fIlibcbor\fP will not handle byte strings with more chunks than the maximum value of \fBsize_t\fP\&. On any sane platform, such string would not fit in the memory anyway. It is, however, possible to process arbitrarily long strings and byte strings using the streaming decoder.
.IP [1] 5
\fI\%https://tools.ietf.org/html/rfc7049#section\-2.2.2\fP
.SS \(dqHalf\-precision\(dq IEEE 754 floats
.sp
As of C99 and even C11, there is no standard implementation for 2 bytes floats. \fIlibcbor\fP packs them as a \fIfloat <https://en.cppreference.com/w/c/language/type>\fP\&. When encoding, \fIlibcbor\fP selects the appropriate wire representation based on metadata and the actual value. This applies both to canonical and normal mode.
.sp
For more information on half\-float serialization, please refer to the section on \fI\%Half floats\fP\&.
.SS Internal mechanics
.sp
Internal workings of \fIlibcbor\fP are mostly derived from the specification. The purpose of this document is to describe technical choices made during design & implementation and to explicate the reasoning behind those choices.
.SS Terminology
.TS
center;
|l|l|l|.
_
T{
MTB
T} T{
Major Type Byte
T} T{
\fI\%http://tools.ietf.org/html/rfc7049#section\-2.1\fP
T}
_
T{
DST
T} T{
Dynamically Sized Type
T} T{
Type whose storage requirements cannot be determined
.sp
during compilation (originated in the \fI\%Rust\fP community)
T}
_
.TE
.SS Conventions
.sp
API symbols start with \fBcbor_\fP or \fBCBOR_\fP prefix, internal symbols have \fB_cbor_\fP or \fB_CBOR_\fP prefix.
.SS Inspiration & related projects
.sp
Most of the API is largely modelled after existing JSON libraries, including
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fI\%Jansson\fP
.IP \(bu 2
\fI\%json\-c\fP
.IP \(bu 2
Gnome\(aqs \fI\%JsonGlib\fP
.UNINDENT
.UNINDENT
.UNINDENT
.sp
and also borrowing from
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fI\%msgpack\-c\fP
.IP \(bu 2
\fI\%Google Protocol Buffers\fP\&.
.UNINDENT
.UNINDENT
.UNINDENT
.SS General notes on the API design
.sp
The API design has two main driving priciples:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP 1. 3
Let the client manage the memory as much as possible
.IP 2. 3
Behave exactly as specified by the standard
.UNINDENT
.UNINDENT
.UNINDENT
.sp
Combining these two principles in practice turns out to be quite difficult. Indefinite\-length strings, arrays, and maps require client to handle every fixed\-size chunk explicitly in order to
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
ensure the client never runs out of memory due to \fIlibcbor\fP
.IP \(bu 2
use \fBrealloc()\fP sparsely and predictably [1]
.INDENT 2.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
provide strong guarantees about its usage (to prevent latency spikes)
.IP \(bu 2
provide APIs to avoid \fBrealloc()\fP altogether
.UNINDENT
.UNINDENT
.UNINDENT
.IP \(bu 2
allow proper handling of (streamed) data bigger than available memory
.UNINDENT
.IP [1] 5
Reasonable handling of DSTs requires reallocation if the API is to remain sane.
.UNINDENT
.UNINDENT
.SS Coding style
.sp
This code loosely follows the \fI\%Linux kernel coding style\fP\&. Tabs are tabs, and they are 4 characters wide.
.SS Memory layout
.sp
CBOR is very dynamic in the sense that it contains many data elements of variable length, sometimes even indefinite length. This section describes internal representation of all CBOR data types.
.sp
Generally speaking, data items consist of three parts:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
a generic \fI\%handle\fP,
.IP \(bu 2
the associated \fI\%metadata\fP,
.IP \(bu 2
and the actual data
.UNINDENT
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B type cbor_item_t
Represents the item. Used as an opaque type
.INDENT 7.0
.TP
.B \fI\%cbor_type\fP type
Type discriminator
.UNINDENT
.INDENT 7.0
.TP
.B size_t refcount
Reference counter. Used by \fI\%cbor_decref()\fP, \fI\%cbor_incref()\fP
.UNINDENT
.INDENT 7.0
.TP
.B union \fI\%cbor_item_metadata\fP metadata
Union discriminated by \fI\%type\fP\&. Contains type\-specific metadata
.UNINDENT
.INDENT 7.0
.TP
.B unsigned char *data
Contains pointer to the actual data. Small, fixed size items (\fI\%Types 0 & 1 Positive and negative integers\fP, \fI\%Type 6 Semantic tags\fP, \fI\%Type 7 Floats & control tokens\fP) are allocated as a single memory block.
.sp
Consider the following snippet
.INDENT 7.0
.INDENT 3.5
.sp
.nf
.ft C
cbor_item_t * item = cbor_new_int8();
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
then the memory is laid out as follows
.INDENT 7.0
.INDENT 3.5
.sp
.nf
.ft C
+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-+
| | | | || |
| type | refcount | metadata | data || uint8_t |
| | | | (= item + sizeof(cbor_item_t)) || |
+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-+
^ ^
| |
+\-\-\- item +\-\-\- item\->data
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Dynamically sized types (\fI\%Type 2 Byte strings\fP, \fI\%Type 3 UTF\-8 strings\fP, \fI\%Type 4 Arrays\fP, \fI\%Type 5 Maps\fP) may store handle and data in separate locations. This enables creating large items (e.g \fI\%byte strings\fP) without \fBrealloc()\fP or copying large blocks of memory. One simply attaches the correct pointer to the handle.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B type cbor_item_metadata
Union type of the following members, based on the item type:
.INDENT 7.0
.TP
.B struct _cbor_int_metadata int_metadata
Used both by both \fI\%Types 0 & 1 Positive and negative integers\fP
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_bytestring_metadata bytestring_metadata
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_string_metadata string_metadata
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_array_metadata array_metadata
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_map_metadata map_metadata
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_tag_metadata tag_metadata
.UNINDENT
.INDENT 7.0
.TP
.B struct _cbor_float_ctrl_metadata float_ctrl_metadata
.UNINDENT
.UNINDENT
.SS Decoding
.sp
As outlined in \fI\%API\fP, there decoding is based on the streaming decoder Essentially, the decoder is a custom set of callbacks for the streaming decoder.
.SS Changelog
.sp
Template:
\- [Fix issue X in feature Y](\fI\%https://github.com/PJK/libcbor/pull/XXX\fP) (by [YYY](\fI\%https://github.com/YYY\fP))
.SS Next
.SS 0.10.1 (2022\-12\-30)
.INDENT 0.0
.IP \(bu 2
[Fix a regression in \fIcbor_serialize_alloc\fP that caused serialization of zero\-length strings and bytestrings or byte/strings with zero\-length chunks to fail](\fI\%https://github.com/PJK/libcbor/pull/260\fP) (discovered by [martelletto](\fI\%https://github.com/martelletto\fP))
.UNINDENT
.SS 0.10.0 (2022\-12\-29)
.INDENT 0.0
.IP \(bu 2
Make the buffer_size optional in \fIcbor_serialize_alloc\fP [[#205]](\fI\%https://github.com/PJK/libcbor/pull/205\fP) (by [hughsie](\fI\%https://github.com/hughsie\fP))
.IP \(bu 2
BREAKING: Improved half\-float encoding for denormalized numbers. [[#208]](\fI\%https://github.com/PJK/libcbor/pull/208\fP) (by [ranvis](\fI\%https://github.com/ranvis\fP))
\- Denormalized half\-floats will now preserve data in the mantissa
\- Note: Half\-float NaNs still lose data (\fI\%https://github.com/PJK/libcbor/issues/215\fP)
.IP \(bu 2
BUILD BREAKING: Minimum CMake version is 3.0 [[#201]](\fI\%https://github.com/PJK/libcbor/pull/201\fP) (by [thewtex@](\fI\%https://github.com/thewtex\fP))
\- See \fI\%https://repology.org/project/cmake/versions\fP for support; the vast majority of users should not be affected.
.IP \(bu 2
Fix a potential memory leak when the allocator fails during array or map decoding [[#224]](\fI\%https://github.com/PJK/libcbor/pull/224\fP) (by [James\-ZHANG](\fI\%https://github.com/James\-ZHANG\fP))
.IP \(bu 2
[Fix a memory leak when the allocator fails when adding chunks to indefinite bytestrings.](\fI\%https://github.com/PJK/libcbor/pull/242\fP) ([discovered](\fI\%https://github.com/PJK/libcbor/pull/228\fP) by [James\-ZHANG](\fI\%https://github.com/James\-ZHANG\fP))
.IP \(bu 2
[Fix a memory leak when the allocator fails when adding chunks to indefinite strings](\fI\%https://github.com/PJK/libcbor/pull/246\fP)
.IP \(bu 2
Potentially BUILD BREAKING: [Add nodiscard attributes to most functions](\fI\%https://github.com/PJK/libcbor/pull/248\fP)
\- \fBWarning\fP: This may cause new build warnings and (in rare cases, depending on your configuration) errors
.IP \(bu 2
BREAKING: [Fix \fIcbor_copy\fP leaking memory and creating invalid items when the allocator fails](\fI\%https://github.com/PJK/libcbor/pull/249\fP).
\- Previously, the failures were not handled in the interface. Now, \fIcbor_copy\fP may return \fINULL\fP upon failure; clients should check the return value
.IP \(bu 2
[Fix \fIcbor_build_tag\fP illegal memory behavior when the allocator fails](\fI\%https://github.com/PJK/libcbor/pull/249\fP)
.IP \(bu 2
[Add a new \fIcbor_serialized_size\fP API](\fI\%https://github.com/PJK/libcbor/pull/250\fP)
.IP \(bu 2
[Reworked \fIcbor_serialize_alloc\fP to allocate the exact amount of memory necessary upfront](\fI\%https://github.com/PJK/libcbor/pull/251\fP)
\- This should significantly speed up \fIcbor_serialize_alloc\fP for large items by avoiding multiple reallocation iterations
\- Clients should not use the return value of \fIcbor_serialize_alloc\fP\&. It may be removed in the future.
.IP \(bu 2
BUILD BREAKING: [Deprecate CBOR_CUSTOM_ALLOC](\fI\%https://github.com/PJK/libcbor/pull/237\fP)
\- \fIcbor_set_allocs\fP will always be enabled from now on
\- Note: The flag will be kept as a no\-op triggering a warning when used for one version and then removed completely
.UNINDENT
.SS 0.9.0 (2021\-11\-14)
.INDENT 0.0
.IP \(bu 2
Improved pkg\-config paths handling [[#164]](\fI\%https://github.com/PJK/libcbor/pull/164\fP) (by [jtojnar@](\fI\%https://github.com/jtojnar\fP))
.IP \(bu 2
Use explicit math.h linkage [[#170]](\fI\%https://github.com/PJK/libcbor/pull/170\fP)
.IP \(bu 2
.INDENT 2.0
.TP
.B BREAKING: Fixed handling of items that exceed the host size_t range [[#186]](\fI\%https://github.com/PJK/libcbor/pull/186hg\fP)
.INDENT 7.0
.IP \(bu 2
Callbacks for bytestrings, strings, arrays, and maps use uint64_t instead of size_t to allow handling of large items that exceed size_t even if size_t < uint64_t
.IP \(bu 2
cbor_decode explicitly checks size to avoid overflows (previously broken, potentially resulting in erroneous decoding on affected systems)
.IP \(bu 2
The change should be a noop for 64b systems
.UNINDENT
.UNINDENT
.IP \(bu 2
Added a [Bazel](\fI\%https://bazel.build/\fP) build example [[#196]](\fI\%https://github.com/PJK/libcbor/pull/196\fP) (by [andyjgf@](\fI\%https://github.com/andyjgf\fP))
.UNINDENT
.SS 0.8.0 (2020\-09\-20)
.INDENT 0.0
.IP \(bu 2
BUILD BREAKING: Use BUILD_SHARED_LIBS to determine how to build libraries (fixed Windows linkage) [[#148]](\fI\%https://github.com/PJK/libcbor/pull/148\fP) (by [intelligide@](\fI\%https://github.com/intelligide\fP))
.IP \(bu 2
BREAKING: Fix \fIcbor_tag_item\fP not increasing the reference count on the tagged item reference it returns [[Fixes #109](\fI\%https://github.com/PJK/libcbor/issues/109\fP)] (discovered bt [JohnGilmour](\fI\%https://github.com/JohnGilmour\fP))
\- If you have previously relied on the broken behavior, you can use \fIcbor_move\fP to emulate as long as the returned handle is an \(dqrvalue\(dq
.IP \(bu 2
.INDENT 2.0
.TP
.B BREAKING: [\fICBOR_DECODER_EBUFFER\fP removed from \fIcbor_decoder_status\fP](\fI\%https://github.com/PJK/libcbor/pull/156\fP)
.INDENT 7.0
.IP \(bu 2
\fIcbor_stream_decode\fP will set \fICBOR_DECODER_NEDATA\fP instead if the input buffer is empty
.UNINDENT
.UNINDENT
.IP \(bu 2
[Fix \fIcbor_stream_decode\fP](\fI\%https://github.com/PJK/libcbor/pull/156\fP) to set \fIcbor_decoder_result.required\fP to the minimum number of input bytes necessary to receive the next callback (as long as at least one byte was passed) (discovered by [woefulwabbit](\fI\%https://github.com/woefulwabbit\fP))
.IP \(bu 2
Fixed several minor manpage issues [[#159]](\fI\%https://github.com/PJK/libcbor/pull/159\fP) (discovered by [kloczek@](\fI\%https://github.com/kloczek\fP))
.UNINDENT
.SS 0.7.0 (2020\-04\-25)
.INDENT 0.0
.IP \(bu 2
.INDENT 2.0
.TP
.B Fix bad encoding of NaN half\-floats [[Fixes #53]](\fI\%https://github.com/PJK/libcbor/issues/53\fP) (discovered by [BSipos\-RKF](\fI\%https://github.com/BSipos\-RKF\fP))
.INDENT 7.0
.IP \(bu 2
\fBWarning\fP: Previous versions encoded NaNs as \fI0xf9e700\fP instead of \fI0xf97e00\fP; if you rely on the broken behavior, this will be a breaking change
.UNINDENT
.UNINDENT
.IP \(bu 2
Fix potentially bad encoding of negative half\-float with exponent < \-14 [[Fixes #112]](\fI\%https://github.com/PJK/libcbor/issues/112\fP) (discovered by [yami36](\fI\%https://github.com/yami36\fP))
.IP \(bu 2
.INDENT 2.0
.TP
.B BREAKING: Improved bool support [[Fixes #63]](\fI\%https://github.com/PJK/libcbor/issues/63\fP)
.INDENT 7.0
.IP \(bu 2
Rename \fIcbor_ctrl_is_bool\fP to \fIcbor_get_bool\fP and fix the behavior
.IP \(bu 2
Add \fIcbor_set_bool\fP
.UNINDENT
.UNINDENT
.IP \(bu 2
Fix memory_allocation_test breaking the build without CBOR_CUSTOM_ALLOC [[Fixes #128]](\fI\%https://github.com/PJK/libcbor/issues/128\fP) (by [panlinux](\fI\%https://github.com/panlinux\fP))
.IP \(bu 2
[Fix a potential build issue where cJSON includes may be misconfigured](\fI\%https://github.com/PJK/libcbor/pull/132\fP)
.IP \(bu 2
.INDENT 2.0
.TP
.B Breaking: [Add a limit on the size of the decoding context stack](\fI\%https://github.com/PJK/libcbor/pull/138\fP) (by [James\-ZHANG](\fI\%https://github.com/James\-ZHANG\fP))
.INDENT 7.0
.IP \(bu 2
If your usecase requires parsing very deeply nested structures, you might need to increase the default 2k limit via \fICBOR_MAX_STACK_SIZE\fP
.UNINDENT
.UNINDENT
.IP \(bu 2
.INDENT 2.0
.TP
.B Enable LTO/IPO based on [CheckIPOSupported](\fI\%https://cmake.org/cmake/help/latest/module/CheckIPOSupported.html#module:CheckIPOSupported\fP) [[#143]](\fI\%https://github.com/PJK/libcbor/pull/143\fP) (by [xanderlent](\fI\%https://github.com/xanderlent\fP))
.INDENT 7.0
.IP \(bu 2
If you rely on LTO being enabled and use CMake version older than 3.9, you will need to re\-enable it manually or upgrade your CMake
.UNINDENT
.UNINDENT
.UNINDENT
.SS 0.6.1 (2020\-03\-26)
.INDENT 0.0
.IP \(bu 2
.INDENT 2.0
.TP
.B [Fix bad shared library version number](\fI\%https://github.com/PJK/libcbor/pull/131\fP)
.INDENT 7.0
.IP \(bu 2
\fBWarning\fP: Shared library built from the 0.6.0 release is erroneously marked as version \(dq0.6.0\(dq, which makes it incompatible with future releases \fIincluding the v0.6.X line\fP even though they may be compatible API/ABI\-wise. Refer to the documentation for the new SO versioning scheme.
.UNINDENT
.UNINDENT
.UNINDENT
.SS 0.6.0 (2020\-03\-15)
.INDENT 0.0
.IP \(bu 2
.INDENT 2.0
.TP
.B Correctly set .so version [[Fixes #52]](\fI\%https://github.com/PJK/libcbor/issues/52\fP).
.INDENT 7.0
.IP \(bu 2
\fBWarning\fP: All previous releases will be identified as 0.0 by the linker.
.UNINDENT
.UNINDENT
.IP \(bu 2
Fix & prevent heap overflow error in example code [[#74]](\fI\%https://github.com/PJK/libcbor/pull/74\fP) [[#76]](\fI\%https://github.com/PJK/libcbor/pull/76\fP) (by @nevun)
.IP \(bu 2
Correctly set OSX dynamic library version [[Fixes #75]](\fI\%https://github.com/PJK/libcbor/issues/75\fP)
.IP \(bu 2
[Fix misplaced 0xFF bytes in maps possibly causing memory corruption](\fI\%https://github.com/PJK/libcbor/pull/82\fP)
.IP \(bu 2
BREAKING: Fix handling & cleanup of failed memory allocation in constructor
and builder helper functions [[Fixes #84]](\fI\%https://github.com/PJK/libcbor/issues/84\fP)
\- All cbor_new_* and cbor_build_* functions will now explicitly return NULL when memory allocation fails
\- It is up to the client to handle such cases
.IP \(bu 2
Globally enforced code style [[Fixes #83]](\fI\%https://github.com/PJK/libcbor/issues/83\fP)
.IP \(bu 2
Fix issue possible memory corruption bug on repeated
cbor_(byte)string_add_chunk calls with intermittently failing realloc calls
.IP \(bu 2
Fix possibly misaligned reads and writes when endian.h is uses or when
running on a big\-endian machine [[Fixes #99](\fI\%https://github.com/PJK/libcbor/issues/99\fP), [#100](\fI\%https://github.com/PJK/libcbor/issues/100\fP)]
.IP \(bu 2
[Improved CI setup with Travis\-native arm64 support](\fI\%https://github.com/PJK/libcbor/pull/116\fP)
.IP \(bu 2
[Docs migrated to Sphinx 2.4 and Python3](\fI\%https://github.com/PJK/libcbor/pull/117\fP)
.UNINDENT
.SS 0.5.0 (2017\-02\-06)
.INDENT 0.0
.IP \(bu 2
Remove cmocka from the subtree (always rely on system or user\-provided version)
.IP \(bu 2
Windows CI
.IP \(bu 2
Only build tests if explicitly enabled (\fI\-DWITH_TESTS=ON\fP)
.IP \(bu 2
Fixed static header declarations (by cedric\-d)
.IP \(bu 2
Improved documentation (by Michael Richardson)
.IP \(bu 2
Improved \fIexamples/readfile.c\fP
.IP \(bu 2
Reworked (re)allocation to handle huge inputs and overflows in size_t [[Fixes #16]](\fI\%https://github.com/PJK/libcbor/issues/16\fP)
.IP \(bu 2
Improvements to C++ linkage (corrected \fIcbor_empty_callbacks\fP, fixed \fIrestrict\fP pointers) (by Dennis Bijwaard)
.IP \(bu 2
Fixed Linux installation directory depending on architecture [[Fixes #34]](\fI\%https://github.com/PJK/libcbor/issues/34\fP) (by jvymazal)
.IP \(bu 2
Improved 32\-bit support [[Fixes #35]](\fI\%https://github.com/PJK/libcbor/issues/35\fP)
.IP \(bu 2
Fixed MSVC compatibility [[Fixes #31]](\fI\%https://github.com/PJK/libcbor/issues/31\fP)
.IP \(bu 2
Fixed and improved half\-float encoding [[Fixes #5](\fI\%https://github.com/PJK/libcbor/issues/5\fP), [#11](\fI\%https://github.com/PJK/libcbor/issues/11\fP)]
.UNINDENT
.SS 0.4.0 (2015\-12\-25)
.sp
Breaks build & header compatibility due to:
.INDENT 0.0
.IP \(bu 2
Improved build configuration and feature check macros
.IP \(bu 2
Endianess configuration fixes (by Erwin Kroon and David Grigsby)
.IP \(bu 2
pkg\-config compatibility (by Vincent Bernat)
.IP \(bu 2
enable use of versioned SONAME (by Vincent Bernat)
.IP \(bu 2
better fuzzer (wasn\(aqt random until now, ooops)
.UNINDENT
.SS 0.3.1 (2015\-05\-21)
.INDENT 0.0
.IP \(bu 2
documentation and comments improvements, mostly for the API reference
.UNINDENT
.SS 0.3.0 (2015\-05\-21)
.INDENT 0.0
.IP \(bu 2
Fixes, polishing, niceties across the code base
.IP \(bu 2
Updated examples
.IP \(bu 2
\fIcbor_copy\fP
.IP \(bu 2
\fIcbor_build_negint8\fP, 16, 32, 64, matching asserts
.IP \(bu 2
\fIcbor_build_stringn\fP
.IP \(bu 2
\fIcbor_build_tag\fP
.IP \(bu 2
\fIcbor_build_float2\fP, ...
.UNINDENT
.SS 0.2.1 (2015\-05\-17)
.INDENT 0.0
.IP \(bu 2
C99 support
.UNINDENT
.SS 0.2.0 (2015\-05\-17)
.INDENT 0.0
.IP \(bu 2
\fIcbor_ctrl_bool\fP \-> \fIcbor_ctrl_is_bool\fP
.IP \(bu 2
Added \fIcbor_array_allocated\fP & map equivalent
.IP \(bu 2
Overhauled endianess conversion \- ARM now works as expected
.IP \(bu 2
\(aqsort.c\(aq example added
.IP \(bu 2
Significantly improved and doxyfied documentation
.UNINDENT
.SS 0.1.0 (2015\-05\-06)
.sp
The initial release, yay!
.SS Development
.SS Vision and principles
.sp
Consistency and coherence are one of the key characteristics of good software.
While the reality is never black and white, it is important libcbor
contributors are working towards the same high\-level goal. This document
attempts to set out the basic principles of libcbor and the rationale behind
them. If you are contributing to libcbor or looking to evaluate whether libcbor
is the right choice for your project, it might be worthwhile to skim through the
section below.
.SS Mission statement
.sp
\fIlibcbor\fP is the compact, full\-featured, and safe CBOR library that works
everywhere.
.SS Goals
.SS RFC\-conformance and full feature support
.sp
Anything the standard allows, libcbor can do.
.sp
\fBWhy?\fP Because conformance and interoperability is the point of defining
standards. Clients expect the support to be feature\-complete and
there is no significant complexity reduction that can be achieved by slightly
cutting corners, which means that the incremental cost of full RFC support is
comparatively small over \(dqalmost\-conformance\(dq seen in many alternatives.
.SS Safety
.sp
Untrusted bytes from the network are the typical input.
.sp
\fBWhy?\fP Because it is the client expectation. Vast majority of security
vulnerabilities are violations of contracts \-\- in other words, bugs \-\- anyway.
.SS Self\-containment
.sp
libcbor has no runtime dependencies.
.sp
\fBWhy?\fP Because any constraint imposed on libcbor has to be enforced
transitively, which is difficult and leads to incompatibilities and
distribution issues, especially in IoT applications.
.SS Portability
.sp
If you can compile C for it, libcbor will work there.
.sp
\fBWhy?\fP Lowest\-common\-denominator solution for system\-level and IoT software
was the original niche of libcbor. Users who rely on libcbor expect future
updates to work on their target platform.
.SS Stable and predictable API
.sp
libcbor will not break without a warning.
.sp
\fBWhy?\fP \fI\%Industry\-standard\fP versioning is a basic
requirement for production\-quality software. This is especially relevant in IoT
environments where updates may be costly.
.SS Performance
.sp
libcbor is fast and resource\-efficient by design
.sp
\fBWhy?\fP Because the main maintainer is an avid hater of slow bloated software.
Who wouldn\(aqt want more bang per their electricity buck?
.SS Non\-goals
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
Convenience \-\- libcbor only provides the minimum surface to make it usable
.IP \(bu 2
FFI/SWIG/interop support \-\- libcbor is primarily a C library for C clients
.IP \(bu 2
One\-off usecases support \-\- although there are primitives to reuse, the
basic
assumption is that most clients want most of CBOR features
.UNINDENT
.UNINDENT
.UNINDENT
.SS Development dependencies
.INDENT 0.0
.IP \(bu 2
\fI\%CMocka\fP (testing)
.IP \(bu 2
\fI\%Python\fP and \fI\%pip\fP (Sphinx platform)
.IP \(bu 2
\fI\%Doxygen\fP
.IP \(bu 2
\fI\%Sphinx\fP (documentation)
.IP \(bu 2
There are some \fI\%Ruby\fP scripts in \fBmisc\fP
.IP \(bu 2
\fI\%Valgrind\fP (memory correctness & profiling)
.IP \(bu 2
\fI\%GCOV/LCOV\fP (test coverage)
.IP \(bu 2
\fIclang\-format\fP
.UNINDENT
.SS Installing \fIsphinx\fP
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
pip install sphinx
pip install sphinx_rtd_theme
pip install breathe
pip install https://github.com/lepture/python\-livereload/archive/master.zip
pip install sphinx\-autobuild
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Further instructions on configuring advanced features can be found at \fI\%http://read\-the\-docs.readthedocs.org/en/latest/install.html\fP\&.
.SS Live preview of docs
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
cd doc
make livehtml
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Set up git hooks
.sp
A catch\-all git hook that runs clang\-format and automatically refreshes the \fI\%GH
pages\fP contents located in \fBdocs\fP can be
symlinked:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
ln \-sf $(pwd)/misc/hooks/pre\-commit .git/hooks
.ft P
.fi
.UNINDENT
.UNINDENT
.SS Testing and code coverage
.sp
Please refer to \fI\%Tests\fP
.SH AUTHOR
Pavel Kalvoda
.SH COPYRIGHT
2023 - 2020, Pavel Kalvoda
.\" Generated by docutils manpage writer.
.