blob: 9043f2247ffe728196524c52c4e512f07d57878e [file] [log] [blame]
Lev Walkind357f3d2017-08-10 17:40:37 -07001
2/*** <<< INCLUDES [Frame] >>> ***/
3
4#include "ConstrainedInteger.h"
5#include <ANY.h>
6#include <asn_ioc.h>
7#include "PrimitiveMessage.h"
8#include "ComplexMessage.h"
Lev Walkin18660d22017-08-12 20:45:23 -07009#include <OPEN_TYPE.h>
10#include <constr_CHOICE.h>
Lev Walkind357f3d2017-08-10 17:40:37 -070011#include <constr_SEQUENCE.h>
12
Lev Walkin18660d22017-08-12 20:45:23 -070013/*** <<< DEPS [Frame] >>> ***/
14
15typedef enum value_PR {
16 value_PR_NOTHING, /* No components present */
17 value_PR_PrimitiveMessage,
18 value_PR_ComplexMessage
19} value_PR;
20
Lev Walkind357f3d2017-08-10 17:40:37 -070021/*** <<< TYPE-DECLS [Frame] >>> ***/
22
23typedef struct Frame {
24 ConstrainedInteger_t ident;
Lev Walkin18660d22017-08-12 20:45:23 -070025 struct value {
26 value_PR present;
27 union value_u {
28 PrimitiveMessage_t PrimitiveMessage;
29 ComplexMessage_t ComplexMessage;
30 } choice;
31
32 /* Context for parsing across buffer boundaries */
33 asn_struct_ctx_t _asn_ctx;
34 } value;
Lev Walkind357f3d2017-08-10 17:40:37 -070035 /*
36 * This type is extensible,
37 * possible extensions are below.
38 */
39
40 /* Context for parsing across buffer boundaries */
41 asn_struct_ctx_t _asn_ctx;
42} Frame_t;
43
44/*** <<< FUNC-DECLS [Frame] >>> ***/
45
46extern asn_TYPE_descriptor_t asn_DEF_Frame;
47
48/*** <<< IOC-TABLES [Frame] >>> ***/
49
50static const long asn_VAL_1_primMessage = 1;
51static const long asn_VAL_2_cplxMessage = 2;
52static const asn_ioc_cell_t asn_IOS_FrameTypes_1_rows[] = {
53 { "&id", aioc__value, &asn_DEF_ConstrainedInteger, &asn_VAL_1_primMessage },
54 { "&Type", aioc__type, &asn_DEF_PrimitiveMessage },
55 { "&id", aioc__value, &asn_DEF_ConstrainedInteger, &asn_VAL_2_cplxMessage },
56 { "&Type", aioc__type, &asn_DEF_ComplexMessage }
57};
Lev Walkin18660d22017-08-12 20:45:23 -070058static const asn_ioc_set_t asn_IOS_FrameTypes_1[] = {
Lev Walkind357f3d2017-08-10 17:40:37 -070059 2, 2, asn_IOS_FrameTypes_1_rows
60};
61
62/*** <<< CODE [Frame] >>> ***/
63
64static int
65memb_ident_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
66 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
67 long value;
68
69 if(!sptr) {
70 ASN__CTFAIL(app_key, td, sptr,
71 "%s: value not given (%s:%d)",
72 td->name, __FILE__, __LINE__);
73 return -1;
74 }
75
76 value = *(const long *)sptr;
77
78 if((value >= 0 && value <= 32767)) {
79 /* Constraint check succeeded */
80 return 0;
81 } else {
82 ASN__CTFAIL(app_key, td, sptr,
83 "%s: constraint failed (%s:%d)",
84 td->name, __FILE__, __LINE__);
85 return -1;
86 }
87}
88
Lev Walkin18660d22017-08-12 20:45:23 -070089static asn_type_selector_result_t
Lev Walkind357f3d2017-08-10 17:40:37 -070090select_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
Lev Walkin18660d22017-08-12 20:45:23 -070091 asn_type_selector_result_t result = {0, 0};
92 const asn_ioc_set_t *itable = asn_IOS_FrameTypes_1;
Lev Walkind357f3d2017-08-10 17:40:37 -070093 size_t constraining_column = 0; /* &id */
94 size_t for_column = 1; /* &Type */
95 size_t row;
96 const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct Frame, ident));
97
98 for(row=0; row < itable->rows_count; row++) {
Lev Walkin18660d22017-08-12 20:45:23 -070099 const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];
100 const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];
101
102 if(constraining_cell->type_descriptor->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
103 result.type_descriptor = type_cell->type_descriptor;
104 result.presence_index = row + 1;
105 break;
Lev Walkind357f3d2017-08-10 17:40:37 -0700106 }
107 }
108
Lev Walkin18660d22017-08-12 20:45:23 -0700109 return result;
Lev Walkind357f3d2017-08-10 17:40:37 -0700110}
111
112static int
113memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
114 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
115
116 if(!sptr) {
117 ASN__CTFAIL(app_key, td, sptr,
118 "%s: value not given (%s:%d)",
119 td->name, __FILE__, __LINE__);
120 return -1;
121 }
122
123
124 if(1 /* No applicable constraints whatsoever */) {
125 /* Nothing is here. See below */
126 }
127
128 return td->check_constraints(td, sptr, ctfailcb, app_key);
129}
130
131
132/*** <<< STAT-DEFS [Frame] >>> ***/
133
Lev Walkin18660d22017-08-12 20:45:23 -0700134static asn_TYPE_member_t asn_MBR_value_3[] = {
135 { ATF_NOFLAGS, 0, offsetof(struct value, choice.PrimitiveMessage),
136 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
137 .tag_mode = 0,
138 .type = &asn_DEF_PrimitiveMessage,
139 .type_selector = 0,
140 .memb_constraints = 0, /* Defer constraints checking to the member type */
141 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
142 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
143 .default_value = 0,
144 .name = "PrimitiveMessage"
145 },
146 { ATF_NOFLAGS, 0, offsetof(struct value, choice.ComplexMessage),
147 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
148 .tag_mode = 0,
149 .type = &asn_DEF_ComplexMessage,
150 .type_selector = 0,
151 .memb_constraints = 0, /* Defer constraints checking to the member type */
152 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
153 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
154 .default_value = 0,
155 .name = "ComplexMessage"
156 },
157};
158static const asn_TYPE_tag2member_t asn_MAP_value_tag2el_3[] = {
159 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* PrimitiveMessage */
160 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* ComplexMessage */
161};
162static asn_CHOICE_specifics_t asn_SPC_value_specs_3 = {
163 sizeof(struct value),
164 offsetof(struct value, _asn_ctx),
165 offsetof(struct value, present),
166 sizeof(((struct value *)0)->present),
167 asn_MAP_value_tag2el_3,
168 2, /* Count of tags in the map */
169 .canonical_order = 0,
170 .ext_start = -1 /* Extensions start */
171};
172static /* Use -fall-defs-global to expose */
173asn_TYPE_descriptor_t asn_DEF_value_3 = {
174 "value",
175 "value",
176 OPEN_TYPE_free,
177 OPEN_TYPE_print,
178 OPEN_TYPE_compare,
179 OPEN_TYPE_constraint,
180 OPEN_TYPE_decode_ber,
181 OPEN_TYPE_encode_der,
182 OPEN_TYPE_decode_xer,
183 OPEN_TYPE_encode_xer,
184 0, 0, /* No OER support, use "-gen-OER" to enable */
185 0, 0, /* No PER support, use "-gen-PER" to enable */
186 0, /* Use generic outmost tag fetcher */
187 0, /* No effective tags (pointer) */
188 0, /* No effective tags (count) */
189 0, /* No tags (pointer) */
190 0, /* No tags (count) */
191 0, /* No OER visible constraints */
192 0, /* No PER visible constraints */
193 asn_MBR_value_3,
194 2, /* Elements count */
195 &asn_SPC_value_specs_3 /* Additional specs */
196};
197
Lev Walkind357f3d2017-08-10 17:40:37 -0700198static asn_TYPE_member_t asn_MBR_Frame_1[] = {
199 { ATF_NOFLAGS, 0, offsetof(struct Frame, ident),
Lev Walkin18660d22017-08-12 20:45:23 -0700200 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
201 .tag_mode = -1, /* IMPLICIT tag at current level */
Lev Walkind357f3d2017-08-10 17:40:37 -0700202 .type = &asn_DEF_ConstrainedInteger,
203 .type_selector = 0,
204 .memb_constraints = memb_ident_constraint_1,
205 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
206 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
207 .default_value = 0,
208 .name = "ident"
209 },
210 { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
Lev Walkin18660d22017-08-12 20:45:23 -0700211 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
212 .tag_mode = +1, /* EXPLICIT tag at current level */
213 .type = &asn_DEF_value_3,
Lev Walkind357f3d2017-08-10 17:40:37 -0700214 .type_selector = select_value_type,
215 .memb_constraints = memb_value_constraint_1,
216 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
217 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
218 .default_value = 0,
219 .name = "value"
220 },
221};
222static const ber_tlv_tag_t asn_DEF_Frame_tags_1[] = {
223 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
224};
225static const asn_TYPE_tag2member_t asn_MAP_Frame_tag2el_1[] = {
Lev Walkin18660d22017-08-12 20:45:23 -0700226 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ident */
227 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* value */
Lev Walkind357f3d2017-08-10 17:40:37 -0700228};
229static asn_SEQUENCE_specifics_t asn_SPC_Frame_specs_1 = {
230 sizeof(struct Frame),
231 offsetof(struct Frame, _asn_ctx),
232 asn_MAP_Frame_tag2el_1,
Lev Walkin18660d22017-08-12 20:45:23 -0700233 2, /* Count of tags in the map */
Lev Walkind357f3d2017-08-10 17:40:37 -0700234 0, 0, 0, /* Optional elements (not needed) */
235 1, /* Start extensions */
236 3 /* Stop extensions */
237};
238asn_TYPE_descriptor_t asn_DEF_Frame = {
239 "Frame",
240 "Frame",
241 SEQUENCE_free,
242 SEQUENCE_print,
243 SEQUENCE_compare,
244 SEQUENCE_constraint,
245 SEQUENCE_decode_ber,
246 SEQUENCE_encode_der,
247 SEQUENCE_decode_xer,
248 SEQUENCE_encode_xer,
249 0, 0, /* No OER support, use "-gen-OER" to enable */
250 0, 0, /* No PER support, use "-gen-PER" to enable */
251 0, /* Use generic outmost tag fetcher */
252 asn_DEF_Frame_tags_1,
253 sizeof(asn_DEF_Frame_tags_1)
254 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
255 asn_DEF_Frame_tags_1, /* Same as above */
256 sizeof(asn_DEF_Frame_tags_1)
257 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
258 0, /* No OER visible constraints */
259 0, /* No PER visible constraints */
260 asn_MBR_Frame_1,
261 2, /* Elements count */
262 &asn_SPC_Frame_specs_1 /* Additional specs */
263};
264
265
266/*** <<< INCLUDES [ConstrainedInteger] >>> ***/
267
268#include <NativeInteger.h>
269
270/*** <<< TYPE-DECLS [ConstrainedInteger] >>> ***/
271
272typedef long ConstrainedInteger_t;
273
274/*** <<< FUNC-DECLS [ConstrainedInteger] >>> ***/
275
276extern asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger;
277asn_struct_free_f ConstrainedInteger_free;
278asn_struct_print_f ConstrainedInteger_print;
279asn_constr_check_f ConstrainedInteger_constraint;
280ber_type_decoder_f ConstrainedInteger_decode_ber;
281der_type_encoder_f ConstrainedInteger_encode_der;
282xer_type_decoder_f ConstrainedInteger_decode_xer;
283xer_type_encoder_f ConstrainedInteger_encode_xer;
284
285/*** <<< CODE [ConstrainedInteger] >>> ***/
286
287int
288ConstrainedInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
289 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
290 long value;
291
292 if(!sptr) {
293 ASN__CTFAIL(app_key, td, sptr,
294 "%s: value not given (%s:%d)",
295 td->name, __FILE__, __LINE__);
296 return -1;
297 }
298
299 value = *(const long *)sptr;
300
301 if((value >= 0 && value <= 32767)) {
302 /* Constraint check succeeded */
303 return 0;
304 } else {
305 ASN__CTFAIL(app_key, td, sptr,
306 "%s: constraint failed (%s:%d)",
307 td->name, __FILE__, __LINE__);
308 return -1;
309 }
310}
311
312/*
313 * This type is implemented using NativeInteger,
314 * so here we adjust the DEF accordingly.
315 */
316
317/*** <<< STAT-DEFS [ConstrainedInteger] >>> ***/
318
319static const ber_tlv_tag_t asn_DEF_ConstrainedInteger_tags_1[] = {
320 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
321};
322asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger = {
323 "ConstrainedInteger",
324 "ConstrainedInteger",
325 NativeInteger_free,
326 NativeInteger_print,
327 NativeInteger_compare,
328 ConstrainedInteger_constraint,
329 NativeInteger_decode_ber,
330 NativeInteger_encode_der,
331 NativeInteger_decode_xer,
332 NativeInteger_encode_xer,
333 0, 0, /* No OER support, use "-gen-OER" to enable */
334 0, 0, /* No PER support, use "-gen-PER" to enable */
335 0, /* Use generic outmost tag fetcher */
336 asn_DEF_ConstrainedInteger_tags_1,
337 sizeof(asn_DEF_ConstrainedInteger_tags_1)
338 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
339 asn_DEF_ConstrainedInteger_tags_1, /* Same as above */
340 sizeof(asn_DEF_ConstrainedInteger_tags_1)
341 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
342 0, /* No OER visible constraints */
343 0, /* No PER visible constraints */
344 0, 0, /* No members */
345 0 /* No specifics */
346};
347
348
349/*** <<< INCLUDES [PrimitiveMessage] >>> ***/
350
351#include <constr_SEQUENCE.h>
352
353/*** <<< TYPE-DECLS [PrimitiveMessage] >>> ***/
354
355typedef struct PrimitiveMessage {
356
357 /* Context for parsing across buffer boundaries */
358 asn_struct_ctx_t _asn_ctx;
359} PrimitiveMessage_t;
360
361/*** <<< FUNC-DECLS [PrimitiveMessage] >>> ***/
362
363extern asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage;
364extern asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1;
365
366/*** <<< STAT-DEFS [PrimitiveMessage] >>> ***/
367
368static const ber_tlv_tag_t asn_DEF_PrimitiveMessage_tags_1[] = {
369 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
370};
371asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1 = {
372 sizeof(struct PrimitiveMessage),
373 offsetof(struct PrimitiveMessage, _asn_ctx),
374 0, /* No top level tags */
375 0, /* No tags in the map */
376 0, 0, 0, /* Optional elements (not needed) */
377 -1, /* Start extensions */
378 -1 /* Stop extensions */
379};
380asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage = {
381 "PrimitiveMessage",
382 "PrimitiveMessage",
383 SEQUENCE_free,
384 SEQUENCE_print,
385 SEQUENCE_compare,
386 SEQUENCE_constraint,
387 SEQUENCE_decode_ber,
388 SEQUENCE_encode_der,
389 SEQUENCE_decode_xer,
390 SEQUENCE_encode_xer,
391 0, 0, /* No OER support, use "-gen-OER" to enable */
392 0, 0, /* No PER support, use "-gen-PER" to enable */
393 0, /* Use generic outmost tag fetcher */
394 asn_DEF_PrimitiveMessage_tags_1,
395 sizeof(asn_DEF_PrimitiveMessage_tags_1)
396 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
397 asn_DEF_PrimitiveMessage_tags_1, /* Same as above */
398 sizeof(asn_DEF_PrimitiveMessage_tags_1)
399 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
400 0, /* No OER visible constraints */
401 0, /* No PER visible constraints */
402 0, 0, /* No members */
403 &asn_SPC_PrimitiveMessage_specs_1 /* Additional specs */
404};
405
406
407/*** <<< INCLUDES [ComplexMessage] >>> ***/
408
409#include <constr_SEQUENCE.h>
410
411/*** <<< TYPE-DECLS [ComplexMessage] >>> ***/
412
413typedef struct ComplexMessage {
414
415 /* Context for parsing across buffer boundaries */
416 asn_struct_ctx_t _asn_ctx;
417} ComplexMessage_t;
418
419/*** <<< FUNC-DECLS [ComplexMessage] >>> ***/
420
421extern asn_TYPE_descriptor_t asn_DEF_ComplexMessage;
422extern asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1;
423
424/*** <<< STAT-DEFS [ComplexMessage] >>> ***/
425
426static const ber_tlv_tag_t asn_DEF_ComplexMessage_tags_1[] = {
427 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
428};
429asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1 = {
430 sizeof(struct ComplexMessage),
431 offsetof(struct ComplexMessage, _asn_ctx),
432 0, /* No top level tags */
433 0, /* No tags in the map */
434 0, 0, 0, /* Optional elements (not needed) */
435 -1, /* Start extensions */
436 -1 /* Stop extensions */
437};
438asn_TYPE_descriptor_t asn_DEF_ComplexMessage = {
439 "ComplexMessage",
440 "ComplexMessage",
441 SEQUENCE_free,
442 SEQUENCE_print,
443 SEQUENCE_compare,
444 SEQUENCE_constraint,
445 SEQUENCE_decode_ber,
446 SEQUENCE_encode_der,
447 SEQUENCE_decode_xer,
448 SEQUENCE_encode_xer,
449 0, 0, /* No OER support, use "-gen-OER" to enable */
450 0, 0, /* No PER support, use "-gen-PER" to enable */
451 0, /* Use generic outmost tag fetcher */
452 asn_DEF_ComplexMessage_tags_1,
453 sizeof(asn_DEF_ComplexMessage_tags_1)
454 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
455 asn_DEF_ComplexMessage_tags_1, /* Same as above */
456 sizeof(asn_DEF_ComplexMessage_tags_1)
457 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
458 0, /* No OER visible constraints */
459 0, /* No PER visible constraints */
460 0, 0, /* No members */
461 &asn_SPC_ComplexMessage_specs_1 /* Additional specs */
462};
463