Branch data Line data Source code
1 : : /*
2 : : * Generated using zcbor version 0.8.99
3 : : * https://github.com/NordicSemiconductor/zcbor
4 : : * Generated with a --default-max-qty of 3
5 : : */
6 : :
7 : : #include <stdint.h>
8 : : #include <stdbool.h>
9 : : #include <stddef.h>
10 : : #include <string.h>
11 : : #include "zcbor_decode.h"
12 : : #include "cbor/edhoc_decode_id_cred_x.h"
13 : : #include "zcbor_print.h"
14 : :
15 : : #if DEFAULT_MAX_QTY != 3
16 : : #error "The type file was generated with a different default_max_qty than this file"
17 : : #endif
18 : :
19 : : static bool decode_repeated_id_cred_x_map_kid(zcbor_state_t *state, struct id_cred_x_map_kid_r *result);
20 : : static bool decode_repeated_id_cred_x_map_x5bag(zcbor_state_t *state, struct id_cred_x_map_x5bag *result);
21 : : static bool decode_repeated_id_cred_x_map_x5chain(zcbor_state_t *state, struct id_cred_x_map_x5chain *result);
22 : : static bool decode_repeated_id_cred_x_map_x5t(zcbor_state_t *state, struct id_cred_x_map_x5t_r *result);
23 : : static bool decode_repeated_id_cred_x_map_x5u(zcbor_state_t *state, struct id_cred_x_map_x5u *result);
24 : : static bool decode_repeated_id_cred_x_map_c5b(zcbor_state_t *state, struct id_cred_x_map_c5b *result);
25 : : static bool decode_repeated_id_cred_x_map_c5c(zcbor_state_t *state, struct id_cred_x_map_c5c *result);
26 : : static bool decode_repeated_id_cred_x_map_c5t(zcbor_state_t *state, struct id_cred_x_map_c5t_r *result);
27 : : static bool decode_repeated_id_cred_x_map_c5u(zcbor_state_t *state, struct id_cred_x_map_c5u *result);
28 : : static bool decode_id_cred_x_map(zcbor_state_t *state, struct id_cred_x_map *result);
29 : :
30 : :
31 : 12 : static bool decode_repeated_id_cred_x_map_kid(
32 : : zcbor_state_t *state, struct id_cred_x_map_kid_r *result)
33 : : {
34 : : zcbor_log("%s\r\n", __func__);
35 : : bool int_res;
36 : :
37 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (4))))
38 [ - + - - : 12 : && (zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result).id_cred_x_map_kid_int)))) && (((*result).id_cred_x_map_kid_choice = id_cred_x_map_kid_int_c), true))
- - ]
39 [ # # # # ]: 0 : || (((zcbor_bstr_decode(state, (&(*result).id_cred_x_map_kid_bstr)))) && (((*result).id_cred_x_map_kid_choice = id_cred_x_map_kid_bstr_c), true))), zcbor_union_end_code(state), int_res))));
40 : :
41 : 12 : if (!tmp_result) {
42 : : zcbor_trace_file(state);
43 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
44 : : } else {
45 : : zcbor_log("%s success\r\n", __func__);
46 : : }
47 : :
48 : 12 : return tmp_result;
49 : : }
50 : :
51 : 12 : static bool decode_repeated_id_cred_x_map_x5bag(
52 : : zcbor_state_t *state, struct id_cred_x_map_x5bag *result)
53 : : {
54 : : zcbor_log("%s\r\n", __func__);
55 : :
56 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (32))))
57 [ - + - - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_x5bag)))));
58 : :
59 : 12 : if (!tmp_result) {
60 : : zcbor_trace_file(state);
61 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
62 : : } else {
63 : : zcbor_log("%s success\r\n", __func__);
64 : : }
65 : :
66 : 12 : return tmp_result;
67 : : }
68 : :
69 : 12 : static bool decode_repeated_id_cred_x_map_x5chain(
70 : : zcbor_state_t *state, struct id_cred_x_map_x5chain *result)
71 : : {
72 : : zcbor_log("%s\r\n", __func__);
73 : :
74 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (33))))
75 [ + + + - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_x5chain)))));
76 : :
77 : 12 : if (!tmp_result) {
78 : : zcbor_trace_file(state);
79 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
80 : : } else {
81 : : zcbor_log("%s success\r\n", __func__);
82 : : }
83 : :
84 : 12 : return tmp_result;
85 : : }
86 : :
87 : 12 : static bool decode_repeated_id_cred_x_map_x5t(
88 : : zcbor_state_t *state, struct id_cred_x_map_x5t_r *result)
89 : : {
90 : : zcbor_log("%s\r\n", __func__);
91 : : bool int_res;
92 : :
93 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (34))))
94 [ + + + - : 36 : && (zcbor_list_start_decode(state) && ((((zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result).id_cred_x_map_x5t_alg_int)))) && (((*result).id_cred_x_map_x5t_alg_choice = id_cred_x_map_x5t_alg_int_c), true))
+ - + - ]
95 [ + - - - ]: 16 : || (((zcbor_tstr_decode(state, (&(*result).id_cred_x_map_x5t_alg_tstr)))) && (((*result).id_cred_x_map_x5t_alg_choice = id_cred_x_map_x5t_alg_tstr_c), true))), zcbor_union_end_code(state), int_res)))
96 [ - + + - ]: 8 : && ((zcbor_bstr_decode(state, (&(*result).id_cred_x_map_x5t_hash))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
97 : :
98 : 12 : if (!tmp_result) {
99 : : zcbor_trace_file(state);
100 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
101 : : } else {
102 : : zcbor_log("%s success\r\n", __func__);
103 : : }
104 : :
105 : 12 : return tmp_result;
106 : : }
107 : :
108 : 12 : static bool decode_repeated_id_cred_x_map_x5u(
109 : : zcbor_state_t *state, struct id_cred_x_map_x5u *result)
110 : : {
111 : : zcbor_log("%s\r\n", __func__);
112 : :
113 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (35))))
114 [ - + - - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_x5u)))));
115 : :
116 : 12 : if (!tmp_result) {
117 : : zcbor_trace_file(state);
118 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
119 : : } else {
120 : : zcbor_log("%s success\r\n", __func__);
121 : : }
122 : :
123 : 12 : return tmp_result;
124 : : }
125 : :
126 : 12 : static bool decode_repeated_id_cred_x_map_c5b(
127 : : zcbor_state_t *state, struct id_cred_x_map_c5b *result)
128 : : {
129 : : zcbor_log("%s\r\n", __func__);
130 : :
131 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (52))))
132 [ - + - - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_c5b)))));
133 : :
134 : 12 : if (!tmp_result) {
135 : : zcbor_trace_file(state);
136 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
137 : : } else {
138 : : zcbor_log("%s success\r\n", __func__);
139 : : }
140 : :
141 : 12 : return tmp_result;
142 : : }
143 : :
144 : 12 : static bool decode_repeated_id_cred_x_map_c5c(
145 : : zcbor_state_t *state, struct id_cred_x_map_c5c *result)
146 : : {
147 : : zcbor_log("%s\r\n", __func__);
148 : :
149 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (53))))
150 [ - + - - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_c5c)))));
151 : :
152 : 12 : if (!tmp_result) {
153 : : zcbor_trace_file(state);
154 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
155 : : } else {
156 : : zcbor_log("%s success\r\n", __func__);
157 : : }
158 : :
159 : 12 : return tmp_result;
160 : : }
161 : :
162 : 12 : static bool decode_repeated_id_cred_x_map_c5t(
163 : : zcbor_state_t *state, struct id_cred_x_map_c5t_r *result)
164 : : {
165 : : zcbor_log("%s\r\n", __func__);
166 : : bool int_res;
167 : :
168 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (54))))
169 [ - + - - : 12 : && (zcbor_list_start_decode(state) && ((((zcbor_union_start_code(state) && (int_res = ((((zcbor_int32_decode(state, (&(*result).id_cred_x_map_c5t_alg_int)))) && (((*result).id_cred_x_map_c5t_alg_choice = id_cred_x_map_c5t_alg_int_c), true))
- - - - ]
170 [ # # # # ]: 0 : || (((zcbor_tstr_decode(state, (&(*result).id_cred_x_map_c5t_alg_tstr)))) && (((*result).id_cred_x_map_c5t_alg_choice = id_cred_x_map_c5t_alg_tstr_c), true))), zcbor_union_end_code(state), int_res)))
171 [ # # # # ]: 0 : && ((zcbor_bstr_decode(state, (&(*result).id_cred_x_map_c5t_hash))))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_list_end_decode(state))));
172 : :
173 : 12 : if (!tmp_result) {
174 : : zcbor_trace_file(state);
175 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
176 : : } else {
177 : : zcbor_log("%s success\r\n", __func__);
178 : : }
179 : :
180 : 12 : return tmp_result;
181 : : }
182 : :
183 : 12 : static bool decode_repeated_id_cred_x_map_c5u(
184 : : zcbor_state_t *state, struct id_cred_x_map_c5u *result)
185 : : {
186 : : zcbor_log("%s\r\n", __func__);
187 : :
188 : 12 : bool tmp_result = ((((zcbor_uint32_expect(state, (55))))
189 [ - + - - ]: 12 : && (zcbor_bstr_decode(state, (&(*result).id_cred_x_map_c5u)))));
190 : :
191 : 12 : if (!tmp_result) {
192 : : zcbor_trace_file(state);
193 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
194 : : } else {
195 : : zcbor_log("%s success\r\n", __func__);
196 : : }
197 : :
198 : 12 : return tmp_result;
199 : : }
200 : :
201 : 12 : static bool decode_id_cred_x_map(
202 : : zcbor_state_t *state, struct id_cred_x_map *result)
203 : : {
204 : : zcbor_log("%s\r\n", __func__);
205 : :
206 [ + - ]: 24 : bool tmp_result = (((zcbor_map_start_decode(state) && ((zcbor_present_decode(&((*result).id_cred_x_map_kid_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_kid, state, (&(*result).id_cred_x_map_kid))
207 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_x5bag_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_x5bag, state, (&(*result).id_cred_x_map_x5bag))
208 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_x5chain_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_x5chain, state, (&(*result).id_cred_x_map_x5chain))
209 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_x5t_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_x5t, state, (&(*result).id_cred_x_map_x5t))
210 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_x5u_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_x5u, state, (&(*result).id_cred_x_map_x5u))
211 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_c5b_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_c5b, state, (&(*result).id_cred_x_map_c5b))
212 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_c5c_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_c5c, state, (&(*result).id_cred_x_map_c5c))
213 [ + - ]: 12 : && zcbor_present_decode(&((*result).id_cred_x_map_c5t_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_c5t, state, (&(*result).id_cred_x_map_c5t))
214 [ + - - + : 24 : && zcbor_present_decode(&((*result).id_cred_x_map_c5u_present), (zcbor_decoder_t *)decode_repeated_id_cred_x_map_c5u, state, (&(*result).id_cred_x_map_c5u))) || (zcbor_list_map_end_force_decode(state), false)) && zcbor_map_end_decode(state))));
+ - ]
215 : :
216 : 12 : if (!tmp_result) {
217 : : zcbor_trace_file(state);
218 : : zcbor_log("%s error: %s\r\n", __func__, zcbor_error_str(zcbor_peek_error(state)));
219 : : } else {
220 : : zcbor_log("%s success\r\n", __func__);
221 : : }
222 : :
223 : 12 : return tmp_result;
224 : : }
225 : :
226 : :
227 : :
228 : 12 : int cbor_decode_id_cred_x_map(
229 : : const uint8_t *payload, size_t payload_len,
230 : : struct id_cred_x_map *result,
231 : : size_t *payload_len_out)
232 : : {
233 : : zcbor_state_t states[5];
234 : :
235 : 12 : return zcbor_entry_function(payload, payload_len, (void *)result, payload_len_out, states,
236 : : (zcbor_decoder_t *)decode_id_cred_x_map, sizeof(states) / sizeof(zcbor_state_t), 1);
237 : : }
|