blob: b3e7e4f0967dcac82096b92ba929b3a73a42115b [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 Walkindf2edbb2017-10-21 13:40:07 -0700166 .first_extension = -1 /* Extensions start */
Lev Walkin18660d22017-08-12 20:45:23 -0700167};
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) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700216 2, /* First extension addition */
Lev Walkind357f3d2017-08-10 17:40:37 -0700217};
218asn_TYPE_descriptor_t asn_DEF_Frame = {
219 "Frame",
220 "Frame",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800221 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700222 asn_DEF_Frame_tags_1,
223 sizeof(asn_DEF_Frame_tags_1)
224 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
225 asn_DEF_Frame_tags_1, /* Same as above */
226 sizeof(asn_DEF_Frame_tags_1)
227 /sizeof(asn_DEF_Frame_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700228 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700229 asn_MBR_Frame_1,
230 2, /* Elements count */
231 &asn_SPC_Frame_specs_1 /* Additional specs */
232};
233
234
235/*** <<< INCLUDES [ConstrainedInteger] >>> ***/
236
237#include <NativeInteger.h>
238
239/*** <<< TYPE-DECLS [ConstrainedInteger] >>> ***/
240
241typedef long ConstrainedInteger_t;
242
243/*** <<< FUNC-DECLS [ConstrainedInteger] >>> ***/
244
245extern asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger;
246asn_struct_free_f ConstrainedInteger_free;
247asn_struct_print_f ConstrainedInteger_print;
248asn_constr_check_f ConstrainedInteger_constraint;
249ber_type_decoder_f ConstrainedInteger_decode_ber;
250der_type_encoder_f ConstrainedInteger_encode_der;
251xer_type_decoder_f ConstrainedInteger_decode_xer;
252xer_type_encoder_f ConstrainedInteger_encode_xer;
253
254/*** <<< CODE [ConstrainedInteger] >>> ***/
255
256int
Lev Walkin20696a42017-10-17 21:27:33 -0700257ConstrainedInteger_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkind357f3d2017-08-10 17:40:37 -0700258 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
259 long value;
260
261 if(!sptr) {
262 ASN__CTFAIL(app_key, td, sptr,
263 "%s: value not given (%s:%d)",
264 td->name, __FILE__, __LINE__);
265 return -1;
266 }
267
268 value = *(const long *)sptr;
269
270 if((value >= 0 && value <= 32767)) {
271 /* Constraint check succeeded */
272 return 0;
273 } else {
274 ASN__CTFAIL(app_key, td, sptr,
275 "%s: constraint failed (%s:%d)",
276 td->name, __FILE__, __LINE__);
277 return -1;
278 }
279}
280
281/*
282 * This type is implemented using NativeInteger,
283 * so here we adjust the DEF accordingly.
284 */
285
286/*** <<< STAT-DEFS [ConstrainedInteger] >>> ***/
287
288static const ber_tlv_tag_t asn_DEF_ConstrainedInteger_tags_1[] = {
289 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
290};
291asn_TYPE_descriptor_t asn_DEF_ConstrainedInteger = {
292 "ConstrainedInteger",
293 "ConstrainedInteger",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800294 &asn_OP_NativeInteger,
Lev Walkind357f3d2017-08-10 17:40:37 -0700295 asn_DEF_ConstrainedInteger_tags_1,
296 sizeof(asn_DEF_ConstrainedInteger_tags_1)
297 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
298 asn_DEF_ConstrainedInteger_tags_1, /* Same as above */
299 sizeof(asn_DEF_ConstrainedInteger_tags_1)
300 /sizeof(asn_DEF_ConstrainedInteger_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700301 { 0, 0, ConstrainedInteger_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700302 0, 0, /* No members */
303 0 /* No specifics */
304};
305
306
307/*** <<< INCLUDES [PrimitiveMessage] >>> ***/
308
309#include <constr_SEQUENCE.h>
310
311/*** <<< TYPE-DECLS [PrimitiveMessage] >>> ***/
312
313typedef struct PrimitiveMessage {
314
315 /* Context for parsing across buffer boundaries */
316 asn_struct_ctx_t _asn_ctx;
317} PrimitiveMessage_t;
318
319/*** <<< FUNC-DECLS [PrimitiveMessage] >>> ***/
320
321extern asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage;
322extern asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1;
323
324/*** <<< STAT-DEFS [PrimitiveMessage] >>> ***/
325
326static const ber_tlv_tag_t asn_DEF_PrimitiveMessage_tags_1[] = {
327 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
328};
329asn_SEQUENCE_specifics_t asn_SPC_PrimitiveMessage_specs_1 = {
330 sizeof(struct PrimitiveMessage),
331 offsetof(struct PrimitiveMessage, _asn_ctx),
332 0, /* No top level tags */
333 0, /* No tags in the map */
334 0, 0, 0, /* Optional elements (not needed) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700335 -1, /* First extension addition */
Lev Walkind357f3d2017-08-10 17:40:37 -0700336};
337asn_TYPE_descriptor_t asn_DEF_PrimitiveMessage = {
338 "PrimitiveMessage",
339 "PrimitiveMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800340 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700341 asn_DEF_PrimitiveMessage_tags_1,
342 sizeof(asn_DEF_PrimitiveMessage_tags_1)
343 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
344 asn_DEF_PrimitiveMessage_tags_1, /* Same as above */
345 sizeof(asn_DEF_PrimitiveMessage_tags_1)
346 /sizeof(asn_DEF_PrimitiveMessage_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700347 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700348 0, 0, /* No members */
349 &asn_SPC_PrimitiveMessage_specs_1 /* Additional specs */
350};
351
352
353/*** <<< INCLUDES [ComplexMessage] >>> ***/
354
355#include <constr_SEQUENCE.h>
356
357/*** <<< TYPE-DECLS [ComplexMessage] >>> ***/
358
359typedef struct ComplexMessage {
360
361 /* Context for parsing across buffer boundaries */
362 asn_struct_ctx_t _asn_ctx;
363} ComplexMessage_t;
364
365/*** <<< FUNC-DECLS [ComplexMessage] >>> ***/
366
367extern asn_TYPE_descriptor_t asn_DEF_ComplexMessage;
368extern asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1;
369
370/*** <<< STAT-DEFS [ComplexMessage] >>> ***/
371
372static const ber_tlv_tag_t asn_DEF_ComplexMessage_tags_1[] = {
373 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
374};
375asn_SEQUENCE_specifics_t asn_SPC_ComplexMessage_specs_1 = {
376 sizeof(struct ComplexMessage),
377 offsetof(struct ComplexMessage, _asn_ctx),
378 0, /* No top level tags */
379 0, /* No tags in the map */
380 0, 0, 0, /* Optional elements (not needed) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700381 -1, /* First extension addition */
Lev Walkind357f3d2017-08-10 17:40:37 -0700382};
383asn_TYPE_descriptor_t asn_DEF_ComplexMessage = {
384 "ComplexMessage",
385 "ComplexMessage",
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +0800386 &asn_OP_SEQUENCE,
Lev Walkind357f3d2017-08-10 17:40:37 -0700387 asn_DEF_ComplexMessage_tags_1,
388 sizeof(asn_DEF_ComplexMessage_tags_1)
389 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
390 asn_DEF_ComplexMessage_tags_1, /* Same as above */
391 sizeof(asn_DEF_ComplexMessage_tags_1)
392 /sizeof(asn_DEF_ComplexMessage_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700393 { 0, 0, SEQUENCE_constraint },
Lev Walkind357f3d2017-08-10 17:40:37 -0700394 0, 0, /* No members */
395 &asn_SPC_ComplexMessage_specs_1 /* Additional specs */
396};
397