blob: 3ae2200a1513318e711f2bafc3ecb292a8e579ae [file] [log] [blame]
vlm7d576b32004-08-20 13:37:45 +00001
2/*** <<< INCLUDES [Int1] >>> ***/
3
4#include <INTEGER.h>
5
6/*** <<< TYPE-DECLS [Int1] >>> ***/
7
8
9typedef INTEGER_t Int1_t;
10
vlm7d576b32004-08-20 13:37:45 +000011/*** <<< FUNC-DECLS [Int1] >>> ***/
12
13extern asn1_TYPE_descriptor_t asn1_DEF_Int1;
14asn_constr_check_f Int1_constraint;
15ber_type_decoder_f Int1_decode_ber;
16der_type_encoder_f Int1_encode_der;
17asn_struct_print_f Int1_print;
18asn_struct_free_f Int1_free;
19
20/*** <<< CODE [Int1] >>> ***/
21
22int
23Int1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
24 asn_app_consume_bytes_f *app_errlog, void *app_key) {
25
26 /* Make the underlying type checker permanent */
27 td->check_constraints = asn1_DEF_INTEGER.check_constraints;
28 return td->check_constraints
29 (td, sptr, app_errlog, app_key);
30}
31
32/*
33 * This type is implemented using INTEGER,
34 * so adjust the DEF appropriately.
35 */
36static void
37Int1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
38 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
39 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
40 td->free_struct = asn1_DEF_INTEGER.free_struct;
41 td->print_struct = asn1_DEF_INTEGER.print_struct;
42 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
43 td->elements = asn1_DEF_INTEGER.elements;
44 td->elements_count = asn1_DEF_INTEGER.elements_count;
45 td->specifics = asn1_DEF_INTEGER.specifics;
46}
47
48ber_dec_rval_t
49Int1_decode_ber(asn1_TYPE_descriptor_t *td,
50 void **structure, void *bufptr, size_t size, int tag_mode) {
51 Int1_inherit_TYPE_descriptor(td);
52 return td->ber_decoder(td, structure,
53 bufptr, size, tag_mode);
54}
55
56der_enc_rval_t
57Int1_encode_der(asn1_TYPE_descriptor_t *td,
58 void *structure, int tag_mode, ber_tlv_tag_t tag,
59 asn_app_consume_bytes_f *cb, void *app_key) {
60 Int1_inherit_TYPE_descriptor(td);
61 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
62}
63
64int
65Int1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
66 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
67 Int1_inherit_TYPE_descriptor(td);
68 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
69}
70
71void
72Int1_free(asn1_TYPE_descriptor_t *td,
73 void *struct_ptr, int contents_only) {
74 Int1_inherit_TYPE_descriptor(td);
75 td->free_struct(td, struct_ptr, contents_only);
76}
77
78
79/*** <<< STAT-DEFS [Int1] >>> ***/
80
81static ber_tlv_tag_t asn1_DEF_Int1_tags[] = {
82 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
83};
84asn1_TYPE_descriptor_t asn1_DEF_Int1 = {
85 "Int1",
86 Int1_constraint,
87 Int1_decode_ber,
88 Int1_encode_der,
89 Int1_print,
90 Int1_free,
91 0, /* Use generic outmost tag fetcher */
92 asn1_DEF_Int1_tags,
93 sizeof(asn1_DEF_Int1_tags)
94 /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */
95 1, /* Tags to skip */
96 -0, /* Unknown yet */
97 0, 0, /* No members */
98 0 /* No specifics */
99};
100
101
102/*** <<< INCLUDES [Int2] >>> ***/
103
104#include <Int1.h>
105
106/*** <<< TYPE-DECLS [Int2] >>> ***/
107
108
109typedef Int1_t Int2_t;
110
vlm7d576b32004-08-20 13:37:45 +0000111/*** <<< FUNC-DECLS [Int2] >>> ***/
112
113extern asn1_TYPE_descriptor_t asn1_DEF_Int2;
114asn_constr_check_f Int2_constraint;
115ber_type_decoder_f Int2_decode_ber;
116der_type_encoder_f Int2_encode_der;
117asn_struct_print_f Int2_print;
118asn_struct_free_f Int2_free;
119
120/*** <<< CODE [Int2] >>> ***/
121
122int
123Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
124 asn_app_consume_bytes_f *app_errlog, void *app_key) {
125
vlmb08de152004-08-22 03:30:05 +0000126 const Int1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000127 long value;
128
129 if(!sptr) {
130 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000131 "%s: value not given (%s:%d)",
132 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000133 return -1;
134 }
135
vlm34ce8ad2004-09-07 06:43:57 +0000136 /* Check if the sign bit is present */
137 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
vlm7d576b32004-08-20 13:37:45 +0000138
139 if((value >= 0)) {
140 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000141 return 0;
vlm7d576b32004-08-20 13:37:45 +0000142 } else {
143 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000144 "%s: constraint failed (%s:%d)",
145 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000146 return -1;
147 }
148}
149
150/*
151 * This type is implemented using Int1,
152 * so adjust the DEF appropriately.
153 */
154static void
155Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
156 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
157 td->der_encoder = asn1_DEF_Int1.der_encoder;
158 td->free_struct = asn1_DEF_Int1.free_struct;
159 td->print_struct = asn1_DEF_Int1.print_struct;
160 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
161 td->elements = asn1_DEF_Int1.elements;
162 td->elements_count = asn1_DEF_Int1.elements_count;
163 td->specifics = asn1_DEF_Int1.specifics;
164}
165
166ber_dec_rval_t
167Int2_decode_ber(asn1_TYPE_descriptor_t *td,
168 void **structure, void *bufptr, size_t size, int tag_mode) {
169 Int2_inherit_TYPE_descriptor(td);
170 return td->ber_decoder(td, structure,
171 bufptr, size, tag_mode);
172}
173
174der_enc_rval_t
175Int2_encode_der(asn1_TYPE_descriptor_t *td,
176 void *structure, int tag_mode, ber_tlv_tag_t tag,
177 asn_app_consume_bytes_f *cb, void *app_key) {
178 Int2_inherit_TYPE_descriptor(td);
179 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
180}
181
182int
183Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
184 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
185 Int2_inherit_TYPE_descriptor(td);
186 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
187}
188
189void
190Int2_free(asn1_TYPE_descriptor_t *td,
191 void *struct_ptr, int contents_only) {
192 Int2_inherit_TYPE_descriptor(td);
193 td->free_struct(td, struct_ptr, contents_only);
194}
195
196
197/*** <<< STAT-DEFS [Int2] >>> ***/
198
199static ber_tlv_tag_t asn1_DEF_Int2_tags[] = {
200 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
201};
202asn1_TYPE_descriptor_t asn1_DEF_Int2 = {
203 "Int2",
204 Int2_constraint,
205 Int2_decode_ber,
206 Int2_encode_der,
207 Int2_print,
208 Int2_free,
209 0, /* Use generic outmost tag fetcher */
210 asn1_DEF_Int2_tags,
211 sizeof(asn1_DEF_Int2_tags)
212 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
213 1, /* Tags to skip */
214 -0, /* Unknown yet */
215 0, 0, /* No members */
216 0 /* No specifics */
217};
218
219
220/*** <<< INCLUDES [Int3] >>> ***/
221
222#include <Int2.h>
223
224/*** <<< TYPE-DECLS [Int3] >>> ***/
225
226
227typedef Int2_t Int3_t;
228
vlm7d576b32004-08-20 13:37:45 +0000229/*** <<< FUNC-DECLS [Int3] >>> ***/
230
231extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
232asn_constr_check_f Int3_constraint;
233ber_type_decoder_f Int3_decode_ber;
234der_type_encoder_f Int3_encode_der;
235asn_struct_print_f Int3_print;
236asn_struct_free_f Int3_free;
237
238/*** <<< CODE [Int3] >>> ***/
239
240int
241Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
242 asn_app_consume_bytes_f *app_errlog, void *app_key) {
243
vlmb08de152004-08-22 03:30:05 +0000244 const Int2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000245 long value;
246
247 if(!sptr) {
248 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000249 "%s: value not given (%s:%d)",
250 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000251 return -1;
252 }
253
254 if(asn1_INTEGER2long(st, &value)) {
255 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000256 "%s: value too large (%s:%d)",
257 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000258 return -1;
259 }
260
261 if((value >= 0 && value <= 10)) {
262 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000263 return 0;
vlm7d576b32004-08-20 13:37:45 +0000264 } else {
265 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000266 "%s: constraint failed (%s:%d)",
267 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000268 return -1;
269 }
270}
271
272/*
273 * This type is implemented using Int2,
274 * so adjust the DEF appropriately.
275 */
276static void
277Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
278 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
279 td->der_encoder = asn1_DEF_Int2.der_encoder;
280 td->free_struct = asn1_DEF_Int2.free_struct;
281 td->print_struct = asn1_DEF_Int2.print_struct;
282 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
283 td->elements = asn1_DEF_Int2.elements;
284 td->elements_count = asn1_DEF_Int2.elements_count;
285 td->specifics = asn1_DEF_Int2.specifics;
286}
287
288ber_dec_rval_t
289Int3_decode_ber(asn1_TYPE_descriptor_t *td,
290 void **structure, void *bufptr, size_t size, int tag_mode) {
291 Int3_inherit_TYPE_descriptor(td);
292 return td->ber_decoder(td, structure,
293 bufptr, size, tag_mode);
294}
295
296der_enc_rval_t
297Int3_encode_der(asn1_TYPE_descriptor_t *td,
298 void *structure, int tag_mode, ber_tlv_tag_t tag,
299 asn_app_consume_bytes_f *cb, void *app_key) {
300 Int3_inherit_TYPE_descriptor(td);
301 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
302}
303
304int
305Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
306 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
307 Int3_inherit_TYPE_descriptor(td);
308 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
309}
310
311void
312Int3_free(asn1_TYPE_descriptor_t *td,
313 void *struct_ptr, int contents_only) {
314 Int3_inherit_TYPE_descriptor(td);
315 td->free_struct(td, struct_ptr, contents_only);
316}
317
318
319/*** <<< STAT-DEFS [Int3] >>> ***/
320
321static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
322 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
323};
324asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
325 "Int3",
326 Int3_constraint,
327 Int3_decode_ber,
328 Int3_encode_der,
329 Int3_print,
330 Int3_free,
331 0, /* Use generic outmost tag fetcher */
332 asn1_DEF_Int3_tags,
333 sizeof(asn1_DEF_Int3_tags)
334 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
335 1, /* Tags to skip */
336 -0, /* Unknown yet */
337 0, 0, /* No members */
338 0 /* No specifics */
339};
340
341
342/*** <<< INCLUDES [Int4] >>> ***/
343
344#include <Int3.h>
345
346/*** <<< TYPE-DECLS [Int4] >>> ***/
347
348
349typedef Int3_t Int4_t;
350
vlm7d576b32004-08-20 13:37:45 +0000351/*** <<< FUNC-DECLS [Int4] >>> ***/
352
353extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
354asn_constr_check_f Int4_constraint;
355ber_type_decoder_f Int4_decode_ber;
356der_type_encoder_f Int4_encode_der;
357asn_struct_print_f Int4_print;
358asn_struct_free_f Int4_free;
359
360/*** <<< CODE [Int4] >>> ***/
361
362int
363Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
364 asn_app_consume_bytes_f *app_errlog, void *app_key) {
365
vlmb08de152004-08-22 03:30:05 +0000366 const Int3_t *st = sptr;
vlm26afd202004-08-25 02:08:08 +0000367 long value;
vlm7d576b32004-08-20 13:37:45 +0000368
369 if(!sptr) {
370 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000371 "%s: value not given (%s:%d)",
372 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000373 return -1;
374 }
375
vlm26afd202004-08-25 02:08:08 +0000376 if(asn1_INTEGER2long(st, &value)) {
377 _ASN_ERRLOG(app_errlog, app_key,
378 "%s: value too large (%s:%d)",
379 td->name, __FILE__, __LINE__);
380 return -1;
vlm7d576b32004-08-20 13:37:45 +0000381 }
382
vlm26afd202004-08-25 02:08:08 +0000383 if((value >= 1 && value <= 10)) {
384 /* Constraint check succeeded */
385 return 0;
386 } else {
387 _ASN_ERRLOG(app_errlog, app_key,
388 "%s: constraint failed (%s:%d)",
389 td->name, __FILE__, __LINE__);
390 return -1;
391 }
vlm7d576b32004-08-20 13:37:45 +0000392}
393
394/*
395 * This type is implemented using Int3,
396 * so adjust the DEF appropriately.
397 */
398static void
399Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
400 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
401 td->der_encoder = asn1_DEF_Int3.der_encoder;
402 td->free_struct = asn1_DEF_Int3.free_struct;
403 td->print_struct = asn1_DEF_Int3.print_struct;
404 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
405 td->elements = asn1_DEF_Int3.elements;
406 td->elements_count = asn1_DEF_Int3.elements_count;
407 td->specifics = asn1_DEF_Int3.specifics;
408}
409
410ber_dec_rval_t
411Int4_decode_ber(asn1_TYPE_descriptor_t *td,
412 void **structure, void *bufptr, size_t size, int tag_mode) {
413 Int4_inherit_TYPE_descriptor(td);
414 return td->ber_decoder(td, structure,
415 bufptr, size, tag_mode);
416}
417
418der_enc_rval_t
419Int4_encode_der(asn1_TYPE_descriptor_t *td,
420 void *structure, int tag_mode, ber_tlv_tag_t tag,
421 asn_app_consume_bytes_f *cb, void *app_key) {
422 Int4_inherit_TYPE_descriptor(td);
423 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
424}
425
426int
427Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
428 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
429 Int4_inherit_TYPE_descriptor(td);
430 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
431}
432
433void
434Int4_free(asn1_TYPE_descriptor_t *td,
435 void *struct_ptr, int contents_only) {
436 Int4_inherit_TYPE_descriptor(td);
437 td->free_struct(td, struct_ptr, contents_only);
438}
439
440
441/*** <<< STAT-DEFS [Int4] >>> ***/
442
443static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
444 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
445};
446asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
447 "Int4",
448 Int4_constraint,
449 Int4_decode_ber,
450 Int4_encode_der,
451 Int4_print,
452 Int4_free,
453 0, /* Use generic outmost tag fetcher */
454 asn1_DEF_Int4_tags,
455 sizeof(asn1_DEF_Int4_tags)
456 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
457 1, /* Tags to skip */
458 -0, /* Unknown yet */
459 0, 0, /* No members */
460 0 /* No specifics */
461};
462
463
464/*** <<< INCLUDES [Int5] >>> ***/
465
466#include <Int4.h>
467
468/*** <<< TYPE-DECLS [Int5] >>> ***/
469
470
471typedef Int4_t Int5_t;
472
vlm7d576b32004-08-20 13:37:45 +0000473/*** <<< FUNC-DECLS [Int5] >>> ***/
474
475extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
476asn_constr_check_f Int5_constraint;
477ber_type_decoder_f Int5_decode_ber;
478der_type_encoder_f Int5_encode_der;
479asn_struct_print_f Int5_print;
480asn_struct_free_f Int5_free;
481
482/*** <<< CODE [Int5] >>> ***/
483
484int
485Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
486 asn_app_consume_bytes_f *app_errlog, void *app_key) {
487
vlmb08de152004-08-22 03:30:05 +0000488 const Int4_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000489 long value;
490
491 if(!sptr) {
492 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000493 "%s: value not given (%s:%d)",
494 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000495 return -1;
496 }
497
498 if(asn1_INTEGER2long(st, &value)) {
499 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000500 "%s: value too large (%s:%d)",
501 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000502 return -1;
503 }
504
505 if((value == 5)) {
506 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000507 return 0;
vlm7d576b32004-08-20 13:37:45 +0000508 } else {
509 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000510 "%s: constraint failed (%s:%d)",
511 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000512 return -1;
513 }
514}
515
516/*
517 * This type is implemented using Int4,
518 * so adjust the DEF appropriately.
519 */
520static void
521Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
522 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
523 td->der_encoder = asn1_DEF_Int4.der_encoder;
524 td->free_struct = asn1_DEF_Int4.free_struct;
525 td->print_struct = asn1_DEF_Int4.print_struct;
526 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
527 td->elements = asn1_DEF_Int4.elements;
528 td->elements_count = asn1_DEF_Int4.elements_count;
529 td->specifics = asn1_DEF_Int4.specifics;
530}
531
532ber_dec_rval_t
533Int5_decode_ber(asn1_TYPE_descriptor_t *td,
534 void **structure, void *bufptr, size_t size, int tag_mode) {
535 Int5_inherit_TYPE_descriptor(td);
536 return td->ber_decoder(td, structure,
537 bufptr, size, tag_mode);
538}
539
540der_enc_rval_t
541Int5_encode_der(asn1_TYPE_descriptor_t *td,
542 void *structure, int tag_mode, ber_tlv_tag_t tag,
543 asn_app_consume_bytes_f *cb, void *app_key) {
544 Int5_inherit_TYPE_descriptor(td);
545 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
546}
547
548int
549Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
550 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
551 Int5_inherit_TYPE_descriptor(td);
552 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
553}
554
555void
556Int5_free(asn1_TYPE_descriptor_t *td,
557 void *struct_ptr, int contents_only) {
558 Int5_inherit_TYPE_descriptor(td);
559 td->free_struct(td, struct_ptr, contents_only);
560}
561
562
563/*** <<< STAT-DEFS [Int5] >>> ***/
564
565static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
566 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
567};
568asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
569 "Int5",
570 Int5_constraint,
571 Int5_decode_ber,
572 Int5_encode_der,
573 Int5_print,
574 Int5_free,
575 0, /* Use generic outmost tag fetcher */
576 asn1_DEF_Int5_tags,
577 sizeof(asn1_DEF_Int5_tags)
578 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
579 1, /* Tags to skip */
580 -0, /* Unknown yet */
581 0, 0, /* No members */
582 0 /* No specifics */
583};
584
585
586/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
587
588#include <INTEGER.h>
589
590/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
591
592
593typedef INTEGER_t ExtensibleExtensions_t;
594
vlm7d576b32004-08-20 13:37:45 +0000595/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
596
597extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
598asn_constr_check_f ExtensibleExtensions_constraint;
599ber_type_decoder_f ExtensibleExtensions_decode_ber;
600der_type_encoder_f ExtensibleExtensions_encode_der;
601asn_struct_print_f ExtensibleExtensions_print;
602asn_struct_free_f ExtensibleExtensions_free;
603
604/*** <<< CODE [ExtensibleExtensions] >>> ***/
605
606int
607ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
608 asn_app_consume_bytes_f *app_errlog, void *app_key) {
609
vlmb08de152004-08-22 03:30:05 +0000610 const INTEGER_t *st = sptr;
vlm26afd202004-08-25 02:08:08 +0000611 long value;
vlm7d576b32004-08-20 13:37:45 +0000612
613 if(!sptr) {
614 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000615 "%s: value not given (%s:%d)",
616 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000617 return -1;
618 }
619
vlm26afd202004-08-25 02:08:08 +0000620 if(asn1_INTEGER2long(st, &value)) {
621 _ASN_ERRLOG(app_errlog, app_key,
622 "%s: value too large (%s:%d)",
623 td->name, __FILE__, __LINE__);
624 return -1;
vlm7d576b32004-08-20 13:37:45 +0000625 }
626
vlm26afd202004-08-25 02:08:08 +0000627 if((value >= 1 && value <= 256)) {
628 /* Constraint check succeeded */
629 return 0;
630 } else {
631 _ASN_ERRLOG(app_errlog, app_key,
632 "%s: constraint failed (%s:%d)",
633 td->name, __FILE__, __LINE__);
634 return -1;
635 }
vlm7d576b32004-08-20 13:37:45 +0000636}
637
638/*
639 * This type is implemented using INTEGER,
640 * so adjust the DEF appropriately.
641 */
642static void
643ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
644 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
645 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
646 td->free_struct = asn1_DEF_INTEGER.free_struct;
647 td->print_struct = asn1_DEF_INTEGER.print_struct;
648 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
649 td->elements = asn1_DEF_INTEGER.elements;
650 td->elements_count = asn1_DEF_INTEGER.elements_count;
651 td->specifics = asn1_DEF_INTEGER.specifics;
652}
653
654ber_dec_rval_t
655ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
656 void **structure, void *bufptr, size_t size, int tag_mode) {
657 ExtensibleExtensions_inherit_TYPE_descriptor(td);
658 return td->ber_decoder(td, structure,
659 bufptr, size, tag_mode);
660}
661
662der_enc_rval_t
663ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
664 void *structure, int tag_mode, ber_tlv_tag_t tag,
665 asn_app_consume_bytes_f *cb, void *app_key) {
666 ExtensibleExtensions_inherit_TYPE_descriptor(td);
667 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
668}
669
670int
671ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
672 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
673 ExtensibleExtensions_inherit_TYPE_descriptor(td);
674 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
675}
676
677void
678ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
679 void *struct_ptr, int contents_only) {
680 ExtensibleExtensions_inherit_TYPE_descriptor(td);
681 td->free_struct(td, struct_ptr, contents_only);
682}
683
684
685/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
686
687static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
688 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
689};
690asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
691 "ExtensibleExtensions",
692 ExtensibleExtensions_constraint,
693 ExtensibleExtensions_decode_ber,
694 ExtensibleExtensions_encode_der,
695 ExtensibleExtensions_print,
696 ExtensibleExtensions_free,
697 0, /* Use generic outmost tag fetcher */
698 asn1_DEF_ExtensibleExtensions_tags,
699 sizeof(asn1_DEF_ExtensibleExtensions_tags)
700 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
701 1, /* Tags to skip */
702 -0, /* Unknown yet */
703 0, 0, /* No members */
704 0 /* No specifics */
705};
706
707
708/*** <<< INCLUDES [Str1] >>> ***/
709
710#include <IA5String.h>
711
712/*** <<< TYPE-DECLS [Str1] >>> ***/
713
714
715typedef IA5String_t Str1_t;
716
vlm7d576b32004-08-20 13:37:45 +0000717/*** <<< FUNC-DECLS [Str1] >>> ***/
718
719extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
720asn_constr_check_f Str1_constraint;
721ber_type_decoder_f Str1_decode_ber;
722der_type_encoder_f Str1_encode_der;
723asn_struct_print_f Str1_print;
724asn_struct_free_f Str1_free;
725
726/*** <<< CODE [Str1] >>> ***/
727
728int
729Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
730 asn_app_consume_bytes_f *app_errlog, void *app_key) {
731
732 /* Make the underlying type checker permanent */
733 td->check_constraints = asn1_DEF_IA5String.check_constraints;
734 return td->check_constraints
735 (td, sptr, app_errlog, app_key);
736}
737
738/*
739 * This type is implemented using IA5String,
740 * so adjust the DEF appropriately.
741 */
742static void
743Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
744 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
745 td->der_encoder = asn1_DEF_IA5String.der_encoder;
746 td->free_struct = asn1_DEF_IA5String.free_struct;
747 td->print_struct = asn1_DEF_IA5String.print_struct;
748 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
749 td->elements = asn1_DEF_IA5String.elements;
750 td->elements_count = asn1_DEF_IA5String.elements_count;
751 td->specifics = asn1_DEF_IA5String.specifics;
752}
753
754ber_dec_rval_t
755Str1_decode_ber(asn1_TYPE_descriptor_t *td,
756 void **structure, void *bufptr, size_t size, int tag_mode) {
757 Str1_inherit_TYPE_descriptor(td);
758 return td->ber_decoder(td, structure,
759 bufptr, size, tag_mode);
760}
761
762der_enc_rval_t
763Str1_encode_der(asn1_TYPE_descriptor_t *td,
764 void *structure, int tag_mode, ber_tlv_tag_t tag,
765 asn_app_consume_bytes_f *cb, void *app_key) {
766 Str1_inherit_TYPE_descriptor(td);
767 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
768}
769
770int
771Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
772 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
773 Str1_inherit_TYPE_descriptor(td);
774 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
775}
776
777void
778Str1_free(asn1_TYPE_descriptor_t *td,
779 void *struct_ptr, int contents_only) {
780 Str1_inherit_TYPE_descriptor(td);
781 td->free_struct(td, struct_ptr, contents_only);
782}
783
784
785/*** <<< STAT-DEFS [Str1] >>> ***/
786
787static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
788 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
789};
790asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
791 "Str1",
792 Str1_constraint,
793 Str1_decode_ber,
794 Str1_encode_der,
795 Str1_print,
796 Str1_free,
797 0, /* Use generic outmost tag fetcher */
798 asn1_DEF_Str1_tags,
799 sizeof(asn1_DEF_Str1_tags)
800 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
801 1, /* Tags to skip */
802 -0, /* Unknown yet */
803 0, 0, /* No members */
804 0 /* No specifics */
805};
806
807
808/*** <<< INCLUDES [Str2] >>> ***/
809
810#include <Str1.h>
811
812/*** <<< TYPE-DECLS [Str2] >>> ***/
813
814
815typedef Str1_t Str2_t;
816
vlm7d576b32004-08-20 13:37:45 +0000817/*** <<< FUNC-DECLS [Str2] >>> ***/
818
819extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
820asn_constr_check_f Str2_constraint;
821ber_type_decoder_f Str2_decode_ber;
822der_type_encoder_f Str2_encode_der;
823asn_struct_print_f Str2_print;
824asn_struct_free_f Str2_free;
825
826/*** <<< CTABLES [Str2] >>> ***/
827
828static int check_permitted_alphabet_1(const void *sptr) {
829 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000830 const IA5String_t *st = sptr;
831 const uint8_t *ch = st->buf;
832 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000833
834 for(; ch < end; ch++) {
835 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000836 if(!(cv <= 127)) return -1;
vlm7d576b32004-08-20 13:37:45 +0000837 }
vlmcdf661b2004-08-22 12:47:03 +0000838 return 0;
vlm7d576b32004-08-20 13:37:45 +0000839}
840
841
842/*** <<< CODE [Str2] >>> ***/
843
844int
845Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
846 asn_app_consume_bytes_f *app_errlog, void *app_key) {
847
vlmb08de152004-08-22 03:30:05 +0000848 const Str1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000849 size_t size;
850
851 if(!sptr) {
852 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000853 "%s: value not given (%s:%d)",
854 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000855 return -1;
856 }
857
858 size = st->size;
859
860 if(((size <= 20) || (size >= 25 && size <= 30))
vlm7e20dfc2004-08-22 13:11:40 +0000861 && !check_permitted_alphabet_1(sptr)) {
vlm7d576b32004-08-20 13:37:45 +0000862 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000863 return 0;
vlm7d576b32004-08-20 13:37:45 +0000864 } else {
865 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000866 "%s: constraint failed (%s:%d)",
867 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000868 return -1;
869 }
870}
871
872/*
873 * This type is implemented using Str1,
874 * so adjust the DEF appropriately.
875 */
876static void
877Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
878 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
879 td->der_encoder = asn1_DEF_Str1.der_encoder;
880 td->free_struct = asn1_DEF_Str1.free_struct;
881 td->print_struct = asn1_DEF_Str1.print_struct;
882 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
883 td->elements = asn1_DEF_Str1.elements;
884 td->elements_count = asn1_DEF_Str1.elements_count;
885 td->specifics = asn1_DEF_Str1.specifics;
886}
887
888ber_dec_rval_t
889Str2_decode_ber(asn1_TYPE_descriptor_t *td,
890 void **structure, void *bufptr, size_t size, int tag_mode) {
891 Str2_inherit_TYPE_descriptor(td);
892 return td->ber_decoder(td, structure,
893 bufptr, size, tag_mode);
894}
895
896der_enc_rval_t
897Str2_encode_der(asn1_TYPE_descriptor_t *td,
898 void *structure, int tag_mode, ber_tlv_tag_t tag,
899 asn_app_consume_bytes_f *cb, void *app_key) {
900 Str2_inherit_TYPE_descriptor(td);
901 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
902}
903
904int
905Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
906 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
907 Str2_inherit_TYPE_descriptor(td);
908 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
909}
910
911void
912Str2_free(asn1_TYPE_descriptor_t *td,
913 void *struct_ptr, int contents_only) {
914 Str2_inherit_TYPE_descriptor(td);
915 td->free_struct(td, struct_ptr, contents_only);
916}
917
918
919/*** <<< STAT-DEFS [Str2] >>> ***/
920
921static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
922 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
923};
924asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
925 "Str2",
926 Str2_constraint,
927 Str2_decode_ber,
928 Str2_encode_der,
929 Str2_print,
930 Str2_free,
931 0, /* Use generic outmost tag fetcher */
932 asn1_DEF_Str2_tags,
933 sizeof(asn1_DEF_Str2_tags)
934 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
935 1, /* Tags to skip */
936 -0, /* Unknown yet */
937 0, 0, /* No members */
938 0 /* No specifics */
939};
940
941
942/*** <<< INCLUDES [Str3] >>> ***/
943
944#include <Str2.h>
945
946/*** <<< TYPE-DECLS [Str3] >>> ***/
947
948
949typedef Str2_t Str3_t;
950
vlm7d576b32004-08-20 13:37:45 +0000951/*** <<< FUNC-DECLS [Str3] >>> ***/
952
953extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
954asn_constr_check_f Str3_constraint;
955ber_type_decoder_f Str3_decode_ber;
956der_type_encoder_f Str3_encode_der;
957asn_struct_print_f Str3_print;
958asn_struct_free_f Str3_free;
959
960/*** <<< CTABLES [Str3] >>> ***/
961
962static int permitted_alphabet_table_2[256] = {
9630,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9650,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9670,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9690,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
970};
971
972static int check_permitted_alphabet_2(const void *sptr) {
973 int *table = permitted_alphabet_table_2;
974 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000975 const IA5String_t *st = sptr;
976 const uint8_t *ch = st->buf;
977 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000978
979 for(; ch < end; ch++) {
980 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000981 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +0000982 }
vlmcdf661b2004-08-22 12:47:03 +0000983 return 0;
vlm7d576b32004-08-20 13:37:45 +0000984}
985
986
987/*** <<< CODE [Str3] >>> ***/
988
989int
990Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
991 asn_app_consume_bytes_f *app_errlog, void *app_key) {
992
vlmb08de152004-08-22 03:30:05 +0000993 const Str2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000994 size_t size;
995
996 if(!sptr) {
997 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000998 "%s: value not given (%s:%d)",
999 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001000 return -1;
1001 }
1002
1003 size = st->size;
1004
1005 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
vlm7e20dfc2004-08-22 13:11:40 +00001006 && !check_permitted_alphabet_2(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001007 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001008 return 0;
vlm7d576b32004-08-20 13:37:45 +00001009 } else {
1010 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001011 "%s: constraint failed (%s:%d)",
1012 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001013 return -1;
1014 }
1015}
1016
1017/*
1018 * This type is implemented using Str2,
1019 * so adjust the DEF appropriately.
1020 */
1021static void
1022Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1023 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1024 td->der_encoder = asn1_DEF_Str2.der_encoder;
1025 td->free_struct = asn1_DEF_Str2.free_struct;
1026 td->print_struct = asn1_DEF_Str2.print_struct;
1027 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1028 td->elements = asn1_DEF_Str2.elements;
1029 td->elements_count = asn1_DEF_Str2.elements_count;
1030 td->specifics = asn1_DEF_Str2.specifics;
1031}
1032
1033ber_dec_rval_t
1034Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1035 void **structure, void *bufptr, size_t size, int tag_mode) {
1036 Str3_inherit_TYPE_descriptor(td);
1037 return td->ber_decoder(td, structure,
1038 bufptr, size, tag_mode);
1039}
1040
1041der_enc_rval_t
1042Str3_encode_der(asn1_TYPE_descriptor_t *td,
1043 void *structure, int tag_mode, ber_tlv_tag_t tag,
1044 asn_app_consume_bytes_f *cb, void *app_key) {
1045 Str3_inherit_TYPE_descriptor(td);
1046 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1047}
1048
1049int
1050Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1051 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1052 Str3_inherit_TYPE_descriptor(td);
1053 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1054}
1055
1056void
1057Str3_free(asn1_TYPE_descriptor_t *td,
1058 void *struct_ptr, int contents_only) {
1059 Str3_inherit_TYPE_descriptor(td);
1060 td->free_struct(td, struct_ptr, contents_only);
1061}
1062
1063
1064/*** <<< STAT-DEFS [Str3] >>> ***/
1065
1066static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
1067 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1068};
1069asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1070 "Str3",
1071 Str3_constraint,
1072 Str3_decode_ber,
1073 Str3_encode_der,
1074 Str3_print,
1075 Str3_free,
1076 0, /* Use generic outmost tag fetcher */
1077 asn1_DEF_Str3_tags,
1078 sizeof(asn1_DEF_Str3_tags)
1079 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
1080 1, /* Tags to skip */
1081 -0, /* Unknown yet */
1082 0, 0, /* No members */
1083 0 /* No specifics */
1084};
1085
1086
vlm25e12932004-09-10 06:07:39 +00001087/*** <<< INCLUDES [Str4] >>> ***/
1088
1089#include <IA5String.h>
1090
1091/*** <<< TYPE-DECLS [Str4] >>> ***/
1092
1093
1094typedef IA5String_t Str4_t;
1095
1096/*** <<< FUNC-DECLS [Str4] >>> ***/
1097
1098extern asn1_TYPE_descriptor_t asn1_DEF_Str4;
1099asn_constr_check_f Str4_constraint;
1100ber_type_decoder_f Str4_decode_ber;
1101der_type_encoder_f Str4_encode_der;
1102asn_struct_print_f Str4_print;
1103asn_struct_free_f Str4_free;
1104
1105/*** <<< CTABLES [Str4] >>> ***/
1106
1107static int check_permitted_alphabet_3(const void *sptr) {
1108 /* The underlying type is IA5String */
1109 const IA5String_t *st = sptr;
1110 const uint8_t *ch = st->buf;
1111 const uint8_t *end = ch + st->size;
1112
1113 for(; ch < end; ch++) {
1114 uint8_t cv = *ch;
1115 if(!(cv <= 127)) return -1;
1116 }
1117 return 0;
1118}
1119
1120
1121/*** <<< CODE [Str4] >>> ***/
1122
1123int
1124Str4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1125 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1126
1127 const IA5String_t *st = sptr;
1128
1129 if(!sptr) {
1130 _ASN_ERRLOG(app_errlog, app_key,
1131 "%s: value not given (%s:%d)",
1132 td->name, __FILE__, __LINE__);
1133 return -1;
1134 }
1135
1136
1137 if(!check_permitted_alphabet_3(sptr)) {
1138 /* Constraint check succeeded */
1139 return 0;
1140 } else {
1141 _ASN_ERRLOG(app_errlog, app_key,
1142 "%s: constraint failed (%s:%d)",
1143 td->name, __FILE__, __LINE__);
1144 return -1;
1145 }
1146}
1147
1148/*
1149 * This type is implemented using IA5String,
1150 * so adjust the DEF appropriately.
1151 */
1152static void
1153Str4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1154 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1155 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1156 td->free_struct = asn1_DEF_IA5String.free_struct;
1157 td->print_struct = asn1_DEF_IA5String.print_struct;
1158 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1159 td->elements = asn1_DEF_IA5String.elements;
1160 td->elements_count = asn1_DEF_IA5String.elements_count;
1161 td->specifics = asn1_DEF_IA5String.specifics;
1162}
1163
1164ber_dec_rval_t
1165Str4_decode_ber(asn1_TYPE_descriptor_t *td,
1166 void **structure, void *bufptr, size_t size, int tag_mode) {
1167 Str4_inherit_TYPE_descriptor(td);
1168 return td->ber_decoder(td, structure,
1169 bufptr, size, tag_mode);
1170}
1171
1172der_enc_rval_t
1173Str4_encode_der(asn1_TYPE_descriptor_t *td,
1174 void *structure, int tag_mode, ber_tlv_tag_t tag,
1175 asn_app_consume_bytes_f *cb, void *app_key) {
1176 Str4_inherit_TYPE_descriptor(td);
1177 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1178}
1179
1180int
1181Str4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1182 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1183 Str4_inherit_TYPE_descriptor(td);
1184 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1185}
1186
1187void
1188Str4_free(asn1_TYPE_descriptor_t *td,
1189 void *struct_ptr, int contents_only) {
1190 Str4_inherit_TYPE_descriptor(td);
1191 td->free_struct(td, struct_ptr, contents_only);
1192}
1193
1194
1195/*** <<< STAT-DEFS [Str4] >>> ***/
1196
1197static ber_tlv_tag_t asn1_DEF_Str4_tags[] = {
1198 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1199};
1200asn1_TYPE_descriptor_t asn1_DEF_Str4 = {
1201 "Str4",
1202 Str4_constraint,
1203 Str4_decode_ber,
1204 Str4_encode_der,
1205 Str4_print,
1206 Str4_free,
1207 0, /* Use generic outmost tag fetcher */
1208 asn1_DEF_Str4_tags,
1209 sizeof(asn1_DEF_Str4_tags)
1210 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
1211 1, /* Tags to skip */
1212 -0, /* Unknown yet */
1213 0, 0, /* No members */
1214 0 /* No specifics */
1215};
1216
1217
vlm7d576b32004-08-20 13:37:45 +00001218/*** <<< INCLUDES [PER-Visible] >>> ***/
1219
1220#include <IA5String.h>
1221
1222/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1223
1224
1225typedef IA5String_t PER_Visible_t;
1226
vlm7d576b32004-08-20 13:37:45 +00001227/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1228
1229extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1230asn_constr_check_f PER_Visible_constraint;
1231ber_type_decoder_f PER_Visible_decode_ber;
1232der_type_encoder_f PER_Visible_encode_der;
1233asn_struct_print_f PER_Visible_print;
1234asn_struct_free_f PER_Visible_free;
1235
1236/*** <<< CTABLES [PER-Visible] >>> ***/
1237
vlm25e12932004-09-10 06:07:39 +00001238static int check_permitted_alphabet_4(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001239 /* The underlying type is IA5String */
vlm4fdaead2004-08-21 07:34:17 +00001240 const IA5String_t *st = sptr;
vlmb08de152004-08-22 03:30:05 +00001241 const uint8_t *ch = st->buf;
1242 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001243
1244 for(; ch < end; ch++) {
1245 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001246 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001247 }
vlmcdf661b2004-08-22 12:47:03 +00001248 return 0;
vlm7d576b32004-08-20 13:37:45 +00001249}
1250
1251
1252/*** <<< CODE [PER-Visible] >>> ***/
1253
1254int
1255PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1256 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1257
vlmb08de152004-08-22 03:30:05 +00001258 const IA5String_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001259
1260 if(!sptr) {
1261 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001262 "%s: value not given (%s:%d)",
1263 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001264 return -1;
1265 }
1266
1267
vlm25e12932004-09-10 06:07:39 +00001268 if(!check_permitted_alphabet_4(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001269 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001270 return 0;
vlm7d576b32004-08-20 13:37:45 +00001271 } else {
1272 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001273 "%s: constraint failed (%s:%d)",
1274 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001275 return -1;
1276 }
1277}
1278
1279/*
1280 * This type is implemented using IA5String,
1281 * so adjust the DEF appropriately.
1282 */
1283static void
1284PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1285 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1286 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1287 td->free_struct = asn1_DEF_IA5String.free_struct;
1288 td->print_struct = asn1_DEF_IA5String.print_struct;
1289 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1290 td->elements = asn1_DEF_IA5String.elements;
1291 td->elements_count = asn1_DEF_IA5String.elements_count;
1292 td->specifics = asn1_DEF_IA5String.specifics;
1293}
1294
1295ber_dec_rval_t
1296PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1297 void **structure, void *bufptr, size_t size, int tag_mode) {
1298 PER_Visible_inherit_TYPE_descriptor(td);
1299 return td->ber_decoder(td, structure,
1300 bufptr, size, tag_mode);
1301}
1302
1303der_enc_rval_t
1304PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1305 void *structure, int tag_mode, ber_tlv_tag_t tag,
1306 asn_app_consume_bytes_f *cb, void *app_key) {
1307 PER_Visible_inherit_TYPE_descriptor(td);
1308 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1309}
1310
1311int
1312PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1313 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1314 PER_Visible_inherit_TYPE_descriptor(td);
1315 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1316}
1317
1318void
1319PER_Visible_free(asn1_TYPE_descriptor_t *td,
1320 void *struct_ptr, int contents_only) {
1321 PER_Visible_inherit_TYPE_descriptor(td);
1322 td->free_struct(td, struct_ptr, contents_only);
1323}
1324
1325
1326/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1327
1328static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1329 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1330};
1331asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1332 "PER-Visible",
1333 PER_Visible_constraint,
1334 PER_Visible_decode_ber,
1335 PER_Visible_encode_der,
1336 PER_Visible_print,
1337 PER_Visible_free,
1338 0, /* Use generic outmost tag fetcher */
1339 asn1_DEF_PER_Visible_tags,
1340 sizeof(asn1_DEF_PER_Visible_tags)
1341 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
1342 1, /* Tags to skip */
1343 -0, /* Unknown yet */
1344 0, 0, /* No members */
1345 0 /* No specifics */
1346};
1347
1348
1349/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1350
1351#include <PER-Visible.h>
1352
1353/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1354
1355
1356typedef PER_Visible_t PER_Visible_2_t;
1357
vlm7d576b32004-08-20 13:37:45 +00001358/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1359
1360extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1361asn_constr_check_f PER_Visible_2_constraint;
1362ber_type_decoder_f PER_Visible_2_decode_ber;
1363der_type_encoder_f PER_Visible_2_encode_der;
1364asn_struct_print_f PER_Visible_2_print;
1365asn_struct_free_f PER_Visible_2_free;
1366
1367/*** <<< CTABLES [PER-Visible-2] >>> ***/
1368
vlm25e12932004-09-10 06:07:39 +00001369static int check_permitted_alphabet_5(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001370 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001371 const IA5String_t *st = sptr;
1372 const uint8_t *ch = st->buf;
1373 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001374
1375 for(; ch < end; ch++) {
1376 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001377 if(!(cv >= 69 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001378 }
vlmcdf661b2004-08-22 12:47:03 +00001379 return 0;
vlm7d576b32004-08-20 13:37:45 +00001380}
1381
1382
1383/*** <<< CODE [PER-Visible-2] >>> ***/
1384
1385int
1386PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1387 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1388
vlmb08de152004-08-22 03:30:05 +00001389 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001390
1391 if(!sptr) {
1392 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001393 "%s: value not given (%s:%d)",
1394 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001395 return -1;
1396 }
1397
1398
vlm25e12932004-09-10 06:07:39 +00001399 if(!check_permitted_alphabet_5(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001400 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001401 return 0;
vlm7d576b32004-08-20 13:37:45 +00001402 } else {
1403 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001404 "%s: constraint failed (%s:%d)",
1405 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001406 return -1;
1407 }
1408}
1409
1410/*
1411 * This type is implemented using PER_Visible,
1412 * so adjust the DEF appropriately.
1413 */
1414static void
1415PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1416 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1417 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1418 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1419 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1420 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1421 td->elements = asn1_DEF_PER_Visible.elements;
1422 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1423 td->specifics = asn1_DEF_PER_Visible.specifics;
1424}
1425
1426ber_dec_rval_t
1427PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1428 void **structure, void *bufptr, size_t size, int tag_mode) {
1429 PER_Visible_2_inherit_TYPE_descriptor(td);
1430 return td->ber_decoder(td, structure,
1431 bufptr, size, tag_mode);
1432}
1433
1434der_enc_rval_t
1435PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1436 void *structure, int tag_mode, ber_tlv_tag_t tag,
1437 asn_app_consume_bytes_f *cb, void *app_key) {
1438 PER_Visible_2_inherit_TYPE_descriptor(td);
1439 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1440}
1441
1442int
1443PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1444 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1445 PER_Visible_2_inherit_TYPE_descriptor(td);
1446 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1447}
1448
1449void
1450PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1451 void *struct_ptr, int contents_only) {
1452 PER_Visible_2_inherit_TYPE_descriptor(td);
1453 td->free_struct(td, struct_ptr, contents_only);
1454}
1455
1456
1457/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1458
1459static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
1460 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1461};
1462asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1463 "PER-Visible-2",
1464 PER_Visible_2_constraint,
1465 PER_Visible_2_decode_ber,
1466 PER_Visible_2_encode_der,
1467 PER_Visible_2_print,
1468 PER_Visible_2_free,
1469 0, /* Use generic outmost tag fetcher */
1470 asn1_DEF_PER_Visible_2_tags,
1471 sizeof(asn1_DEF_PER_Visible_2_tags)
1472 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
1473 1, /* Tags to skip */
1474 -0, /* Unknown yet */
1475 0, 0, /* No members */
1476 0 /* No specifics */
1477};
1478
1479
1480/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1481
1482#include <PER-Visible.h>
1483
1484/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1485
1486
1487typedef PER_Visible_t Not_PER_Visible_1_t;
1488
vlm7d576b32004-08-20 13:37:45 +00001489/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1490
1491extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1492asn_constr_check_f Not_PER_Visible_1_constraint;
1493ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1494der_type_encoder_f Not_PER_Visible_1_encode_der;
1495asn_struct_print_f Not_PER_Visible_1_print;
1496asn_struct_free_f Not_PER_Visible_1_free;
1497
1498/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1499
vlm25e12932004-09-10 06:07:39 +00001500static int check_permitted_alphabet_6(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001501 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001502 const IA5String_t *st = sptr;
1503 const uint8_t *ch = st->buf;
1504 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001505
1506 for(; ch < end; ch++) {
1507 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001508 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001509 }
vlmcdf661b2004-08-22 12:47:03 +00001510 return 0;
vlm7d576b32004-08-20 13:37:45 +00001511}
1512
1513
1514/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1515
1516int
1517Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1518 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1519
vlmb08de152004-08-22 03:30:05 +00001520 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001521
1522 if(!sptr) {
1523 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001524 "%s: value not given (%s:%d)",
1525 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001526 return -1;
1527 }
1528
1529
vlm25e12932004-09-10 06:07:39 +00001530 if(!check_permitted_alphabet_6(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001531 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001532 return 0;
vlm7d576b32004-08-20 13:37:45 +00001533 } else {
1534 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001535 "%s: constraint failed (%s:%d)",
1536 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001537 return -1;
1538 }
1539}
1540
1541/*
1542 * This type is implemented using PER_Visible,
1543 * so adjust the DEF appropriately.
1544 */
1545static void
1546Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1547 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1548 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1549 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1550 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1551 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1552 td->elements = asn1_DEF_PER_Visible.elements;
1553 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1554 td->specifics = asn1_DEF_PER_Visible.specifics;
1555}
1556
1557ber_dec_rval_t
1558Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1559 void **structure, void *bufptr, size_t size, int tag_mode) {
1560 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1561 return td->ber_decoder(td, structure,
1562 bufptr, size, tag_mode);
1563}
1564
1565der_enc_rval_t
1566Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1567 void *structure, int tag_mode, ber_tlv_tag_t tag,
1568 asn_app_consume_bytes_f *cb, void *app_key) {
1569 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1570 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1571}
1572
1573int
1574Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1575 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1576 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1577 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1578}
1579
1580void
1581Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1582 void *struct_ptr, int contents_only) {
1583 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1584 td->free_struct(td, struct_ptr, contents_only);
1585}
1586
1587
1588/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1589
1590static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
1591 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1592};
1593asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1594 "Not-PER-Visible-1",
1595 Not_PER_Visible_1_constraint,
1596 Not_PER_Visible_1_decode_ber,
1597 Not_PER_Visible_1_encode_der,
1598 Not_PER_Visible_1_print,
1599 Not_PER_Visible_1_free,
1600 0, /* Use generic outmost tag fetcher */
1601 asn1_DEF_Not_PER_Visible_1_tags,
1602 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1603 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1604 1, /* Tags to skip */
1605 -0, /* Unknown yet */
1606 0, 0, /* No members */
1607 0 /* No specifics */
1608};
1609
1610
1611/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1612
1613#include <PER-Visible.h>
1614
1615/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1616
1617
1618typedef PER_Visible_t Not_PER_Visible_2_t;
1619
vlm7d576b32004-08-20 13:37:45 +00001620/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1621
1622extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1623asn_constr_check_f Not_PER_Visible_2_constraint;
1624ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1625der_type_encoder_f Not_PER_Visible_2_encode_der;
1626asn_struct_print_f Not_PER_Visible_2_print;
1627asn_struct_free_f Not_PER_Visible_2_free;
1628
vlm26afd202004-08-25 02:08:08 +00001629/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1630
vlm25e12932004-09-10 06:07:39 +00001631static int check_permitted_alphabet_7(const void *sptr) {
vlm26afd202004-08-25 02:08:08 +00001632 /* The underlying type is IA5String */
1633 const IA5String_t *st = sptr;
1634 const uint8_t *ch = st->buf;
1635 const uint8_t *end = ch + st->size;
1636
1637 for(; ch < end; ch++) {
1638 uint8_t cv = *ch;
1639 if(!(cv >= 65 && cv <= 66)) return -1;
1640 }
1641 return 0;
1642}
1643
1644
vlm7d576b32004-08-20 13:37:45 +00001645/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1646
1647int
1648Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1649 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1650
vlmb08de152004-08-22 03:30:05 +00001651 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001652
1653 if(!sptr) {
1654 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001655 "%s: value not given (%s:%d)",
1656 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001657 return -1;
1658 }
1659
1660
vlm25e12932004-09-10 06:07:39 +00001661 if(!check_permitted_alphabet_7(sptr)) {
vlm26afd202004-08-25 02:08:08 +00001662 /* Constraint check succeeded */
1663 return 0;
1664 } else {
1665 _ASN_ERRLOG(app_errlog, app_key,
1666 "%s: constraint failed (%s:%d)",
1667 td->name, __FILE__, __LINE__);
1668 return -1;
vlm7d576b32004-08-20 13:37:45 +00001669 }
vlm7d576b32004-08-20 13:37:45 +00001670}
1671
1672/*
1673 * This type is implemented using PER_Visible,
1674 * so adjust the DEF appropriately.
1675 */
1676static void
1677Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1678 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1679 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1680 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1681 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1682 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1683 td->elements = asn1_DEF_PER_Visible.elements;
1684 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1685 td->specifics = asn1_DEF_PER_Visible.specifics;
1686}
1687
1688ber_dec_rval_t
1689Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1690 void **structure, void *bufptr, size_t size, int tag_mode) {
1691 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1692 return td->ber_decoder(td, structure,
1693 bufptr, size, tag_mode);
1694}
1695
1696der_enc_rval_t
1697Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1698 void *structure, int tag_mode, ber_tlv_tag_t tag,
1699 asn_app_consume_bytes_f *cb, void *app_key) {
1700 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1701 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1702}
1703
1704int
1705Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1706 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1707 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1708 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1709}
1710
1711void
1712Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1713 void *struct_ptr, int contents_only) {
1714 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1715 td->free_struct(td, struct_ptr, contents_only);
1716}
1717
1718
1719/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1720
1721static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
1722 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1723};
1724asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1725 "Not-PER-Visible-2",
1726 Not_PER_Visible_2_constraint,
1727 Not_PER_Visible_2_decode_ber,
1728 Not_PER_Visible_2_encode_der,
1729 Not_PER_Visible_2_print,
1730 Not_PER_Visible_2_free,
1731 0, /* Use generic outmost tag fetcher */
1732 asn1_DEF_Not_PER_Visible_2_tags,
1733 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1734 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1735 1, /* Tags to skip */
1736 -0, /* Unknown yet */
1737 0, 0, /* No members */
1738 0 /* No specifics */
1739};
1740
1741
1742/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1743
1744#include <PER-Visible.h>
1745
1746/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1747
1748
1749typedef PER_Visible_t Not_PER_Visible_3_t;
1750
vlm7d576b32004-08-20 13:37:45 +00001751/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1752
1753extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1754asn_constr_check_f Not_PER_Visible_3_constraint;
1755ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1756der_type_encoder_f Not_PER_Visible_3_encode_der;
1757asn_struct_print_f Not_PER_Visible_3_print;
1758asn_struct_free_f Not_PER_Visible_3_free;
1759
vlm26afd202004-08-25 02:08:08 +00001760/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1761
vlm25e12932004-09-10 06:07:39 +00001762static int check_permitted_alphabet_8(const void *sptr) {
vlm26afd202004-08-25 02:08:08 +00001763 /* The underlying type is IA5String */
1764 const IA5String_t *st = sptr;
1765 const uint8_t *ch = st->buf;
1766 const uint8_t *end = ch + st->size;
1767
1768 for(; ch < end; ch++) {
1769 uint8_t cv = *ch;
1770 if(!(cv >= 65 && cv <= 66)) return -1;
1771 }
1772 return 0;
1773}
1774
1775
vlm7d576b32004-08-20 13:37:45 +00001776/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1777
1778int
1779Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1780 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1781
vlmb08de152004-08-22 03:30:05 +00001782 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001783
1784 if(!sptr) {
1785 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001786 "%s: value not given (%s:%d)",
1787 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001788 return -1;
1789 }
1790
1791
vlm25e12932004-09-10 06:07:39 +00001792 if(!check_permitted_alphabet_8(sptr)) {
vlm26afd202004-08-25 02:08:08 +00001793 /* Constraint check succeeded */
1794 return 0;
1795 } else {
1796 _ASN_ERRLOG(app_errlog, app_key,
1797 "%s: constraint failed (%s:%d)",
1798 td->name, __FILE__, __LINE__);
1799 return -1;
vlm7d576b32004-08-20 13:37:45 +00001800 }
vlm7d576b32004-08-20 13:37:45 +00001801}
1802
1803/*
1804 * This type is implemented using PER_Visible,
1805 * so adjust the DEF appropriately.
1806 */
1807static void
1808Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1809 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1810 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1811 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1812 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1813 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1814 td->elements = asn1_DEF_PER_Visible.elements;
1815 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1816 td->specifics = asn1_DEF_PER_Visible.specifics;
1817}
1818
1819ber_dec_rval_t
1820Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1821 void **structure, void *bufptr, size_t size, int tag_mode) {
1822 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1823 return td->ber_decoder(td, structure,
1824 bufptr, size, tag_mode);
1825}
1826
1827der_enc_rval_t
1828Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1829 void *structure, int tag_mode, ber_tlv_tag_t tag,
1830 asn_app_consume_bytes_f *cb, void *app_key) {
1831 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1832 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1833}
1834
1835int
1836Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1837 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1838 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1839 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1840}
1841
1842void
1843Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1844 void *struct_ptr, int contents_only) {
1845 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1846 td->free_struct(td, struct_ptr, contents_only);
1847}
1848
1849
1850/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1851
1852static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
1853 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1854};
1855asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1856 "Not-PER-Visible-3",
1857 Not_PER_Visible_3_constraint,
1858 Not_PER_Visible_3_decode_ber,
1859 Not_PER_Visible_3_encode_der,
1860 Not_PER_Visible_3_print,
1861 Not_PER_Visible_3_free,
1862 0, /* Use generic outmost tag fetcher */
1863 asn1_DEF_Not_PER_Visible_3_tags,
1864 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1865 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1866 1, /* Tags to skip */
1867 -0, /* Unknown yet */
1868 0, 0, /* No members */
1869 0 /* No specifics */
1870};
1871
1872
1873/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1874
1875#include <PER-Visible.h>
1876
1877/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1878
1879
1880typedef PER_Visible_t SIZE_but_not_FROM_t;
1881
vlm7d576b32004-08-20 13:37:45 +00001882/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1883
1884extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1885asn_constr_check_f SIZE_but_not_FROM_constraint;
1886ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1887der_type_encoder_f SIZE_but_not_FROM_encode_der;
1888asn_struct_print_f SIZE_but_not_FROM_print;
1889asn_struct_free_f SIZE_but_not_FROM_free;
1890
1891/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1892
vlm25e12932004-09-10 06:07:39 +00001893static int check_permitted_alphabet_9(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001894 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001895 const IA5String_t *st = sptr;
1896 const uint8_t *ch = st->buf;
1897 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001898
1899 for(; ch < end; ch++) {
1900 uint8_t cv = *ch;
vlm26afd202004-08-25 02:08:08 +00001901 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001902 }
vlmcdf661b2004-08-22 12:47:03 +00001903 return 0;
vlm7d576b32004-08-20 13:37:45 +00001904}
1905
1906
1907/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1908
1909int
1910SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1911 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1912
vlmb08de152004-08-22 03:30:05 +00001913 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001914 size_t size;
1915
1916 if(!sptr) {
1917 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001918 "%s: value not given (%s:%d)",
1919 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001920 return -1;
1921 }
1922
1923 size = st->size;
1924
1925 if((size >= 1 && size <= 4)
vlm25e12932004-09-10 06:07:39 +00001926 && !check_permitted_alphabet_9(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001927 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001928 return 0;
vlm7d576b32004-08-20 13:37:45 +00001929 } else {
1930 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001931 "%s: constraint failed (%s:%d)",
1932 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001933 return -1;
1934 }
1935}
1936
1937/*
1938 * This type is implemented using PER_Visible,
1939 * so adjust the DEF appropriately.
1940 */
1941static void
1942SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1943 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1944 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1945 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1946 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1947 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1948 td->elements = asn1_DEF_PER_Visible.elements;
1949 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1950 td->specifics = asn1_DEF_PER_Visible.specifics;
1951}
1952
1953ber_dec_rval_t
1954SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1955 void **structure, void *bufptr, size_t size, int tag_mode) {
1956 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1957 return td->ber_decoder(td, structure,
1958 bufptr, size, tag_mode);
1959}
1960
1961der_enc_rval_t
1962SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1963 void *structure, int tag_mode, ber_tlv_tag_t tag,
1964 asn_app_consume_bytes_f *cb, void *app_key) {
1965 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1966 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1967}
1968
1969int
1970SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1971 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1972 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1973 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1974}
1975
1976void
1977SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1978 void *struct_ptr, int contents_only) {
1979 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1980 td->free_struct(td, struct_ptr, contents_only);
1981}
1982
1983
1984/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1985
1986static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
1987 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1988};
1989asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
1990 "SIZE-but-not-FROM",
1991 SIZE_but_not_FROM_constraint,
1992 SIZE_but_not_FROM_decode_ber,
1993 SIZE_but_not_FROM_encode_der,
1994 SIZE_but_not_FROM_print,
1995 SIZE_but_not_FROM_free,
1996 0, /* Use generic outmost tag fetcher */
1997 asn1_DEF_SIZE_but_not_FROM_tags,
1998 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
1999 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
2000 1, /* Tags to skip */
2001 -0, /* Unknown yet */
2002 0, 0, /* No members */
2003 0 /* No specifics */
2004};
2005
2006
2007/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2008
2009#include <PER-Visible.h>
2010
2011/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2012
2013
2014typedef PER_Visible_t SIZE_and_FROM_t;
2015
vlm7d576b32004-08-20 13:37:45 +00002016/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2017
2018extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
2019asn_constr_check_f SIZE_and_FROM_constraint;
2020ber_type_decoder_f SIZE_and_FROM_decode_ber;
2021der_type_encoder_f SIZE_and_FROM_encode_der;
2022asn_struct_print_f SIZE_and_FROM_print;
2023asn_struct_free_f SIZE_and_FROM_free;
2024
2025/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2026
vlm25e12932004-09-10 06:07:39 +00002027static int check_permitted_alphabet_10(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00002028 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00002029 const IA5String_t *st = sptr;
2030 const uint8_t *ch = st->buf;
2031 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002032
2033 for(; ch < end; ch++) {
2034 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002035 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00002036 }
vlmcdf661b2004-08-22 12:47:03 +00002037 return 0;
vlm7d576b32004-08-20 13:37:45 +00002038}
2039
2040
2041/*** <<< CODE [SIZE-and-FROM] >>> ***/
2042
2043int
2044SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2045 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2046
vlmb08de152004-08-22 03:30:05 +00002047 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002048 size_t size;
2049
2050 if(!sptr) {
2051 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002052 "%s: value not given (%s:%d)",
2053 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002054 return -1;
2055 }
2056
2057 size = st->size;
2058
2059 if((size >= 1 && size <= 4)
vlm25e12932004-09-10 06:07:39 +00002060 && !check_permitted_alphabet_10(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002061 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002062 return 0;
vlm7d576b32004-08-20 13:37:45 +00002063 } else {
2064 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002065 "%s: constraint failed (%s:%d)",
2066 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002067 return -1;
2068 }
2069}
2070
2071/*
2072 * This type is implemented using PER_Visible,
2073 * so adjust the DEF appropriately.
2074 */
2075static void
2076SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2077 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2078 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2079 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2080 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2081 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2082 td->elements = asn1_DEF_PER_Visible.elements;
2083 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2084 td->specifics = asn1_DEF_PER_Visible.specifics;
2085}
2086
2087ber_dec_rval_t
2088SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2089 void **structure, void *bufptr, size_t size, int tag_mode) {
2090 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2091 return td->ber_decoder(td, structure,
2092 bufptr, size, tag_mode);
2093}
2094
2095der_enc_rval_t
2096SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2097 void *structure, int tag_mode, ber_tlv_tag_t tag,
2098 asn_app_consume_bytes_f *cb, void *app_key) {
2099 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2100 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2101}
2102
2103int
2104SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2105 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2106 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2107 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2108}
2109
2110void
2111SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
2112 void *struct_ptr, int contents_only) {
2113 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2114 td->free_struct(td, struct_ptr, contents_only);
2115}
2116
2117
2118/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2119
2120static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
2121 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2122};
2123asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
2124 "SIZE-and-FROM",
2125 SIZE_and_FROM_constraint,
2126 SIZE_and_FROM_decode_ber,
2127 SIZE_and_FROM_encode_der,
2128 SIZE_and_FROM_print,
2129 SIZE_and_FROM_free,
2130 0, /* Use generic outmost tag fetcher */
2131 asn1_DEF_SIZE_and_FROM_tags,
2132 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2133 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
2134 1, /* Tags to skip */
2135 -0, /* Unknown yet */
2136 0, 0, /* No members */
2137 0 /* No specifics */
2138};
2139
2140
2141/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2142
2143#include <PER-Visible.h>
2144
2145/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2146
2147
2148typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2149
vlm7d576b32004-08-20 13:37:45 +00002150/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2151
2152extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
2153asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2154ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2155der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
2156asn_struct_print_f Neither_SIZE_nor_FROM_print;
2157asn_struct_free_f Neither_SIZE_nor_FROM_free;
2158
2159/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2160
vlm25e12932004-09-10 06:07:39 +00002161static int check_permitted_alphabet_11(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00002162 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00002163 const IA5String_t *st = sptr;
2164 const uint8_t *ch = st->buf;
2165 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002166
2167 for(; ch < end; ch++) {
2168 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002169 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00002170 }
vlmcdf661b2004-08-22 12:47:03 +00002171 return 0;
vlm7d576b32004-08-20 13:37:45 +00002172}
2173
2174
2175/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2176
2177int
2178Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2179 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2180
vlmb08de152004-08-22 03:30:05 +00002181 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002182
2183 if(!sptr) {
2184 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002185 "%s: value not given (%s:%d)",
2186 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002187 return -1;
2188 }
2189
2190
vlm25e12932004-09-10 06:07:39 +00002191 if(!check_permitted_alphabet_11(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002192 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002193 return 0;
vlm7d576b32004-08-20 13:37:45 +00002194 } else {
2195 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002196 "%s: constraint failed (%s:%d)",
2197 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002198 return -1;
2199 }
2200}
2201
2202/*
2203 * This type is implemented using PER_Visible,
2204 * so adjust the DEF appropriately.
2205 */
2206static void
2207Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2208 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2209 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2210 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2211 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2212 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2213 td->elements = asn1_DEF_PER_Visible.elements;
2214 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2215 td->specifics = asn1_DEF_PER_Visible.specifics;
2216}
2217
2218ber_dec_rval_t
2219Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2220 void **structure, void *bufptr, size_t size, int tag_mode) {
2221 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2222 return td->ber_decoder(td, structure,
2223 bufptr, size, tag_mode);
2224}
2225
2226der_enc_rval_t
2227Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2228 void *structure, int tag_mode, ber_tlv_tag_t tag,
2229 asn_app_consume_bytes_f *cb, void *app_key) {
2230 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2231 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2232}
2233
2234int
2235Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2236 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2237 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2238 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2239}
2240
2241void
2242Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2243 void *struct_ptr, int contents_only) {
2244 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2245 td->free_struct(td, struct_ptr, contents_only);
2246}
2247
2248
2249/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2250
2251static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
2252 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2253};
2254asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2255 "Neither-SIZE-nor-FROM",
2256 Neither_SIZE_nor_FROM_constraint,
2257 Neither_SIZE_nor_FROM_decode_ber,
2258 Neither_SIZE_nor_FROM_encode_der,
2259 Neither_SIZE_nor_FROM_print,
2260 Neither_SIZE_nor_FROM_free,
2261 0, /* Use generic outmost tag fetcher */
2262 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2263 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2264 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2265 1, /* Tags to skip */
2266 -0, /* Unknown yet */
2267 0, 0, /* No members */
2268 0 /* No specifics */
2269};
2270
2271
2272/*** <<< INCLUDES [Utf8-3] >>> ***/
2273
2274#include <Utf8-2.h>
2275
2276/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2277
2278
2279typedef Utf8_2_t Utf8_3_t;
2280
vlm7d576b32004-08-20 13:37:45 +00002281/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2282
2283extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2284asn_constr_check_f Utf8_3_constraint;
2285ber_type_decoder_f Utf8_3_decode_ber;
2286der_type_encoder_f Utf8_3_encode_der;
2287asn_struct_print_f Utf8_3_print;
2288asn_struct_free_f Utf8_3_free;
2289
2290/*** <<< CTABLES [Utf8-3] >>> ***/
2291
vlm25e12932004-09-10 06:07:39 +00002292static int permitted_alphabet_table_12[128] = {
vlm7d576b32004-08-20 13:37:45 +000022930,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22940,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22950,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22960,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22970,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
22981,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
22990,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
23001,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2301};
2302
vlm25e12932004-09-10 06:07:39 +00002303static int check_permitted_alphabet_12(const void *sptr) {
2304 int *table = permitted_alphabet_table_12;
vlm7d576b32004-08-20 13:37:45 +00002305 /* The underlying type is UTF8String */
vlmb08de152004-08-22 03:30:05 +00002306 const UTF8String_t *st = sptr;
2307 const uint8_t *ch = st->buf;
2308 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002309
2310 for(; ch < end; ch++) {
2311 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002312 if(cv >= 0x80) return -1;
2313 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +00002314 }
vlmcdf661b2004-08-22 12:47:03 +00002315 return 0;
vlm7d576b32004-08-20 13:37:45 +00002316}
2317
2318
2319/*** <<< CODE [Utf8-3] >>> ***/
2320
2321int
2322Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2323 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2324
vlmb08de152004-08-22 03:30:05 +00002325 const Utf8_2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002326 size_t size;
2327
2328 if(!sptr) {
2329 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002330 "%s: value not given (%s:%d)",
2331 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002332 return -1;
2333 }
2334
2335 size = UTF8String_length(st, td->name, app_errlog, app_key);
2336 if(size == (size_t)-1) return -1;
2337
2338 if((size >= 1 && size <= 2)
vlm25e12932004-09-10 06:07:39 +00002339 && !check_permitted_alphabet_12(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002340 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002341 return 0;
vlm7d576b32004-08-20 13:37:45 +00002342 } else {
2343 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002344 "%s: constraint failed (%s:%d)",
2345 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002346 return -1;
2347 }
2348}
2349
2350/*
2351 * This type is implemented using Utf8_2,
2352 * so adjust the DEF appropriately.
2353 */
2354static void
2355Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2356 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2357 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2358 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2359 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2360 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2361 td->elements = asn1_DEF_Utf8_2.elements;
2362 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2363 td->specifics = asn1_DEF_Utf8_2.specifics;
2364}
2365
2366ber_dec_rval_t
2367Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2368 void **structure, void *bufptr, size_t size, int tag_mode) {
2369 Utf8_3_inherit_TYPE_descriptor(td);
2370 return td->ber_decoder(td, structure,
2371 bufptr, size, tag_mode);
2372}
2373
2374der_enc_rval_t
2375Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2376 void *structure, int tag_mode, ber_tlv_tag_t tag,
2377 asn_app_consume_bytes_f *cb, void *app_key) {
2378 Utf8_3_inherit_TYPE_descriptor(td);
2379 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2380}
2381
2382int
2383Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2384 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2385 Utf8_3_inherit_TYPE_descriptor(td);
2386 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2387}
2388
2389void
2390Utf8_3_free(asn1_TYPE_descriptor_t *td,
2391 void *struct_ptr, int contents_only) {
2392 Utf8_3_inherit_TYPE_descriptor(td);
2393 td->free_struct(td, struct_ptr, contents_only);
2394}
2395
2396
2397/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2398
2399static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
2400 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2401};
2402asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2403 "Utf8-3",
2404 Utf8_3_constraint,
2405 Utf8_3_decode_ber,
2406 Utf8_3_encode_der,
2407 Utf8_3_print,
2408 Utf8_3_free,
2409 0, /* Use generic outmost tag fetcher */
2410 asn1_DEF_Utf8_3_tags,
2411 sizeof(asn1_DEF_Utf8_3_tags)
2412 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
2413 1, /* Tags to skip */
2414 -0, /* Unknown yet */
2415 0, 0, /* No members */
2416 0 /* No specifics */
2417};
2418
2419
2420/*** <<< INCLUDES [Utf8-2] >>> ***/
2421
2422#include <Utf8-1.h>
2423
2424/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2425
2426
2427typedef Utf8_1_t Utf8_2_t;
2428
vlm7d576b32004-08-20 13:37:45 +00002429/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2430
2431extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2432asn_constr_check_f Utf8_2_constraint;
2433ber_type_decoder_f Utf8_2_decode_ber;
2434der_type_encoder_f Utf8_2_encode_der;
2435asn_struct_print_f Utf8_2_print;
2436asn_struct_free_f Utf8_2_free;
2437
2438/*** <<< CODE [Utf8-2] >>> ***/
2439
2440int
2441Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2442 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2443
vlmb08de152004-08-22 03:30:05 +00002444 const Utf8_1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002445 size_t size;
2446
2447 if(!sptr) {
2448 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002449 "%s: value not given (%s:%d)",
2450 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002451 return -1;
2452 }
2453
2454 size = UTF8String_length(st, td->name, app_errlog, app_key);
2455 if(size == (size_t)-1) return -1;
2456
2457 if((size >= 1 && size <= 2)) {
2458 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002459 return 0;
vlm7d576b32004-08-20 13:37:45 +00002460 } else {
2461 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002462 "%s: constraint failed (%s:%d)",
2463 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002464 return -1;
2465 }
2466}
2467
2468/*
2469 * This type is implemented using Utf8_1,
2470 * so adjust the DEF appropriately.
2471 */
2472static void
2473Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2474 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2475 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2476 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2477 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2478 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2479 td->elements = asn1_DEF_Utf8_1.elements;
2480 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2481 td->specifics = asn1_DEF_Utf8_1.specifics;
2482}
2483
2484ber_dec_rval_t
2485Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2486 void **structure, void *bufptr, size_t size, int tag_mode) {
2487 Utf8_2_inherit_TYPE_descriptor(td);
2488 return td->ber_decoder(td, structure,
2489 bufptr, size, tag_mode);
2490}
2491
2492der_enc_rval_t
2493Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2494 void *structure, int tag_mode, ber_tlv_tag_t tag,
2495 asn_app_consume_bytes_f *cb, void *app_key) {
2496 Utf8_2_inherit_TYPE_descriptor(td);
2497 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2498}
2499
2500int
2501Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2502 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2503 Utf8_2_inherit_TYPE_descriptor(td);
2504 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2505}
2506
2507void
2508Utf8_2_free(asn1_TYPE_descriptor_t *td,
2509 void *struct_ptr, int contents_only) {
2510 Utf8_2_inherit_TYPE_descriptor(td);
2511 td->free_struct(td, struct_ptr, contents_only);
2512}
2513
2514
2515/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2516
2517static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
2518 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2519};
2520asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2521 "Utf8-2",
2522 Utf8_2_constraint,
2523 Utf8_2_decode_ber,
2524 Utf8_2_encode_der,
2525 Utf8_2_print,
2526 Utf8_2_free,
2527 0, /* Use generic outmost tag fetcher */
2528 asn1_DEF_Utf8_2_tags,
2529 sizeof(asn1_DEF_Utf8_2_tags)
2530 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
2531 1, /* Tags to skip */
2532 -0, /* Unknown yet */
2533 0, 0, /* No members */
2534 0 /* No specifics */
2535};
2536
2537
2538/*** <<< INCLUDES [Utf8-1] >>> ***/
2539
2540#include <UTF8String.h>
2541
2542/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2543
2544
2545typedef UTF8String_t Utf8_1_t;
2546
vlm7d576b32004-08-20 13:37:45 +00002547/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2548
2549extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2550asn_constr_check_f Utf8_1_constraint;
2551ber_type_decoder_f Utf8_1_decode_ber;
2552der_type_encoder_f Utf8_1_encode_der;
2553asn_struct_print_f Utf8_1_print;
2554asn_struct_free_f Utf8_1_free;
2555
2556/*** <<< CODE [Utf8-1] >>> ***/
2557
2558int
2559Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2560 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2561
2562 /* Make the underlying type checker permanent */
2563 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2564 return td->check_constraints
2565 (td, sptr, app_errlog, app_key);
2566}
2567
2568/*
2569 * This type is implemented using UTF8String,
2570 * so adjust the DEF appropriately.
2571 */
2572static void
2573Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2574 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2575 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2576 td->free_struct = asn1_DEF_UTF8String.free_struct;
2577 td->print_struct = asn1_DEF_UTF8String.print_struct;
2578 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2579 td->elements = asn1_DEF_UTF8String.elements;
2580 td->elements_count = asn1_DEF_UTF8String.elements_count;
2581 td->specifics = asn1_DEF_UTF8String.specifics;
2582}
2583
2584ber_dec_rval_t
2585Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2586 void **structure, void *bufptr, size_t size, int tag_mode) {
2587 Utf8_1_inherit_TYPE_descriptor(td);
2588 return td->ber_decoder(td, structure,
2589 bufptr, size, tag_mode);
2590}
2591
2592der_enc_rval_t
2593Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2594 void *structure, int tag_mode, ber_tlv_tag_t tag,
2595 asn_app_consume_bytes_f *cb, void *app_key) {
2596 Utf8_1_inherit_TYPE_descriptor(td);
2597 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2598}
2599
2600int
2601Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2602 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2603 Utf8_1_inherit_TYPE_descriptor(td);
2604 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2605}
2606
2607void
2608Utf8_1_free(asn1_TYPE_descriptor_t *td,
2609 void *struct_ptr, int contents_only) {
2610 Utf8_1_inherit_TYPE_descriptor(td);
2611 td->free_struct(td, struct_ptr, contents_only);
2612}
2613
2614
2615/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2616
2617static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2618 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2619};
2620asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2621 "Utf8-1",
2622 Utf8_1_constraint,
2623 Utf8_1_decode_ber,
2624 Utf8_1_encode_der,
2625 Utf8_1_print,
2626 Utf8_1_free,
2627 0, /* Use generic outmost tag fetcher */
2628 asn1_DEF_Utf8_1_tags,
2629 sizeof(asn1_DEF_Utf8_1_tags)
2630 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
2631 1, /* Tags to skip */
2632 -0, /* Unknown yet */
2633 0, 0, /* No members */
2634 0 /* No specifics */
2635};
2636