blob: 9befb070d2d15c9cdb7cb5f5f93d14aef50d43a9 [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;
Bi-Ruei, Chiue460c3b2017-10-19 20:49:17 +080027 union Frame__value_u {
Lev Walkin18660d22017-08-12 20:45:23 -070028 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
Lev Walkin20696a42017-10-17 21:27:33 -070065memb_ident_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkind357f3d2017-08-10 17:40:37 -070066 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
Bi-Ruei, Chiue460c3b2017-10-19 20:49:17 +080090select_Frame_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
Lev Walkin20696a42017-10-17 21:27:33 -0700113memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkind357f3d2017-08-10 17:40:37 -0700114 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
Lev Walkin0bfea562017-09-29 23:16:48 -0700128 return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
Lev Walkind357f3d2017-08-10 17:40:37 -0700129}
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,
Lev Walkin0bfea562017-09-29 23:16:48 -0700140 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700141 0, 0, /* No default value */
Lev Walkin18660d22017-08-12 20:45:23 -0700142 .name = "PrimitiveMessage"
143 },
144 { ATF_NOFLAGS, 0, offsetof(struct value, choice.ComplexMessage),
145 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
146 .tag_mode = 0,
147 .type = &asn_DEF_ComplexMessage,
148 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700149 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700150 0, 0, /* No default value */
Lev Walkin18660d22017-08-12 20:45:23 -0700151 .name = "ComplexMessage"
152 },
153};
154static const asn_TYPE_tag2member_t asn_MAP_value_tag2el_3[] = {
155 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* PrimitiveMessage */
156 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* ComplexMessage */
157};
158static asn_CHOICE_specifics_t asn_SPC_value_specs_3 = {
159 sizeof(struct value),
160 offsetof(struct value, _asn_ctx),
161 offsetof(struct value, present),
162 sizeof(((struct value *)0)->present),
Lev Walkine3917082017-08-23 10:29:38 -0700163 .tag2el = asn_MAP_value_tag2el_3,
164 .tag2el_count = 2, /* Count of tags in the map */
Lev Walkin20696a42017-10-17 21:27:33 -0700165 0, 0,
Lev Walkin18660d22017-08-12 20:45:23 -0700166 .ext_start = -1 /* Extensions start */
167};
168static /* Use -fall-defs-global to expose */
169asn_TYPE_descriptor_t asn_DEF_value_3 = {
170 "value",
171 "value",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800172 &asn_OP_OPEN_TYPE,
Lev Walkin18660d22017-08-12 20:45:23 -0700173 0, /* No effective tags (pointer) */
174 0, /* No effective tags (count) */
175 0, /* No tags (pointer) */
176 0, /* No tags (count) */
Lev Walkin0bfea562017-09-29 23:16:48 -0700177 { 0, 0, OPEN_TYPE_constraint },
Lev Walkin18660d22017-08-12 20:45:23 -0700178 asn_MBR_value_3,
179 2, /* Elements count */
180 &asn_SPC_value_specs_3 /* Additional specs */
181};
182
Lev Walkind357f3d2017-08-10 17:40:37 -0700183static asn_TYPE_member_t asn_MBR_Frame_1[] = {
184 { ATF_NOFLAGS, 0, offsetof(struct Frame, ident),
Lev Walkin18660d22017-08-12 20:45:23 -0700185 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
186 .tag_mode = -1, /* IMPLICIT tag at current level */
Lev Walkind357f3d2017-08-10 17:40:37 -0700187 .type = &asn_DEF_ConstrainedInteger,
188 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700189 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_ident_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700190 0, 0, /* No default value */
Lev Walkind357f3d2017-08-10 17:40:37 -0700191 .name = "ident"
192 },
193 { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct Frame, value),
Lev Walkin18660d22017-08-12 20:45:23 -0700194 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
195 .tag_mode = +1, /* EXPLICIT tag at current level */
196 .type = &asn_DEF_value_3,
Bi-Ruei, Chiue460c3b2017-10-19 20:49:17 +0800197 .type_selector = select_Frame_value_type,
Lev Walkin0bfea562017-09-29 23:16:48 -0700198 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = memb_value_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700199 0, 0, /* No default value */
Lev Walkind357f3d2017-08-10 17:40:37 -0700200 .name = "value"
201 },
202};
203static const ber_tlv_tag_t asn_DEF_Frame_tags_1[] = {
204 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
205};
206static const asn_TYPE_tag2member_t asn_MAP_Frame_tag2el_1[] = {
Lev Walkin18660d22017-08-12 20:45:23 -0700207 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ident */
208 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* value */
Lev Walkind357f3d2017-08-10 17:40:37 -0700209};
210static asn_SEQUENCE_specifics_t asn_SPC_Frame_specs_1 = {
211 sizeof(struct Frame),
212 offsetof(struct Frame, _asn_ctx),
Lev Walkine3917082017-08-23 10:29:38 -0700213 .tag2el = asn_MAP_Frame_tag2el_1,
214 .tag2el_count = 2, /* Count of tags in the map */
Lev Walkind357f3d2017-08-10 17:40:37 -0700215 0, 0, 0, /* Optional elements (not needed) */
216 1, /* Start extensions */
217 3 /* Stop extensions */
218};
219asn_TYPE_descriptor_t asn_DEF_Frame = {
220 "Frame",
221 "Frame",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800222 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700223 asn_DEF_Frame_tags_1,
224 sizeof(asn_DEF_Frame_tags_1)
225 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
226 asn_DEF_Frame_tags_1, /* Same as above */
227 sizeof(asn_DEF_Frame_tags_1)
228 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700229 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700230 asn_MBR_Frame_1,
231 2, /* Elements count */
232 &asn_SPC_Frame_specs_1 /* Additional specs */
233};
234
235
236/*** <<< INCLUDES [ConstrainedInteger] >>> ***/
237
238#include <NativeInteger.h>
239
240/*** <<< TYPE-DECLS [ConstrainedInteger] >>> ***/
241
242typedef long ConstrainedInteger_t;
243
244/*** <<< FUNC-DECLS [ConstrainedInteger] >>> ***/
245
246extern asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger;
247asn_struct_free_f ConstrainedInteger_free;
248asn_struct_print_f ConstrainedInteger_print;
249asn_constr_check_f ConstrainedInteger_constraint;
250ber_type_decoder_f ConstrainedInteger_decode_ber;
251der_type_encoder_f ConstrainedInteger_encode_der;
252xer_type_decoder_f ConstrainedInteger_decode_xer;
253xer_type_encoder_f ConstrainedInteger_encode_xer;
254
255/*** <<< CODE [ConstrainedInteger] >>> ***/
256
257int
Lev Walkin20696a42017-10-17 21:27:33 -0700258ConstrainedInteger_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkind357f3d2017-08-10 17:40:37 -0700259 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
260 long value;
261
262 if(!sptr) {
263 ASN__CTFAIL(app_key, td, sptr,
264 "%s: value not given (%s:%d)",
265 td->name, __FILE__, __LINE__);
266 return -1;
267 }
268
269 value = *(const long *)sptr;
270
271 if((value >= 0 && value <= 32767)) {
272 /* Constraint check succeeded */
273 return 0;
274 } else {
275 ASN__CTFAIL(app_key, td, sptr,
276 "%s: constraint failed (%s:%d)",
277 td->name, __FILE__, __LINE__);
278 return -1;
279 }
280}
281
282/*
283 * This type is implemented using NativeInteger,
284 * so here we adjust the DEF accordingly.
285 */
286
287/*** <<< STAT-DEFS [ConstrainedInteger] >>> ***/
288
289static const ber_tlv_tag_t asn_DEF_ConstrainedInteger_tags_1[] = {
290 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
291};
292asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger = {
293 "ConstrainedInteger",
294 "ConstrainedInteger",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800295 &asn_OP_NativeInteger,
Lev Walkind357f3d2017-08-10 17:40:37 -0700296 asn_DEF_ConstrainedInteger_tags_1,
297 sizeof(asn_DEF_ConstrainedInteger_tags_1)
298 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
299 asn_DEF_ConstrainedInteger_tags_1, /* Same as above */
300 sizeof(asn_DEF_ConstrainedInteger_tags_1)
301 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700302 { 0, 0, ConstrainedInteger_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700303 0, 0, /* No members */
304 0 /* No specifics */
305};
306
307
308/*** <<< INCLUDES [PrimitiveMessage] >>> ***/
309
310#include <constr_SEQUENCE.h>
311
312/*** <<< TYPE-DECLS [PrimitiveMessage] >>> ***/
313
314typedef struct PrimitiveMessage {
315
316 /* Context for parsing across buffer boundaries */
317 asn_struct_ctx_t _asn_ctx;
318} PrimitiveMessage_t;
319
320/*** <<< FUNC-DECLS [PrimitiveMessage] >>> ***/
321
322extern asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage;
323extern asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1;
324
325/*** <<< STAT-DEFS [PrimitiveMessage] >>> ***/
326
327static const ber_tlv_tag_t asn_DEF_PrimitiveMessage_tags_1[] = {
328 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
329};
330asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1 = {
331 sizeof(struct PrimitiveMessage),
332 offsetof(struct PrimitiveMessage, _asn_ctx),
333 0, /* No top level tags */
334 0, /* No tags in the map */
335 0, 0, 0, /* Optional elements (not needed) */
336 -1, /* Start extensions */
337 -1 /* Stop extensions */
338};
339asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage = {
340 "PrimitiveMessage",
341 "PrimitiveMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800342 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700343 asn_DEF_PrimitiveMessage_tags_1,
344 sizeof(asn_DEF_PrimitiveMessage_tags_1)
345 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
346 asn_DEF_PrimitiveMessage_tags_1, /* Same as above */
347 sizeof(asn_DEF_PrimitiveMessage_tags_1)
348 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700349 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700350 0, 0, /* No members */
351 &asn_SPC_PrimitiveMessage_specs_1 /* Additional specs */
352};
353
354
355/*** <<< INCLUDES [ComplexMessage] >>> ***/
356
357#include <constr_SEQUENCE.h>
358
359/*** <<< TYPE-DECLS [ComplexMessage] >>> ***/
360
361typedef struct ComplexMessage {
362
363 /* Context for parsing across buffer boundaries */
364 asn_struct_ctx_t _asn_ctx;
365} ComplexMessage_t;
366
367/*** <<< FUNC-DECLS [ComplexMessage] >>> ***/
368
369extern asn_TYPE_descriptor_t asn_DEF_ComplexMessage;
370extern asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1;
371
372/*** <<< STAT-DEFS [ComplexMessage] >>> ***/
373
374static const ber_tlv_tag_t asn_DEF_ComplexMessage_tags_1[] = {
375 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
376};
377asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1 = {
378 sizeof(struct ComplexMessage),
379 offsetof(struct ComplexMessage, _asn_ctx),
380 0, /* No top level tags */
381 0, /* No tags in the map */
382 0, 0, 0, /* Optional elements (not needed) */
383 -1, /* Start extensions */
384 -1 /* Stop extensions */
385};
386asn_TYPE_descriptor_t asn_DEF_ComplexMessage = {
387 "ComplexMessage",
388 "ComplexMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800389 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700390 asn_DEF_ComplexMessage_tags_1,
391 sizeof(asn_DEF_ComplexMessage_tags_1)
392 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
393 asn_DEF_ComplexMessage_tags_1, /* Same as above */
394 sizeof(asn_DEF_ComplexMessage_tags_1)
395 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700396 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700397 0, 0, /* No members */
398 &asn_SPC_ComplexMessage_specs_1 /* Additional specs */
399};
400