NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / tests / tests-asn1c-compiler / 155-parameterization-more-than-two-level-OK.asn1.-Pgen-PER
1
2 /*** <<< INCLUDES [PacketId] >>> ***/
3
4 #include <NativeInteger.h>
5
6 /*** <<< TYPE-DECLS [PacketId] >>> ***/
7
8 typedef long     PacketId_t;
9
10 /*** <<< FUNC-DECLS [PacketId] >>> ***/
11
12 #define PacketId_id_TYPE1       ((PacketId_t)1)
13 extern asn_per_constraints_t asn_PER_type_PacketId_constr_1;
14 extern asn_TYPE_descriptor_t asn_DEF_PacketId;
15 asn_struct_free_f PacketId_free;
16 asn_struct_print_f PacketId_print;
17 asn_constr_check_f PacketId_constraint;
18 ber_type_decoder_f PacketId_decode_ber;
19 der_type_encoder_f PacketId_encode_der;
20 xer_type_decoder_f PacketId_decode_xer;
21 xer_type_encoder_f PacketId_encode_xer;
22 per_type_decoder_f PacketId_decode_uper;
23 per_type_encoder_f PacketId_encode_uper;
24 per_type_decoder_f PacketId_decode_aper;
25 per_type_encoder_f PacketId_encode_aper;
26
27 /*** <<< CODE [PacketId] >>> ***/
28
29 int
30 PacketId_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
31                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
32         long value;
33         
34         if(!sptr) {
35                 ASN__CTFAIL(app_key, td, sptr,
36                         "%s: value not given (%s:%d)",
37                         td->name, __FILE__, __LINE__);
38                 return -1;
39         }
40         
41         value = *(const long *)sptr;
42         
43         if((value >= 0 && value <= 65535)) {
44                 /* Constraint check succeeded */
45                 return 0;
46         } else {
47                 ASN__CTFAIL(app_key, td, sptr,
48                         "%s: constraint failed (%s:%d)",
49                         td->name, __FILE__, __LINE__);
50                 return -1;
51         }
52 }
53
54 /*
55  * This type is implemented using NativeInteger,
56  * so here we adjust the DEF accordingly.
57  */
58
59 /*** <<< CTDEFS [PacketId] >>> ***/
60
61 asn_per_constraints_t asn_PER_type_PacketId_constr_1 CC_NOTUSED = {
62         { APC_CONSTRAINED,       16,  16,  0,  65535 }  /* (0..65535) */,
63         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
64         0, 0    /* No PER value map */
65 };
66
67 /*** <<< STAT-DEFS [PacketId] >>> ***/
68
69 static const ber_tlv_tag_t asn_DEF_PacketId_tags_1[] = {
70         (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
71 };
72 asn_TYPE_descriptor_t asn_DEF_PacketId = {
73         "PacketId",
74         "PacketId",
75         &asn_OP_NativeInteger,
76         asn_DEF_PacketId_tags_1,
77         sizeof(asn_DEF_PacketId_tags_1)
78                 /sizeof(asn_DEF_PacketId_tags_1[0]), /* 1 */
79         asn_DEF_PacketId_tags_1,        /* Same as above */
80         sizeof(asn_DEF_PacketId_tags_1)
81                 /sizeof(asn_DEF_PacketId_tags_1[0]), /* 1 */
82         { 0, &asn_PER_type_PacketId_constr_1, PacketId_constraint },
83         0, 0,   /* No members */
84         0       /* No specifics */
85 };
86
87
88 /*** <<< INCLUDES [Color] >>> ***/
89
90 #include <NativeEnumerated.h>
91
92 /*** <<< DEPS [Color] >>> ***/
93
94 typedef enum Color {
95         Color_red       = 0,
96         Color_green     = 1,
97         Color_blue      = 2
98 } e_Color;
99
100 /*** <<< TYPE-DECLS [Color] >>> ***/
101
102 typedef long     Color_t;
103
104 /*** <<< FUNC-DECLS [Color] >>> ***/
105
106 extern asn_per_constraints_t asn_PER_type_Color_constr_1;
107 extern asn_TYPE_descriptor_t asn_DEF_Color;
108 extern const asn_INTEGER_specifics_t asn_SPC_Color_specs_1;
109 asn_struct_free_f Color_free;
110 asn_struct_print_f Color_print;
111 asn_constr_check_f Color_constraint;
112 ber_type_decoder_f Color_decode_ber;
113 der_type_encoder_f Color_encode_der;
114 xer_type_decoder_f Color_decode_xer;
115 xer_type_encoder_f Color_encode_xer;
116 per_type_decoder_f Color_decode_uper;
117 per_type_encoder_f Color_encode_uper;
118 per_type_decoder_f Color_decode_aper;
119 per_type_encoder_f Color_encode_aper;
120
121 /*** <<< CODE [Color] >>> ***/
122
123 /*
124  * This type is implemented using NativeEnumerated,
125  * so here we adjust the DEF accordingly.
126  */
127
128 /*** <<< CTDEFS [Color] >>> ***/
129
130 asn_per_constraints_t asn_PER_type_Color_constr_1 CC_NOTUSED = {
131         { APC_CONSTRAINED,       2,  2,  0,  2 }        /* (0..2) */,
132         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
133         0, 0    /* No PER value map */
134 };
135
136 /*** <<< STAT-DEFS [Color] >>> ***/
137
138 static const asn_INTEGER_enum_map_t asn_MAP_Color_value2enum_1[] = {
139         { 0,    3,      "red" },
140         { 1,    5,      "green" },
141         { 2,    4,      "blue" }
142 };
143 static const unsigned int asn_MAP_Color_enum2value_1[] = {
144         2,      /* blue(2) */
145         1,      /* green(1) */
146         0       /* red(0) */
147 };
148 const asn_INTEGER_specifics_t asn_SPC_Color_specs_1 = {
149         asn_MAP_Color_value2enum_1,     /* "tag" => N; sorted by tag */
150         asn_MAP_Color_enum2value_1,     /* N => "tag"; sorted by N */
151         3,      /* Number of elements in the maps */
152         0,      /* Enumeration is not extensible */
153         1,      /* Strict enumeration */
154         0,      /* Native long size */
155         0
156 };
157 static const ber_tlv_tag_t asn_DEF_Color_tags_1[] = {
158         (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
159 };
160 asn_TYPE_descriptor_t asn_DEF_Color = {
161         "Color",
162         "Color",
163         &asn_OP_NativeEnumerated,
164         asn_DEF_Color_tags_1,
165         sizeof(asn_DEF_Color_tags_1)
166                 /sizeof(asn_DEF_Color_tags_1[0]), /* 1 */
167         asn_DEF_Color_tags_1,   /* Same as above */
168         sizeof(asn_DEF_Color_tags_1)
169                 /sizeof(asn_DEF_Color_tags_1[0]), /* 1 */
170         { 0, &asn_PER_type_Color_constr_1, NativeEnumerated_constraint },
171         0, 0,   /* Defined elsewhere */
172         &asn_SPC_Color_specs_1  /* Additional specs */
173 };
174
175
176 /*** <<< INCLUDES [Valid] >>> ***/
177
178 #include <NativeEnumerated.h>
179
180 /*** <<< DEPS [Valid] >>> ***/
181
182 typedef enum Valid {
183         Valid_crc_nok   = 0,
184         Valid_crc_ok    = 1
185 } e_Valid;
186
187 /*** <<< TYPE-DECLS [Valid] >>> ***/
188
189 typedef long     Valid_t;
190
191 /*** <<< FUNC-DECLS [Valid] >>> ***/
192
193 extern asn_per_constraints_t asn_PER_type_Valid_constr_1;
194 extern asn_TYPE_descriptor_t asn_DEF_Valid;
195 extern const asn_INTEGER_specifics_t asn_SPC_Valid_specs_1;
196 asn_struct_free_f Valid_free;
197 asn_struct_print_f Valid_print;
198 asn_constr_check_f Valid_constraint;
199 ber_type_decoder_f Valid_decode_ber;
200 der_type_encoder_f Valid_encode_der;
201 xer_type_decoder_f Valid_decode_xer;
202 xer_type_encoder_f Valid_encode_xer;
203 per_type_decoder_f Valid_decode_uper;
204 per_type_encoder_f Valid_encode_uper;
205 per_type_decoder_f Valid_decode_aper;
206 per_type_encoder_f Valid_encode_aper;
207
208 /*** <<< CODE [Valid] >>> ***/
209
210 /*
211  * This type is implemented using NativeEnumerated,
212  * so here we adjust the DEF accordingly.
213  */
214
215 /*** <<< CTDEFS [Valid] >>> ***/
216
217 asn_per_constraints_t asn_PER_type_Valid_constr_1 CC_NOTUSED = {
218         { APC_CONSTRAINED,       1,  1,  0,  1 }        /* (0..1) */,
219         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
220         0, 0    /* No PER value map */
221 };
222
223 /*** <<< STAT-DEFS [Valid] >>> ***/
224
225 static const asn_INTEGER_enum_map_t asn_MAP_Valid_value2enum_1[] = {
226         { 0,    7,      "crc-nok" },
227         { 1,    6,      "crc-ok" }
228 };
229 static const unsigned int asn_MAP_Valid_enum2value_1[] = {
230         0,      /* crc-nok(0) */
231         1       /* crc-ok(1) */
232 };
233 const asn_INTEGER_specifics_t asn_SPC_Valid_specs_1 = {
234         asn_MAP_Valid_value2enum_1,     /* "tag" => N; sorted by tag */
235         asn_MAP_Valid_enum2value_1,     /* N => "tag"; sorted by N */
236         2,      /* Number of elements in the maps */
237         0,      /* Enumeration is not extensible */
238         1,      /* Strict enumeration */
239         0,      /* Native long size */
240         0
241 };
242 static const ber_tlv_tag_t asn_DEF_Valid_tags_1[] = {
243         (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
244 };
245 asn_TYPE_descriptor_t asn_DEF_Valid = {
246         "Valid",
247         "Valid",
248         &asn_OP_NativeEnumerated,
249         asn_DEF_Valid_tags_1,
250         sizeof(asn_DEF_Valid_tags_1)
251                 /sizeof(asn_DEF_Valid_tags_1[0]), /* 1 */
252         asn_DEF_Valid_tags_1,   /* Same as above */
253         sizeof(asn_DEF_Valid_tags_1)
254                 /sizeof(asn_DEF_Valid_tags_1[0]), /* 1 */
255         { 0, &asn_PER_type_Valid_constr_1, NativeEnumerated_constraint },
256         0, 0,   /* Defined elsewhere */
257         &asn_SPC_Valid_specs_1  /* Additional specs */
258 };
259
260
261 /*** <<< INCLUDES [Packet-List] >>> ***/
262
263 #include "UpperLayer-List.h"
264
265 /*** <<< TYPE-DECLS [Packet-List] >>> ***/
266
267 typedef UpperLayer_List_41P0_t   Packet_List_t;
268
269 /*** <<< FUNC-DECLS [Packet-List] >>> ***/
270
271 extern asn_TYPE_descriptor_t asn_DEF_Packet_List;
272 asn_struct_free_f Packet_List_free;
273 asn_struct_print_f Packet_List_print;
274 asn_constr_check_f Packet_List_constraint;
275 ber_type_decoder_f Packet_List_decode_ber;
276 der_type_encoder_f Packet_List_encode_der;
277 xer_type_decoder_f Packet_List_decode_xer;
278 xer_type_encoder_f Packet_List_encode_xer;
279 per_type_decoder_f Packet_List_decode_uper;
280 per_type_encoder_f Packet_List_encode_uper;
281 per_type_decoder_f Packet_List_decode_aper;
282 per_type_encoder_f Packet_List_encode_aper;
283
284 /*** <<< CODE [Packet-List] >>> ***/
285
286 int
287 Packet_List_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
288                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
289         size_t size;
290         
291         if(!sptr) {
292                 ASN__CTFAIL(app_key, td, sptr,
293                         "%s: value not given (%s:%d)",
294                         td->name, __FILE__, __LINE__);
295                 return -1;
296         }
297         
298         /* Determine the number of elements */
299         size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
300         
301         if((size >= 1 && size <= 256)) {
302                 /* Perform validation of the inner elements */
303                 return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
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 UpperLayer_List_41P0,
314  * so here we adjust the DEF accordingly.
315  */
316
317 /*** <<< CTDEFS [Packet-List] >>> ***/
318
319 static asn_per_constraints_t asn_PER_type_Packet_List_constr_1 CC_NOTUSED = {
320         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
321         { APC_CONSTRAINED,       8,  8,  1,  256 }      /* (SIZE(1..256)) */,
322         0, 0    /* No PER value map */
323 };
324
325 /*** <<< STAT-DEFS [Packet-List] >>> ***/
326
327 static const ber_tlv_tag_t asn_DEF_Packet_List_tags_1[] = {
328         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
329 };
330 asn_TYPE_descriptor_t asn_DEF_Packet_List = {
331         "Packet-List",
332         "Packet-List",
333         &asn_OP_SEQUENCE_OF,
334         asn_DEF_Packet_List_tags_1,
335         sizeof(asn_DEF_Packet_List_tags_1)
336                 /sizeof(asn_DEF_Packet_List_tags_1[0]), /* 1 */
337         asn_DEF_Packet_List_tags_1,     /* Same as above */
338         sizeof(asn_DEF_Packet_List_tags_1)
339                 /sizeof(asn_DEF_Packet_List_tags_1[0]), /* 1 */
340         { 0, &asn_PER_type_Packet_List_constr_1, Packet_List_constraint },
341         asn_MBR_LowerLayer_List_45P0_1,
342         1,      /* Single element */
343         &asn_SPC_LowerLayer_List_45P0_specs_1   /* Additional specs */
344 };
345
346
347 /*** <<< INCLUDES [UpperLayer-List] >>> ***/
348
349 #include "LowerLayer-List.h"
350
351 /*** <<< TYPE-DECLS [UpperLayer-List] >>> ***/
352
353 typedef LowerLayer_List_45P0_t   UpperLayer_List_41P0_t;
354
355 /*** <<< FUNC-DECLS [UpperLayer-List] >>> ***/
356
357 extern asn_per_constraints_t asn_PER_type_UpperLayer_List_41P0_constr_1;
358 extern asn_TYPE_descriptor_t asn_DEF_UpperLayer_List_41P0;
359 asn_struct_free_f UpperLayer_List_41P0_free;
360 asn_struct_print_f UpperLayer_List_41P0_print;
361 asn_constr_check_f UpperLayer_List_41P0_constraint;
362 ber_type_decoder_f UpperLayer_List_41P0_decode_ber;
363 der_type_encoder_f UpperLayer_List_41P0_encode_der;
364 xer_type_decoder_f UpperLayer_List_41P0_decode_xer;
365 xer_type_encoder_f UpperLayer_List_41P0_encode_xer;
366 per_type_decoder_f UpperLayer_List_41P0_decode_uper;
367 per_type_encoder_f UpperLayer_List_41P0_encode_uper;
368 per_type_decoder_f UpperLayer_List_41P0_decode_aper;
369 per_type_encoder_f UpperLayer_List_41P0_encode_aper;
370
371 /*** <<< CODE [UpperLayer-List] >>> ***/
372
373 int
374 UpperLayer_List_41P0_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
375                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
376         size_t size;
377         
378         if(!sptr) {
379                 ASN__CTFAIL(app_key, td, sptr,
380                         "%s: value not given (%s:%d)",
381                         td->name, __FILE__, __LINE__);
382                 return -1;
383         }
384         
385         /* Determine the number of elements */
386         size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
387         
388         if((size >= 1 && size <= 256)) {
389                 /* Perform validation of the inner elements */
390                 return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
391         } else {
392                 ASN__CTFAIL(app_key, td, sptr,
393                         "%s: constraint failed (%s:%d)",
394                         td->name, __FILE__, __LINE__);
395                 return -1;
396         }
397 }
398
399 /*
400  * This type is implemented using LowerLayer_List_45P0,
401  * so here we adjust the DEF accordingly.
402  */
403
404 /*** <<< CTDEFS [UpperLayer-List] >>> ***/
405
406 asn_per_constraints_t asn_PER_type_UpperLayer_List_41P0_constr_1 CC_NOTUSED = {
407         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
408         { APC_CONSTRAINED,       8,  8,  1,  256 }      /* (SIZE(1..256)) */,
409         0, 0    /* No PER value map */
410 };
411
412 /*** <<< STAT-DEFS [UpperLayer-List] >>> ***/
413
414 static const ber_tlv_tag_t asn_DEF_UpperLayer_List_41P0_tags_1[] = {
415         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
416 };
417 asn_TYPE_descriptor_t asn_DEF_UpperLayer_List_41P0 = {
418         "UpperLayer-List",
419         "UpperLayer-List",
420         &asn_OP_SEQUENCE_OF,
421         asn_DEF_UpperLayer_List_41P0_tags_1,
422         sizeof(asn_DEF_UpperLayer_List_41P0_tags_1)
423                 /sizeof(asn_DEF_UpperLayer_List_41P0_tags_1[0]), /* 1 */
424         asn_DEF_UpperLayer_List_41P0_tags_1,    /* Same as above */
425         sizeof(asn_DEF_UpperLayer_List_41P0_tags_1)
426                 /sizeof(asn_DEF_UpperLayer_List_41P0_tags_1[0]), /* 1 */
427         { 0, &asn_PER_type_UpperLayer_List_41P0_constr_1, UpperLayer_List_41P0_constraint },
428         asn_MBR_LowerLayer_List_45P0_1,
429         1,      /* Single element */
430         &asn_SPC_LowerLayer_List_45P0_specs_1   /* Additional specs */
431 };
432
433
434 /*** <<< INCLUDES [LowerLayer-List] >>> ***/
435
436 #include <asn_SEQUENCE_OF.h>
437 #include <constr_SEQUENCE_OF.h>
438
439 /*** <<< FWD-DECLS [LowerLayer-List] >>> ***/
440
441 struct SinglePacket;
442
443 /*** <<< TYPE-DECLS [LowerLayer-List] >>> ***/
444
445 typedef struct LowerLayer_List_45P0 {
446         A_SEQUENCE_OF(struct SinglePacket) list;
447         
448         /* Context for parsing across buffer boundaries */
449         asn_struct_ctx_t _asn_ctx;
450 } LowerLayer_List_45P0_t;
451
452 /*** <<< FUNC-DECLS [LowerLayer-List] >>> ***/
453
454 extern asn_TYPE_descriptor_t asn_DEF_LowerLayer_List_45P0;
455 extern asn_SET_OF_specifics_t asn_SPC_LowerLayer_List_45P0_specs_1;
456 extern asn_TYPE_member_t asn_MBR_LowerLayer_List_45P0_1[1];
457 extern asn_per_constraints_t asn_PER_type_LowerLayer_List_45P0_constr_1;
458
459 /*** <<< POST-INCLUDE [LowerLayer-List] >>> ***/
460
461 #include "SinglePacket.h"
462
463 /*** <<< CTDEFS [LowerLayer-List] >>> ***/
464
465 asn_per_constraints_t asn_PER_type_LowerLayer_List_45P0_constr_1 CC_NOTUSED = {
466         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
467         { APC_CONSTRAINED,       8,  8,  1,  256 }      /* (SIZE(1..256)) */,
468         0, 0    /* No PER value map */
469 };
470
471 /*** <<< STAT-DEFS [LowerLayer-List] >>> ***/
472
473 asn_TYPE_member_t asn_MBR_LowerLayer_List_45P0_1[] = {
474         { ATF_POINTER, 0, 0,
475                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
476                 .tag_mode = 0,
477                 .type = &asn_DEF_SinglePacket_48P0,
478                 .type_selector = 0,
479                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
480                 0, 0, /* No default value */
481                 .name = ""
482                 },
483 };
484 static const ber_tlv_tag_t asn_DEF_LowerLayer_List_45P0_tags_1[] = {
485         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
486 };
487 asn_SET_OF_specifics_t asn_SPC_LowerLayer_List_45P0_specs_1 = {
488         sizeof(struct LowerLayer_List_45P0),
489         offsetof(struct LowerLayer_List_45P0, _asn_ctx),
490         0,      /* XER encoding is XMLDelimitedItemList */
491 };
492 asn_TYPE_descriptor_t asn_DEF_LowerLayer_List_45P0 = {
493         "LowerLayer-List",
494         "LowerLayer-List",
495         &asn_OP_SEQUENCE_OF,
496         asn_DEF_LowerLayer_List_45P0_tags_1,
497         sizeof(asn_DEF_LowerLayer_List_45P0_tags_1)
498                 /sizeof(asn_DEF_LowerLayer_List_45P0_tags_1[0]), /* 1 */
499         asn_DEF_LowerLayer_List_45P0_tags_1,    /* Same as above */
500         sizeof(asn_DEF_LowerLayer_List_45P0_tags_1)
501                 /sizeof(asn_DEF_LowerLayer_List_45P0_tags_1[0]), /* 1 */
502         { 0, &asn_PER_type_LowerLayer_List_45P0_constr_1, SEQUENCE_OF_constraint },
503         asn_MBR_LowerLayer_List_45P0_1,
504         1,      /* Single element */
505         &asn_SPC_LowerLayer_List_45P0_specs_1   /* Additional specs */
506 };
507
508
509 /*** <<< INCLUDES [SinglePacket] >>> ***/
510
511 #include "Packet.h"
512
513 /*** <<< TYPE-DECLS [SinglePacket] >>> ***/
514
515 typedef ClassItem_t      SinglePacket_48P0_t;
516
517 /*** <<< FUNC-DECLS [SinglePacket] >>> ***/
518
519 extern asn_TYPE_descriptor_t asn_DEF_SinglePacket_48P0;
520 asn_struct_free_f SinglePacket_48P0_free;
521 asn_struct_print_f SinglePacket_48P0_print;
522 asn_constr_check_f SinglePacket_48P0_constraint;
523 ber_type_decoder_f SinglePacket_48P0_decode_ber;
524 der_type_encoder_f SinglePacket_48P0_encode_der;
525 xer_type_decoder_f SinglePacket_48P0_decode_xer;
526 xer_type_encoder_f SinglePacket_48P0_encode_xer;
527 per_type_decoder_f SinglePacket_48P0_decode_uper;
528 per_type_encoder_f SinglePacket_48P0_encode_uper;
529 per_type_decoder_f SinglePacket_48P0_decode_aper;
530 per_type_encoder_f SinglePacket_48P0_encode_aper;
531
532 /*** <<< CODE [SinglePacket] >>> ***/
533
534 /*
535  * This type is implemented using ClassItem,
536  * so here we adjust the DEF accordingly.
537  */
538
539 /*** <<< STAT-DEFS [SinglePacket] >>> ***/
540
541 static const ber_tlv_tag_t asn_DEF_SinglePacket_48P0_tags_1[] = {
542         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
543 };
544 asn_TYPE_descriptor_t asn_DEF_SinglePacket_48P0 = {
545         "SinglePacket",
546         "SinglePacket",
547         &asn_OP_SEQUENCE,
548         asn_DEF_SinglePacket_48P0_tags_1,
549         sizeof(asn_DEF_SinglePacket_48P0_tags_1)
550                 /sizeof(asn_DEF_SinglePacket_48P0_tags_1[0]), /* 1 */
551         asn_DEF_SinglePacket_48P0_tags_1,       /* Same as above */
552         sizeof(asn_DEF_SinglePacket_48P0_tags_1)
553                 /sizeof(asn_DEF_SinglePacket_48P0_tags_1[0]), /* 1 */
554         { 0, 0, SEQUENCE_constraint },
555         asn_MBR_ClassItem_1,
556         3,      /* Elements count */
557         &asn_SPC_ClassItem_specs_1      /* Additional specs */
558 };
559
560
561 /*** <<< INCLUDES [Packet] >>> ***/
562
563 #include "PacketId.h"
564 #include "Color.h"
565 #include <ANY.h>
566 #include <asn_ioc.h>
567 #include <OCTET_STRING.h>
568 #include "Valid.h"
569 #include <OPEN_TYPE.h>
570 #include <constr_CHOICE.h>
571 #include <constr_SEQUENCE.h>
572
573 /*** <<< DEPS [Packet] >>> ***/
574
575 typedef enum value_PR {
576         value_PR_NOTHING,       /* No components present */
577         value_PR_OCTET_STRING
578 } value_PR;
579
580 /*** <<< TYPE-DECLS [Packet] >>> ***/
581
582 typedef struct ClassItem {
583         PacketId_t       id;
584         Color_t  color;
585         struct value {
586                 value_PR present;
587                 union ClassItem__value_u {
588                         OCTET_STRING_t   OCTET_STRING;
589                 } choice;
590                 
591                 /* Context for parsing across buffer boundaries */
592                 asn_struct_ctx_t _asn_ctx;
593         } value;
594         
595         /* Context for parsing across buffer boundaries */
596         asn_struct_ctx_t _asn_ctx;
597 } ClassItem_t;
598
599 /*** <<< FUNC-DECLS [Packet] >>> ***/
600
601 extern asn_TYPE_descriptor_t asn_DEF_ClassItem;
602 extern asn_SEQUENCE_specifics_t asn_SPC_ClassItem_specs_1;
603 extern asn_TYPE_member_t asn_MBR_ClassItem_1[3];
604
605 /*** <<< IOC-TABLES [Packet] >>> ***/
606
607 static const long asn_VAL_1_id_TYPE1 = 1;
608 static const long asn_VAL_1_blue = 2;
609 static const long asn_VAL_1_crc_ok = 1;
610 static const asn_ioc_cell_t asn_IOS_ClassItem_1_rows[] = {
611         { "&id", aioc__value, &asn_DEF_PacketId, &asn_VAL_1_id_TYPE1 },
612         { "&color", aioc__value, &asn_DEF_Color, &asn_VAL_1_blue },
613         { "&Value", aioc__type, &asn_DEF_OCTET_STRING },
614         { "&valid", aioc__value, &asn_DEF_Valid, &asn_VAL_1_crc_ok }
615 };
616 static const asn_ioc_set_t asn_IOS_ClassItem_1[] = {
617         { 1, 4, asn_IOS_ClassItem_1_rows }
618 };
619
620 /*** <<< CODE [Packet] >>> ***/
621
622 static int
623 memb_id_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
624                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
625         long value;
626         
627         if(!sptr) {
628                 ASN__CTFAIL(app_key, td, sptr,
629                         "%s: value not given (%s:%d)",
630                         td->name, __FILE__, __LINE__);
631                 return -1;
632         }
633         
634         value = *(const long *)sptr;
635         
636         if((value >= 0 && value <= 65535)) {
637                 /* Constraint check succeeded */
638                 return 0;
639         } else {
640                 ASN__CTFAIL(app_key, td, sptr,
641                         "%s: constraint failed (%s:%d)",
642                         td->name, __FILE__, __LINE__);
643                 return -1;
644         }
645 }
646
647 static asn_type_selector_result_t
648 select_ClassItem_color_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
649         asn_type_selector_result_t result = {0, 0};
650         const asn_ioc_set_t *itable = asn_IOS_ClassItem_1;
651         size_t constraining_column = 0; /* &id */
652         size_t for_column = 1; /* &color */
653         size_t row, presence_index = 0;
654         const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct ClassItem, id));
655         
656         for(row=0; row < itable->rows_count; row++) {
657             const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];
658             const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];
659         
660             if(type_cell->cell_kind == aioc__undefined)
661                 continue;
662         
663             presence_index++;
664             if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
665                 result.type_descriptor = type_cell->type_descriptor;
666                 result.presence_index = presence_index;
667                 break;
668             }
669         }
670         
671         return result;
672 }
673
674 static int
675 memb_color_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
676                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
677         
678         if(!sptr) {
679                 ASN__CTFAIL(app_key, td, sptr,
680                         "%s: value not given (%s:%d)",
681                         td->name, __FILE__, __LINE__);
682                 return -1;
683         }
684         
685         
686         if(1 /* No applicable constraints whatsoever */) {
687                 /* Nothing is here. See below */
688         }
689         
690         return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
691 }
692
693 static asn_type_selector_result_t
694 select_ClassItem_value_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
695         asn_type_selector_result_t result = {0, 0};
696         const asn_ioc_set_t *itable = asn_IOS_ClassItem_1;
697         size_t constraining_column = 0; /* &id */
698         size_t for_column = 2; /* &Value */
699         size_t row, presence_index = 0;
700         const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct ClassItem, id));
701         
702         for(row=0; row < itable->rows_count; row++) {
703             const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];
704             const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];
705         
706             if(type_cell->cell_kind == aioc__undefined)
707                 continue;
708         
709             presence_index++;
710             if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
711                 result.type_descriptor = type_cell->type_descriptor;
712                 result.presence_index = presence_index;
713                 break;
714             }
715         }
716         
717         return result;
718 }
719
720 static int
721 memb_value_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
722                         asn_app_constraint_failed_f *ctfailcb, void *app_key) {
723         
724         if(!sptr) {
725                 ASN__CTFAIL(app_key, td, sptr,
726                         "%s: value not given (%s:%d)",
727                         td->name, __FILE__, __LINE__);
728                 return -1;
729         }
730         
731         
732         if(1 /* No applicable constraints whatsoever */) {
733                 /* Nothing is here. See below */
734         }
735         
736         return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
737 }
738
739
740 /*** <<< CTDEFS [Packet] >>> ***/
741
742 static asn_per_constraints_t asn_PER_memb_id_constr_2 CC_NOTUSED = {
743         { APC_CONSTRAINED,       16,  16,  0,  65535 }  /* (0..65535) */,
744         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
745         0, 0    /* No PER value map */
746 };
747 static asn_per_constraints_t asn_PER_memb_color_constr_3 CC_NOTUSED = {
748         { APC_CONSTRAINED,       2,  2,  0,  2 }        /* (0..2) */,
749         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
750         0, 0    /* No PER value map */
751 };
752 static asn_per_constraints_t asn_PER_memb_value_constr_4 CC_NOTUSED = {
753         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
754         { APC_UNCONSTRAINED,    -1, -1,  0,  0 },
755         0, 0    /* No PER value map */
756 };
757
758 /*** <<< STAT-DEFS [Packet] >>> ***/
759
760 static asn_TYPE_member_t asn_MBR_value_4[] = {
761         { ATF_NOFLAGS, 0, offsetof(struct value, choice.OCTET_STRING),
762                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
763                 .tag_mode = 0,
764                 .type = &asn_DEF_OCTET_STRING,
765                 .type_selector = 0,
766                 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
767                 0, 0, /* No default value */
768                 .name = "OCTET STRING"
769                 },
770 };
771 static const asn_TYPE_tag2member_t asn_MAP_value_tag2el_4[] = {
772     { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 } /* OCTET STRING */
773 };
774 static asn_CHOICE_specifics_t asn_SPC_value_specs_4 = {
775         sizeof(struct value),
776         offsetof(struct value, _asn_ctx),
777         offsetof(struct value, present),
778         sizeof(((struct value *)0)->present),
779         .tag2el = asn_MAP_value_tag2el_4,
780         .tag2el_count = 1,      /* Count of tags in the map */
781         0, 0,
782         .first_extension = -1   /* Extensions start */
783 };
784 static /* Use -fall-defs-global to expose */
785 asn_TYPE_descriptor_t asn_DEF_value_4 = {
786         "value",
787         "value",
788         &asn_OP_OPEN_TYPE,
789         0,      /* No effective tags (pointer) */
790         0,      /* No effective tags (count) */
791         0,      /* No tags (pointer) */
792         0,      /* No tags (count) */
793         { 0, 0, OPEN_TYPE_constraint },
794         asn_MBR_value_4,
795         1,      /* Elements count */
796         &asn_SPC_value_specs_4  /* Additional specs */
797 };
798
799 asn_TYPE_member_t asn_MBR_ClassItem_1[] = {
800         { ATF_NOFLAGS, 0, offsetof(struct ClassItem, id),
801                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
802                 .tag_mode = 0,
803                 .type = &asn_DEF_PacketId,
804                 .type_selector = 0,
805                 { .oer_constraints = 0, .per_constraints = &asn_PER_memb_id_constr_2, .general_constraints =  memb_id_constraint_1 },
806                 0, 0, /* No default value */
807                 .name = "id"
808                 },
809         { ATF_NOFLAGS, 0, offsetof(struct ClassItem, color),
810                 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
811                 .tag_mode = 0,
812                 .type = &asn_DEF_Color,
813                 .type_selector = select_ClassItem_color_type,
814                 { .oer_constraints = 0, .per_constraints = &asn_PER_memb_color_constr_3, .general_constraints =  memb_color_constraint_1 },
815                 0, 0, /* No default value */
816                 .name = "color"
817                 },
818         { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct ClassItem, value),
819                 .tag = -1 /* Ambiguous tag (ANY?) */,
820                 .tag_mode = 0,
821                 .type = &asn_DEF_value_4,
822                 .type_selector = select_ClassItem_value_type,
823                 { .oer_constraints = 0, .per_constraints = &asn_PER_memb_value_constr_4, .general_constraints =  memb_value_constraint_1 },
824                 0, 0, /* No default value */
825                 .name = "value"
826                 },
827 };
828 static const ber_tlv_tag_t asn_DEF_ClassItem_tags_1[] = {
829         (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
830 };
831 static const asn_TYPE_tag2member_t asn_MAP_ClassItem_tag2el_1[] = {
832     { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* id */
833     { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 1, 0, 0 } /* color */
834 };
835 asn_SEQUENCE_specifics_t asn_SPC_ClassItem_specs_1 = {
836         sizeof(struct ClassItem),
837         offsetof(struct ClassItem, _asn_ctx),
838         .tag2el = asn_MAP_ClassItem_tag2el_1,
839         .tag2el_count = 2,      /* Count of tags in the map */
840         0, 0, 0,        /* Optional elements (not needed) */
841         -1,     /* First extension addition */
842 };
843 asn_TYPE_descriptor_t asn_DEF_ClassItem = {
844         "ClassItem",
845         "ClassItem",
846         &asn_OP_SEQUENCE,
847         asn_DEF_ClassItem_tags_1,
848         sizeof(asn_DEF_ClassItem_tags_1)
849                 /sizeof(asn_DEF_ClassItem_tags_1[0]), /* 1 */
850         asn_DEF_ClassItem_tags_1,       /* Same as above */
851         sizeof(asn_DEF_ClassItem_tags_1)
852                 /sizeof(asn_DEF_ClassItem_tags_1[0]), /* 1 */
853         { 0, 0, SEQUENCE_constraint },
854         asn_MBR_ClassItem_1,
855         3,      /* Elements count */
856         &asn_SPC_ClassItem_specs_1      /* Additional specs */
857 };
858
859
860 /*** <<< asn_constant.h >>> ***/
861
862 /*
863  * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
864  */
865
866 #ifndef _ASN_CONSTANT_H
867 #define _ASN_CONSTANT_H
868
869 #ifdef __cplusplus
870 extern "C" {
871 #endif
872
873 #define max_items (256)
874
875
876 #ifdef __cplusplus
877 }
878 #endif
879
880 #endif /* _ASN_CONSTANT_H */