Lines Matching refs:state
40 static bool initial_checks(zcbor_state_t *state) in initial_checks() argument
48 static bool type_check(zcbor_state_t *state, zcbor_major_type_t exp_major_type) in type_check() argument
50 if (!initial_checks(state)) { in type_check()
53 zcbor_major_type_t major_type = ZCBOR_MAJOR_TYPE(*state->payload); in type_check()
64 if (!initial_checks(state)) { \
71 if (!type_check(state, exp_major_type)) { \
76 static void err_restore(zcbor_state_t *state, int err) in err_restore() argument
78 state->payload = state->payload_bak; in err_restore()
79 state->elem_count++; in err_restore()
80 zcbor_error(state, err); in err_restore()
85 err_restore(state, err); \
91 state->payload = state->payload_bak; \
92 state->elem_count++; \
129 static bool value_extract(zcbor_state_t *state, in value_extract() argument
132 zcbor_trace(state, "value_extract"); in value_extract()
138 ZCBOR_ERR_IF((state->elem_count == 0), ZCBOR_ERR_LOW_ELEM_COUNT); in value_extract()
140 uint8_t additional = ZCBOR_ADDITIONAL(*state->payload); in value_extract()
146 ZCBOR_ERR_IF((state->payload + len + 1) > state->payload_end, in value_extract()
154 endian_copy(result_offs, state->payload + 1, len); in value_extract()
162 state->payload_bak = state->payload; in value_extract()
163 (state->payload) += len + 1; in value_extract()
164 (state->elem_count)--; in value_extract()
169 bool zcbor_int_decode(zcbor_state_t *state, void *result, size_t result_size) argument
173 zcbor_major_type_t major_type = ZCBOR_MAJOR_TYPE(*state->payload);
183 if (!value_extract(state, result, result_size)) {
207 bool zcbor_int32_decode(zcbor_state_t *state, int32_t *result) argument
210 return zcbor_int_decode(state, result, sizeof(*result));
214 bool zcbor_int64_decode(zcbor_state_t *state, int64_t *result) argument
217 return zcbor_int_decode(state, result, sizeof(*result));
221 bool zcbor_uint_decode(zcbor_state_t *state, void *result, size_t result_size) argument
226 if (!value_extract(state, result, result_size)) {
234 bool zcbor_uint32_decode(zcbor_state_t *state, uint32_t *result) argument
237 return zcbor_uint_decode(state, result, sizeof(*result));
241 bool zcbor_int32_expect_union(zcbor_state_t *state, int32_t result) argument
244 if (!zcbor_union_elem_code(state)) {
247 return zcbor_int32_expect(state, result);
251 bool zcbor_int64_expect_union(zcbor_state_t *state, int64_t result) argument
254 if (!zcbor_union_elem_code(state)) {
257 return zcbor_int64_expect(state, result);
261 bool zcbor_uint32_expect_union(zcbor_state_t *state, uint32_t result) argument
264 if (!zcbor_union_elem_code(state)) {
267 return zcbor_uint32_expect(state, result);
271 bool zcbor_uint64_expect_union(zcbor_state_t *state, uint64_t result) argument
274 if (!zcbor_union_elem_code(state)) {
277 return zcbor_uint64_expect(state, result);
281 bool zcbor_int32_expect(zcbor_state_t *state, int32_t expected) argument
284 return zcbor_int64_expect(state, expected);
288 bool zcbor_int32_pexpect(zcbor_state_t *state, int32_t *expected) argument
291 return zcbor_int32_expect(state, *expected);
295 bool zcbor_int64_expect(zcbor_state_t *state, int64_t expected) argument
300 if (!zcbor_int64_decode(state, &actual)) {
312 bool zcbor_int64_pexpect(zcbor_state_t *state, int64_t *expected) argument
315 return zcbor_int64_expect(state, *expected);
319 bool zcbor_uint64_decode(zcbor_state_t *state, uint64_t *result) argument
322 return zcbor_uint_decode(state, result, sizeof(*result));
327 bool zcbor_size_decode(zcbor_state_t *state, size_t *result) argument
330 return zcbor_uint_decode(state, result, sizeof(*result));
335 bool zcbor_uint32_expect(zcbor_state_t *state, uint32_t expected) argument
338 return zcbor_uint64_expect(state, expected);
342 bool zcbor_uint32_pexpect(zcbor_state_t *state, uint32_t *expected) argument
345 return zcbor_uint32_expect(state, *expected);
349 bool zcbor_uint64_expect(zcbor_state_t *state, uint64_t expected) argument
354 if (!zcbor_uint64_decode(state, &actual)) {
365 bool zcbor_uint64_pexpect(zcbor_state_t *state, uint64_t *expected) argument
368 return zcbor_uint64_expect(state, *expected);
373 bool zcbor_size_expect(zcbor_state_t *state, size_t expected) argument
376 return zcbor_uint64_expect(state, expected);
380 bool zcbor_size_pexpect(zcbor_state_t *state, size_t *expected) argument
383 return zcbor_size_expect(state, *expected);
388 static bool str_start_decode(zcbor_state_t *state, argument
393 if (!value_extract(state, &result->len, sizeof(result->len))) {
397 result->value = state->payload;
401 static bool str_start_decode_with_overflow_check(zcbor_state_t *state, argument
404 bool res = str_start_decode(state, result, exp_major_type);
412 if (result->len > (size_t)(state->payload_end - state->payload)) {
415 (state->payload_end - state->payload));
423 bool zcbor_bstr_start_decode(zcbor_state_t *state, struct zcbor_string *result) argument
431 if(!str_start_decode_with_overflow_check(state, result, ZCBOR_MAJOR_TYPE_BSTR)) {
435 if (!zcbor_new_backup(state, ZCBOR_MAX_ELEM_COUNT)) {
439 state->payload_end = result->value + result->len;
444 bool zcbor_bstr_end_decode(zcbor_state_t *state) argument
446 ZCBOR_ERR_IF(state->payload != state->payload_end, ZCBOR_ERR_PAYLOAD_NOT_CONSUMED);
448 if (!zcbor_process_backup(state,
458 static void partition_fragment(const zcbor_state_t *state, argument
462 (size_t)state->payload_end - (size_t)state->payload);
466 static bool start_decode_fragment(zcbor_state_t *state, argument
471 if(!str_start_decode(state, &result->fragment, exp_major_type)) {
477 partition_fragment(state, result);
478 state->payload_end = state->payload + result->fragment.len;
483 bool zcbor_bstr_start_decode_fragment(zcbor_state_t *state, argument
487 if (!start_decode_fragment(state, result, ZCBOR_MAJOR_TYPE_BSTR)) {
490 if (!zcbor_new_backup(state, ZCBOR_MAX_ELEM_COUNT)) {
497 void zcbor_next_fragment(zcbor_state_t *state, argument
502 result->fragment.value = state->payload_mut;
506 partition_fragment(state, result);
509 state->payload += result->fragment.len;
513 void zcbor_bstr_next_fragment(zcbor_state_t *state, argument
518 result->fragment.value = state->payload_mut;
522 partition_fragment(state, result);
524 state->payload_end = state->payload + result->fragment.len;
534 static bool str_decode(zcbor_state_t *state, struct zcbor_string *result, argument
537 if (!str_start_decode_with_overflow_check(state, result, exp_major_type)) {
541 state->payload += result->len;
546 static bool str_decode_fragment(zcbor_state_t *state, struct zcbor_string_fragment *result, argument
549 if (!start_decode_fragment(state, result, exp_major_type)) {
553 (state->payload) += result->fragment.len;
558 static bool str_expect(zcbor_state_t *state, struct zcbor_string *result, argument
563 if (!str_decode(state, &tmp_result, exp_major_type)) {
573 bool zcbor_bstr_decode(zcbor_state_t *state, struct zcbor_string *result) argument
576 return str_decode(state, result, ZCBOR_MAJOR_TYPE_BSTR);
580 bool zcbor_bstr_decode_fragment(zcbor_state_t *state, struct zcbor_string_fragment *result) argument
583 return str_decode_fragment(state, result, ZCBOR_MAJOR_TYPE_BSTR);
587 bool zcbor_bstr_expect(zcbor_state_t *state, struct zcbor_string *expected) argument
590 return str_expect(state, expected, ZCBOR_MAJOR_TYPE_BSTR);
594 bool zcbor_tstr_decode(zcbor_state_t *state, struct zcbor_string *result) argument
597 return str_decode(state, result, ZCBOR_MAJOR_TYPE_TSTR);
601 bool zcbor_tstr_decode_fragment(zcbor_state_t *state, struct zcbor_string_fragment *result) argument
604 return str_decode_fragment(state, result, ZCBOR_MAJOR_TYPE_TSTR);
608 bool zcbor_tstr_expect(zcbor_state_t *state, struct zcbor_string *expected) argument
611 return str_expect(state, expected, ZCBOR_MAJOR_TYPE_TSTR);
615 bool zcbor_bstr_expect_ptr(zcbor_state_t *state, char const *ptr, size_t len) argument
620 return zcbor_bstr_expect(state, &zs);
624 bool zcbor_tstr_expect_ptr(zcbor_state_t *state, char const *ptr, size_t len) argument
629 return zcbor_tstr_expect(state, &zs);
633 bool zcbor_bstr_expect_term(zcbor_state_t *state, char const *string, size_t maxlen) argument
636 return zcbor_bstr_expect_ptr(state, string, strnlen(string, maxlen));
640 bool zcbor_tstr_expect_term(zcbor_state_t *state, char const *string, size_t maxlen) argument
643 return zcbor_tstr_expect_ptr(state, string, strnlen(string, maxlen));
647 static bool list_map_start_decode(zcbor_state_t *state, argument
656 if (ZCBOR_ADDITIONAL(*state->payload) == ZCBOR_VALUE_IS_INDEFINITE_LENGTH) {
659 ZCBOR_ERR_IF(state->elem_count == 0, ZCBOR_ERR_LOW_ELEM_COUNT);
661 state->payload_bak = state->payload++;
662 state->elem_count--;
666 if (!value_extract(state, &new_elem_count, sizeof(new_elem_count))) {
671 if (!zcbor_new_backup(state, new_elem_count)) {
675 state->decode_state.indefinite_length_array = indefinite_length_array;
681 bool zcbor_list_start_decode(zcbor_state_t *state) argument
684 return list_map_start_decode(state, ZCBOR_MAJOR_TYPE_LIST);
688 bool zcbor_map_start_decode(zcbor_state_t *state) argument
691 bool ret = list_map_start_decode(state, ZCBOR_MAJOR_TYPE_MAP);
693 if (ret && !state->decode_state.indefinite_length_array) {
694 if (state->elem_count >= (ZCBOR_MAX_ELEM_COUNT / 2)) {
698 state->elem_count *= 2;
704 bool zcbor_array_at_end(zcbor_state_t *state) argument
709 const bool indefinite_length_array = state->decode_state.indefinite_length_array;
711 return ((!indefinite_length_array && (state->elem_count == 0))
713 && (state->payload < state->payload_end)
714 && (*state->payload == 0xFF)));
718 static size_t update_map_elem_count(zcbor_state_t *state, size_t elem_count);
720 static bool allocate_map_flags(zcbor_state_t *state, size_t elem_count);
724 bool zcbor_unordered_map_start_decode(zcbor_state_t *state) argument
727 ZCBOR_FAIL_IF(!zcbor_map_start_decode(state));
730 state->decode_state.map_search_elem_state
731 += zcbor_flags_to_bytes(state->decode_state.map_elem_count);
733 state->decode_state.map_elems_processed = 0;
735 state->decode_state.map_elem_count = 0;
736 state->decode_state.counting_map_elems = state->decode_state.indefinite_length_array;
738 if (!state->decode_state.counting_map_elems) {
739 size_t old_flags = update_map_elem_count(state, state->elem_count);
741 ZCBOR_FAIL_IF(!allocate_map_flags(state, old_flags));
754 static size_t zcbor_current_max_elem_count(zcbor_state_t *state) argument
756 return (state->decode_state.indefinite_length_array ? \
757 ZCBOR_LARGE_ELEM_COUNT : state->decode_state.map_elem_count * 2);
761 static bool map_restart(zcbor_state_t *state) argument
763 if (!zcbor_process_backup(state, ZCBOR_FLAG_RESTORE | ZCBOR_FLAG_KEEP_DECODE_STATE,
768 state->elem_count = zcbor_current_max_elem_count(state);
774 static size_t get_current_index(zcbor_state_t *state, uint32_t index_offset) argument
778 return ((zcbor_current_max_elem_count(state) - state->elem_count - index_offset) / 2);
787 static bool manipulate_flags(zcbor_state_t *state, uint32_t mode) argument
789 const size_t last_index = (state->decode_state.map_elem_count - 1);
790 size_t index = (mode == FLAG_MODE_CLEAR_UNUSED) ? last_index : get_current_index(state, mode);
792 ZCBOR_ERR_IF((index >= state->decode_state.map_elem_count),
794 uint8_t *flag_byte = &state->decode_state.map_search_elem_state[index >> 3];
811 static bool should_try_key(zcbor_state_t *state) argument
813 return manipulate_flags(state, FLAG_MODE_GET_CURRENT);
817 bool zcbor_elem_processed(zcbor_state_t *state) argument
819 return manipulate_flags(state, FLAG_MODE_CLEAR_CURRENT);
823 static bool allocate_map_flags(zcbor_state_t *state, size_t old_flags) argument
825 size_t new_bytes = zcbor_flags_to_bytes(state->decode_state.map_elem_count);
828 const uint8_t *flags_end = state->constant_state->map_search_elem_state_end;
831 if ((state->decode_state.map_search_elem_state + new_bytes) > flags_end) {
832 state->decode_state.map_elem_count
833 = 8 * (size_t)(flags_end - state->decode_state.map_search_elem_state);
837 memset(&state->decode_state.map_search_elem_state[new_bytes - extra_bytes], 0xFF, extra_bytes);
843 static bool should_try_key(zcbor_state_t *state) argument
845 return (state->decode_state.map_elems_processed < state->decode_state.map_elem_count);
849 bool zcbor_elem_processed(zcbor_state_t *state) argument
851 if (should_try_key(state)) {
852 state->decode_state.map_elems_processed++;
859 static size_t update_map_elem_count(zcbor_state_t *state, size_t elem_count) argument
861 size_t old_map_elem_count = state->decode_state.map_elem_count;
863 state->decode_state.map_elem_count = MAX(old_map_elem_count, elem_count / 2);
868 static bool handle_map_end(zcbor_state_t *state) argument
870 state->decode_state.counting_map_elems = false;
871 return map_restart(state);
875 static bool try_key(zcbor_state_t *state, void *key_result, zcbor_decoder_t key_decoder) argument
877 uint8_t const *payload_bak2 = state->payload;
878 size_t elem_count_bak = state->elem_count;
880 if (!key_decoder(state, (uint8_t *)key_result)) {
881 state->payload = payload_bak2;
882 state->elem_count = elem_count_bak;
886 zcbor_log("Found element at index %zu.\n", get_current_index(state, 1));
891 bool zcbor_unordered_map_search(zcbor_decoder_t key_decoder, zcbor_state_t *state, void *key_result) argument
897 ZCBOR_ERR_IF(state->elem_count & 1, ZCBOR_ERR_MAP_MISALIGNED);
899 uint8_t const *payload_bak = state->payload;
900 size_t elem_count = state->elem_count;
904 if (zcbor_array_at_end(state)) {
905 if (!handle_map_end(state)) {
912 if (state->decode_state.counting_map_elems) {
913 size_t m_elem_count = ZCBOR_LARGE_ELEM_COUNT - state->elem_count + 2;
914 size_t old_flags = update_map_elem_count(state, m_elem_count);
916 ZCBOR_FAIL_IF(!allocate_map_flags(state, old_flags));
921 if (should_try_key(state) && try_key(state, key_result, key_decoder)) {
922 if (!state->constant_state->manually_process_elem) {
923 ZCBOR_FAIL_IF(!zcbor_elem_processed(state));
929 if (!zcbor_any_skip(state, NULL) || !zcbor_any_skip(state, NULL)) {
932 } while (state->elem_count != elem_count);
934 zcbor_error(state, ZCBOR_ERR_ELEM_NOT_FOUND);
936 state->payload = payload_bak;
937 state->elem_count = elem_count;
942 bool zcbor_search_key_bstr_ptr(zcbor_state_t *state, char const *ptr, size_t len) argument
946 return zcbor_unordered_map_search((zcbor_decoder_t *)zcbor_bstr_expect, state, &zs);
950 bool zcbor_search_key_tstr_ptr(zcbor_state_t *state, char const *ptr, size_t len) argument
954 return zcbor_unordered_map_search((zcbor_decoder_t *)zcbor_tstr_expect, state, &zs);
958 bool zcbor_search_key_bstr_term(zcbor_state_t *state, char const *str, size_t maxlen) argument
960 return zcbor_search_key_bstr_ptr(state, str, strnlen(str, maxlen));
964 bool zcbor_search_key_tstr_term(zcbor_state_t *state, char const *str, size_t maxlen) argument
966 return zcbor_search_key_tstr_ptr(state, str, strnlen(str, maxlen));
970 static bool array_end_expect(zcbor_state_t *state) argument
973 ZCBOR_ERR_IF(*state->payload != 0xFF, ZCBOR_ERR_WRONG_TYPE);
975 state->payload++;
980 static bool list_map_end_decode(zcbor_state_t *state) argument
985 if (state->decode_state.indefinite_length_array) {
986 if (!array_end_expect(state)) {
990 state->decode_state.indefinite_length_array = false;
993 if (!zcbor_process_backup(state,
1003 bool zcbor_list_end_decode(zcbor_state_t *state) argument
1006 return list_map_end_decode(state);
1010 bool zcbor_map_end_decode(zcbor_state_t *state) argument
1013 return list_map_end_decode(state);
1017 bool zcbor_unordered_map_end_decode(zcbor_state_t *state) argument
1021 ZCBOR_ERR_IF(!zcbor_array_at_end(state) && state->decode_state.counting_map_elems,
1024 if (state->decode_state.map_elem_count > 0) {
1026 manipulate_flags(state, FLAG_MODE_CLEAR_UNUSED);
1028 for (size_t i = 0; i < zcbor_flags_to_bytes(state->decode_state.map_elem_count); i++) {
1029 if (state->decode_state.map_search_elem_state[i] != 0) {
1031 i, state->decode_state.map_search_elem_state[i]);
1036 ZCBOR_ERR_IF(should_try_key(state), ZCBOR_ERR_ELEMS_NOT_PROCESSED);
1039 while (!zcbor_array_at_end(state)) {
1040 zcbor_any_skip(state, NULL);
1042 return zcbor_map_end_decode(state);
1046 bool zcbor_list_map_end_force_decode(zcbor_state_t *state) argument
1048 if (!zcbor_process_backup(state,
1058 bool zcbor_simple_decode(zcbor_state_t *state, uint8_t *result) argument
1066 ZCBOR_ERR_IF(ZCBOR_ADDITIONAL(*state->payload) > 24, ZCBOR_ERR_WRONG_TYPE);
1068 if (!value_extract(state, result, sizeof(*result))) {
1075 bool zcbor_simple_expect(zcbor_state_t *state, uint8_t expected) argument
1080 if (!zcbor_simple_decode(state, &actual)) {
1093 bool zcbor_simple_pexpect(zcbor_state_t *state, uint8_t *expected) argument
1096 return zcbor_simple_expect(state, *expected);
1100 bool zcbor_nil_expect(zcbor_state_t *state, void *unused) argument
1104 return zcbor_simple_expect(state, 22);
1108 bool zcbor_undefined_expect(zcbor_state_t *state, void *unused) argument
1112 return zcbor_simple_expect(state, 23);
1116 bool zcbor_bool_decode(zcbor_state_t *state, bool *result) argument
1121 if (!zcbor_simple_decode(state, &value)) {
1135 bool zcbor_bool_expect(zcbor_state_t *state, bool expected) argument
1138 return zcbor_simple_expect(state, (uint8_t)(!!expected) + ZCBOR_BOOL_TO_SIMPLE);
1142 bool zcbor_bool_pexpect(zcbor_state_t *state, bool *expected) argument
1145 return zcbor_bool_expect(state, *expected);
1149 static bool float_check(zcbor_state_t *state, uint8_t additional_val) argument
1152 ZCBOR_ERR_IF(ZCBOR_ADDITIONAL(*state->payload) != additional_val, ZCBOR_ERR_FLOAT_SIZE);
1157 bool zcbor_float16_bytes_decode(zcbor_state_t *state, uint16_t *result) argument
1160 ZCBOR_FAIL_IF(!float_check(state, ZCBOR_VALUE_IS_2_BYTES));
1162 if (!value_extract(state, result, sizeof(*result))) {
1170 bool zcbor_float16_bytes_expect(zcbor_state_t *state, uint16_t expected) argument
1175 if (!zcbor_float16_bytes_decode(state, &actual)) {
1185 bool zcbor_float16_bytes_pexpect(zcbor_state_t *state, uint16_t *expected) argument
1188 return zcbor_float16_bytes_expect(state, *expected);
1192 bool zcbor_float16_decode(zcbor_state_t *state, float *result) argument
1197 if (!zcbor_float16_bytes_decode(state, &value16)) {
1206 bool zcbor_float16_expect(zcbor_state_t *state, float expected) argument
1211 if (!zcbor_float16_decode(state, &actual)) {
1221 bool zcbor_float16_pexpect(zcbor_state_t *state, float *expected) argument
1224 return zcbor_float16_expect(state, *expected);
1228 bool zcbor_float32_decode(zcbor_state_t *state, float *result) argument
1231 ZCBOR_FAIL_IF(!float_check(state, ZCBOR_VALUE_IS_4_BYTES));
1233 if (!value_extract(state, result, sizeof(*result))) {
1241 bool zcbor_float32_expect(zcbor_state_t *state, float expected) argument
1246 if (!zcbor_float32_decode(state, &actual)) {
1256 bool zcbor_float32_pexpect(zcbor_state_t *state, float *expected) argument
1259 return zcbor_float32_expect(state, *expected);
1263 bool zcbor_float16_32_decode(zcbor_state_t *state, float *result) argument
1266 if (zcbor_float16_decode(state, result)) {
1268 } else if (!zcbor_float32_decode(state, result)) {
1276 bool zcbor_float16_32_expect(zcbor_state_t *state, float expected) argument
1279 if (zcbor_float16_expect(state, expected)) {
1281 } else if (!zcbor_float32_expect(state, expected)) {
1289 bool zcbor_float16_32_pexpect(zcbor_state_t *state, float *expected) argument
1292 return zcbor_float16_32_expect(state, *expected);
1296 bool zcbor_float64_decode(zcbor_state_t *state, double *result) argument
1299 ZCBOR_FAIL_IF(!float_check(state, ZCBOR_VALUE_IS_8_BYTES));
1301 if (!value_extract(state, result, sizeof(*result))) {
1309 bool zcbor_float64_expect(zcbor_state_t *state, double expected) argument
1314 if (!zcbor_float64_decode(state, &actual)) {
1324 bool zcbor_float64_pexpect(zcbor_state_t *state, double *expected) argument
1327 return zcbor_float64_expect(state, *expected);
1331 bool zcbor_float32_64_decode(zcbor_state_t *state, double *result) argument
1336 if (zcbor_float32_decode(state, &float_result)) {
1338 } else if (!zcbor_float64_decode(state, result)) {
1346 bool zcbor_float32_64_expect(zcbor_state_t *state, double expected) argument
1349 if (zcbor_float64_expect(state, expected)) {
1351 } else if (!zcbor_float32_expect(state, (float)expected)) {
1359 bool zcbor_float32_64_pexpect(zcbor_state_t *state, double *expected) argument
1362 return zcbor_float32_64_expect(state, *expected);
1366 bool zcbor_float_decode(zcbor_state_t *state, double *result) argument
1371 if (zcbor_float16_decode(state, &float_result)) {
1373 } else if (zcbor_float32_decode(state, &float_result)) {
1375 } else if (!zcbor_float64_decode(state, result)) {
1383 bool zcbor_float_expect(zcbor_state_t *state, double expected) argument
1386 if (zcbor_float16_expect(state, (float)expected)) {
1388 } else if (zcbor_float32_expect(state, (float)expected)) {
1390 } else if (!zcbor_float64_expect(state, expected)) {
1398 bool zcbor_float_pexpect(zcbor_state_t *state, double *expected) argument
1401 return zcbor_float_expect(state, *expected);
1405 bool zcbor_any_skip(zcbor_state_t *state, void *result) argument
1413 zcbor_major_type_t major_type = ZCBOR_MAJOR_TYPE(*state->payload);
1414 uint8_t additional = ZCBOR_ADDITIONAL(*state->payload);
1418 memcpy(&state_copy, state, sizeof(zcbor_state_t));
1479 state->payload = state_copy.payload;
1480 state->elem_count--;
1486 bool zcbor_tag_decode(zcbor_state_t *state, uint32_t *result) argument
1491 if (!value_extract(state, result, sizeof(*result))) {
1494 state->elem_count++;
1499 bool zcbor_tag_expect(zcbor_state_t *state, uint32_t expected) argument
1504 if (!zcbor_tag_decode(state, &actual)) {
1514 bool zcbor_tag_pexpect(zcbor_state_t *state, uint32_t *expected) argument
1517 return zcbor_tag_expect(state, *expected);
1525 zcbor_state_t *state, argument
1532 uint8_t const *payload_bak = state->payload;
1533 size_t elem_count_bak = state->elem_count;
1535 if (!decoder(state,
1538 state->payload = payload_bak;
1539 state->elem_count = elem_count_bak;
1553 zcbor_state_t *state, argument
1558 bool retval = zcbor_multi_decode(0, 1, &num_decode, decoder, state, result, 0);