45 unsigned char ** buffer,
65 if (tmp_bfr == NULL) {
72 *buffer_size = bfr_size;
116 if (written && (buffer_size - written >= length)) {
118 return written + length;
130 for (
size_t i = 0; i < chunk_count; i++) {
132 if (chunk_written == 0)
135 written += chunk_written;
150 if (written && (buffer_size - written >= length)) {
152 return written + length;
164 for (
size_t i = 0; i < chunk_count; i++) {
166 if (chunk_written == 0)
169 written += chunk_written;
194 for (
size_t i = 0; i < size; i++) {
195 item_written =
cbor_serialize(*(handle++), buffer + written, buffer_size - written);
196 if (item_written == 0)
199 written += item_written;
207 if (item_written == 0)
231 for (
size_t i = 0; i < size; i++) {
232 item_written =
cbor_serialize(handle->
key, buffer + written, buffer_size - written);
233 if (item_written == 0)
236 written += item_written;
238 if (item_written == 0)
241 written += item_written;
249 if (item_written == 0)
264 if (item_written == 0)
267 return written + item_written;
size_t cbor_encode_map_start(size_t length, unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_break(unsigned char *buffer, size_t buffer_size)
bool cbor_bytestring_is_definite(const cbor_item_t *item)
Is the byte string definite?
size_t cbor_serialize_uint(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize an uint.
size_t cbor_encode_half(float value, unsigned char *buffer, size_t buffer_size)
Encodes a half-precision float.
cbor_int_width cbor_int_get_width(const cbor_item_t *item)
Queries the integer width.
Internal use - ctrl and special values.
size_t cbor_serialize_map(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a map.
unsigned char * cbor_string_handle(const cbor_item_t *item)
Get the handle to the underlying string.
size_t cbor_encode_indef_array_start(unsigned char *buffer, size_t buffer_size)
size_t cbor_serialize_bytestring(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a bytestring.
bool cbor_isa_negint(const cbor_item_t *item)
Does the item have the appropriate major type?
size_t cbor_encode_string_start(size_t length, unsigned char *buffer, size_t buffer_size)
bool cbor_isa_string(const cbor_item_t *item)
Does the item have the appropriate major type?
size_t cbor_encode_negint32(uint32_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_bytestring_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
cbor_item_t ** cbor_string_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
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.
bool cbor_isa_bytestring(const cbor_item_t *item)
Does the item have the appropriate major type?
size_t cbor_encode_ctrl(uint8_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_map_size(const cbor_item_t *item)
Get the number of pairs.
cbor_item_t ** cbor_bytestring_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
bool cbor_bytestring_is_indefinite(const cbor_item_t *item)
Is the byte string indefinite?
size_t cbor_encode_negint8(uint8_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_serialize_string(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a string.
size_t cbor_encode_uint64(uint64_t value, unsigned char *buffer, size_t buffer_size)
7 - decimals and special values (true, false, nil, ...)
uint32_t cbor_get_uint32(const cbor_item_t *item)
Extracts the integer value.
bool cbor_map_is_indefinite(const cbor_item_t *item)
Is this map indefinite?
Simple pair of items for use in maps.
bool cbor_array_is_definite(const cbor_item_t *item)
Is the array definite?
uint16_t cbor_get_uint16(const cbor_item_t *item)
Extracts the integer value.
size_t cbor_encode_single(float value, unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_indef_map_start(unsigned char *buffer, size_t buffer_size)
size_t cbor_serialize_tag(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a tag.
size_t cbor_encode_double(double value, unsigned char *buffer, size_t buffer_size)
size_t cbor_string_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
size_t cbor_serialize_float_ctrl(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a.
size_t cbor_serialize_array(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize an array.
size_t cbor_array_size(const cbor_item_t *item)
Get the number of members.
size_t cbor_encode_array_start(size_t length, unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_uint8(uint8_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_uint16(uint16_t value, unsigned char *buffer, size_t buffer_size)
uint8_t cbor_get_uint8(const cbor_item_t *item)
Extracts the integer value.
float cbor_float_get_float4(const cbor_item_t *item)
Get a single precision float.
uint64_t cbor_get_uint64(const cbor_item_t *item)
Extracts the integer value.
uint8_t cbor_ctrl_value(const cbor_item_t *item)
Reads the control value.
cbor_float_width cbor_float_get_width(const cbor_item_t *item)
Get the float width.
bool cbor_isa_float_ctrl(const cbor_item_t *item)
Does the item have the appropriate major type?
bool cbor_isa_array(const cbor_item_t *item)
Does the item have the appropriate major type?
bool cbor_isa_map(const cbor_item_t *item)
Does the item have the appropriate major type?
bool cbor_map_is_definite(const cbor_item_t *item)
Is this map definite?
float cbor_float_get_float2(const cbor_item_t *item)
Get a half precision float.
bool cbor_isa_uint(const cbor_item_t *item)
Does the item have the appropriate major type?
double cbor_float_get_float8(const cbor_item_t *item)
Get a double precision float.
bool cbor_isa_tag(const cbor_item_t *item)
Does the item have the appropriate major type?
size_t cbor_encode_negint64(uint64_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_uint32(uint32_t value, unsigned char *buffer, size_t buffer_size)
cbor_type cbor_typeof(const cbor_item_t *item)
Get the type of the item.
bool cbor_string_is_definite(const cbor_item_t *item)
Is the string definite?
unsigned char * cbor_bytestring_handle(const cbor_item_t *item)
Get the handle to the binary data.
size_t cbor_encode_indef_string_start(unsigned char *buffer, size_t buffer_size)
size_t cbor_serialize(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize the given item.
size_t cbor_string_length(const cbor_item_t *item)
Returns the length of the underlying string.
size_t cbor_encode_bytestring_start(size_t length, unsigned char *buffer, size_t buffer_size)
bool _cbor_safe_to_multiply(size_t a, size_t b)
Can a and b be multiplied without overflowing size_t?
size_t cbor_encode_indef_bytestring_start(unsigned char *buffer, size_t buffer_size)
size_t cbor_encode_negint16(uint16_t value, unsigned char *buffer, size_t buffer_size)
struct cbor_pair * cbor_map_handle(const cbor_item_t *item)
Get the pairs storage.
bool cbor_array_is_indefinite(const cbor_item_t *item)
Is the array indefinite?
size_t cbor_bytestring_length(const cbor_item_t *item)
Returns the length of the binary data.
size_t cbor_encode_tag(uint64_t value, unsigned char *buffer, size_t buffer_size)
size_t cbor_serialize_negint(const cbor_item_t *item, unsigned char *buffer, size_t buffer_size)
Serialize a negint.
cbor_item_t ** cbor_array_handle(const cbor_item_t *item)
Get the array contents.
bool cbor_string_is_indefinite(const cbor_item_t *item)
Is the string indefinite?