libcbor 0.12.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
|
Go to the source code of this file.
Functions | |
size_t | cbor_serialize (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize the given item. | |
size_t | cbor_serialized_size (const cbor_item_t *item) |
Compute the length (in bytes) of the item when serialized using cbor_serialize . | |
size_t | cbor_serialize_alloc (const cbor_item_t *item, unsigned char **buffer, size_t *buffer_size) |
Serialize the given item, allocating buffers as needed. | |
size_t | cbor_serialize_uint (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize an uint. | |
size_t | cbor_serialize_negint (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a negint. | |
size_t | cbor_serialize_bytestring (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a bytestring. | |
size_t | cbor_serialize_string (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a string. | |
size_t | cbor_serialize_array (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize an array. | |
size_t | cbor_serialize_map (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a map. | |
size_t | cbor_serialize_tag (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a tag. | |
size_t | cbor_serialize_float_ctrl (const cbor_item_t *item, cbor_mutable_data buffer, size_t buffer_size) |
Serialize a. | |
size_t cbor_serialize | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize the given item.
item | A data item |
buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
Definition at line 20 of file serialization.c.
size_t cbor_serialize_alloc | ( | const cbor_item_t * | item, |
unsigned char ** | buffer, | ||
size_t * | buffer_size ) |
Serialize the given item, allocating buffers as needed.
Since libcbor v0.10, the return value is always the same as buffer_size
(if provided, see https://github.com/PJK/libcbor/pull/251/). New clients should ignore the return value.
embed:rst:leading-asterisk * .. warning:: It is the caller's responsibility to free the buffer using an * appropriate ``free`` implementation. *
item | A data item | |
[out] | buffer | Buffer containing the result |
[out] | buffer_size | Size of the buffer , or 0 on memory allocation failure. |
buffer
is NULL
. Definition at line 164 of file serialization.c.
size_t cbor_serialize_array | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize an array.
item | An array | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result. The buffer
may still be modified Definition at line 286 of file serialization.c.
size_t cbor_serialize_bytestring | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a bytestring.
item | A bytestring | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result. The buffer
may still be modified Definition at line 222 of file serialization.c.
size_t cbor_serialize_float_ctrl | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a.
item | A float or ctrl | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result Definition at line 367 of file serialization.c.
size_t cbor_serialize_map | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a map.
item | A map | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result. The buffer
may still be modified Definition at line 317 of file serialization.c.
size_t cbor_serialize_negint | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a negint.
item | A negint | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result Definition at line 203 of file serialization.c.
size_t cbor_serialize_string | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a string.
item | A string | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result. The buffer
may still be modified Definition at line 254 of file serialization.c.
size_t cbor_serialize_tag | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize a tag.
item | A tag | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result. The buffer
may still be modified Definition at line 355 of file serialization.c.
size_t cbor_serialize_uint | ( | const cbor_item_t * | item, |
cbor_mutable_data | buffer, | ||
size_t | buffer_size ) |
Serialize an uint.
item | A uint | |
[out] | buffer | Buffer to serialize to |
buffer_size | Size of the buffer |
buffer_size
doesn't fit the result Definition at line 184 of file serialization.c.
size_t cbor_serialized_size | ( | const cbor_item_t * | item | ) |
Compute the length (in bytes) of the item when serialized using cbor_serialize
.
Time complexity is proportional to the number of nested items.
item | A data item |
size_t
. Definition at line 63 of file serialization.c.