QtBase  v6.3.1
cbor.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 Intel Corporation
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included in
13 ** all copies or substantial portions of the Software.
14 **
15 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 ** THE SOFTWARE.
22 **
23 ****************************************************************************/
24 
25 #ifndef CBOR_H
26 #define CBOR_H
27 
28 #ifndef assert
29 #include <assert.h>
30 #endif
31 #include <limits.h>
32 #include <stddef.h>
33 #include <stdint.h>
34 #include <string.h>
35 #include <stdio.h>
36 
37 #include "tinycbor-version.h"
38 
39 #define TINYCBOR_VERSION ((TINYCBOR_VERSION_MAJOR << 16) | (TINYCBOR_VERSION_MINOR << 8) | TINYCBOR_VERSION_PATCH)
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #else
44 #include <stdbool.h>
45 #endif
46 
47 #ifndef SIZE_MAX
48 /* Some systems fail to define SIZE_MAX in <stdint.h>, even though C99 requires it...
49  * Conversion from signed to unsigned is defined in 6.3.1.3 (Signed and unsigned integers) p2,
50  * which says: "the value is converted by repeatedly adding or subtracting one more than the
51  * maximum value that can be represented in the new type until the value is in the range of the
52  * new type."
53  * So -1 gets converted to size_t by adding SIZE_MAX + 1, which results in SIZE_MAX.
54  */
55 # define SIZE_MAX ((size_t)-1)
56 #endif
57 
58 #ifndef CBOR_API
59 # define CBOR_API
60 #endif
61 #ifndef CBOR_PRIVATE_API
62 # define CBOR_PRIVATE_API
63 #endif
64 #ifndef CBOR_INLINE_API
65 # if defined(__cplusplus)
66 # define CBOR_INLINE inline
67 # define CBOR_INLINE_API inline
68 # else
69 # define CBOR_INLINE_API static CBOR_INLINE
70 # if defined(_MSC_VER)
71 # define CBOR_INLINE __inline
72 # elif defined(__GNUC__)
73 # define CBOR_INLINE __inline__
74 # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
75 # define CBOR_INLINE inline
76 # else
77 # define CBOR_INLINE
78 # endif
79 # endif
80 #endif
81 
82 typedef enum CborType {
86  CborArrayType = 0x80,
87  CborMapType = 0xa0,
88  CborTagType = 0xc0,
91  CborNullType = 0xf6,
94  CborFloatType = 0xfa,
96 
97  CborInvalidType = 0xff /* equivalent to the break byte, so it will never be used */
99 
100 typedef uint64_t CborTag;
101 typedef enum CborKnownTags {
123  CborSignatureTag = 55799
125 
126 /* #define the constants so we can check with #ifdef */
127 #define CborDateTimeStringTag CborDateTimeStringTag
128 #define CborUnixTime_tTag CborUnixTime_tTag
129 #define CborPositiveBignumTag CborPositiveBignumTag
130 #define CborNegativeBignumTag CborNegativeBignumTag
131 #define CborDecimalTag CborDecimalTag
132 #define CborBigfloatTag CborBigfloatTag
133 #define CborCOSE_Encrypt0Tag CborCOSE_Encrypt0Tag
134 #define CborCOSE_Mac0Tag CborCOSE_Mac0Tag
135 #define CborCOSE_Sign1Tag CborCOSE_Sign1Tag
136 #define CborExpectedBase64urlTag CborExpectedBase64urlTag
137 #define CborExpectedBase64Tag CborExpectedBase64Tag
138 #define CborExpectedBase16Tag CborExpectedBase16Tag
139 #define CborEncodedCborTag CborEncodedCborTag
140 #define CborUrlTag CborUrlTag
141 #define CborBase64urlTag CborBase64urlTag
142 #define CborBase64Tag CborBase64Tag
143 #define CborRegularExpressionTag CborRegularExpressionTag
144 #define CborMimeMessageTag CborMimeMessageTag
145 #define CborCOSE_EncryptTag CborCOSE_EncryptTag
146 #define CborCOSE_MacTag CborCOSE_MacTag
147 #define CborCOSE_SignTag CborCOSE_SignTag
148 #define CborSignatureTag CborSignatureTag
149 
150 /* Error API */
151 
152 typedef enum CborError {
154 
155  /* errors in all modes */
157  CborErrorUnknownLength, /* request for length in array, map, or string with indeterminate length */
160 
161  /* parser errors streaming errors */
165  CborErrorUnknownType, /* can only happen in major type 7 */
166  CborErrorIllegalType, /* type not allowed here */
168  CborErrorIllegalSimpleType, /* types of value less than 32 encoded in two bytes */
170 
171  /* parser errors in strict mode parsing only */
184 
185  /* encoder errors */
188 
189  /* internal implementation errors */
194 
195  /* errors in converting to JSON */
199 
200  CborErrorOutOfMemory = (int) (~0U / 2 + 1),
201  CborErrorInternalError = (int) (~0U / 2) /* INT_MAX on two's complement machines */
203 
205 
206 /* Encoder API */
207 
209 {
213 
214 typedef CborError (*CborEncoderWriteFunction)(void *, const void *, size_t, CborEncoderAppendType);
215 
217 {
220 };
221 
223 {
224  union {
225  uint8_t *ptr;
226  ptrdiff_t bytes_needed;
228  } data;
229  uint8_t *end;
230  size_t remaining;
231  int flags;
232 };
233 typedef struct CborEncoder CborEncoder;
234 
235 static const size_t CborIndefiniteLength = SIZE_MAX;
236 
237 #ifndef CBOR_NO_ENCODER_API
238 CBOR_API void cbor_encoder_init(CborEncoder *encoder, uint8_t *buffer, size_t size, int flags);
242 CBOR_API CborError cbor_encode_negative_int(CborEncoder *encoder, uint64_t absolute_value);
245 CBOR_API CborError cbor_encode_text_string(CborEncoder *encoder, const char *string, size_t length);
247 { return cbor_encode_text_string(encoder, string, strlen(string)); }
248 CBOR_API CborError cbor_encode_byte_string(CborEncoder *encoder, const uint8_t *string, size_t length);
250 
252 { return cbor_encode_simple_value(encoder, (int)value - 1 + (CborBooleanType & 0x1f)); }
254 { return cbor_encode_simple_value(encoder, CborNullType & 0x1f); }
256 { return cbor_encode_simple_value(encoder, CborUndefinedType & 0x1f); }
257 
262 { return cbor_encode_floating_point(encoder, CborFloatType, &value); }
264 { return cbor_encode_floating_point(encoder, CborDoubleType, &value); }
265 
266 CBOR_API CborError cbor_encoder_create_array(CborEncoder *parentEncoder, CborEncoder *arrayEncoder, size_t length);
267 CBOR_API CborError cbor_encoder_create_map(CborEncoder *parentEncoder, CborEncoder *mapEncoder, size_t length);
268 CBOR_API CborError cbor_encoder_close_container(CborEncoder *parentEncoder, const CborEncoder *containerEncoder);
270 
272 {
273  return encoder->data.ptr;
274 }
275 
276 CBOR_INLINE_API size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t *buffer)
277 {
278  return (size_t)(encoder->data.ptr - buffer);
279 }
280 
282 {
283  return encoder->end ? 0 : (size_t)encoder->data.bytes_needed;
284 }
285 #endif /* CBOR_NO_ENCODER_API */
286 
287 /* Parser API */
288 
290 {
292 };
293 
295 {
296  /* used for all types, but not during string chunk iteration
297  * (values are static-asserted, don't change) */
300 
301  /* used only for CborIntegerType */
303 
304  /* used only during string iteration */
307 
308  /* used for arrays, maps and strings, including during chunk iteration */
310 
311  /* used for maps, but must be kept for all types
312  * (ContainerIsMap value must be CborMapType - CborArrayType) */
315 };
316 
317 struct CborValue;
319 {
320  bool (*can_read_bytes)(void *token, size_t len);
321  void *(*read_bytes)(void *token, void *dst, size_t offset, size_t len);
322  void (*advance_bytes)(void *token, size_t len);
323  CborError (*transfer_string)(void *token, const void **userptr, size_t offset, size_t len);
324 };
325 
327 {
328  union {
329  const uint8_t *end;
330  const struct CborParserOperations *ops;
333 };
334 typedef struct CborParser CborParser;
335 
336 struct CborValue
337 {
339  union {
340  const uint8_t *ptr;
341  void *token;
343  uint32_t remaining;
344  uint16_t extra;
345  uint8_t type;
346  uint8_t flags;
347 };
348 typedef struct CborValue CborValue;
349 
350 #ifndef CBOR_NO_PARSER_API
351 CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it);
353 
355 
357 { return it->remaining == 0; }
359 { return it->source.ptr; }
364 { return it->type == CborArrayType || it->type == CborMapType; }
367 
370 {
373 }
374 
376 { return value && value->type != CborInvalidType; }
378 { return (CborType)value->type; }
379 
380 /* Null & undefined type */
382 { return value->type == CborNullType; }
384 { return value->type == CborUndefinedType; }
385 
386 /* Booleans */
388 { return value->type == CborBooleanType; }
390 {
392  *result = !!value->extra;
393  return CborNoError;
394 }
395 
396 /* Simple types */
398 { return value->type == CborSimpleType; }
400 {
402  *result = (uint8_t)value->extra;
403  return CborNoError;
404 }
405 
406 /* Integers */
408 { return value->type == CborIntegerType; }
413 
415 {
418  return CborNoError;
419 }
420 
422 {
425  return CborNoError;
426 }
427 
429 {
433  *result = -*result - 1;
434  return CborNoError;
435 }
436 
438 {
442  *result = -*result - 1;
443  return CborNoError;
444 }
445 
448 
450 { return (value->flags & CborIteratorFlag_UnknownLength) == 0; }
451 
452 /* Tags */
454 { return value->type == CborTagType; }
456 {
459  return CborNoError;
460 }
462 
463 /* Strings */
465 { return value->type == CborByteStringType; }
467 { return value->type == CborTextStringType; }
468 
470 {
471  uint64_t v;
474  return CborErrorUnknownLength;
476  *length = (size_t)v;
477  if (*length != v)
478  return CborErrorDataTooLarge;
479  return CborNoError;
480 }
481 
483  size_t *buflen, CborValue *next);
485  size_t *buflen, CborValue *next);
486 
488 
490  size_t *buflen, CborValue *next)
491 {
493  return _cbor_value_copy_string(value, buffer, buflen, next);
494 }
496  size_t *buflen, CborValue *next)
497 {
499  return _cbor_value_copy_string(value, buffer, buflen, next);
500 }
501 
503  size_t *buflen, CborValue *next)
504 {
506  return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
507 }
509  size_t *buflen, CborValue *next)
510 {
512  return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
513 }
514 
517 {
520 }
521 
523 {
524  size_t dummy;
526 }
527 
530 {
534 }
535 
538 {
541 }
542 
544  size_t *len, CborValue *next);
546  size_t *len, CborValue *next)
547 {
549  return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, next);
550 }
552  size_t *len, CborValue *next)
553 {
555  return _cbor_value_get_string_chunk(value, (const void **)bufferptr, len, next);
556 }
557 
558 CBOR_API CborError cbor_value_text_string_equals(const CborValue *value, const char *string, bool *result);
559 
560 /* Maps and arrays */
562 { return value->type == CborArrayType; }
564 { return value->type == CborMapType; }
565 
567 {
568  uint64_t v;
571  return CborErrorUnknownLength;
573  *length = (size_t)v;
574  if (*length != v)
575  return CborErrorDataTooLarge;
576  return CborNoError;
577 }
578 
580 {
581  uint64_t v;
584  return CborErrorUnknownLength;
586  *length = (size_t)v;
587  if (*length != v)
588  return CborErrorDataTooLarge;
589  return CborNoError;
590 }
591 
592 CBOR_API CborError cbor_value_map_find_value(const CborValue *map, const char *string, CborValue *element);
593 
594 /* Floating point */
596 { return value->type == CborHalfFloatType; }
599 {
602 
603  /* size has already been computed */
604  memcpy(result, &value->extra, sizeof(value->extra));
605  return CborNoError;
606 }
607 
609 { return value->type == CborFloatType; }
611 {
612  uint32_t data;
616  memcpy(result, &data, sizeof(*result));
617  return CborNoError;
618 }
619 
621 { return value->type == CborDoubleType; }
623 {
624  uint64_t data;
628  memcpy(result, &data, sizeof(*result));
629  return CborNoError;
630 }
631 
632 /* Validation API */
633 #ifndef CBOR_NO_VALIDATION_API
634 
636  /* Bit mapping:
637  * bits 0-7 (8 bits): canonical format
638  * bits 8-11 (4 bits): canonical format & strict mode
639  * bits 12-20 (8 bits): strict mode
640  * bits 21-31 (10 bits): other
641  */
642 
648 
650 
654 
656 
659  CborValidateNoTags = 0x400000,
661  /* unused = 0x1000000, */
662  /* unused = 0x2000000, */
663 
669 
670  CborValidateCompleteData = (int)0x80000000,
671 
674 };
675 
677 #endif /* CBOR_NO_VALIDATION_API */
678 
679 /* Human-readable (dump) API */
680 #ifndef CBOR_NO_PRETTY_API
681 
685 
689 
692 
694 };
695 
696 typedef CborError (*CborStreamFunction)(void *token, const char *fmt, ...)
697 #ifdef __GNUC__
698  __attribute__((__format__(printf, 2, 3)))
699 #endif
700 ;
701 
703 
704 /* The following API requires a hosted C implementation (uses FILE*) */
705 #if !defined(__STDC_HOSTED__) || __STDC_HOSTED__-0 == 1
709 {
710  CborValue copy = *value;
712 }
713 #endif /* __STDC_HOSTED__ check */
714 
715 #endif /* CBOR_NO_PRETTY_API */
716 
717 #endif /* CBOR_NO_PARSER_API */
718 
719 #ifdef __cplusplus
720 }
721 #endif
722 
723 #endif /* CBOR_H */
724 
#define value
[5]
CBOR_INLINE_API bool cbor_value_string_iteration_at_end(const CborValue *value)
Definition: cbor.h:522
CBOR_INLINE_API CborError cbor_value_get_byte_string_chunk(const CborValue *value, const uint8_t **bufferptr, size_t *len, CborValue *next)
Definition: cbor.h:551
CBOR_INLINE_API uint8_t * _cbor_encoder_get_buffer_pointer(const CborEncoder *encoder)
Definition: cbor.h:271
CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
CBOR_INLINE_API CborError cbor_value_begin_string_iteration(CborValue *value)
Definition: cbor.h:529
#define CborBase64Tag
Definition: cbor.h:142
CborError(* CborStreamFunction)(void *token, const char *fmt,...)
Definition: cbor.h:696
#define CborPositiveBignumTag
Definition: cbor.h:129
CborEncoderAppendType
Definition: cbor.h:209
@ CborEncoderAppendStringData
Definition: cbor.h:211
@ CborEncoderAppendCborData
Definition: cbor.h:210
uint64_t CborTag
Definition: cbor.h:100
#define CborEncodedCborTag
Definition: cbor.h:139
#define CborUrlTag
Definition: cbor.h:140
CBOR_INLINE_API CborError cbor_value_get_double(const CborValue *value, double *result)
Definition: cbor.h:622
#define CborNegativeBignumTag
Definition: cbor.h:130
CBOR_API CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *token, CborValue *value, int flags)
CborType
Definition: cbor.h:82
@ CborFloatType
Definition: cbor.h:94
@ CborUndefinedType
Definition: cbor.h:92
@ CborMapType
Definition: cbor.h:87
@ CborIntegerType
Definition: cbor.h:83
@ CborByteStringType
Definition: cbor.h:84
@ CborInvalidType
Definition: cbor.h:97
@ CborNullType
Definition: cbor.h:91
@ CborDoubleType
Definition: cbor.h:95
@ CborArrayType
Definition: cbor.h:86
@ CborTagType
Definition: cbor.h:88
@ CborTextStringType
Definition: cbor.h:85
@ CborBooleanType
Definition: cbor.h:90
@ CborSimpleType
Definition: cbor.h:89
@ CborHalfFloatType
Definition: cbor.h:93
#define SIZE_MAX
Definition: cbor.h:55
#define CborUnixTime_tTag
Definition: cbor.h:128
#define CborRegularExpressionTag
Definition: cbor.h:143
#define CborDateTimeStringTag
Definition: cbor.h:127
#define CborSignatureTag
Definition: cbor.h:148
#define CBOR_PRIVATE_API
Definition: cbor.h:62
CBOR_API CborError cbor_value_validate(const CborValue *it, uint32_t flags)
CBOR_INLINE_API uint64_t _cbor_value_extract_int64_helper(const CborValue *value)
Definition: cbor.h:369
#define CborExpectedBase64Tag
Definition: cbor.h:137
#define CborCOSE_MacTag
Definition: cbor.h:146
#define CborMimeMessageTag
Definition: cbor.h:144
#define CborBigfloatTag
Definition: cbor.h:132
CBOR_INLINE_API CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer, size_t *buflen, CborValue *next)
Definition: cbor.h:508
#define CborExpectedBase64urlTag
Definition: cbor.h:136
CborError
Definition: cbor.h:152
@ CborErrorInternalError
Definition: cbor.h:201
@ CborErrorUnknownType
Definition: cbor.h:165
@ CborErrorIllegalSimpleType
Definition: cbor.h:168
@ CborErrorInvalidUtf8TextString
Definition: cbor.h:176
@ CborErrorDataTooLarge
Definition: cbor.h:190
@ CborErrorImproperValue
Definition: cbor.h:179
@ CborErrorTooFewItems
Definition: cbor.h:187
@ CborErrorUnsupportedType
Definition: cbor.h:192
@ CborErrorNestingTooDeep
Definition: cbor.h:191
@ CborErrorOverlongEncoding
Definition: cbor.h:180
@ CborErrorNoMoreStringChunks
Definition: cbor.h:169
@ CborErrorUnimplementedValidation
Definition: cbor.h:193
@ CborErrorInappropriateTagForType
Definition: cbor.h:174
@ CborErrorMapKeyNotString
Definition: cbor.h:181
@ CborErrorJsonObjectKeyIsAggregate
Definition: cbor.h:196
@ CborErrorUnknownLength
Definition: cbor.h:157
@ CborErrorAdvancePastEOF
Definition: cbor.h:158
@ CborErrorUnknownTag
Definition: cbor.h:173
@ CborErrorExcludedValue
Definition: cbor.h:178
@ CborErrorIO
Definition: cbor.h:159
@ CborErrorGarbageAtEnd
Definition: cbor.h:162
@ CborErrorMapKeysNotUnique
Definition: cbor.h:183
@ CborErrorDuplicateObjectKeys
Definition: cbor.h:175
@ CborErrorExcludedType
Definition: cbor.h:177
@ CborErrorOutOfMemory
Definition: cbor.h:200
@ CborErrorJsonObjectKeyNotString
Definition: cbor.h:197
@ CborUnknownError
Definition: cbor.h:156
@ CborErrorUnexpectedBreak
Definition: cbor.h:164
@ CborErrorMapNotSorted
Definition: cbor.h:182
@ CborErrorUnknownSimpleType
Definition: cbor.h:172
@ CborNoError
Definition: cbor.h:153
@ CborErrorIllegalType
Definition: cbor.h:166
@ CborErrorTooManyItems
Definition: cbor.h:186
@ CborErrorIllegalNumber
Definition: cbor.h:167
@ CborErrorJsonNotImplemented
Definition: cbor.h:198
@ CborErrorUnexpectedEOF
Definition: cbor.h:163
#define CborCOSE_EncryptTag
Definition: cbor.h:145
CBOR_PRIVATE_API CborError _cbor_value_dup_string(const CborValue *value, void **buffer, size_t *buflen, CborValue *next)
CBOR_INLINE_API CborError cbor_value_get_string_chunk_size(const CborValue *value, size_t *len)
Definition: cbor.h:516
#define CborDecimalTag
Definition: cbor.h:131
CborError(* CborEncoderWriteFunction)(void *, const void *, size_t, CborEncoderAppendType)
Definition: cbor.h:214
#define CBOR_INLINE_API
Definition: cbor.h:69
CBOR_API CborError cbor_value_get_half_float_as_float(const CborValue *value, float *result)
CborEncoderFlags
Definition: cbor.h:217
@ CborIteratorFlag_WriterFunction
Definition: cbor.h:218
@ CborIteratorFlag_ContainerIsMap_
Definition: cbor.h:219
#define CborBase64urlTag
Definition: cbor.h:141
CborValidationFlags
Definition: cbor.h:635
@ CborValidateShortestFloatingPoint
Definition: cbor.h:644
@ CborValidateUtf8
Definition: cbor.h:653
@ CborValidateBasic
Definition: cbor.h:673
@ CborValidateNoUnknownSimpleTypes
Definition: cbor.h:665
@ CborValidateCompleteData
Definition: cbor.h:670
@ CborValidateNoUndefined
Definition: cbor.h:658
@ CborValidateMapIsSorted
Definition: cbor.h:647
@ CborValidateMapKeysAreUnique
Definition: cbor.h:651
@ CborValidateNoUnknownSimpleTypesSA
Definition: cbor.h:664
@ CborValidateNoUnknownTagsSR
Definition: cbor.h:667
@ CborValidateNoUnknownTagsSA
Definition: cbor.h:666
@ CborValidateStrictest
Definition: cbor.h:672
@ CborValidateNoTags
Definition: cbor.h:659
@ CborValidateShortestNumbers
Definition: cbor.h:645
@ CborValidateCanonicalFormat
Definition: cbor.h:649
@ CborValidateFiniteFloatingPoint
Definition: cbor.h:660
@ CborValidateNoUnknownTags
Definition: cbor.h:668
@ CborValidateShortestIntegrals
Definition: cbor.h:643
@ CborValidateStrictMode
Definition: cbor.h:655
@ CborValidateNoIndeterminateLength
Definition: cbor.h:646
@ CborValidateTagUse
Definition: cbor.h:652
@ CborValidateMapKeysAreString
Definition: cbor.h:657
#define CborCOSE_Mac0Tag
Definition: cbor.h:134
CBOR_INLINE_API CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, size_t *buflen, CborValue *next)
Definition: cbor.h:502
CborPrettyFlags
Definition: cbor.h:682
@ CborPrettyIndicateIndeterminateLength
Definition: cbor.h:686
@ CborPrettyIndicateIndetermineLength
Definition: cbor.h:687
@ CborPrettyMergeStringFragments
Definition: cbor.h:691
@ CborPrettyNumericEncodingIndicators
Definition: cbor.h:683
@ CborPrettyShowStringFragments
Definition: cbor.h:690
@ CborPrettyTextualEncodingIndicators
Definition: cbor.h:684
@ CborPrettyDefaultFlags
Definition: cbor.h:693
@ CborPrettyIndicateOverlongNumbers
Definition: cbor.h:688
CborParserIteratorFlags
Definition: cbor.h:295
@ CborIteratorFlag_NextIsMapKey
Definition: cbor.h:314
@ CborIteratorFlag_IntegerValueIs64Bit
Definition: cbor.h:298
@ CborIteratorFlag_NegativeInteger
Definition: cbor.h:302
@ CborIteratorFlag_IntegerValueTooLarge
Definition: cbor.h:299
@ CborIteratorFlag_ContainerIsMap
Definition: cbor.h:313
@ CborIteratorFlag_IteratingStringChunks
Definition: cbor.h:306
@ CborIteratorFlag_UnknownLength
Definition: cbor.h:309
@ CborIteratorFlag_BeforeFirstStringChunk
Definition: cbor.h:305
CBOR_INLINE_API CborError cbor_value_to_pretty(FILE *out, const CborValue *value)
Definition: cbor.h:708
CBOR_API CborError cbor_value_to_pretty_advance_flags(FILE *out, CborValue *value, int flags)
#define CborCOSE_SignTag
Definition: cbor.h:147
CborParserGlobalFlags
Definition: cbor.h:290
@ CborParserFlag_ExternalSource
Definition: cbor.h:291
CborKnownTags
Definition: cbor.h:101
CBOR_INLINE_API CborError cbor_value_finish_string_iteration(CborValue *value)
Definition: cbor.h:537
#define CborCOSE_Encrypt0Tag
Definition: cbor.h:133
#define CborExpectedBase16Tag
Definition: cbor.h:138
CBOR_API CborError cbor_value_to_pretty_advance(FILE *out, CborValue *value)
CBOR_API const char * cbor_error_string(CborError error)
#define CborCOSE_Sign1Tag
Definition: cbor.h:135
FT_Error error
Definition: cffdrivr.c:657
char * data()
QMap< QString, QString > map
[6]
CBOR_API CborError cbor_encode_negative_int(CborEncoder *encoder, uint64_t absolute_value)
Definition: cborencoder.c:368
CBOR_API CborError cbor_encode_byte_string(CborEncoder *encoder, const uint8_t *string, size_t length)
Definition: cborencoder.c:470
CBOR_INLINE_API CborError cbor_encode_double(CborEncoder *encoder, double value)
Definition: cbor.h:263
CBOR_API void cbor_encoder_init(CborEncoder *encoder, uint8_t *buffer, size_t size, int flags)
Definition: cborencoder.c:203
CBOR_API CborError cbor_encode_uint(CborEncoder *encoder, uint64_t value)
Definition: cborencoder.c:355
CBOR_API CborError cbor_encode_float_as_half_float(CborEncoder *encoder, float value)
CBOR_INLINE_API CborError cbor_encode_null(CborEncoder *encoder)
Definition: cbor.h:253
CBOR_API CborError cbor_encode_text_string(CborEncoder *encoder, const char *string, size_t length)
Definition: cborencoder.c:482
CBOR_INLINE_API CborError cbor_encode_text_stringz(CborEncoder *encoder, const char *string)
Definition: cbor.h:246
CBOR_API CborError cbor_encoder_close_container(CborEncoder *parentEncoder, const CborEncoder *containerEncoder)
Definition: cborencoder.c:573
CBOR_INLINE_API size_t cbor_encoder_get_buffer_size(const CborEncoder *encoder, const uint8_t *buffer)
Definition: cbor.h:276
CBOR_API CborError cbor_encode_tag(CborEncoder *encoder, CborTag tag)
Definition: cborencoder.c:439
CBOR_INLINE_API CborError cbor_encode_boolean(CborEncoder *encoder, bool value)
Definition: cbor.h:251
CBOR_API CborError cbor_encode_simple_value(CborEncoder *encoder, uint8_t value)
Definition: cborencoder.c:395
CBOR_INLINE_API CborError cbor_encode_undefined(CborEncoder *encoder)
Definition: cbor.h:255
CBOR_API CborError cbor_encoder_create_array(CborEncoder *parentEncoder, CborEncoder *arrayEncoder, size_t length)
Definition: cborencoder.c:530
CBOR_API CborError cbor_encoder_create_map(CborEncoder *parentEncoder, CborEncoder *mapEncoder, size_t length)
Definition: cborencoder.c:554
CBOR_API void cbor_encoder_init_writer(CborEncoder *encoder, CborEncoderWriteFunction writer, void *)
Definition: cborencoder.c:211
CBOR_API CborError cbor_encode_int(CborEncoder *encoder, int64_t value)
Definition: cborencoder.c:379
CBOR_API CborError cbor_encode_floating_point(CborEncoder *encoder, CborType fpType, const void *value)
Definition: cborencoder.c:416
CBOR_INLINE_API CborError cbor_encode_half_float(CborEncoder *encoder, const void *value)
Definition: cbor.h:258
CBOR_INLINE_API CborError cbor_encode_float(CborEncoder *encoder, float value)
Definition: cbor.h:261
CBOR_INLINE_API size_t cbor_encoder_get_extra_bytes_needed(const CborEncoder *encoder)
Definition: cbor.h:281
CBOR_INLINE_API CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, size_t *buflen, CborValue *next)
Definition: cbor.h:489
CBOR_INLINE_API CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result)
Definition: cbor.h:399
CBOR_INLINE_API bool cbor_value_is_length_known(const CborValue *value)
Definition: cbor.h:449
CBOR_INLINE_API const uint8_t * cbor_value_get_next_byte(const CborValue *it)
Definition: cbor.h:358
CBOR_API CborError cbor_value_enter_container(const CborValue *it, CborValue *recursed)
Definition: cborparser.c:581
CBOR_INLINE_API bool cbor_value_is_boolean(const CborValue *value)
Definition: cbor.h:387
CBOR_INLINE_API bool cbor_value_is_undefined(const CborValue *value)
Definition: cbor.h:383
CBOR_INLINE_API bool cbor_value_is_null(const CborValue *value)
Definition: cbor.h:381
CBOR_PRIVATE_API CborError _cbor_value_copy_string(const CborValue *value, void *buffer, size_t *buflen, CborValue *next)
Definition: cborparser.c:1298
CBOR_API CborError cbor_value_validate_basic(const CborValue *it)
Definition: cborparser.c:445
CBOR_INLINE_API bool cbor_value_is_map(const CborValue *value)
Definition: cbor.h:563
CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk_size(const CborValue *value, size_t *len)
Definition: cborparser.c:1045
CBOR_PRIVATE_API uint64_t _cbor_value_decode_int64_internal(const CborValue *value)
Definition: cborparser.c:326
CBOR_INLINE_API bool cbor_value_is_tag(const CborValue *value)
Definition: cbor.h:453
CBOR_API CborError cbor_value_skip_tag(CborValue *it)
Definition: cborparser.c:554
CBOR_INLINE_API CborError cbor_value_get_raw_integer(const CborValue *value, uint64_t *result)
Definition: cbor.h:414
CBOR_INLINE_API bool cbor_value_is_integer(const CborValue *value)
Definition: cbor.h:407
CBOR_INLINE_API CborType cbor_value_get_type(const CborValue *value)
Definition: cbor.h:377
CBOR_INLINE_API bool cbor_value_at_end(const CborValue *it)
Definition: cbor.h:356
CBOR_INLINE_API CborError cbor_value_get_tag(const CborValue *value, CborTag *result)
Definition: cbor.h:455
CBOR_API CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
Definition: cborparser.c:630
CBOR_INLINE_API CborError cbor_value_get_half_float(const CborValue *value, void *result)
Definition: cbor.h:598
CBOR_API CborError cbor_value_get_int64_checked(const CborValue *value, int64_t *result)
Definition: cborparser.c:815
CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it)
Definition: cborparser.c:346
CBOR_INLINE_API bool cbor_value_is_double(const CborValue *value)
Definition: cbor.h:620
CBOR_API CborError cbor_value_reparse(CborValue *it)
Definition: cborparser.c:407
CBOR_PRIVATE_API CborError _cbor_value_begin_string_iteration(CborValue *value)
Definition: cborparser.c:972
CBOR_INLINE_API bool cbor_value_is_simple_type(const CborValue *value)
Definition: cbor.h:397
CBOR_INLINE_API bool cbor_value_is_negative_integer(const CborValue *value)
Definition: cbor.h:411
CBOR_INLINE_API bool cbor_value_is_half_float(const CborValue *value)
Definition: cbor.h:595
CBOR_INLINE_API CborError cbor_value_get_uint64(const CborValue *value, uint64_t *result)
Definition: cbor.h:421
CBOR_INLINE_API CborError cbor_value_get_int(const CborValue *value, int *result)
Definition: cbor.h:437
CBOR_API CborError cbor_value_advance_fixed(CborValue *it)
Definition: cborparser.c:466
CBOR_INLINE_API CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer, size_t *buflen, CborValue *next)
Definition: cbor.h:495
CBOR_API CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *token)
Definition: cborparser.c:358
CBOR_INLINE_API bool cbor_value_is_unsigned_integer(const CborValue *value)
Definition: cbor.h:409
CBOR_API CborError cbor_value_text_string_equals(const CborValue *value, const char *string, bool *result)
Definition: cborparser.c:1326
CBOR_PRIVATE_API CborError _cbor_value_finish_string_iteration(CborValue *value)
Definition: cborparser.c:985
CBOR_INLINE_API CborError cbor_value_get_text_string_chunk(const CborValue *value, const char **bufferptr, size_t *len, CborValue *next)
Definition: cbor.h:545
CBOR_API CborError cbor_value_calculate_string_length(const CborValue *value, size_t *length)
Definition: cborparser.c:966
CBOR_INLINE_API CborError cbor_value_get_map_length(const CborValue *value, size_t *length)
Definition: cbor.h:579
CBOR_INLINE_API bool cbor_value_is_byte_string(const CborValue *value)
Definition: cbor.h:464
CBOR_PRIVATE_API CborError _cbor_value_get_string_chunk(const CborValue *value, const void **bufferptr, size_t *len, CborValue *next)
Definition: cborparser.c:1149
CBOR_INLINE_API CborError cbor_value_get_boolean(const CborValue *value, bool *result)
Definition: cbor.h:389
CBOR_INLINE_API bool cbor_value_is_array(const CborValue *value)
Definition: cbor.h:561
CBOR_INLINE_API CborError cbor_value_get_int64(const CborValue *value, int64_t *result)
Definition: cbor.h:428
CBOR_API CborError cbor_value_advance(CborValue *it)
Definition: cborparser.c:518
CBOR_INLINE_API CborError cbor_value_get_array_length(const CborValue *value, size_t *length)
Definition: cbor.h:566
CBOR_INLINE_API bool cbor_value_is_valid(const CborValue *value)
Definition: cbor.h:375
CBOR_INLINE_API bool cbor_value_is_text_string(const CborValue *value)
Definition: cbor.h:466
CBOR_API CborError cbor_value_map_find_value(const CborValue *map, const char *string, CborValue *element)
Definition: cborparser.c:1414
CBOR_INLINE_API CborError cbor_value_get_string_length(const CborValue *value, size_t *length)
Definition: cbor.h:469
CBOR_INLINE_API bool cbor_value_is_container(const CborValue *it)
Definition: cbor.h:363
CBOR_API CborError cbor_value_get_int_checked(const CborValue *value, int *result)
Definition: cborparser.c:855
CBOR_INLINE_API CborError cbor_value_get_float(const CborValue *value, float *result)
Definition: cbor.h:610
CBOR_INLINE_API bool cbor_value_is_float(const CborValue *value)
Definition: cbor.h:608
#define __attribute__(x)
Definition: hb.hh:256
short next
Definition: keywords.cpp:454
Token token
Definition: keywords.cpp:453
parser
Definition: devices.py:74
PCRE2_SIZE PRIV() strlen(PCRE2_SPTR str)
void
Definition: png.h:1080
#define CBOR_API
Definition: qcborcommon_p.h:72
#define assert
Definition: qcborcommon_p.h:63
EGLOutputLayerEXT EGLint EGLAttrib value
GLenum GLuint GLenum GLsizei length
Definition: qopengl.h:270
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint buffer
GLenum GLenum dst
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLenum GLsizei len
Definition: qopenglext.h:3292
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
QTextStream out(stdout)
[7]
QStringList::Iterator it
uint8_t * ptr
Definition: cbor.h:225
size_t remaining
Definition: cbor.h:230
union CborEncoder::@261 data
ptrdiff_t bytes_needed
Definition: cbor.h:226
uint8_t * end
Definition: cbor.h:229
int flags
Definition: cbor.h:231
CborEncoderWriteFunction writer
Definition: cbor.h:227
enum CborParserGlobalFlags flags
Definition: cbor.h:332
const uint8_t * end
Definition: cbor.h:329
union CborParser::@262 source
const struct CborParserOperations * ops
Definition: cbor.h:330
CborError(* transfer_string)(void *token, const void **userptr, size_t offset, size_t len)
Definition: cbor.h:323
void(* advance_bytes)(void *token, size_t len)
Definition: cbor.h:322
bool(* can_read_bytes)(void *token, size_t len)
Definition: cbor.h:320
void * token
Definition: cbor.h:341
uint8_t type
Definition: cbor.h:345
const uint8_t * ptr
Definition: cbor.h:340
uint32_t remaining
Definition: cbor.h:343
uint16_t extra
Definition: cbor.h:344
uint8_t flags
Definition: cbor.h:346
const CborParser * parser
Definition: cbor.h:338
union CborValue::@263 source
QThreadStorage< int * > dummy[8]
XmlOutput::xml_output tag(const QString &name)
Definition: xmloutput.h:154