libcbor 0.12.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Loading...
Searching...
No Matches
data.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  _cbor_int_metadata
 Integers specific metadata. More...
 
struct  _cbor_bytestring_metadata
 Bytestrings specific metadata. More...
 
struct  _cbor_string_metadata
 Strings specific metadata. More...
 
struct  _cbor_array_metadata
 Arrays specific metadata. More...
 
struct  _cbor_map_metadata
 Maps specific metadata. More...
 
struct  _cbor_tag_metadata
 Arrays specific metadata. More...
 
struct  _cbor_float_ctrl_metadata
 Floats specific metadata - includes CTRL values. More...
 
union  _cbor_float_helper
 Raw memory casts helper. More...
 
union  _cbor_double_helper
 Raw memory casts helper. More...
 
union  cbor_item_metadata
 Union of metadata across all possible types - discriminated in cbor_item_t. More...
 
struct  cbor_item_t
 The item handle. More...
 
struct  cbor_indefinite_string_data
 Defines cbor_item_t::data structure for indefinite strings and bytestrings. More...
 
struct  cbor_error
 High-level decoding error. More...
 
struct  cbor_pair
 Simple pair of items for use in maps. More...
 
struct  cbor_load_result
 High-level decoding result. More...
 
struct  cbor_decoder_result
 Streaming decoder result. More...
 

Typedefs

typedef const unsigned char * cbor_data
 
typedef unsigned char * cbor_mutable_data
 
typedef enum cbor_type cbor_type
 Specifies the Major type of cbor_item_t.
 
typedef struct cbor_item_t cbor_item_t
 The item handle.
 

Enumerations

enum  cbor_type {
  CBOR_TYPE_UINT , CBOR_TYPE_NEGINT , CBOR_TYPE_BYTESTRING , CBOR_TYPE_STRING ,
  CBOR_TYPE_ARRAY , CBOR_TYPE_MAP , CBOR_TYPE_TAG , CBOR_TYPE_FLOAT_CTRL
}
 Specifies the Major type of cbor_item_t. More...
 
enum  cbor_error_code {
  CBOR_ERR_NONE , CBOR_ERR_NOTENOUGHDATA , CBOR_ERR_NODATA , CBOR_ERR_MALFORMATED ,
  CBOR_ERR_MEMERROR , CBOR_ERR_SYNTAXERROR
}
 Possible decoding errors. More...
 
enum  cbor_int_width { CBOR_INT_8 , CBOR_INT_16 , CBOR_INT_32 , CBOR_INT_64 }
 Possible widths of CBOR_TYPE_UINT items. More...
 
enum  cbor_float_width { CBOR_FLOAT_0 , CBOR_FLOAT_16 , CBOR_FLOAT_32 , CBOR_FLOAT_64 }
 Possible widths of CBOR_TYPE_FLOAT_CTRL items. More...
 
enum  _cbor_dst_metadata { _CBOR_METADATA_DEFINITE , _CBOR_METADATA_INDEFINITE }
 Metadata for dynamically sized types. More...
 
enum  _cbor_ctrl {
  CBOR_CTRL_NONE = 0 , CBOR_CTRL_FALSE = 20 , CBOR_CTRL_TRUE = 21 , CBOR_CTRL_NULL = 22 ,
  CBOR_CTRL_UNDEF = 23
}
 Semantic mapping for CTRL simple values. More...
 
enum  cbor_decoder_status { CBOR_DECODER_FINISHED , CBOR_DECODER_NEDATA , CBOR_DECODER_ERROR }
 Streaming decoder result - status. More...
 

Typedef Documentation

◆ cbor_data

typedef const unsigned char* cbor_data

Definition at line 20 of file data.h.

◆ cbor_item_t

typedef struct cbor_item_t cbor_item_t

The item handle.

◆ cbor_mutable_data

typedef unsigned char* cbor_mutable_data

Definition at line 21 of file data.h.

◆ cbor_type

typedef enum cbor_type cbor_type

Specifies the Major type of cbor_item_t.

Enumeration Type Documentation

◆ _cbor_ctrl

enum _cbor_ctrl

Semantic mapping for CTRL simple values.

Enumerator
CBOR_CTRL_NONE 
CBOR_CTRL_FALSE 
CBOR_CTRL_TRUE 
CBOR_CTRL_NULL 
CBOR_CTRL_UNDEF 

Definition at line 83 of file data.h.

◆ _cbor_dst_metadata

Metadata for dynamically sized types.

Enumerator
_CBOR_METADATA_DEFINITE 
_CBOR_METADATA_INDEFINITE 

Definition at line 77 of file data.h.

◆ cbor_decoder_status

Streaming decoder result - status.

Enumerator
CBOR_DECODER_FINISHED 

Decoding finished successfully (a callback has been invoked)

Note that this does not mean that the buffer has been fully decoded; there may still be unread bytes for which no callback has been involved.

CBOR_DECODER_NEDATA 

Not enough data to invoke a callback.

CBOR_DECODER_ERROR 

Bad data (reserved MTB, malformed value, etc.)

Definition at line 214 of file data.h.

◆ cbor_error_code

Possible decoding errors.

Enumerator
CBOR_ERR_NONE 
CBOR_ERR_NOTENOUGHDATA 
CBOR_ERR_NODATA 
CBOR_ERR_MALFORMATED 
CBOR_ERR_MEMERROR 

Memory error - item allocation failed.

Is it too big for your allocator?

CBOR_ERR_SYNTAXERROR 

Stack parsing algorithm failed.

Definition at line 44 of file data.h.

◆ cbor_float_width

Possible widths of CBOR_TYPE_FLOAT_CTRL items.

Enumerator
CBOR_FLOAT_0 

Internal use - ctrl and special values.

CBOR_FLOAT_16 

Half float.

CBOR_FLOAT_32 

Single float.

CBOR_FLOAT_64 

Double.

Definition at line 66 of file data.h.

◆ cbor_int_width

Possible widths of CBOR_TYPE_UINT items.

Enumerator
CBOR_INT_8 
CBOR_INT_16 
CBOR_INT_32 
CBOR_INT_64 

Definition at line 58 of file data.h.

◆ cbor_type

enum cbor_type

Specifies the Major type of cbor_item_t.

Enumerator
CBOR_TYPE_UINT 

0 - positive integers

CBOR_TYPE_NEGINT 

1 - negative integers

CBOR_TYPE_BYTESTRING 

2 - byte strings

CBOR_TYPE_STRING 

3 - strings

CBOR_TYPE_ARRAY 

4 - arrays

CBOR_TYPE_MAP 

5 - maps

CBOR_TYPE_TAG 

6 - tags

CBOR_TYPE_FLOAT_CTRL 

7 - decimals and special values (true, false, nil, ...)

Definition at line 24 of file data.h.