blob: 757b1d667fdf7b3be9c90be4d93f0352b6b0a705 [file] [log] [blame]
Lev Walkin006de1c2004-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
Lev Walkin006de1c2004-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
Lev Walkin006de1c2004-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
Lev Walkin634a3b82004-08-22 03:30:05 +0000126 const Int1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000127 long value;
128
129 if(!sptr) {
130 _ASN_ERRLOG(app_errlog, app_key,
131 "%s: value not given", td->name);
132 return -1;
133 }
134
135 if(asn1_INTEGER2long(st, &value)) {
136 _ASN_ERRLOG(app_errlog, app_key,
137 "%s: value too large", td->name);
138 return -1;
139 }
140
141 if((value >= 0)) {
142 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000143 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000144 } else {
145 _ASN_ERRLOG(app_errlog, app_key,
146 "%s: constraint failed", td->name);
147 return -1;
148 }
149}
150
151/*
152 * This type is implemented using Int1,
153 * so adjust the DEF appropriately.
154 */
155static void
156Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
157 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
158 td->der_encoder = asn1_DEF_Int1.der_encoder;
159 td->free_struct = asn1_DEF_Int1.free_struct;
160 td->print_struct = asn1_DEF_Int1.print_struct;
161 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
162 td->elements = asn1_DEF_Int1.elements;
163 td->elements_count = asn1_DEF_Int1.elements_count;
164 td->specifics = asn1_DEF_Int1.specifics;
165}
166
167ber_dec_rval_t
168Int2_decode_ber(asn1_TYPE_descriptor_t *td,
169 void **structure, void *bufptr, size_t size, int tag_mode) {
170 Int2_inherit_TYPE_descriptor(td);
171 return td->ber_decoder(td, structure,
172 bufptr, size, tag_mode);
173}
174
175der_enc_rval_t
176Int2_encode_der(asn1_TYPE_descriptor_t *td,
177 void *structure, int tag_mode, ber_tlv_tag_t tag,
178 asn_app_consume_bytes_f *cb, void *app_key) {
179 Int2_inherit_TYPE_descriptor(td);
180 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
181}
182
183int
184Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
185 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
186 Int2_inherit_TYPE_descriptor(td);
187 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
188}
189
190void
191Int2_free(asn1_TYPE_descriptor_t *td,
192 void *struct_ptr, int contents_only) {
193 Int2_inherit_TYPE_descriptor(td);
194 td->free_struct(td, struct_ptr, contents_only);
195}
196
197
198/*** <<< STAT-DEFS [Int2] >>> ***/
199
200static ber_tlv_tag_t asn1_DEF_Int2_tags[] = {
201 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
202};
203asn1_TYPE_descriptor_t asn1_DEF_Int2 = {
204 "Int2",
205 Int2_constraint,
206 Int2_decode_ber,
207 Int2_encode_der,
208 Int2_print,
209 Int2_free,
210 0, /* Use generic outmost tag fetcher */
211 asn1_DEF_Int2_tags,
212 sizeof(asn1_DEF_Int2_tags)
213 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
214 1, /* Tags to skip */
215 -0, /* Unknown yet */
216 0, 0, /* No members */
217 0 /* No specifics */
218};
219
220
221/*** <<< INCLUDES [Int3] >>> ***/
222
223#include <Int2.h>
224
225/*** <<< TYPE-DECLS [Int3] >>> ***/
226
227
228typedef Int2_t Int3_t;
229
Lev Walkin006de1c2004-08-20 13:37:45 +0000230/*** <<< FUNC-DECLS [Int3] >>> ***/
231
232extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
233asn_constr_check_f Int3_constraint;
234ber_type_decoder_f Int3_decode_ber;
235der_type_encoder_f Int3_encode_der;
236asn_struct_print_f Int3_print;
237asn_struct_free_f Int3_free;
238
239/*** <<< CODE [Int3] >>> ***/
240
241int
242Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
243 asn_app_consume_bytes_f *app_errlog, void *app_key) {
244
Lev Walkin634a3b82004-08-22 03:30:05 +0000245 const Int2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000246 long value;
247
248 if(!sptr) {
249 _ASN_ERRLOG(app_errlog, app_key,
250 "%s: value not given", td->name);
251 return -1;
252 }
253
254 if(asn1_INTEGER2long(st, &value)) {
255 _ASN_ERRLOG(app_errlog, app_key,
256 "%s: value too large", td->name);
257 return -1;
258 }
259
260 if((value >= 0 && value <= 10)) {
261 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000262 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000263 } else {
264 _ASN_ERRLOG(app_errlog, app_key,
265 "%s: constraint failed", td->name);
266 return -1;
267 }
268}
269
270/*
271 * This type is implemented using Int2,
272 * so adjust the DEF appropriately.
273 */
274static void
275Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
276 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
277 td->der_encoder = asn1_DEF_Int2.der_encoder;
278 td->free_struct = asn1_DEF_Int2.free_struct;
279 td->print_struct = asn1_DEF_Int2.print_struct;
280 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
281 td->elements = asn1_DEF_Int2.elements;
282 td->elements_count = asn1_DEF_Int2.elements_count;
283 td->specifics = asn1_DEF_Int2.specifics;
284}
285
286ber_dec_rval_t
287Int3_decode_ber(asn1_TYPE_descriptor_t *td,
288 void **structure, void *bufptr, size_t size, int tag_mode) {
289 Int3_inherit_TYPE_descriptor(td);
290 return td->ber_decoder(td, structure,
291 bufptr, size, tag_mode);
292}
293
294der_enc_rval_t
295Int3_encode_der(asn1_TYPE_descriptor_t *td,
296 void *structure, int tag_mode, ber_tlv_tag_t tag,
297 asn_app_consume_bytes_f *cb, void *app_key) {
298 Int3_inherit_TYPE_descriptor(td);
299 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
300}
301
302int
303Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
304 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
305 Int3_inherit_TYPE_descriptor(td);
306 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
307}
308
309void
310Int3_free(asn1_TYPE_descriptor_t *td,
311 void *struct_ptr, int contents_only) {
312 Int3_inherit_TYPE_descriptor(td);
313 td->free_struct(td, struct_ptr, contents_only);
314}
315
316
317/*** <<< STAT-DEFS [Int3] >>> ***/
318
319static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
320 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
321};
322asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
323 "Int3",
324 Int3_constraint,
325 Int3_decode_ber,
326 Int3_encode_der,
327 Int3_print,
328 Int3_free,
329 0, /* Use generic outmost tag fetcher */
330 asn1_DEF_Int3_tags,
331 sizeof(asn1_DEF_Int3_tags)
332 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
333 1, /* Tags to skip */
334 -0, /* Unknown yet */
335 0, 0, /* No members */
336 0 /* No specifics */
337};
338
339
340/*** <<< INCLUDES [Int4] >>> ***/
341
342#include <Int3.h>
343
344/*** <<< TYPE-DECLS [Int4] >>> ***/
345
346
347typedef Int3_t Int4_t;
348
Lev Walkin006de1c2004-08-20 13:37:45 +0000349/*** <<< FUNC-DECLS [Int4] >>> ***/
350
351extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
352asn_constr_check_f Int4_constraint;
353ber_type_decoder_f Int4_decode_ber;
354der_type_encoder_f Int4_encode_der;
355asn_struct_print_f Int4_print;
356asn_struct_free_f Int4_free;
357
358/*** <<< CODE [Int4] >>> ***/
359
360int
361Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
362 asn_app_consume_bytes_f *app_errlog, void *app_key) {
363
Lev Walkin634a3b82004-08-22 03:30:05 +0000364 const Int3_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000365
366 if(!sptr) {
367 _ASN_ERRLOG(app_errlog, app_key,
368 "%s: value not given", td->name);
369 return -1;
370 }
371
372
373 if(1 /* No applicable constraints whatsoever */) {
374 /* Nothing is here. See below */
375 }
376
377 /* Make the underlying type checker permanent */
378 td->check_constraints = asn1_DEF_Int3.check_constraints;
379 return td->check_constraints
380 (td, sptr, app_errlog, app_key);
381}
382
383/*
384 * This type is implemented using Int3,
385 * so adjust the DEF appropriately.
386 */
387static void
388Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
389 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
390 td->der_encoder = asn1_DEF_Int3.der_encoder;
391 td->free_struct = asn1_DEF_Int3.free_struct;
392 td->print_struct = asn1_DEF_Int3.print_struct;
393 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
394 td->elements = asn1_DEF_Int3.elements;
395 td->elements_count = asn1_DEF_Int3.elements_count;
396 td->specifics = asn1_DEF_Int3.specifics;
397}
398
399ber_dec_rval_t
400Int4_decode_ber(asn1_TYPE_descriptor_t *td,
401 void **structure, void *bufptr, size_t size, int tag_mode) {
402 Int4_inherit_TYPE_descriptor(td);
403 return td->ber_decoder(td, structure,
404 bufptr, size, tag_mode);
405}
406
407der_enc_rval_t
408Int4_encode_der(asn1_TYPE_descriptor_t *td,
409 void *structure, int tag_mode, ber_tlv_tag_t tag,
410 asn_app_consume_bytes_f *cb, void *app_key) {
411 Int4_inherit_TYPE_descriptor(td);
412 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
413}
414
415int
416Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
417 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
418 Int4_inherit_TYPE_descriptor(td);
419 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
420}
421
422void
423Int4_free(asn1_TYPE_descriptor_t *td,
424 void *struct_ptr, int contents_only) {
425 Int4_inherit_TYPE_descriptor(td);
426 td->free_struct(td, struct_ptr, contents_only);
427}
428
429
430/*** <<< STAT-DEFS [Int4] >>> ***/
431
432static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
433 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
434};
435asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
436 "Int4",
437 Int4_constraint,
438 Int4_decode_ber,
439 Int4_encode_der,
440 Int4_print,
441 Int4_free,
442 0, /* Use generic outmost tag fetcher */
443 asn1_DEF_Int4_tags,
444 sizeof(asn1_DEF_Int4_tags)
445 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
446 1, /* Tags to skip */
447 -0, /* Unknown yet */
448 0, 0, /* No members */
449 0 /* No specifics */
450};
451
452
453/*** <<< INCLUDES [Int5] >>> ***/
454
455#include <Int4.h>
456
457/*** <<< TYPE-DECLS [Int5] >>> ***/
458
459
460typedef Int4_t Int5_t;
461
Lev Walkin006de1c2004-08-20 13:37:45 +0000462/*** <<< FUNC-DECLS [Int5] >>> ***/
463
464extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
465asn_constr_check_f Int5_constraint;
466ber_type_decoder_f Int5_decode_ber;
467der_type_encoder_f Int5_encode_der;
468asn_struct_print_f Int5_print;
469asn_struct_free_f Int5_free;
470
471/*** <<< CODE [Int5] >>> ***/
472
473int
474Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
475 asn_app_consume_bytes_f *app_errlog, void *app_key) {
476
Lev Walkin634a3b82004-08-22 03:30:05 +0000477 const Int4_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000478 long value;
479
480 if(!sptr) {
481 _ASN_ERRLOG(app_errlog, app_key,
482 "%s: value not given", td->name);
483 return -1;
484 }
485
486 if(asn1_INTEGER2long(st, &value)) {
487 _ASN_ERRLOG(app_errlog, app_key,
488 "%s: value too large", td->name);
489 return -1;
490 }
491
492 if((value == 5)) {
493 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000494 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000495 } else {
496 _ASN_ERRLOG(app_errlog, app_key,
497 "%s: constraint failed", td->name);
498 return -1;
499 }
500}
501
502/*
503 * This type is implemented using Int4,
504 * so adjust the DEF appropriately.
505 */
506static void
507Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
508 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
509 td->der_encoder = asn1_DEF_Int4.der_encoder;
510 td->free_struct = asn1_DEF_Int4.free_struct;
511 td->print_struct = asn1_DEF_Int4.print_struct;
512 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
513 td->elements = asn1_DEF_Int4.elements;
514 td->elements_count = asn1_DEF_Int4.elements_count;
515 td->specifics = asn1_DEF_Int4.specifics;
516}
517
518ber_dec_rval_t
519Int5_decode_ber(asn1_TYPE_descriptor_t *td,
520 void **structure, void *bufptr, size_t size, int tag_mode) {
521 Int5_inherit_TYPE_descriptor(td);
522 return td->ber_decoder(td, structure,
523 bufptr, size, tag_mode);
524}
525
526der_enc_rval_t
527Int5_encode_der(asn1_TYPE_descriptor_t *td,
528 void *structure, int tag_mode, ber_tlv_tag_t tag,
529 asn_app_consume_bytes_f *cb, void *app_key) {
530 Int5_inherit_TYPE_descriptor(td);
531 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
532}
533
534int
535Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
536 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
537 Int5_inherit_TYPE_descriptor(td);
538 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
539}
540
541void
542Int5_free(asn1_TYPE_descriptor_t *td,
543 void *struct_ptr, int contents_only) {
544 Int5_inherit_TYPE_descriptor(td);
545 td->free_struct(td, struct_ptr, contents_only);
546}
547
548
549/*** <<< STAT-DEFS [Int5] >>> ***/
550
551static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
552 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
553};
554asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
555 "Int5",
556 Int5_constraint,
557 Int5_decode_ber,
558 Int5_encode_der,
559 Int5_print,
560 Int5_free,
561 0, /* Use generic outmost tag fetcher */
562 asn1_DEF_Int5_tags,
563 sizeof(asn1_DEF_Int5_tags)
564 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
565 1, /* Tags to skip */
566 -0, /* Unknown yet */
567 0, 0, /* No members */
568 0 /* No specifics */
569};
570
571
572/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
573
574#include <INTEGER.h>
575
576/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
577
578
579typedef INTEGER_t ExtensibleExtensions_t;
580
Lev Walkin006de1c2004-08-20 13:37:45 +0000581/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
582
583extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
584asn_constr_check_f ExtensibleExtensions_constraint;
585ber_type_decoder_f ExtensibleExtensions_decode_ber;
586der_type_encoder_f ExtensibleExtensions_encode_der;
587asn_struct_print_f ExtensibleExtensions_print;
588asn_struct_free_f ExtensibleExtensions_free;
589
590/*** <<< CODE [ExtensibleExtensions] >>> ***/
591
592int
593ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
594 asn_app_consume_bytes_f *app_errlog, void *app_key) {
595
Lev Walkin634a3b82004-08-22 03:30:05 +0000596 const INTEGER_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000597
598 if(!sptr) {
599 _ASN_ERRLOG(app_errlog, app_key,
600 "%s: value not given", td->name);
601 return -1;
602 }
603
604
605 if(1 /* No applicable constraints whatsoever */) {
606 /* Nothing is here. See below */
607 }
608
609 /* Make the underlying type checker permanent */
610 td->check_constraints = asn1_DEF_INTEGER.check_constraints;
611 return td->check_constraints
612 (td, sptr, app_errlog, app_key);
613}
614
615/*
616 * This type is implemented using INTEGER,
617 * so adjust the DEF appropriately.
618 */
619static void
620ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
621 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
622 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
623 td->free_struct = asn1_DEF_INTEGER.free_struct;
624 td->print_struct = asn1_DEF_INTEGER.print_struct;
625 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
626 td->elements = asn1_DEF_INTEGER.elements;
627 td->elements_count = asn1_DEF_INTEGER.elements_count;
628 td->specifics = asn1_DEF_INTEGER.specifics;
629}
630
631ber_dec_rval_t
632ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
633 void **structure, void *bufptr, size_t size, int tag_mode) {
634 ExtensibleExtensions_inherit_TYPE_descriptor(td);
635 return td->ber_decoder(td, structure,
636 bufptr, size, tag_mode);
637}
638
639der_enc_rval_t
640ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
641 void *structure, int tag_mode, ber_tlv_tag_t tag,
642 asn_app_consume_bytes_f *cb, void *app_key) {
643 ExtensibleExtensions_inherit_TYPE_descriptor(td);
644 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
645}
646
647int
648ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
649 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
650 ExtensibleExtensions_inherit_TYPE_descriptor(td);
651 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
652}
653
654void
655ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
656 void *struct_ptr, int contents_only) {
657 ExtensibleExtensions_inherit_TYPE_descriptor(td);
658 td->free_struct(td, struct_ptr, contents_only);
659}
660
661
662/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
663
664static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
665 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
666};
667asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
668 "ExtensibleExtensions",
669 ExtensibleExtensions_constraint,
670 ExtensibleExtensions_decode_ber,
671 ExtensibleExtensions_encode_der,
672 ExtensibleExtensions_print,
673 ExtensibleExtensions_free,
674 0, /* Use generic outmost tag fetcher */
675 asn1_DEF_ExtensibleExtensions_tags,
676 sizeof(asn1_DEF_ExtensibleExtensions_tags)
677 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
678 1, /* Tags to skip */
679 -0, /* Unknown yet */
680 0, 0, /* No members */
681 0 /* No specifics */
682};
683
684
685/*** <<< INCLUDES [Str1] >>> ***/
686
687#include <IA5String.h>
688
689/*** <<< TYPE-DECLS [Str1] >>> ***/
690
691
692typedef IA5String_t Str1_t;
693
Lev Walkin006de1c2004-08-20 13:37:45 +0000694/*** <<< FUNC-DECLS [Str1] >>> ***/
695
696extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
697asn_constr_check_f Str1_constraint;
698ber_type_decoder_f Str1_decode_ber;
699der_type_encoder_f Str1_encode_der;
700asn_struct_print_f Str1_print;
701asn_struct_free_f Str1_free;
702
703/*** <<< CODE [Str1] >>> ***/
704
705int
706Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
707 asn_app_consume_bytes_f *app_errlog, void *app_key) {
708
709 /* Make the underlying type checker permanent */
710 td->check_constraints = asn1_DEF_IA5String.check_constraints;
711 return td->check_constraints
712 (td, sptr, app_errlog, app_key);
713}
714
715/*
716 * This type is implemented using IA5String,
717 * so adjust the DEF appropriately.
718 */
719static void
720Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
721 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
722 td->der_encoder = asn1_DEF_IA5String.der_encoder;
723 td->free_struct = asn1_DEF_IA5String.free_struct;
724 td->print_struct = asn1_DEF_IA5String.print_struct;
725 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
726 td->elements = asn1_DEF_IA5String.elements;
727 td->elements_count = asn1_DEF_IA5String.elements_count;
728 td->specifics = asn1_DEF_IA5String.specifics;
729}
730
731ber_dec_rval_t
732Str1_decode_ber(asn1_TYPE_descriptor_t *td,
733 void **structure, void *bufptr, size_t size, int tag_mode) {
734 Str1_inherit_TYPE_descriptor(td);
735 return td->ber_decoder(td, structure,
736 bufptr, size, tag_mode);
737}
738
739der_enc_rval_t
740Str1_encode_der(asn1_TYPE_descriptor_t *td,
741 void *structure, int tag_mode, ber_tlv_tag_t tag,
742 asn_app_consume_bytes_f *cb, void *app_key) {
743 Str1_inherit_TYPE_descriptor(td);
744 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
745}
746
747int
748Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
749 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
750 Str1_inherit_TYPE_descriptor(td);
751 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
752}
753
754void
755Str1_free(asn1_TYPE_descriptor_t *td,
756 void *struct_ptr, int contents_only) {
757 Str1_inherit_TYPE_descriptor(td);
758 td->free_struct(td, struct_ptr, contents_only);
759}
760
761
762/*** <<< STAT-DEFS [Str1] >>> ***/
763
764static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
765 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
766};
767asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
768 "Str1",
769 Str1_constraint,
770 Str1_decode_ber,
771 Str1_encode_der,
772 Str1_print,
773 Str1_free,
774 0, /* Use generic outmost tag fetcher */
775 asn1_DEF_Str1_tags,
776 sizeof(asn1_DEF_Str1_tags)
777 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
778 1, /* Tags to skip */
779 -0, /* Unknown yet */
780 0, 0, /* No members */
781 0 /* No specifics */
782};
783
784
785/*** <<< INCLUDES [Str2] >>> ***/
786
787#include <Str1.h>
788
789/*** <<< TYPE-DECLS [Str2] >>> ***/
790
791
792typedef Str1_t Str2_t;
793
Lev Walkin006de1c2004-08-20 13:37:45 +0000794/*** <<< FUNC-DECLS [Str2] >>> ***/
795
796extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
797asn_constr_check_f Str2_constraint;
798ber_type_decoder_f Str2_decode_ber;
799der_type_encoder_f Str2_encode_der;
800asn_struct_print_f Str2_print;
801asn_struct_free_f Str2_free;
802
803/*** <<< CTABLES [Str2] >>> ***/
804
805static int check_permitted_alphabet_1(const void *sptr) {
806 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000807 const IA5String_t *st = sptr;
808 const uint8_t *ch = st->buf;
809 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000810
811 for(; ch < end; ch++) {
812 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000813 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000814 }
Lev Walkin775885e2004-08-22 12:47:03 +0000815 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000816}
817
818
819/*** <<< CODE [Str2] >>> ***/
820
821int
822Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
823 asn_app_consume_bytes_f *app_errlog, void *app_key) {
824
Lev Walkin634a3b82004-08-22 03:30:05 +0000825 const Str1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000826 size_t size;
827
828 if(!sptr) {
829 _ASN_ERRLOG(app_errlog, app_key,
830 "%s: value not given", td->name);
831 return -1;
832 }
833
834 size = st->size;
835
836 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000837 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000838 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000839 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000840 } else {
841 _ASN_ERRLOG(app_errlog, app_key,
842 "%s: constraint failed", td->name);
843 return -1;
844 }
845}
846
847/*
848 * This type is implemented using Str1,
849 * so adjust the DEF appropriately.
850 */
851static void
852Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
853 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
854 td->der_encoder = asn1_DEF_Str1.der_encoder;
855 td->free_struct = asn1_DEF_Str1.free_struct;
856 td->print_struct = asn1_DEF_Str1.print_struct;
857 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
858 td->elements = asn1_DEF_Str1.elements;
859 td->elements_count = asn1_DEF_Str1.elements_count;
860 td->specifics = asn1_DEF_Str1.specifics;
861}
862
863ber_dec_rval_t
864Str2_decode_ber(asn1_TYPE_descriptor_t *td,
865 void **structure, void *bufptr, size_t size, int tag_mode) {
866 Str2_inherit_TYPE_descriptor(td);
867 return td->ber_decoder(td, structure,
868 bufptr, size, tag_mode);
869}
870
871der_enc_rval_t
872Str2_encode_der(asn1_TYPE_descriptor_t *td,
873 void *structure, int tag_mode, ber_tlv_tag_t tag,
874 asn_app_consume_bytes_f *cb, void *app_key) {
875 Str2_inherit_TYPE_descriptor(td);
876 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
877}
878
879int
880Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
881 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
882 Str2_inherit_TYPE_descriptor(td);
883 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
884}
885
886void
887Str2_free(asn1_TYPE_descriptor_t *td,
888 void *struct_ptr, int contents_only) {
889 Str2_inherit_TYPE_descriptor(td);
890 td->free_struct(td, struct_ptr, contents_only);
891}
892
893
894/*** <<< STAT-DEFS [Str2] >>> ***/
895
896static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
897 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
898};
899asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
900 "Str2",
901 Str2_constraint,
902 Str2_decode_ber,
903 Str2_encode_der,
904 Str2_print,
905 Str2_free,
906 0, /* Use generic outmost tag fetcher */
907 asn1_DEF_Str2_tags,
908 sizeof(asn1_DEF_Str2_tags)
909 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
910 1, /* Tags to skip */
911 -0, /* Unknown yet */
912 0, 0, /* No members */
913 0 /* No specifics */
914};
915
916
917/*** <<< INCLUDES [Str3] >>> ***/
918
919#include <Str2.h>
920
921/*** <<< TYPE-DECLS [Str3] >>> ***/
922
923
924typedef Str2_t Str3_t;
925
Lev Walkin006de1c2004-08-20 13:37:45 +0000926/*** <<< FUNC-DECLS [Str3] >>> ***/
927
928extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
929asn_constr_check_f Str3_constraint;
930ber_type_decoder_f Str3_decode_ber;
931der_type_encoder_f Str3_encode_der;
932asn_struct_print_f Str3_print;
933asn_struct_free_f Str3_free;
934
935/*** <<< CTABLES [Str3] >>> ***/
936
937static int permitted_alphabet_table_2[256] = {
9380,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9390,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9400,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9420,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9430,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9440,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
945};
946
947static int check_permitted_alphabet_2(const void *sptr) {
948 int *table = permitted_alphabet_table_2;
949 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000950 const IA5String_t *st = sptr;
951 const uint8_t *ch = st->buf;
952 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000953
954 for(; ch < end; ch++) {
955 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000956 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000957 }
Lev Walkin775885e2004-08-22 12:47:03 +0000958 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000959}
960
961
962/*** <<< CODE [Str3] >>> ***/
963
964int
965Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
966 asn_app_consume_bytes_f *app_errlog, void *app_key) {
967
Lev Walkin634a3b82004-08-22 03:30:05 +0000968 const Str2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000969 size_t size;
970
971 if(!sptr) {
972 _ASN_ERRLOG(app_errlog, app_key,
973 "%s: value not given", td->name);
974 return -1;
975 }
976
977 size = st->size;
978
979 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +0000980 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000981 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000982 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000983 } else {
984 _ASN_ERRLOG(app_errlog, app_key,
985 "%s: constraint failed", td->name);
986 return -1;
987 }
988}
989
990/*
991 * This type is implemented using Str2,
992 * so adjust the DEF appropriately.
993 */
994static void
995Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
996 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
997 td->der_encoder = asn1_DEF_Str2.der_encoder;
998 td->free_struct = asn1_DEF_Str2.free_struct;
999 td->print_struct = asn1_DEF_Str2.print_struct;
1000 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1001 td->elements = asn1_DEF_Str2.elements;
1002 td->elements_count = asn1_DEF_Str2.elements_count;
1003 td->specifics = asn1_DEF_Str2.specifics;
1004}
1005
1006ber_dec_rval_t
1007Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1008 void **structure, void *bufptr, size_t size, int tag_mode) {
1009 Str3_inherit_TYPE_descriptor(td);
1010 return td->ber_decoder(td, structure,
1011 bufptr, size, tag_mode);
1012}
1013
1014der_enc_rval_t
1015Str3_encode_der(asn1_TYPE_descriptor_t *td,
1016 void *structure, int tag_mode, ber_tlv_tag_t tag,
1017 asn_app_consume_bytes_f *cb, void *app_key) {
1018 Str3_inherit_TYPE_descriptor(td);
1019 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1020}
1021
1022int
1023Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1024 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1025 Str3_inherit_TYPE_descriptor(td);
1026 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1027}
1028
1029void
1030Str3_free(asn1_TYPE_descriptor_t *td,
1031 void *struct_ptr, int contents_only) {
1032 Str3_inherit_TYPE_descriptor(td);
1033 td->free_struct(td, struct_ptr, contents_only);
1034}
1035
1036
1037/*** <<< STAT-DEFS [Str3] >>> ***/
1038
1039static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
1040 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1041};
1042asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1043 "Str3",
1044 Str3_constraint,
1045 Str3_decode_ber,
1046 Str3_encode_der,
1047 Str3_print,
1048 Str3_free,
1049 0, /* Use generic outmost tag fetcher */
1050 asn1_DEF_Str3_tags,
1051 sizeof(asn1_DEF_Str3_tags)
1052 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
1053 1, /* Tags to skip */
1054 -0, /* Unknown yet */
1055 0, 0, /* No members */
1056 0 /* No specifics */
1057};
1058
1059
1060/*** <<< INCLUDES [PER-Visible] >>> ***/
1061
1062#include <IA5String.h>
1063
1064/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1065
1066
1067typedef IA5String_t PER_Visible_t;
1068
Lev Walkin006de1c2004-08-20 13:37:45 +00001069/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1070
1071extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1072asn_constr_check_f PER_Visible_constraint;
1073ber_type_decoder_f PER_Visible_decode_ber;
1074der_type_encoder_f PER_Visible_encode_der;
1075asn_struct_print_f PER_Visible_print;
1076asn_struct_free_f PER_Visible_free;
1077
1078/*** <<< CTABLES [PER-Visible] >>> ***/
1079
1080static int check_permitted_alphabet_3(const void *sptr) {
1081 /* The underlying type is IA5String */
Lev Walkind1e54942004-08-21 07:34:17 +00001082 const IA5String_t *st = sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001083 const uint8_t *ch = st->buf;
1084 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001085
1086 for(; ch < end; ch++) {
1087 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001088 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001089 }
Lev Walkin775885e2004-08-22 12:47:03 +00001090 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001091}
1092
1093
1094/*** <<< CODE [PER-Visible] >>> ***/
1095
1096int
1097PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1098 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1099
Lev Walkin634a3b82004-08-22 03:30:05 +00001100 const IA5String_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001101
1102 if(!sptr) {
1103 _ASN_ERRLOG(app_errlog, app_key,
1104 "%s: value not given", td->name);
1105 return -1;
1106 }
1107
1108
Lev Walkin730b15a2004-08-22 13:11:40 +00001109 if(!check_permitted_alphabet_3(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001110 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001111 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001112 } else {
1113 _ASN_ERRLOG(app_errlog, app_key,
1114 "%s: constraint failed", td->name);
1115 return -1;
1116 }
1117}
1118
1119/*
1120 * This type is implemented using IA5String,
1121 * so adjust the DEF appropriately.
1122 */
1123static void
1124PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1125 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1126 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1127 td->free_struct = asn1_DEF_IA5String.free_struct;
1128 td->print_struct = asn1_DEF_IA5String.print_struct;
1129 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1130 td->elements = asn1_DEF_IA5String.elements;
1131 td->elements_count = asn1_DEF_IA5String.elements_count;
1132 td->specifics = asn1_DEF_IA5String.specifics;
1133}
1134
1135ber_dec_rval_t
1136PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1137 void **structure, void *bufptr, size_t size, int tag_mode) {
1138 PER_Visible_inherit_TYPE_descriptor(td);
1139 return td->ber_decoder(td, structure,
1140 bufptr, size, tag_mode);
1141}
1142
1143der_enc_rval_t
1144PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1145 void *structure, int tag_mode, ber_tlv_tag_t tag,
1146 asn_app_consume_bytes_f *cb, void *app_key) {
1147 PER_Visible_inherit_TYPE_descriptor(td);
1148 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1149}
1150
1151int
1152PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1153 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1154 PER_Visible_inherit_TYPE_descriptor(td);
1155 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1156}
1157
1158void
1159PER_Visible_free(asn1_TYPE_descriptor_t *td,
1160 void *struct_ptr, int contents_only) {
1161 PER_Visible_inherit_TYPE_descriptor(td);
1162 td->free_struct(td, struct_ptr, contents_only);
1163}
1164
1165
1166/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1167
1168static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1169 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1170};
1171asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1172 "PER-Visible",
1173 PER_Visible_constraint,
1174 PER_Visible_decode_ber,
1175 PER_Visible_encode_der,
1176 PER_Visible_print,
1177 PER_Visible_free,
1178 0, /* Use generic outmost tag fetcher */
1179 asn1_DEF_PER_Visible_tags,
1180 sizeof(asn1_DEF_PER_Visible_tags)
1181 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
1182 1, /* Tags to skip */
1183 -0, /* Unknown yet */
1184 0, 0, /* No members */
1185 0 /* No specifics */
1186};
1187
1188
1189/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1190
1191#include <PER-Visible.h>
1192
1193/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1194
1195
1196typedef PER_Visible_t PER_Visible_2_t;
1197
Lev Walkin006de1c2004-08-20 13:37:45 +00001198/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1199
1200extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1201asn_constr_check_f PER_Visible_2_constraint;
1202ber_type_decoder_f PER_Visible_2_decode_ber;
1203der_type_encoder_f PER_Visible_2_encode_der;
1204asn_struct_print_f PER_Visible_2_print;
1205asn_struct_free_f PER_Visible_2_free;
1206
1207/*** <<< CTABLES [PER-Visible-2] >>> ***/
1208
1209static int check_permitted_alphabet_4(const void *sptr) {
1210 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001211 const IA5String_t *st = sptr;
1212 const uint8_t *ch = st->buf;
1213 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001214
1215 for(; ch < end; ch++) {
1216 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001217 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001218 }
Lev Walkin775885e2004-08-22 12:47:03 +00001219 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001220}
1221
1222
1223/*** <<< CODE [PER-Visible-2] >>> ***/
1224
1225int
1226PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1227 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1228
Lev Walkin634a3b82004-08-22 03:30:05 +00001229 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001230
1231 if(!sptr) {
1232 _ASN_ERRLOG(app_errlog, app_key,
1233 "%s: value not given", td->name);
1234 return -1;
1235 }
1236
1237
Lev Walkin730b15a2004-08-22 13:11:40 +00001238 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001239 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001240 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001241 } else {
1242 _ASN_ERRLOG(app_errlog, app_key,
1243 "%s: constraint failed", td->name);
1244 return -1;
1245 }
1246}
1247
1248/*
1249 * This type is implemented using PER_Visible,
1250 * so adjust the DEF appropriately.
1251 */
1252static void
1253PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1254 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1255 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1256 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1257 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1258 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1259 td->elements = asn1_DEF_PER_Visible.elements;
1260 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1261 td->specifics = asn1_DEF_PER_Visible.specifics;
1262}
1263
1264ber_dec_rval_t
1265PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1266 void **structure, void *bufptr, size_t size, int tag_mode) {
1267 PER_Visible_2_inherit_TYPE_descriptor(td);
1268 return td->ber_decoder(td, structure,
1269 bufptr, size, tag_mode);
1270}
1271
1272der_enc_rval_t
1273PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1274 void *structure, int tag_mode, ber_tlv_tag_t tag,
1275 asn_app_consume_bytes_f *cb, void *app_key) {
1276 PER_Visible_2_inherit_TYPE_descriptor(td);
1277 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1278}
1279
1280int
1281PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1282 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1283 PER_Visible_2_inherit_TYPE_descriptor(td);
1284 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1285}
1286
1287void
1288PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1289 void *struct_ptr, int contents_only) {
1290 PER_Visible_2_inherit_TYPE_descriptor(td);
1291 td->free_struct(td, struct_ptr, contents_only);
1292}
1293
1294
1295/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1296
1297static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
1298 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1299};
1300asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1301 "PER-Visible-2",
1302 PER_Visible_2_constraint,
1303 PER_Visible_2_decode_ber,
1304 PER_Visible_2_encode_der,
1305 PER_Visible_2_print,
1306 PER_Visible_2_free,
1307 0, /* Use generic outmost tag fetcher */
1308 asn1_DEF_PER_Visible_2_tags,
1309 sizeof(asn1_DEF_PER_Visible_2_tags)
1310 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
1311 1, /* Tags to skip */
1312 -0, /* Unknown yet */
1313 0, 0, /* No members */
1314 0 /* No specifics */
1315};
1316
1317
1318/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1319
1320#include <PER-Visible.h>
1321
1322/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1323
1324
1325typedef PER_Visible_t Not_PER_Visible_1_t;
1326
Lev Walkin006de1c2004-08-20 13:37:45 +00001327/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1328
1329extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1330asn_constr_check_f Not_PER_Visible_1_constraint;
1331ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1332der_type_encoder_f Not_PER_Visible_1_encode_der;
1333asn_struct_print_f Not_PER_Visible_1_print;
1334asn_struct_free_f Not_PER_Visible_1_free;
1335
1336/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1337
1338static int check_permitted_alphabet_5(const void *sptr) {
1339 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001340 const IA5String_t *st = sptr;
1341 const uint8_t *ch = st->buf;
1342 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001343
1344 for(; ch < end; ch++) {
1345 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001346 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001347 }
Lev Walkin775885e2004-08-22 12:47:03 +00001348 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001349}
1350
1351
1352/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1353
1354int
1355Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1356 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1357
Lev Walkin634a3b82004-08-22 03:30:05 +00001358 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001359
1360 if(!sptr) {
1361 _ASN_ERRLOG(app_errlog, app_key,
1362 "%s: value not given", td->name);
1363 return -1;
1364 }
1365
1366
Lev Walkin730b15a2004-08-22 13:11:40 +00001367 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001368 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001369 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001370 } else {
1371 _ASN_ERRLOG(app_errlog, app_key,
1372 "%s: constraint failed", td->name);
1373 return -1;
1374 }
1375}
1376
1377/*
1378 * This type is implemented using PER_Visible,
1379 * so adjust the DEF appropriately.
1380 */
1381static void
1382Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1383 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1384 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1385 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1386 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1387 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1388 td->elements = asn1_DEF_PER_Visible.elements;
1389 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1390 td->specifics = asn1_DEF_PER_Visible.specifics;
1391}
1392
1393ber_dec_rval_t
1394Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1395 void **structure, void *bufptr, size_t size, int tag_mode) {
1396 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1397 return td->ber_decoder(td, structure,
1398 bufptr, size, tag_mode);
1399}
1400
1401der_enc_rval_t
1402Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1403 void *structure, int tag_mode, ber_tlv_tag_t tag,
1404 asn_app_consume_bytes_f *cb, void *app_key) {
1405 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1406 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1407}
1408
1409int
1410Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1411 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1412 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1413 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1414}
1415
1416void
1417Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1418 void *struct_ptr, int contents_only) {
1419 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1420 td->free_struct(td, struct_ptr, contents_only);
1421}
1422
1423
1424/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1425
1426static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
1427 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1428};
1429asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1430 "Not-PER-Visible-1",
1431 Not_PER_Visible_1_constraint,
1432 Not_PER_Visible_1_decode_ber,
1433 Not_PER_Visible_1_encode_der,
1434 Not_PER_Visible_1_print,
1435 Not_PER_Visible_1_free,
1436 0, /* Use generic outmost tag fetcher */
1437 asn1_DEF_Not_PER_Visible_1_tags,
1438 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1439 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1440 1, /* Tags to skip */
1441 -0, /* Unknown yet */
1442 0, 0, /* No members */
1443 0 /* No specifics */
1444};
1445
1446
1447/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1448
1449#include <PER-Visible.h>
1450
1451/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1452
1453
1454typedef PER_Visible_t Not_PER_Visible_2_t;
1455
Lev Walkin006de1c2004-08-20 13:37:45 +00001456/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1457
1458extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1459asn_constr_check_f Not_PER_Visible_2_constraint;
1460ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1461der_type_encoder_f Not_PER_Visible_2_encode_der;
1462asn_struct_print_f Not_PER_Visible_2_print;
1463asn_struct_free_f Not_PER_Visible_2_free;
1464
1465/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1466
1467int
1468Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1469 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1470
Lev Walkin634a3b82004-08-22 03:30:05 +00001471 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001472
1473 if(!sptr) {
1474 _ASN_ERRLOG(app_errlog, app_key,
1475 "%s: value not given", td->name);
1476 return -1;
1477 }
1478
1479
1480 if(1 /* No applicable constraints whatsoever */) {
1481 /* Nothing is here. See below */
1482 }
1483
1484 /* Make the underlying type checker permanent */
1485 td->check_constraints = asn1_DEF_PER_Visible.check_constraints;
1486 return td->check_constraints
1487 (td, sptr, app_errlog, app_key);
1488}
1489
1490/*
1491 * This type is implemented using PER_Visible,
1492 * so adjust the DEF appropriately.
1493 */
1494static void
1495Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1496 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1497 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1498 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1499 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1500 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1501 td->elements = asn1_DEF_PER_Visible.elements;
1502 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1503 td->specifics = asn1_DEF_PER_Visible.specifics;
1504}
1505
1506ber_dec_rval_t
1507Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1508 void **structure, void *bufptr, size_t size, int tag_mode) {
1509 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1510 return td->ber_decoder(td, structure,
1511 bufptr, size, tag_mode);
1512}
1513
1514der_enc_rval_t
1515Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1516 void *structure, int tag_mode, ber_tlv_tag_t tag,
1517 asn_app_consume_bytes_f *cb, void *app_key) {
1518 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1519 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1520}
1521
1522int
1523Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1524 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1525 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1526 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1527}
1528
1529void
1530Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1531 void *struct_ptr, int contents_only) {
1532 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1533 td->free_struct(td, struct_ptr, contents_only);
1534}
1535
1536
1537/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1538
1539static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
1540 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1541};
1542asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1543 "Not-PER-Visible-2",
1544 Not_PER_Visible_2_constraint,
1545 Not_PER_Visible_2_decode_ber,
1546 Not_PER_Visible_2_encode_der,
1547 Not_PER_Visible_2_print,
1548 Not_PER_Visible_2_free,
1549 0, /* Use generic outmost tag fetcher */
1550 asn1_DEF_Not_PER_Visible_2_tags,
1551 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1552 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1553 1, /* Tags to skip */
1554 -0, /* Unknown yet */
1555 0, 0, /* No members */
1556 0 /* No specifics */
1557};
1558
1559
1560/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1561
1562#include <PER-Visible.h>
1563
1564/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1565
1566
1567typedef PER_Visible_t Not_PER_Visible_3_t;
1568
Lev Walkin006de1c2004-08-20 13:37:45 +00001569/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1570
1571extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1572asn_constr_check_f Not_PER_Visible_3_constraint;
1573ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1574der_type_encoder_f Not_PER_Visible_3_encode_der;
1575asn_struct_print_f Not_PER_Visible_3_print;
1576asn_struct_free_f Not_PER_Visible_3_free;
1577
1578/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1579
1580int
1581Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1582 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1583
Lev Walkin634a3b82004-08-22 03:30:05 +00001584 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001585
1586 if(!sptr) {
1587 _ASN_ERRLOG(app_errlog, app_key,
1588 "%s: value not given", td->name);
1589 return -1;
1590 }
1591
1592
1593 if(1 /* No applicable constraints whatsoever */) {
1594 /* Nothing is here. See below */
1595 }
1596
1597 /* Make the underlying type checker permanent */
1598 td->check_constraints = asn1_DEF_PER_Visible.check_constraints;
1599 return td->check_constraints
1600 (td, sptr, app_errlog, app_key);
1601}
1602
1603/*
1604 * This type is implemented using PER_Visible,
1605 * so adjust the DEF appropriately.
1606 */
1607static void
1608Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1609 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1610 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1611 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1612 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1613 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1614 td->elements = asn1_DEF_PER_Visible.elements;
1615 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1616 td->specifics = asn1_DEF_PER_Visible.specifics;
1617}
1618
1619ber_dec_rval_t
1620Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1621 void **structure, void *bufptr, size_t size, int tag_mode) {
1622 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1623 return td->ber_decoder(td, structure,
1624 bufptr, size, tag_mode);
1625}
1626
1627der_enc_rval_t
1628Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1629 void *structure, int tag_mode, ber_tlv_tag_t tag,
1630 asn_app_consume_bytes_f *cb, void *app_key) {
1631 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1632 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1633}
1634
1635int
1636Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1637 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1638 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1639 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1640}
1641
1642void
1643Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1644 void *struct_ptr, int contents_only) {
1645 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1646 td->free_struct(td, struct_ptr, contents_only);
1647}
1648
1649
1650/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1651
1652static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
1653 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1654};
1655asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1656 "Not-PER-Visible-3",
1657 Not_PER_Visible_3_constraint,
1658 Not_PER_Visible_3_decode_ber,
1659 Not_PER_Visible_3_encode_der,
1660 Not_PER_Visible_3_print,
1661 Not_PER_Visible_3_free,
1662 0, /* Use generic outmost tag fetcher */
1663 asn1_DEF_Not_PER_Visible_3_tags,
1664 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1665 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1666 1, /* Tags to skip */
1667 -0, /* Unknown yet */
1668 0, 0, /* No members */
1669 0 /* No specifics */
1670};
1671
1672
1673/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1674
1675#include <PER-Visible.h>
1676
1677/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1678
1679
1680typedef PER_Visible_t SIZE_but_not_FROM_t;
1681
Lev Walkin006de1c2004-08-20 13:37:45 +00001682/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1683
1684extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1685asn_constr_check_f SIZE_but_not_FROM_constraint;
1686ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1687der_type_encoder_f SIZE_but_not_FROM_encode_der;
1688asn_struct_print_f SIZE_but_not_FROM_print;
1689asn_struct_free_f SIZE_but_not_FROM_free;
1690
1691/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1692
1693static int check_permitted_alphabet_6(const void *sptr) {
1694 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001695 const IA5String_t *st = sptr;
1696 const uint8_t *ch = st->buf;
1697 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001698
1699 for(; ch < end; ch++) {
1700 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001701 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001702 }
Lev Walkin775885e2004-08-22 12:47:03 +00001703 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001704}
1705
1706
1707/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1708
1709int
1710SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1711 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1712
Lev Walkin634a3b82004-08-22 03:30:05 +00001713 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001714 size_t size;
1715
1716 if(!sptr) {
1717 _ASN_ERRLOG(app_errlog, app_key,
1718 "%s: value not given", td->name);
1719 return -1;
1720 }
1721
1722 size = st->size;
1723
1724 if((size >= 1 && size <= 4)
Lev Walkin730b15a2004-08-22 13:11:40 +00001725 && !check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001726 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001727 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001728 } else {
1729 _ASN_ERRLOG(app_errlog, app_key,
1730 "%s: constraint failed", td->name);
1731 return -1;
1732 }
1733}
1734
1735/*
1736 * This type is implemented using PER_Visible,
1737 * so adjust the DEF appropriately.
1738 */
1739static void
1740SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1741 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1742 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1743 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1744 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1745 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1746 td->elements = asn1_DEF_PER_Visible.elements;
1747 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1748 td->specifics = asn1_DEF_PER_Visible.specifics;
1749}
1750
1751ber_dec_rval_t
1752SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1753 void **structure, void *bufptr, size_t size, int tag_mode) {
1754 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1755 return td->ber_decoder(td, structure,
1756 bufptr, size, tag_mode);
1757}
1758
1759der_enc_rval_t
1760SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1761 void *structure, int tag_mode, ber_tlv_tag_t tag,
1762 asn_app_consume_bytes_f *cb, void *app_key) {
1763 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1764 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1765}
1766
1767int
1768SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1769 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1770 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1771 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1772}
1773
1774void
1775SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1776 void *struct_ptr, int contents_only) {
1777 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1778 td->free_struct(td, struct_ptr, contents_only);
1779}
1780
1781
1782/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1783
1784static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
1785 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1786};
1787asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
1788 "SIZE-but-not-FROM",
1789 SIZE_but_not_FROM_constraint,
1790 SIZE_but_not_FROM_decode_ber,
1791 SIZE_but_not_FROM_encode_der,
1792 SIZE_but_not_FROM_print,
1793 SIZE_but_not_FROM_free,
1794 0, /* Use generic outmost tag fetcher */
1795 asn1_DEF_SIZE_but_not_FROM_tags,
1796 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
1797 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
1798 1, /* Tags to skip */
1799 -0, /* Unknown yet */
1800 0, 0, /* No members */
1801 0 /* No specifics */
1802};
1803
1804
1805/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
1806
1807#include <PER-Visible.h>
1808
1809/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
1810
1811
1812typedef PER_Visible_t SIZE_and_FROM_t;
1813
Lev Walkin006de1c2004-08-20 13:37:45 +00001814/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
1815
1816extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
1817asn_constr_check_f SIZE_and_FROM_constraint;
1818ber_type_decoder_f SIZE_and_FROM_decode_ber;
1819der_type_encoder_f SIZE_and_FROM_encode_der;
1820asn_struct_print_f SIZE_and_FROM_print;
1821asn_struct_free_f SIZE_and_FROM_free;
1822
1823/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
1824
1825static int check_permitted_alphabet_7(const void *sptr) {
1826 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001827 const IA5String_t *st = sptr;
1828 const uint8_t *ch = st->buf;
1829 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001830
1831 for(; ch < end; ch++) {
1832 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001833 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001834 }
Lev Walkin775885e2004-08-22 12:47:03 +00001835 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001836}
1837
1838
1839/*** <<< CODE [SIZE-and-FROM] >>> ***/
1840
1841int
1842SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1843 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1844
Lev Walkin634a3b82004-08-22 03:30:05 +00001845 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001846 size_t size;
1847
1848 if(!sptr) {
1849 _ASN_ERRLOG(app_errlog, app_key,
1850 "%s: value not given", td->name);
1851 return -1;
1852 }
1853
1854 size = st->size;
1855
1856 if((size >= 1 && size <= 4)
Lev Walkin730b15a2004-08-22 13:11:40 +00001857 && !check_permitted_alphabet_7(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001858 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001859 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001860 } else {
1861 _ASN_ERRLOG(app_errlog, app_key,
1862 "%s: constraint failed", td->name);
1863 return -1;
1864 }
1865}
1866
1867/*
1868 * This type is implemented using PER_Visible,
1869 * so adjust the DEF appropriately.
1870 */
1871static void
1872SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1873 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1874 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1875 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1876 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1877 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1878 td->elements = asn1_DEF_PER_Visible.elements;
1879 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1880 td->specifics = asn1_DEF_PER_Visible.specifics;
1881}
1882
1883ber_dec_rval_t
1884SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1885 void **structure, void *bufptr, size_t size, int tag_mode) {
1886 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1887 return td->ber_decoder(td, structure,
1888 bufptr, size, tag_mode);
1889}
1890
1891der_enc_rval_t
1892SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1893 void *structure, int tag_mode, ber_tlv_tag_t tag,
1894 asn_app_consume_bytes_f *cb, void *app_key) {
1895 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1896 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1897}
1898
1899int
1900SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1901 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1902 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1903 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1904}
1905
1906void
1907SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
1908 void *struct_ptr, int contents_only) {
1909 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1910 td->free_struct(td, struct_ptr, contents_only);
1911}
1912
1913
1914/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
1915
1916static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
1917 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1918};
1919asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
1920 "SIZE-and-FROM",
1921 SIZE_and_FROM_constraint,
1922 SIZE_and_FROM_decode_ber,
1923 SIZE_and_FROM_encode_der,
1924 SIZE_and_FROM_print,
1925 SIZE_and_FROM_free,
1926 0, /* Use generic outmost tag fetcher */
1927 asn1_DEF_SIZE_and_FROM_tags,
1928 sizeof(asn1_DEF_SIZE_and_FROM_tags)
1929 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
1930 1, /* Tags to skip */
1931 -0, /* Unknown yet */
1932 0, 0, /* No members */
1933 0 /* No specifics */
1934};
1935
1936
1937/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
1938
1939#include <PER-Visible.h>
1940
1941/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
1942
1943
1944typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
1945
Lev Walkin006de1c2004-08-20 13:37:45 +00001946/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
1947
1948extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
1949asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
1950ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
1951der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
1952asn_struct_print_f Neither_SIZE_nor_FROM_print;
1953asn_struct_free_f Neither_SIZE_nor_FROM_free;
1954
1955/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
1956
1957static int check_permitted_alphabet_8(const void *sptr) {
1958 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001959 const IA5String_t *st = sptr;
1960 const uint8_t *ch = st->buf;
1961 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001962
1963 for(; ch < end; ch++) {
1964 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001965 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001966 }
Lev Walkin775885e2004-08-22 12:47:03 +00001967 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001968}
1969
1970
1971/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
1972
1973int
1974Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1975 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1976
Lev Walkin634a3b82004-08-22 03:30:05 +00001977 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001978
1979 if(!sptr) {
1980 _ASN_ERRLOG(app_errlog, app_key,
1981 "%s: value not given", td->name);
1982 return -1;
1983 }
1984
1985
Lev Walkin730b15a2004-08-22 13:11:40 +00001986 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001987 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001988 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001989 } else {
1990 _ASN_ERRLOG(app_errlog, app_key,
1991 "%s: constraint failed", td->name);
1992 return -1;
1993 }
1994}
1995
1996/*
1997 * This type is implemented using PER_Visible,
1998 * so adjust the DEF appropriately.
1999 */
2000static void
2001Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2002 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2003 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2004 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2005 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2006 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2007 td->elements = asn1_DEF_PER_Visible.elements;
2008 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2009 td->specifics = asn1_DEF_PER_Visible.specifics;
2010}
2011
2012ber_dec_rval_t
2013Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2014 void **structure, void *bufptr, size_t size, int tag_mode) {
2015 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2016 return td->ber_decoder(td, structure,
2017 bufptr, size, tag_mode);
2018}
2019
2020der_enc_rval_t
2021Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2022 void *structure, int tag_mode, ber_tlv_tag_t tag,
2023 asn_app_consume_bytes_f *cb, void *app_key) {
2024 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2025 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2026}
2027
2028int
2029Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2030 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2031 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2032 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2033}
2034
2035void
2036Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2037 void *struct_ptr, int contents_only) {
2038 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2039 td->free_struct(td, struct_ptr, contents_only);
2040}
2041
2042
2043/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2044
2045static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
2046 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2047};
2048asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2049 "Neither-SIZE-nor-FROM",
2050 Neither_SIZE_nor_FROM_constraint,
2051 Neither_SIZE_nor_FROM_decode_ber,
2052 Neither_SIZE_nor_FROM_encode_der,
2053 Neither_SIZE_nor_FROM_print,
2054 Neither_SIZE_nor_FROM_free,
2055 0, /* Use generic outmost tag fetcher */
2056 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2057 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2058 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2059 1, /* Tags to skip */
2060 -0, /* Unknown yet */
2061 0, 0, /* No members */
2062 0 /* No specifics */
2063};
2064
2065
2066/*** <<< INCLUDES [Utf8-3] >>> ***/
2067
2068#include <Utf8-2.h>
2069
2070/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2071
2072
2073typedef Utf8_2_t Utf8_3_t;
2074
Lev Walkin006de1c2004-08-20 13:37:45 +00002075/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2076
2077extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2078asn_constr_check_f Utf8_3_constraint;
2079ber_type_decoder_f Utf8_3_decode_ber;
2080der_type_encoder_f Utf8_3_encode_der;
2081asn_struct_print_f Utf8_3_print;
2082asn_struct_free_f Utf8_3_free;
2083
2084/*** <<< CTABLES [Utf8-3] >>> ***/
2085
2086static int permitted_alphabet_table_9[128] = {
20870,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
20880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
20890,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
20900,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
20910,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
20921,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
20930,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
20941,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2095};
2096
2097static int check_permitted_alphabet_9(const void *sptr) {
2098 int *table = permitted_alphabet_table_9;
2099 /* The underlying type is UTF8String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002100 const UTF8String_t *st = sptr;
2101 const uint8_t *ch = st->buf;
2102 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002103
2104 for(; ch < end; ch++) {
2105 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002106 if(cv >= 0x80) return -1;
2107 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002108 }
Lev Walkin775885e2004-08-22 12:47:03 +00002109 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002110}
2111
2112
2113/*** <<< CODE [Utf8-3] >>> ***/
2114
2115int
2116Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2117 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2118
Lev Walkin634a3b82004-08-22 03:30:05 +00002119 const Utf8_2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002120 size_t size;
2121
2122 if(!sptr) {
2123 _ASN_ERRLOG(app_errlog, app_key,
2124 "%s: value not given", td->name);
2125 return -1;
2126 }
2127
2128 size = UTF8String_length(st, td->name, app_errlog, app_key);
2129 if(size == (size_t)-1) return -1;
2130
2131 if((size >= 1 && size <= 2)
Lev Walkin730b15a2004-08-22 13:11:40 +00002132 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002133 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002134 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002135 } else {
2136 _ASN_ERRLOG(app_errlog, app_key,
2137 "%s: constraint failed", td->name);
2138 return -1;
2139 }
2140}
2141
2142/*
2143 * This type is implemented using Utf8_2,
2144 * so adjust the DEF appropriately.
2145 */
2146static void
2147Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2148 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2149 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2150 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2151 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2152 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2153 td->elements = asn1_DEF_Utf8_2.elements;
2154 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2155 td->specifics = asn1_DEF_Utf8_2.specifics;
2156}
2157
2158ber_dec_rval_t
2159Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2160 void **structure, void *bufptr, size_t size, int tag_mode) {
2161 Utf8_3_inherit_TYPE_descriptor(td);
2162 return td->ber_decoder(td, structure,
2163 bufptr, size, tag_mode);
2164}
2165
2166der_enc_rval_t
2167Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2168 void *structure, int tag_mode, ber_tlv_tag_t tag,
2169 asn_app_consume_bytes_f *cb, void *app_key) {
2170 Utf8_3_inherit_TYPE_descriptor(td);
2171 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2172}
2173
2174int
2175Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2176 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2177 Utf8_3_inherit_TYPE_descriptor(td);
2178 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2179}
2180
2181void
2182Utf8_3_free(asn1_TYPE_descriptor_t *td,
2183 void *struct_ptr, int contents_only) {
2184 Utf8_3_inherit_TYPE_descriptor(td);
2185 td->free_struct(td, struct_ptr, contents_only);
2186}
2187
2188
2189/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2190
2191static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
2192 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2193};
2194asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2195 "Utf8-3",
2196 Utf8_3_constraint,
2197 Utf8_3_decode_ber,
2198 Utf8_3_encode_der,
2199 Utf8_3_print,
2200 Utf8_3_free,
2201 0, /* Use generic outmost tag fetcher */
2202 asn1_DEF_Utf8_3_tags,
2203 sizeof(asn1_DEF_Utf8_3_tags)
2204 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
2205 1, /* Tags to skip */
2206 -0, /* Unknown yet */
2207 0, 0, /* No members */
2208 0 /* No specifics */
2209};
2210
2211
2212/*** <<< INCLUDES [Utf8-2] >>> ***/
2213
2214#include <Utf8-1.h>
2215
2216/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2217
2218
2219typedef Utf8_1_t Utf8_2_t;
2220
Lev Walkin006de1c2004-08-20 13:37:45 +00002221/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2222
2223extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2224asn_constr_check_f Utf8_2_constraint;
2225ber_type_decoder_f Utf8_2_decode_ber;
2226der_type_encoder_f Utf8_2_encode_der;
2227asn_struct_print_f Utf8_2_print;
2228asn_struct_free_f Utf8_2_free;
2229
2230/*** <<< CODE [Utf8-2] >>> ***/
2231
2232int
2233Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2234 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2235
Lev Walkin634a3b82004-08-22 03:30:05 +00002236 const Utf8_1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002237 size_t size;
2238
2239 if(!sptr) {
2240 _ASN_ERRLOG(app_errlog, app_key,
2241 "%s: value not given", td->name);
2242 return -1;
2243 }
2244
2245 size = UTF8String_length(st, td->name, app_errlog, app_key);
2246 if(size == (size_t)-1) return -1;
2247
2248 if((size >= 1 && size <= 2)) {
2249 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002250 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002251 } else {
2252 _ASN_ERRLOG(app_errlog, app_key,
2253 "%s: constraint failed", td->name);
2254 return -1;
2255 }
2256}
2257
2258/*
2259 * This type is implemented using Utf8_1,
2260 * so adjust the DEF appropriately.
2261 */
2262static void
2263Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2264 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2265 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2266 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2267 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2268 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2269 td->elements = asn1_DEF_Utf8_1.elements;
2270 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2271 td->specifics = asn1_DEF_Utf8_1.specifics;
2272}
2273
2274ber_dec_rval_t
2275Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2276 void **structure, void *bufptr, size_t size, int tag_mode) {
2277 Utf8_2_inherit_TYPE_descriptor(td);
2278 return td->ber_decoder(td, structure,
2279 bufptr, size, tag_mode);
2280}
2281
2282der_enc_rval_t
2283Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2284 void *structure, int tag_mode, ber_tlv_tag_t tag,
2285 asn_app_consume_bytes_f *cb, void *app_key) {
2286 Utf8_2_inherit_TYPE_descriptor(td);
2287 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2288}
2289
2290int
2291Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2292 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2293 Utf8_2_inherit_TYPE_descriptor(td);
2294 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2295}
2296
2297void
2298Utf8_2_free(asn1_TYPE_descriptor_t *td,
2299 void *struct_ptr, int contents_only) {
2300 Utf8_2_inherit_TYPE_descriptor(td);
2301 td->free_struct(td, struct_ptr, contents_only);
2302}
2303
2304
2305/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2306
2307static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
2308 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2309};
2310asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2311 "Utf8-2",
2312 Utf8_2_constraint,
2313 Utf8_2_decode_ber,
2314 Utf8_2_encode_der,
2315 Utf8_2_print,
2316 Utf8_2_free,
2317 0, /* Use generic outmost tag fetcher */
2318 asn1_DEF_Utf8_2_tags,
2319 sizeof(asn1_DEF_Utf8_2_tags)
2320 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
2321 1, /* Tags to skip */
2322 -0, /* Unknown yet */
2323 0, 0, /* No members */
2324 0 /* No specifics */
2325};
2326
2327
2328/*** <<< INCLUDES [Utf8-1] >>> ***/
2329
2330#include <UTF8String.h>
2331
2332/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2333
2334
2335typedef UTF8String_t Utf8_1_t;
2336
Lev Walkin006de1c2004-08-20 13:37:45 +00002337/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2338
2339extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2340asn_constr_check_f Utf8_1_constraint;
2341ber_type_decoder_f Utf8_1_decode_ber;
2342der_type_encoder_f Utf8_1_encode_der;
2343asn_struct_print_f Utf8_1_print;
2344asn_struct_free_f Utf8_1_free;
2345
2346/*** <<< CODE [Utf8-1] >>> ***/
2347
2348int
2349Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2350 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2351
2352 /* Make the underlying type checker permanent */
2353 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2354 return td->check_constraints
2355 (td, sptr, app_errlog, app_key);
2356}
2357
2358/*
2359 * This type is implemented using UTF8String,
2360 * so adjust the DEF appropriately.
2361 */
2362static void
2363Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2364 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2365 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2366 td->free_struct = asn1_DEF_UTF8String.free_struct;
2367 td->print_struct = asn1_DEF_UTF8String.print_struct;
2368 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2369 td->elements = asn1_DEF_UTF8String.elements;
2370 td->elements_count = asn1_DEF_UTF8String.elements_count;
2371 td->specifics = asn1_DEF_UTF8String.specifics;
2372}
2373
2374ber_dec_rval_t
2375Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2376 void **structure, void *bufptr, size_t size, int tag_mode) {
2377 Utf8_1_inherit_TYPE_descriptor(td);
2378 return td->ber_decoder(td, structure,
2379 bufptr, size, tag_mode);
2380}
2381
2382der_enc_rval_t
2383Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2384 void *structure, int tag_mode, ber_tlv_tag_t tag,
2385 asn_app_consume_bytes_f *cb, void *app_key) {
2386 Utf8_1_inherit_TYPE_descriptor(td);
2387 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2388}
2389
2390int
2391Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2392 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2393 Utf8_1_inherit_TYPE_descriptor(td);
2394 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2395}
2396
2397void
2398Utf8_1_free(asn1_TYPE_descriptor_t *td,
2399 void *struct_ptr, int contents_only) {
2400 Utf8_1_inherit_TYPE_descriptor(td);
2401 td->free_struct(td, struct_ptr, contents_only);
2402}
2403
2404
2405/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2406
2407static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2408 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2409};
2410asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2411 "Utf8-1",
2412 Utf8_1_constraint,
2413 Utf8_1_decode_ber,
2414 Utf8_1_encode_der,
2415 Utf8_1_print,
2416 Utf8_1_free,
2417 0, /* Use generic outmost tag fetcher */
2418 asn1_DEF_Utf8_1_tags,
2419 sizeof(asn1_DEF_Utf8_1_tags)
2420 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
2421 1, /* Tags to skip */
2422 -0, /* Unknown yet */
2423 0, 0, /* No members */
2424 0 /* No specifics */
2425};
2426