8 #ifndef LIBCBOR_COMMON_H     9 #define LIBCBOR_COMMON_H    17 #include "cbor/configuration.h"    28 #define CBOR_RESTRICT_POINTER    33 #define CBOR_RESTRICT_POINTER CBOR_RESTRICT_SPECIFIER    37 static const uint8_t cbor_major_version = CBOR_MAJOR_VERSION;
    38 static const uint8_t cbor_minor_version = CBOR_MINOR_VERSION;
    39 static const uint8_t cbor_patch_version = CBOR_PATCH_VERSION;
    41 #define CBOR_VERSION TO_STR(CBOR_MAJOR_VERSION) "." TO_STR(CBOR_MINOR_VERSION) "." TO_STR(CBOR_PATCH_VERSION)    42 #define CBOR_HEX_VERSION ((CBOR_MAJOR_VERSION << 16) | (CBOR_MINOR_VERSION << 8) | CBOR_PATCH_VERSION)    48 #define debug_print(fmt, ...) do { \    50         fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__); \    53 #define debug_print(fmt, ...) do {} while (0)    57 #define TO_STR(x) TO_STR_(x)     61 typedef void * (* _cbor_malloc_t)(size_t);
    62 typedef void * (* _cbor_realloc_t)(
void *, size_t);
    84 #define _CBOR_MALLOC _cbor_malloc    85 #define _CBOR_REALLOC _cbor_realloc    86 #define _CBOR_FREE _cbor_free    90 #define _CBOR_MALLOC malloc    91 #define _CBOR_REALLOC realloc    92 #define _CBOR_FREE free   261 #endif //LIBCBOR_COMMON_H void(* _cbor_free_t)(void *)
void cbor_decref(cbor_item_t **item)
Decreases the reference count by one, deallocating the item if needed. 
void cbor_intermediate_decref(cbor_item_t *item)
Decreases the reference count by one, deallocating the item if needed. 
bool cbor_isa_string(const cbor_item_t *item)
Does the item have the appropriate major type? 
cbor_item_t * cbor_move(cbor_item_t *item)
Provides CPP-like move construct. 
bool cbor_is_undef(const cbor_item_t *item)
Does this item represent undefined 
bool cbor_isa_negint(const cbor_item_t *item)
Does the item have the appropriate major type? 
void *(* _cbor_realloc_t)(void *, size_t)
cbor_item_t * cbor_incref(cbor_item_t *item)
Increases the reference count by one. 
bool cbor_isa_tag(const cbor_item_t *item)
Does the item have the appropriate major type? 
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_uint(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? 
void cbor_set_allocs(_cbor_malloc_t custom_malloc, _cbor_realloc_t custom_realloc, _cbor_free_t custom_free)
Sets the memory management routines to use. 
void *(* _cbor_malloc_t)(size_t)
cbor_type
Specifies the Major type of cbor_item_t. 
bool cbor_is_bool(const cbor_item_t *item)
Is the item an a boolean? 
bool cbor_is_float(const cbor_item_t *item)
Is the item an a floating point number? 
_cbor_malloc_t _cbor_malloc
bool cbor_is_int(const cbor_item_t *item)
Is the item an integer, either positive or negative? 
bool cbor_isa_bytestring(const cbor_item_t *item)
Does the item have the appropriate major type? 
cbor_type cbor_typeof(const cbor_item_t *item)
Get the type of the item. 
bool cbor_is_null(const cbor_item_t *item)
Does this item represent null 
_cbor_realloc_t _cbor_realloc
size_t cbor_refcount(const cbor_item_t *item)
Get the reference count.