TinyCBOR 0.5.2 API
Typedefs | Enumerations | Functions | Variables
Global constants

Constants used by all TinyCBOR function groups. More...

Typedefs

typedef uint64_t CborTag
 This typedef is an unsigned 64-bit integer. More...
 

Enumerations

enum  CborType
 The CborType enum contains the types known to TinyCBOR. More...
 
enum  CborKnownTags
 The CborKnownTags enum contains known tags specified in RFC 7049, for use by the application. More...
 
enum  CborError
 The CborError enum contains the possible error values used by the CBOR encoder and decoder. More...
 

Functions

const char * cbor_error_string (CborError error)
 Returns the error string corresponding to the CBOR error condition error.
 

Variables

static const size_t CborIndefiniteLength = ((size_t)-1)
 This variable is a constant used to indicate that the length of the map or array is not yet determined. More...
 

Detailed Description

Constants used by all TinyCBOR function groups.

Typedef Documentation

◆ CborTag

This typedef is an unsigned 64-bit integer.

Known CBOR tags can be used from the CborKnownTags enum but the user application may use other tag values than the ones specified in RFC 7049.

Enumeration Type Documentation

◆ CborError

enum CborError

The CborError enum contains the possible error values used by the CBOR encoder and decoder.

TinyCBOR functions report success by returning CborNoError, or one error condition by returning one of the values below. One exception is the out-of-memory condition (CborErrorOutOfMemory), which the functions for Encoding to CBOR may report in bit-wise OR with other conditions.

This technique allows code to determine whether the only error condition was a lack of buffer space, which may not be a fatal condition if the buffer can be resized. Additionally, the functions for Encoding to CBOR may continue to be used even after CborErrorOutOfMemory is returned, and instead they will simply calculate the extra space needed.

  • CborNoError No error occurred CborUnknownError
  • CborErrorUnknownLength Request for the length of an array, map or string whose length is not provided in the CBOR stream
  • CborErrorAdvancePastEOF Not enough data in the stream to decode item (decoding would advance past end of stream)
  • CborErrorIO An I/O error occurred, probably due to an out-of-memory situation
  • CborErrorGarbageAtEnd Bytes exist past the end of the CBOR stream
  • CborErrorUnexpectedEOF End of stream reached unexpectedly
  • CborErrorUnexpectedBreak A CBOR break byte was found where not expected
  • CborErrorUnknownType An unknown type (future extension to CBOR) was found in the stream
  • CborErrorIllegalType An invalid type was found while parsing a chunked CBOR string
  • CborErrorIllegalNumber An illegal initial byte (encoding unspecified additional information) was found
  • CborErrorIllegalSimpleType An illegal encoding of a CBOR Simple Type of value less than 32 was found CborErrorUnknownSimpleType CborErrorUnknownTag CborErrorInappropriateTagForType CborErrorDuplicateObjectKeys
  • CborErrorInvalidUtf8TextString Illegal UTF-8 encoding found while parsing CBOR Text String
  • CborErrorTooManyItems Too many items were added to CBOR map or array of pre-determined length
  • CborErrorTooFewItems Too few items were added to CBOR map or array of pre-determined length
  • CborErrorDataTooLarge Data item size exceeds TinyCBOR's implementation limits
  • CborErrorNestingTooDeep Data item nesting exceeds TinyCBOR's implementation limits CborErrorUnsupportedType
  • CborErrorJsonObjectKeyIsAggregate Conversion to JSON failed because the key in a map is a CBOR map or array
  • CborErrorJsonObjectKeyNotString Conversion to JSON failed because the key in a map is not a text string
  • CborErrorOutOfMemory During CBOR encoding, the buffer provided is insufficient for encoding the data item; in other situations, TinyCBOR failed to allocate memory
  • CborErrorInternalError An internal error occurred in TinyCBOR

◆ CborKnownTags

The CborKnownTags enum contains known tags specified in RFC 7049, for use by the application.

TinyCBOR does not usually interpret the meaning of these tags and does not add them to the output stream, unless specifically instructed to do so in functions for that effect.

  • CborDateTimeStringTag Text string contains a date-time encoded in RFC 3339 format, "YYYY-MM-DD hh:mm:ss+zzzz"
  • CborUnixTime_tTag Number is a Unix time_t quantity, the number of seconds since 1970-01-01 midnight UTC
  • CborPositiveBignumTag Item is a CBOR byte string encoding a positive integer of arbitrary precision
  • CborNegativeBignumTag Item is a CBOR byte string encoding a negative integer of arbitrary precision
  • CborDecimalTag Item is a CBOR array of two integers encoding a fixed-point decimal
  • CborBigfloatTag Item is a bigfloat
  • CborExpectedBase64urlTag Item is a CBOR byte string that is expected to be encoded as Base64Url
  • CborExpectedBase64Tag Item is a CBOR byte string that is expected to be encoded as Base64
  • CborExpectedBase16Tag Item is a CBOR byte string that is expected to be encoded as Base16 (also known as "hexdump")
  • CborUriTag Item is a CBOR text string containing a URI (RFC 3986) or IRI (RFC 3987)
  • CborBase64urlTag Item is a CBOR text string that was encoded as Base64Url
  • CborBase64Tag Item is a CBOR text string that was encoded as Base64
  • CborRegularExpressionTag Item is a CBOR text string containing a regular expression
  • CborMimeMessageTag Item is a CBOR text string containing a MIME message (RFC 2045, 2046, 2047, 2822)
  • CborSignatureTag Item contains CBOR-encoded data. This tag is also used as "file magic," marking a file as containing CBOR

◆ CborType

enum CborType

The CborType enum contains the types known to TinyCBOR.

  • CborIntegerType Type is an integer value, positive, negative or zero
  • CborByteStringType Type is a string of arbitrary raw bytes
  • CborTextStringType Type is a text string encoded in UTF-8
  • CborArrayType Type is a CBOR array
  • CborMapType Type is a CBOR map (an associative container with key and value pairs)
  • CborTagType Type is a CBOR tag (a 64-bit integer describing the item that follows, see CborKnownTags)
  • CborSimpleType Type is one of the CBOR Simple Types
  • CborBooleanType Type is a boolean (true or false)
  • CborNullType Type encodes a null
  • CborUndefinedType Type encodes an undefined value
  • CborHalfFloatType Type is an IEEE 754 half precision (16-bit) floating point type
  • CborFloatType Type is an IEEE 754 single precision (32-bit) floating point type
  • CborDoubleType Type is an IEEE 754 double precision (64-bit) floating point type
  • CborInvalidType Type is not valid (this value is used to indicate error conditions)

Variable Documentation

◆ CborIndefiniteLength

size_t CborIndefiniteLength = ((size_t)-1)
static

This variable is a constant used to indicate that the length of the map or array is not yet determined.

It is used in functions cbor_encoder_create_map() and cbor_encoder_create_array()

Referenced by cbor_encoder_create_map().