Debian Codegraph @

tests/126-per-extensions-OK.asn1.-Pgen-PER

raw
1
2 /*** <<< INCLUDES [PDU] >>> ***/
3
4 #include <IA5String.h>
5 #include "Singleton.h"
6 #include <constr_SEQUENCE.h>
7
8 /*** <<< FWD-DECLS [PDU] >>> ***/
9
10 struct PDU_2;
11 struct Singleton;
12
13 /*** <<< TYPE-DECLS [PDU] >>> ***/
14
15 typedef struct PDU {
16 /*
17 * This type is extensible,
18 * possible extensions are below.
19 */
20 IA5String_t *str_o /* OPTIONAL */;
21 IA5String_t *str_m;
22 struct Singleton *singl;
23 struct PDU_2 *pdu_2 /* OPTIONAL */;
24
25 /* Context for parsing across buffer boundaries */
26 asn_struct_ctx_t _asn_ctx;
27 } PDU_t;
28
29 /*** <<< FUNC-DECLS [PDU] >>> ***/
30
31 extern asn_TYPE_descriptor_t asn_DEF_PDU;
32
33 /*** <<< POST-INCLUDE [PDU] >>> ***/
34
35 #include "PDU-2.h"
36
37 /*** <<< STAT-DEFS [PDU] >>> ***/
38
39 static asn_TYPE_member_t asn_MBR_PDU_1[] = {
40 { ATF_POINTER, 4, offsetof(struct PDU, str_o),
41 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
42 .tag_mode = -1, /* IMPLICIT tag at current level */
43 .type = &asn_DEF_IA5String,
44 .memb_constraints = 0, /* Defer constraints checking to the member type */
45 .per_constraints = 0, /* No PER visible constraints */
46 .default_value = 0,
47 .name = "str-o"
48 },
49 { ATF_POINTER, 3, offsetof(struct PDU, str_m),
50 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
51 .tag_mode = -1, /* IMPLICIT tag at current level */
52 .type = &asn_DEF_IA5String,
53 .memb_constraints = 0, /* Defer constraints checking to the member type */
54 .per_constraints = 0, /* No PER visible constraints */
55 .default_value = 0,
56 .name = "str-m"
57 },
58 { ATF_POINTER, 2, offsetof(struct PDU, singl),
59 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
60 .tag_mode = -1, /* IMPLICIT tag at current level */
61 .type = &asn_DEF_Singleton,
62 .memb_constraints = 0, /* Defer constraints checking to the member type */
63 .per_constraints = 0, /* No PER visible constraints */
64 .default_value = 0,
65 .name = "singl"
66 },
67 { ATF_POINTER, 1, offsetof(struct PDU, pdu_2),
68 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
69 .tag_mode = +1, /* EXPLICIT tag at current level */
70 .type = &asn_DEF_PDU_2,
71 .memb_constraints = 0, /* Defer constraints checking to the member type */
72 .per_constraints = 0, /* No PER visible constraints */
73 .default_value = 0,
74 .name = "pdu-2"
75 },
76 };
77 static const int asn_MAP_PDU_oms_1[] = { 0, 1, 2, 3 };
78 static const ber_tlv_tag_t asn_DEF_PDU_tags_1[] = {
79 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
80 };
81 static const asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = {
82 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* str-o */
83 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* str-m */
84 { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* singl */
85 { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pdu-2 */
86 };
87 static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = {
88 sizeof(struct PDU),
89 offsetof(struct PDU, _asn_ctx),
90 asn_MAP_PDU_tag2el_1,
91 4, /* Count of tags in the map */
92 asn_MAP_PDU_oms_1, /* Optional members */
93 0, 4, /* Root/Additions */
94 -1, /* Start extensions */
95 5 /* Stop extensions */
96 };
97 asn_TYPE_descriptor_t asn_DEF_PDU = {
98 "PDU",
99 "PDU",
100 SEQUENCE_free,
101 SEQUENCE_print,
102 SEQUENCE_constraint,
103 SEQUENCE_decode_ber,
104 SEQUENCE_encode_der,
105 SEQUENCE_decode_xer,
106 SEQUENCE_encode_xer,
107 SEQUENCE_decode_uper,
108 SEQUENCE_encode_uper,
109 0, /* Use generic outmost tag fetcher */
110 asn_DEF_PDU_tags_1,
111 sizeof(asn_DEF_PDU_tags_1)
112 /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */
113 asn_DEF_PDU_tags_1, /* Same as above */
114 sizeof(asn_DEF_PDU_tags_1)
115 /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */
116 0, /* No PER visible constraints */
117 asn_MBR_PDU_1,
118 4, /* Elements count */
119 &asn_SPC_PDU_specs_1 /* Additional specs */
120 };
121
122
123 /*** <<< INCLUDES [Singleton] >>> ***/
124
125 #include <IA5String.h>
126 #include <constr_SEQUENCE.h>
127
128 /*** <<< TYPE-DECLS [Singleton] >>> ***/
129
130 typedef struct Singleton {
131 IA5String_t *opt_z /* DEFAULT z */;
132
133 /* Context for parsing across buffer boundaries */
134 asn_struct_ctx_t _asn_ctx;
135 } Singleton_t;
136
137 /*** <<< FUNC-DECLS [Singleton] >>> ***/
138
139 extern asn_TYPE_descriptor_t asn_DEF_Singleton;
140
141 /*** <<< STAT-DEFS [Singleton] >>> ***/
142
143 static int asn_DFL_2_set(int set_value, void **sptr) {
144 static uint8_t defv[] = "z";
145 IA5String_t *st = *sptr;
146
147 if(!st) {
148 if(!set_value) return -1; /* Not a default value */
149 st = (*sptr = CALLOC(1, sizeof(*st)));
150 if(!st) return -1;
151 }
152
153 if(set_value) {
154 uint8_t *ptr = MALLOC(sizeof(defv));
155 if(!ptr) return -1;
156 memcpy(ptr, &defv, sizeof(defv));
157 FREEMEM(st->buf);
158 st->buf = ptr;
159 st->size = sizeof(defv) - 1;
160 return 0;
161 } else {
162 if(st->size != (sizeof(defv) - 1)
163 || memcmp(st->buf, &defv, sizeof(defv) - 1))
164 return 0;
165 return 1;
166 }
167
168 }
169 static asn_TYPE_member_t asn_MBR_Singleton_1[] = {
170 { ATF_POINTER, 1, offsetof(struct Singleton, opt_z),
171 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
172 .tag_mode = -1, /* IMPLICIT tag at current level */
173 .type = &asn_DEF_IA5String,
174 .memb_constraints = 0, /* Defer constraints checking to the member type */
175 .per_constraints = 0, /* No PER visible constraints */
176 .default_value = asn_DFL_2_set, /* DEFAULT "z" */
177 .name = "opt-z"
178 },
179 };
180 static const int asn_MAP_Singleton_oms_1[] = { 0 };
181 static const ber_tlv_tag_t asn_DEF_Singleton_tags_1[] = {
182 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
183 };
184 static const asn_TYPE_tag2member_t asn_MAP_Singleton_tag2el_1[] = {
185 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* opt-z */
186 };
187 static asn_SEQUENCE_specifics_t asn_SPC_Singleton_specs_1 = {
188 sizeof(struct Singleton),
189 offsetof(struct Singleton, _asn_ctx),
190 asn_MAP_Singleton_tag2el_1,
191 1, /* Count of tags in the map */
192 asn_MAP_Singleton_oms_1, /* Optional members */
193 1, 0, /* Root/Additions */
194 -1, /* Start extensions */
195 -1 /* Stop extensions */
196 };
197 asn_TYPE_descriptor_t asn_DEF_Singleton = {
198 "Singleton",
199 "Singleton",
200 SEQUENCE_free,
201 SEQUENCE_print,
202 SEQUENCE_constraint,
203 SEQUENCE_decode_ber,
204 SEQUENCE_encode_der,
205 SEQUENCE_decode_xer,
206 SEQUENCE_encode_xer,
207 SEQUENCE_decode_uper,
208 SEQUENCE_encode_uper,
209 0, /* Use generic outmost tag fetcher */
210 asn_DEF_Singleton_tags_1,
211 sizeof(asn_DEF_Singleton_tags_1)
212 /sizeof(asn_DEF_Singleton_tags_1[0]), /* 1 */
213 asn_DEF_Singleton_tags_1, /* Same as above */
214 sizeof(asn_DEF_Singleton_tags_1)
215 /sizeof(asn_DEF_Singleton_tags_1[0]), /* 1 */
216 0, /* No PER visible constraints */
217 asn_MBR_Singleton_1,
218 1, /* Elements count */
219 &asn_SPC_Singleton_specs_1 /* Additional specs */
220 };
221
222
223 /*** <<< INCLUDES [PDU-2] >>> ***/
224
225 #include <NativeInteger.h>
226 #include <constr_CHOICE.h>
227
228 /*** <<< DEPS [PDU-2] >>> ***/
229
230 typedef enum PDU_2_PR {
231 PDU_2_PR_NOTHING, /* No components present */
232 PDU_2_PR_main,
233 /* Extensions may appear below */
234 PDU_2_PR_ext1,
235 PDU_2_PR_ext0
236 } PDU_2_PR;
237
238 /*** <<< TYPE-DECLS [PDU-2] >>> ***/
239
240 typedef struct PDU_2 {
241 PDU_2_PR present;
242 union PDU_2_u {
243 long main;
244 /*
245 * This type is extensible,
246 * possible extensions are below.
247 */
248 long ext1;
249 long ext0;
250 } choice;
251
252 /* Context for parsing across buffer boundaries */
253 asn_struct_ctx_t _asn_ctx;
254 } PDU_2_t;
255
256 /*** <<< FUNC-DECLS [PDU-2] >>> ***/
257
258 extern asn_TYPE_descriptor_t asn_DEF_PDU_2;
259
260 /*** <<< CTDEFS [PDU-2] >>> ***/
261
262 static asn_per_constraints_t asn_PER_type_PDU_2_constr_1 GCC_NOTUSED = {
263 { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
264 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
265 0, 0 /* No PER value map */
266 };
267
268 /*** <<< STAT-DEFS [PDU-2] >>> ***/
269
270 static asn_TYPE_member_t asn_MBR_PDU_2_1[] = {
271 { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.main),
272 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
273 .tag_mode = -1, /* IMPLICIT tag at current level */
274 .type = &asn_DEF_NativeInteger,
275 .memb_constraints = 0, /* Defer constraints checking to the member type */
276 .per_constraints = 0, /* No PER visible constraints */
277 .default_value = 0,
278 .name = "main"
279 },
280 { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext1),
281 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
282 .tag_mode = -1, /* IMPLICIT tag at current level */
283 .type = &asn_DEF_NativeInteger,
284 .memb_constraints = 0, /* Defer constraints checking to the member type */
285 .per_constraints = 0, /* No PER visible constraints */
286 .default_value = 0,
287 .name = "ext1"
288 },
289 { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext0),
290 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
291 .tag_mode = -1, /* IMPLICIT tag at current level */
292 .type = &asn_DEF_NativeInteger,
293 .memb_constraints = 0, /* Defer constraints checking to the member type */
294 .per_constraints = 0, /* No PER visible constraints */
295 .default_value = 0,
296 .name = "ext0"
297 },
298 };
299 static const int asn_MAP_PDU_2_cmap_1[] = { 0, 2, 1 };
300 static const asn_TYPE_tag2member_t asn_MAP_PDU_2_tag2el_1[] = {
301 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* ext0 */
302 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ext1 */
303 { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 } /* main */
304 };
305 static asn_CHOICE_specifics_t asn_SPC_PDU_2_specs_1 = {
306 sizeof(struct PDU_2),
307 offsetof(struct PDU_2, _asn_ctx),
308 offsetof(struct PDU_2, present),
309 sizeof(((struct PDU_2 *)0)->present),
310 asn_MAP_PDU_2_tag2el_1,
311 3, /* Count of tags in the map */
312 .canonical_order = asn_MAP_PDU_2_cmap_1, /* Canonically sorted */
313 .ext_start = 1 /* Extensions start */
314 };
315 asn_TYPE_descriptor_t asn_DEF_PDU_2 = {
316 "PDU-2",
317 "PDU-2",
318 CHOICE_free,
319 CHOICE_print,
320 CHOICE_constraint,
321 CHOICE_decode_ber,
322 CHOICE_encode_der,
323 CHOICE_decode_xer,
324 CHOICE_encode_xer,
325 CHOICE_decode_uper,
326 CHOICE_encode_uper,
327 CHOICE_outmost_tag,
328 0, /* No effective tags (pointer) */
329 0, /* No effective tags (count) */
330 0, /* No tags (pointer) */
331 0, /* No tags (count) */
332 &asn_PER_type_PDU_2_constr_1,
333 asn_MBR_PDU_2_1,
334 3, /* Elements count */
335 &asn_SPC_PDU_2_specs_1 /* Additional specs */
336 };
337