11 bool static _cbor_claim_bytes(
size_t required,
14 if (required > (provided - result->
read)) {
20 result->
read += required;
31 if (source_size < 1) {
71 if (_cbor_claim_bytes(1, source_size, &result)) {
79 if (_cbor_claim_bytes(2, source_size, &result)) {
87 if (_cbor_claim_bytes(4, source_size, &result)) {
95 if (_cbor_claim_bytes(8, source_size, &result)) {
140 if (_cbor_claim_bytes(1, source_size, &result)) {
148 if (_cbor_claim_bytes(2, source_size, &result)) {
156 if (_cbor_claim_bytes(4, source_size, &result)) {
164 if (_cbor_claim_bytes(8, source_size, &result)) {
204 if (_cbor_claim_bytes(length, source_size, &result)) {
205 callbacks->byte_string(context, source + 1, length);
213 if (_cbor_claim_bytes(1, source_size, &result)) {
215 if (_cbor_claim_bytes(length, source_size, &result)) {
216 callbacks->byte_string(context, source + 1 + 1, length);
224 if (_cbor_claim_bytes(2, source_size, &result)) {
226 if (_cbor_claim_bytes(length, source_size, &result)) {
227 callbacks->byte_string(context, source + 1 + 2, length);
235 if (_cbor_claim_bytes(4, source_size, &result)) {
237 if (_cbor_claim_bytes(length, source_size, &result)) {
238 callbacks->byte_string(context, source + 1 + 4, length);
246 if (_cbor_claim_bytes(8, source_size, &result)) {
248 if (_cbor_claim_bytes(length, source_size, &result)) {
249 callbacks->byte_string(context, source + 1 + 8, length);
264 callbacks->byte_string_start(context);
294 if (_cbor_claim_bytes(length, source_size, &result)) {
295 callbacks->string(context, source + 1, length);
302 if (_cbor_claim_bytes(1, source_size, &result)) {
304 if (_cbor_claim_bytes(length, source_size, &result)) {
305 callbacks->string(context, source + 1 + 1, length);
313 if (_cbor_claim_bytes(2, source_size, &result)) {
315 if (_cbor_claim_bytes(length, source_size, &result)) {
316 callbacks->string(context, source + 1 + 2, length);
324 if (_cbor_claim_bytes(4, source_size, &result)) {
326 if (_cbor_claim_bytes(length, source_size, &result)) {
327 callbacks->string(context, source + 1 + 4, length);
335 if (_cbor_claim_bytes(8, source_size, &result)) {
337 if (_cbor_claim_bytes(length, source_size, &result)) {
338 callbacks->string(context, source + 1 + 8, length);
353 callbacks->string_start(context);
388 if (_cbor_claim_bytes(1, source_size, &result)) {
396 if (_cbor_claim_bytes(2, source_size, &result)) {
404 if (_cbor_claim_bytes(4, source_size, &result)) {
412 if (_cbor_claim_bytes(8, source_size, &result)) {
427 callbacks->indef_array_start(context);
462 if (_cbor_claim_bytes(1, source_size, &result)) {
470 if (_cbor_claim_bytes(2, source_size, &result)) {
478 if (_cbor_claim_bytes(4, source_size, &result)) {
486 if (_cbor_claim_bytes(8, source_size, &result)) {
501 callbacks->indef_map_start(context);
547 if (_cbor_claim_bytes(1, source_size, &result)) {
554 if (_cbor_claim_bytes(2, source_size, &result)) {
561 if (_cbor_claim_bytes(4, source_size, &result)) {
568 if (_cbor_claim_bytes(8, source_size, &result)) {
606 callbacks->boolean(context,
false);
612 callbacks->boolean(context,
true);
618 callbacks->null(context);
624 callbacks->undefined(context);
635 if (_cbor_claim_bytes(2, source_size, &result)) {
643 if (_cbor_claim_bytes(4, source_size, &result)) {
651 if (_cbor_claim_bytes(8, source_size, &result)) {
666 callbacks->indef_break(context);
double _cbor_load_double(cbor_data source)
Malformed or reserved MTB/value.
float _cbor_load_float(cbor_data source)
double _cbor_load_half(cbor_data source)
uint16_t _cbor_load_uint16(const unsigned char *source)
uint8_t _cbor_load_uint8(cbor_data source)
uint32_t _cbor_load_uint32(const unsigned char *source)
Streaming decoder result.
const unsigned char * cbor_data
enum cbor_decoder_status status
The result.
Callback bundle – passed to the decoder.
Not enough data - mismatch with MTB.
Buffer manipulation problem.
struct cbor_decoder_result cbor_stream_decode(cbor_data source, size_t source_size, const struct cbor_callbacks *callbacks, void *context)
Stateless decoder.
uint64_t _cbor_load_uint64(const unsigned char *source)