blob: 23424460546a500c9412d09e4530489d71a35f9b [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
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800102 if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
Lev Walkin18660d22017-08-12 20:45:23 -0700103 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),
Lev Walkine3917082017-08-23 10:29:38 -0700167 .tag2el = asn_MAP_value_tag2el_3,
168 .tag2el_count = 2, /* Count of tags in the map */
Lev Walkin18660d22017-08-12 20:45:23 -0700169 .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",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800176 &asn_OP_OPEN_TYPE,
Lev Walkin18660d22017-08-12 20:45:23 -0700177 OPEN_TYPE_constraint,
Lev Walkin18660d22017-08-12 20:45:23 -0700178 0, /* No effective tags (pointer) */
179 0, /* No effective tags (count) */
180 0, /* No tags (pointer) */
181 0, /* No tags (count) */
182 0, /* No OER visible constraints */
183 0, /* No PER visible constraints */
184 asn_MBR_value_3,
185 2, /* Elements count */
186 &asn_SPC_value_specs_3 /* Additional specs */
187};
188
Lev Walkind357f3d2017-08-10 17:40:37 -0700189static asn_TYPE_member_t asn_MBR_Frame_1[] = {
190 { ATF_NOFLAGS, 0, offsetof(struct Frame, ident),
Lev Walkin18660d22017-08-12 20:45:23 -0700191 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
192 .tag_mode = -1, /* IMPLICIT tag at current level */
Lev Walkind357f3d2017-08-10 17:40:37 -0700193 .type = &asn_DEF_ConstrainedInteger,
194 .type_selector = 0,
195 .memb_constraints = memb_ident_constraint_1,
196 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
197 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
198 .default_value = 0,
199 .name = "ident"
200 },
201 { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
Lev Walkin18660d22017-08-12 20:45:23 -0700202 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
203 .tag_mode = +1, /* EXPLICIT tag at current level */
204 .type = &asn_DEF_value_3,
Lev Walkind357f3d2017-08-10 17:40:37 -0700205 .type_selector = select_value_type,
206 .memb_constraints = memb_value_constraint_1,
207 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
208 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
209 .default_value = 0,
210 .name = "value"
211 },
212};
213static const ber_tlv_tag_t asn_DEF_Frame_tags_1[] = {
214 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
215};
216static const asn_TYPE_tag2member_t asn_MAP_Frame_tag2el_1[] = {
Lev Walkin18660d22017-08-12 20:45:23 -0700217 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ident */
218 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* value */
Lev Walkind357f3d2017-08-10 17:40:37 -0700219};
220static asn_SEQUENCE_specifics_t asn_SPC_Frame_specs_1 = {
221 sizeof(struct Frame),
222 offsetof(struct Frame, _asn_ctx),
Lev Walkine3917082017-08-23 10:29:38 -0700223 .tag2el = asn_MAP_Frame_tag2el_1,
224 .tag2el_count = 2, /* Count of tags in the map */
Lev Walkind357f3d2017-08-10 17:40:37 -0700225 0, 0, 0, /* Optional elements (not needed) */
226 1, /* Start extensions */
227 3 /* Stop extensions */
228};
229asn_TYPE_descriptor_t asn_DEF_Frame = {
230 "Frame",
231 "Frame",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800232 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700233 SEQUENCE_constraint,
Lev Walkind357f3d2017-08-10 17:40:37 -0700234 asn_DEF_Frame_tags_1,
235 sizeof(asn_DEF_Frame_tags_1)
236 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
237 asn_DEF_Frame_tags_1, /* Same as above */
238 sizeof(asn_DEF_Frame_tags_1)
239 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
240 0, /* No OER visible constraints */
241 0, /* No PER visible constraints */
242 asn_MBR_Frame_1,
243 2, /* Elements count */
244 &asn_SPC_Frame_specs_1 /* Additional specs */
245};
246
247
248/*** <<< INCLUDES [ConstrainedInteger] >>> ***/
249
250#include <NativeInteger.h>
251
252/*** <<< TYPE-DECLS [ConstrainedInteger] >>> ***/
253
254typedef long ConstrainedInteger_t;
255
256/*** <<< FUNC-DECLS [ConstrainedInteger] >>> ***/
257
258extern asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger;
259asn_struct_free_f ConstrainedInteger_free;
260asn_struct_print_f ConstrainedInteger_print;
261asn_constr_check_f ConstrainedInteger_constraint;
262ber_type_decoder_f ConstrainedInteger_decode_ber;
263der_type_encoder_f ConstrainedInteger_encode_der;
264xer_type_decoder_f ConstrainedInteger_decode_xer;
265xer_type_encoder_f ConstrainedInteger_encode_xer;
266
267/*** <<< CODE [ConstrainedInteger] >>> ***/
268
269int
270ConstrainedInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
271 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
272 long value;
273
274 if(!sptr) {
275 ASN__CTFAIL(app_key, td, sptr,
276 "%s: value not given (%s:%d)",
277 td->name, __FILE__, __LINE__);
278 return -1;
279 }
280
281 value = *(const long *)sptr;
282
283 if((value >= 0 && value <= 32767)) {
284 /* Constraint check succeeded */
285 return 0;
286 } else {
287 ASN__CTFAIL(app_key, td, sptr,
288 "%s: constraint failed (%s:%d)",
289 td->name, __FILE__, __LINE__);
290 return -1;
291 }
292}
293
294/*
295 * This type is implemented using NativeInteger,
296 * so here we adjust the DEF accordingly.
297 */
298
299/*** <<< STAT-DEFS [ConstrainedInteger] >>> ***/
300
301static const ber_tlv_tag_t asn_DEF_ConstrainedInteger_tags_1[] = {
302 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
303};
304asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger = {
305 "ConstrainedInteger",
306 "ConstrainedInteger",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800307 &asn_OP_NativeInteger,
Lev Walkind357f3d2017-08-10 17:40:37 -0700308 ConstrainedInteger_constraint,
Lev Walkind357f3d2017-08-10 17:40:37 -0700309 asn_DEF_ConstrainedInteger_tags_1,
310 sizeof(asn_DEF_ConstrainedInteger_tags_1)
311 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
312 asn_DEF_ConstrainedInteger_tags_1, /* Same as above */
313 sizeof(asn_DEF_ConstrainedInteger_tags_1)
314 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
315 0, /* No OER visible constraints */
316 0, /* No PER visible constraints */
317 0, 0, /* No members */
318 0 /* No specifics */
319};
320
321
322/*** <<< INCLUDES [PrimitiveMessage] >>> ***/
323
324#include <constr_SEQUENCE.h>
325
326/*** <<< TYPE-DECLS [PrimitiveMessage] >>> ***/
327
328typedef struct PrimitiveMessage {
329
330 /* Context for parsing across buffer boundaries */
331 asn_struct_ctx_t _asn_ctx;
332} PrimitiveMessage_t;
333
334/*** <<< FUNC-DECLS [PrimitiveMessage] >>> ***/
335
336extern asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage;
337extern asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1;
338
339/*** <<< STAT-DEFS [PrimitiveMessage] >>> ***/
340
341static const ber_tlv_tag_t asn_DEF_PrimitiveMessage_tags_1[] = {
342 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
343};
344asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1 = {
345 sizeof(struct PrimitiveMessage),
346 offsetof(struct PrimitiveMessage, _asn_ctx),
347 0, /* No top level tags */
348 0, /* No tags in the map */
349 0, 0, 0, /* Optional elements (not needed) */
350 -1, /* Start extensions */
351 -1 /* Stop extensions */
352};
353asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage = {
354 "PrimitiveMessage",
355 "PrimitiveMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800356 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700357 SEQUENCE_constraint,
Lev Walkind357f3d2017-08-10 17:40:37 -0700358 asn_DEF_PrimitiveMessage_tags_1,
359 sizeof(asn_DEF_PrimitiveMessage_tags_1)
360 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
361 asn_DEF_PrimitiveMessage_tags_1, /* Same as above */
362 sizeof(asn_DEF_PrimitiveMessage_tags_1)
363 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
364 0, /* No OER visible constraints */
365 0, /* No PER visible constraints */
366 0, 0, /* No members */
367 &asn_SPC_PrimitiveMessage_specs_1 /* Additional specs */
368};
369
370
371/*** <<< INCLUDES [ComplexMessage] >>> ***/
372
373#include <constr_SEQUENCE.h>
374
375/*** <<< TYPE-DECLS [ComplexMessage] >>> ***/
376
377typedef struct ComplexMessage {
378
379 /* Context for parsing across buffer boundaries */
380 asn_struct_ctx_t _asn_ctx;
381} ComplexMessage_t;
382
383/*** <<< FUNC-DECLS [ComplexMessage] >>> ***/
384
385extern asn_TYPE_descriptor_t asn_DEF_ComplexMessage;
386extern asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1;
387
388/*** <<< STAT-DEFS [ComplexMessage] >>> ***/
389
390static const ber_tlv_tag_t asn_DEF_ComplexMessage_tags_1[] = {
391 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
392};
393asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1 = {
394 sizeof(struct ComplexMessage),
395 offsetof(struct ComplexMessage, _asn_ctx),
396 0, /* No top level tags */
397 0, /* No tags in the map */
398 0, 0, 0, /* Optional elements (not needed) */
399 -1, /* Start extensions */
400 -1 /* Stop extensions */
401};
402asn_TYPE_descriptor_t asn_DEF_ComplexMessage = {
403 "ComplexMessage",
404 "ComplexMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800405 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700406 SEQUENCE_constraint,
Lev Walkind357f3d2017-08-10 17:40:37 -0700407 asn_DEF_ComplexMessage_tags_1,
408 sizeof(asn_DEF_ComplexMessage_tags_1)
409 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
410 asn_DEF_ComplexMessage_tags_1, /* Same as above */
411 sizeof(asn_DEF_ComplexMessage_tags_1)
412 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
413 0, /* No OER visible constraints */
414 0, /* No PER visible constraints */
415 0, 0, /* No members */
416 &asn_SPC_ComplexMessage_specs_1 /* Additional specs */
417};
418