cbor.h File Reference

CBOR definitions. More...

Detailed Description

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
+ Include dependency graph for cbor.h:

Go to the source code of this file.

Data Structures

struct  cbor_stream_t
 Struct containing CBOR-encoded data. More...
 

Functions

void cbor_init (cbor_stream_t *stream, unsigned char *buffer, size_t size)
 Initialize cbor struct. More...
 
void cbor_clear (cbor_stream_t *stream)
 Clear cbor struct. More...
 
void cbor_destroy (cbor_stream_t *stream)
 Destroy the cbor struct. More...
 
void cbor_stream_print (const cbor_stream_t *stream)
 Print stream in hex representation. More...
 
void cbor_stream_decode (cbor_stream_t *stream)
 Decode CBOR from stream. More...
 
size_t cbor_serialize_int (cbor_stream_t *stream, int val)
 Serializes an integer. More...
 
size_t cbor_deserialize_int (const cbor_stream_t *stream, size_t offset, int *val)
 Deserialize integers from stream to val. More...
 
size_t cbor_serialize_uint64_t (cbor_stream_t *stream, uint64_t val)
 Serializes an unsigned 64 bit value. More...
 
size_t cbor_deserialize_uint64_t (const cbor_stream_t *stream, size_t offset, uint64_t *val)
 Deserialize unsigned 64 bit values from stream to val. More...
 
size_t cbor_serialize_int64_t (cbor_stream_t *stream, int64_t val)
 Serializes a signed 64 bit value. More...
 
size_t cbor_deserialize_int64_t (const cbor_stream_t *stream, size_t offset, int64_t *val)
 Deserialize signed 64 bit values from stream to val. More...
 
size_t cbor_serialize_bool (cbor_stream_t *stream, bool val)
 Serializes a boolean value. More...
 
size_t cbor_deserialize_bool (const cbor_stream_t *stream, size_t offset, bool *val)
 Deserialize boolean values from stream to val. More...
 
size_t cbor_serialize_byte_string (cbor_stream_t *stream, const char *val)
 Serializes a signed 64 bit value. More...
 
size_t cbor_serialize_byte_stringl (cbor_stream_t *stream, const char *val, size_t length)
 Serializes an arbitrary byte string. More...
 
size_t cbor_deserialize_byte_string (const cbor_stream_t *stream, size_t offset, char *val, size_t length)
 Deserialize bytes from stream to val. More...
 
size_t cbor_serialize_unicode_string (cbor_stream_t *stream, const char *val)
 Serializes a unicode string. More...
 
size_t cbor_deserialize_byte_string_no_copy (const cbor_stream_t *stream, size_t offset, unsigned char **val, size_t *length)
 Deserialize bytes from stream to val (without copy) More...
 
size_t cbor_deserialize_unicode_string_no_copy (const cbor_stream_t *stream, size_t offset, unsigned char **val, size_t *length)
 Deserialize unicode string from stream to val (without copy) More...
 
size_t cbor_deserialize_unicode_string (const cbor_stream_t *stream, size_t offset, char *val, size_t length)
 Deserialize unicode string from stream to val. More...
 
size_t cbor_serialize_array (cbor_stream_t *stream, size_t array_length)
 Serialize array of length array_length. More...
 
size_t cbor_deserialize_array (const cbor_stream_t *stream, size_t offset, size_t *array_length)
 Deserialize array of items. More...
 
size_t cbor_serialize_array_indefinite (cbor_stream_t *stream)
 Serialize array of infite length. More...
 
size_t cbor_deserialize_array_indefinite (const cbor_stream_t *stream, size_t offset)
 Deserialize array of items. More...
 
size_t cbor_serialize_map (cbor_stream_t *stream, size_t map_length)
 Serialize map of length map_length. More...
 
size_t cbor_deserialize_map (const cbor_stream_t *stream, size_t offset, size_t *map_length)
 Deserialize map of items. More...
 
size_t cbor_serialize_map_indefinite (cbor_stream_t *stream)
 Serialize map of infite length. More...
 
size_t cbor_deserialize_map_indefinite (const cbor_stream_t *stream, size_t offset)
 Deserialize map of items. More...
 
size_t cbor_write_break (cbor_stream_t *stream)
 Write a break symbol at the current offset in stream stream. More...
 
bool cbor_at_break (const cbor_stream_t *stream, size_t offset)
 Whether we are at a break symbol in stream stream at offset offset. More...
 
bool cbor_at_end (const cbor_stream_t *stream, size_t offset)
 Whether we are at the end of the stream stream at offset offset. More...