libcbor  0.5.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Functions
serialization.h File Reference
#include "cbor/common.h"

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. More...
 
size_t cbor_serialize_alloc (const cbor_item_t *item, cbor_mutable_data *buffer, size_t *buffer_size)
 Serialize the given item, allocating buffers as needed. More...
 
size_t cbor_serialize_uint (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize an uint. More...
 
size_t cbor_serialize_negint (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a negint. More...
 
size_t cbor_serialize_bytestring (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a bytestring. More...
 
size_t cbor_serialize_string (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a string. More...
 
size_t cbor_serialize_array (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize an array. More...
 
size_t cbor_serialize_map (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a map. More...
 
size_t cbor_serialize_tag (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a tag. More...
 
size_t cbor_serialize_float_ctrl (const cbor_item_t *, cbor_mutable_data, size_t)
 Serialize a. More...
 

Function Documentation

§ cbor_serialize()

size_t cbor_serialize ( const cbor_item_t item,
cbor_mutable_data  buffer,
size_t  buffer_size 
)

Serialize the given item.

Parameters
item[borrow]A data item
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 20 of file serialization.c.

§ cbor_serialize_alloc()

size_t cbor_serialize_alloc ( const cbor_item_t item,
cbor_mutable_data buffer,
size_t *  buffer_size 
)

Serialize the given item, allocating buffers as needed.

embed:rst:leading-asterisk
* .. warning:: It is your responsibility to free the buffer using an appropriate ``free`` implementation.
* 
Parameters
item[borrow]A data item
buffer[out]Buffer containing the result
buffer_size[out]Size of the buffer
Returns
Length of the result. 0 on failure, in which case buffer is NULL.

Definition at line 44 of file serialization.c.

§ cbor_serialize_array()

size_t cbor_serialize_array ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize an array.

Parameters
item[borrow]An array
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 178 of file serialization.c.

§ cbor_serialize_bytestring()

size_t cbor_serialize_bytestring ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a bytestring.

Parameters
item[borrow]A bytestring
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 110 of file serialization.c.

§ cbor_serialize_float_ctrl()

size_t cbor_serialize_float_ctrl ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a.

Parameters
item[borrow]A float or ctrl
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 270 of file serialization.c.

§ cbor_serialize_map()

size_t cbor_serialize_map ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a map.

Parameters
item[borrow]A map
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 214 of file serialization.c.

§ cbor_serialize_negint()

size_t cbor_serialize_negint ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a negint.

Parameters
item[borrow]A neging
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 93 of file serialization.c.

§ cbor_serialize_string()

size_t cbor_serialize_string ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a string.

Parameters
item[borrow]A string
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 144 of file serialization.c.

§ cbor_serialize_tag()

size_t cbor_serialize_tag ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize a tag.

Parameters
item[borrow]A tag
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 256 of file serialization.c.

§ cbor_serialize_uint()

size_t cbor_serialize_uint ( const cbor_item_t ,
cbor_mutable_data  ,
size_t   
)

Serialize an uint.

Parameters
item[borrow]A uint
bufferBuffer to serialize to
buffer_sizeSize of the buffer
Returns
Length of the result. 0 on failure.

Definition at line 76 of file serialization.c.