blob: 059f64e36f41b3c674f058099d96e40677258d4a [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
136 if(asn1_INTEGER2long(st, &value)) {
137 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000138 "%s: value too large (%s:%d)",
139 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000140 return -1;
141 }
142
143 if((value >= 0)) {
144 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000145 return 0;
vlm7d576b32004-08-20 13:37:45 +0000146 } else {
147 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000148 "%s: constraint failed (%s:%d)",
149 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000150 return -1;
151 }
152}
153
154/*
155 * This type is implemented using Int1,
156 * so adjust the DEF appropriately.
157 */
158static void
159Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
160 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
161 td->der_encoder = asn1_DEF_Int1.der_encoder;
162 td->free_struct = asn1_DEF_Int1.free_struct;
163 td->print_struct = asn1_DEF_Int1.print_struct;
164 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
165 td->elements = asn1_DEF_Int1.elements;
166 td->elements_count = asn1_DEF_Int1.elements_count;
167 td->specifics = asn1_DEF_Int1.specifics;
168}
169
170ber_dec_rval_t
171Int2_decode_ber(asn1_TYPE_descriptor_t *td,
172 void **structure, void *bufptr, size_t size, int tag_mode) {
173 Int2_inherit_TYPE_descriptor(td);
174 return td->ber_decoder(td, structure,
175 bufptr, size, tag_mode);
176}
177
178der_enc_rval_t
179Int2_encode_der(asn1_TYPE_descriptor_t *td,
180 void *structure, int tag_mode, ber_tlv_tag_t tag,
181 asn_app_consume_bytes_f *cb, void *app_key) {
182 Int2_inherit_TYPE_descriptor(td);
183 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
184}
185
186int
187Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
188 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
189 Int2_inherit_TYPE_descriptor(td);
190 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
191}
192
193void
194Int2_free(asn1_TYPE_descriptor_t *td,
195 void *struct_ptr, int contents_only) {
196 Int2_inherit_TYPE_descriptor(td);
197 td->free_struct(td, struct_ptr, contents_only);
198}
199
200
201/*** <<< STAT-DEFS [Int2] >>> ***/
202
203static ber_tlv_tag_t asn1_DEF_Int2_tags[] = {
204 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
205};
206asn1_TYPE_descriptor_t asn1_DEF_Int2 = {
207 "Int2",
208 Int2_constraint,
209 Int2_decode_ber,
210 Int2_encode_der,
211 Int2_print,
212 Int2_free,
213 0, /* Use generic outmost tag fetcher */
214 asn1_DEF_Int2_tags,
215 sizeof(asn1_DEF_Int2_tags)
216 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
217 1, /* Tags to skip */
218 -0, /* Unknown yet */
219 0, 0, /* No members */
220 0 /* No specifics */
221};
222
223
224/*** <<< INCLUDES [Int3] >>> ***/
225
226#include <Int2.h>
227
228/*** <<< TYPE-DECLS [Int3] >>> ***/
229
230
231typedef Int2_t Int3_t;
232
vlm7d576b32004-08-20 13:37:45 +0000233/*** <<< FUNC-DECLS [Int3] >>> ***/
234
235extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
236asn_constr_check_f Int3_constraint;
237ber_type_decoder_f Int3_decode_ber;
238der_type_encoder_f Int3_encode_der;
239asn_struct_print_f Int3_print;
240asn_struct_free_f Int3_free;
241
242/*** <<< CODE [Int3] >>> ***/
243
244int
245Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
246 asn_app_consume_bytes_f *app_errlog, void *app_key) {
247
vlmb08de152004-08-22 03:30:05 +0000248 const Int2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000249 long value;
250
251 if(!sptr) {
252 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000253 "%s: value not given (%s:%d)",
254 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000255 return -1;
256 }
257
258 if(asn1_INTEGER2long(st, &value)) {
259 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000260 "%s: value too large (%s:%d)",
261 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000262 return -1;
263 }
264
265 if((value >= 0 && value <= 10)) {
266 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000267 return 0;
vlm7d576b32004-08-20 13:37:45 +0000268 } else {
269 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000270 "%s: constraint failed (%s:%d)",
271 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000272 return -1;
273 }
274}
275
276/*
277 * This type is implemented using Int2,
278 * so adjust the DEF appropriately.
279 */
280static void
281Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
282 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
283 td->der_encoder = asn1_DEF_Int2.der_encoder;
284 td->free_struct = asn1_DEF_Int2.free_struct;
285 td->print_struct = asn1_DEF_Int2.print_struct;
286 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
287 td->elements = asn1_DEF_Int2.elements;
288 td->elements_count = asn1_DEF_Int2.elements_count;
289 td->specifics = asn1_DEF_Int2.specifics;
290}
291
292ber_dec_rval_t
293Int3_decode_ber(asn1_TYPE_descriptor_t *td,
294 void **structure, void *bufptr, size_t size, int tag_mode) {
295 Int3_inherit_TYPE_descriptor(td);
296 return td->ber_decoder(td, structure,
297 bufptr, size, tag_mode);
298}
299
300der_enc_rval_t
301Int3_encode_der(asn1_TYPE_descriptor_t *td,
302 void *structure, int tag_mode, ber_tlv_tag_t tag,
303 asn_app_consume_bytes_f *cb, void *app_key) {
304 Int3_inherit_TYPE_descriptor(td);
305 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
306}
307
308int
309Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
310 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
311 Int3_inherit_TYPE_descriptor(td);
312 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
313}
314
315void
316Int3_free(asn1_TYPE_descriptor_t *td,
317 void *struct_ptr, int contents_only) {
318 Int3_inherit_TYPE_descriptor(td);
319 td->free_struct(td, struct_ptr, contents_only);
320}
321
322
323/*** <<< STAT-DEFS [Int3] >>> ***/
324
325static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
326 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
327};
328asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
329 "Int3",
330 Int3_constraint,
331 Int3_decode_ber,
332 Int3_encode_der,
333 Int3_print,
334 Int3_free,
335 0, /* Use generic outmost tag fetcher */
336 asn1_DEF_Int3_tags,
337 sizeof(asn1_DEF_Int3_tags)
338 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
339 1, /* Tags to skip */
340 -0, /* Unknown yet */
341 0, 0, /* No members */
342 0 /* No specifics */
343};
344
345
346/*** <<< INCLUDES [Int4] >>> ***/
347
348#include <Int3.h>
349
350/*** <<< TYPE-DECLS [Int4] >>> ***/
351
352
353typedef Int3_t Int4_t;
354
vlm7d576b32004-08-20 13:37:45 +0000355/*** <<< FUNC-DECLS [Int4] >>> ***/
356
357extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
358asn_constr_check_f Int4_constraint;
359ber_type_decoder_f Int4_decode_ber;
360der_type_encoder_f Int4_encode_der;
361asn_struct_print_f Int4_print;
362asn_struct_free_f Int4_free;
363
364/*** <<< CODE [Int4] >>> ***/
365
366int
367Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
368 asn_app_consume_bytes_f *app_errlog, void *app_key) {
369
vlmb08de152004-08-22 03:30:05 +0000370 const Int3_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000371
372 if(!sptr) {
373 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000374 "%s: value not given (%s:%d)",
375 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000376 return -1;
377 }
378
379
380 if(1 /* No applicable constraints whatsoever */) {
381 /* Nothing is here. See below */
382 }
383
384 /* Make the underlying type checker permanent */
385 td->check_constraints = asn1_DEF_Int3.check_constraints;
386 return td->check_constraints
387 (td, sptr, app_errlog, app_key);
388}
389
390/*
391 * This type is implemented using Int3,
392 * so adjust the DEF appropriately.
393 */
394static void
395Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
396 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
397 td->der_encoder = asn1_DEF_Int3.der_encoder;
398 td->free_struct = asn1_DEF_Int3.free_struct;
399 td->print_struct = asn1_DEF_Int3.print_struct;
400 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
401 td->elements = asn1_DEF_Int3.elements;
402 td->elements_count = asn1_DEF_Int3.elements_count;
403 td->specifics = asn1_DEF_Int3.specifics;
404}
405
406ber_dec_rval_t
407Int4_decode_ber(asn1_TYPE_descriptor_t *td,
408 void **structure, void *bufptr, size_t size, int tag_mode) {
409 Int4_inherit_TYPE_descriptor(td);
410 return td->ber_decoder(td, structure,
411 bufptr, size, tag_mode);
412}
413
414der_enc_rval_t
415Int4_encode_der(asn1_TYPE_descriptor_t *td,
416 void *structure, int tag_mode, ber_tlv_tag_t tag,
417 asn_app_consume_bytes_f *cb, void *app_key) {
418 Int4_inherit_TYPE_descriptor(td);
419 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
420}
421
422int
423Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
424 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
425 Int4_inherit_TYPE_descriptor(td);
426 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
427}
428
429void
430Int4_free(asn1_TYPE_descriptor_t *td,
431 void *struct_ptr, int contents_only) {
432 Int4_inherit_TYPE_descriptor(td);
433 td->free_struct(td, struct_ptr, contents_only);
434}
435
436
437/*** <<< STAT-DEFS [Int4] >>> ***/
438
439static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
440 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
441};
442asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
443 "Int4",
444 Int4_constraint,
445 Int4_decode_ber,
446 Int4_encode_der,
447 Int4_print,
448 Int4_free,
449 0, /* Use generic outmost tag fetcher */
450 asn1_DEF_Int4_tags,
451 sizeof(asn1_DEF_Int4_tags)
452 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
453 1, /* Tags to skip */
454 -0, /* Unknown yet */
455 0, 0, /* No members */
456 0 /* No specifics */
457};
458
459
460/*** <<< INCLUDES [Int5] >>> ***/
461
462#include <Int4.h>
463
464/*** <<< TYPE-DECLS [Int5] >>> ***/
465
466
467typedef Int4_t Int5_t;
468
vlm7d576b32004-08-20 13:37:45 +0000469/*** <<< FUNC-DECLS [Int5] >>> ***/
470
471extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
472asn_constr_check_f Int5_constraint;
473ber_type_decoder_f Int5_decode_ber;
474der_type_encoder_f Int5_encode_der;
475asn_struct_print_f Int5_print;
476asn_struct_free_f Int5_free;
477
478/*** <<< CODE [Int5] >>> ***/
479
480int
481Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
482 asn_app_consume_bytes_f *app_errlog, void *app_key) {
483
vlmb08de152004-08-22 03:30:05 +0000484 const Int4_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000485 long value;
486
487 if(!sptr) {
488 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000489 "%s: value not given (%s:%d)",
490 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000491 return -1;
492 }
493
494 if(asn1_INTEGER2long(st, &value)) {
495 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000496 "%s: value too large (%s:%d)",
497 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000498 return -1;
499 }
500
501 if((value == 5)) {
502 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000503 return 0;
vlm7d576b32004-08-20 13:37:45 +0000504 } else {
505 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000506 "%s: constraint failed (%s:%d)",
507 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000508 return -1;
509 }
510}
511
512/*
513 * This type is implemented using Int4,
514 * so adjust the DEF appropriately.
515 */
516static void
517Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
518 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
519 td->der_encoder = asn1_DEF_Int4.der_encoder;
520 td->free_struct = asn1_DEF_Int4.free_struct;
521 td->print_struct = asn1_DEF_Int4.print_struct;
522 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
523 td->elements = asn1_DEF_Int4.elements;
524 td->elements_count = asn1_DEF_Int4.elements_count;
525 td->specifics = asn1_DEF_Int4.specifics;
526}
527
528ber_dec_rval_t
529Int5_decode_ber(asn1_TYPE_descriptor_t *td,
530 void **structure, void *bufptr, size_t size, int tag_mode) {
531 Int5_inherit_TYPE_descriptor(td);
532 return td->ber_decoder(td, structure,
533 bufptr, size, tag_mode);
534}
535
536der_enc_rval_t
537Int5_encode_der(asn1_TYPE_descriptor_t *td,
538 void *structure, int tag_mode, ber_tlv_tag_t tag,
539 asn_app_consume_bytes_f *cb, void *app_key) {
540 Int5_inherit_TYPE_descriptor(td);
541 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
542}
543
544int
545Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
546 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
547 Int5_inherit_TYPE_descriptor(td);
548 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
549}
550
551void
552Int5_free(asn1_TYPE_descriptor_t *td,
553 void *struct_ptr, int contents_only) {
554 Int5_inherit_TYPE_descriptor(td);
555 td->free_struct(td, struct_ptr, contents_only);
556}
557
558
559/*** <<< STAT-DEFS [Int5] >>> ***/
560
561static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
562 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
563};
564asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
565 "Int5",
566 Int5_constraint,
567 Int5_decode_ber,
568 Int5_encode_der,
569 Int5_print,
570 Int5_free,
571 0, /* Use generic outmost tag fetcher */
572 asn1_DEF_Int5_tags,
573 sizeof(asn1_DEF_Int5_tags)
574 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
575 1, /* Tags to skip */
576 -0, /* Unknown yet */
577 0, 0, /* No members */
578 0 /* No specifics */
579};
580
581
582/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
583
584#include <INTEGER.h>
585
586/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
587
588
589typedef INTEGER_t ExtensibleExtensions_t;
590
vlm7d576b32004-08-20 13:37:45 +0000591/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
592
593extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
594asn_constr_check_f ExtensibleExtensions_constraint;
595ber_type_decoder_f ExtensibleExtensions_decode_ber;
596der_type_encoder_f ExtensibleExtensions_encode_der;
597asn_struct_print_f ExtensibleExtensions_print;
598asn_struct_free_f ExtensibleExtensions_free;
599
600/*** <<< CODE [ExtensibleExtensions] >>> ***/
601
602int
603ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
604 asn_app_consume_bytes_f *app_errlog, void *app_key) {
605
vlmb08de152004-08-22 03:30:05 +0000606 const INTEGER_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000607
608 if(!sptr) {
609 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000610 "%s: value not given (%s:%d)",
611 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000612 return -1;
613 }
614
615
616 if(1 /* No applicable constraints whatsoever */) {
617 /* Nothing is here. See below */
618 }
619
620 /* Make the underlying type checker permanent */
621 td->check_constraints = asn1_DEF_INTEGER.check_constraints;
622 return td->check_constraints
623 (td, sptr, app_errlog, app_key);
624}
625
626/*
627 * This type is implemented using INTEGER,
628 * so adjust the DEF appropriately.
629 */
630static void
631ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
632 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
633 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
634 td->free_struct = asn1_DEF_INTEGER.free_struct;
635 td->print_struct = asn1_DEF_INTEGER.print_struct;
636 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
637 td->elements = asn1_DEF_INTEGER.elements;
638 td->elements_count = asn1_DEF_INTEGER.elements_count;
639 td->specifics = asn1_DEF_INTEGER.specifics;
640}
641
642ber_dec_rval_t
643ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
644 void **structure, void *bufptr, size_t size, int tag_mode) {
645 ExtensibleExtensions_inherit_TYPE_descriptor(td);
646 return td->ber_decoder(td, structure,
647 bufptr, size, tag_mode);
648}
649
650der_enc_rval_t
651ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
652 void *structure, int tag_mode, ber_tlv_tag_t tag,
653 asn_app_consume_bytes_f *cb, void *app_key) {
654 ExtensibleExtensions_inherit_TYPE_descriptor(td);
655 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
656}
657
658int
659ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
660 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
661 ExtensibleExtensions_inherit_TYPE_descriptor(td);
662 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
663}
664
665void
666ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
667 void *struct_ptr, int contents_only) {
668 ExtensibleExtensions_inherit_TYPE_descriptor(td);
669 td->free_struct(td, struct_ptr, contents_only);
670}
671
672
673/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
674
675static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
676 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
677};
678asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
679 "ExtensibleExtensions",
680 ExtensibleExtensions_constraint,
681 ExtensibleExtensions_decode_ber,
682 ExtensibleExtensions_encode_der,
683 ExtensibleExtensions_print,
684 ExtensibleExtensions_free,
685 0, /* Use generic outmost tag fetcher */
686 asn1_DEF_ExtensibleExtensions_tags,
687 sizeof(asn1_DEF_ExtensibleExtensions_tags)
688 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
689 1, /* Tags to skip */
690 -0, /* Unknown yet */
691 0, 0, /* No members */
692 0 /* No specifics */
693};
694
695
696/*** <<< INCLUDES [Str1] >>> ***/
697
698#include <IA5String.h>
699
700/*** <<< TYPE-DECLS [Str1] >>> ***/
701
702
703typedef IA5String_t Str1_t;
704
vlm7d576b32004-08-20 13:37:45 +0000705/*** <<< FUNC-DECLS [Str1] >>> ***/
706
707extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
708asn_constr_check_f Str1_constraint;
709ber_type_decoder_f Str1_decode_ber;
710der_type_encoder_f Str1_encode_der;
711asn_struct_print_f Str1_print;
712asn_struct_free_f Str1_free;
713
714/*** <<< CODE [Str1] >>> ***/
715
716int
717Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
718 asn_app_consume_bytes_f *app_errlog, void *app_key) {
719
720 /* Make the underlying type checker permanent */
721 td->check_constraints = asn1_DEF_IA5String.check_constraints;
722 return td->check_constraints
723 (td, sptr, app_errlog, app_key);
724}
725
726/*
727 * This type is implemented using IA5String,
728 * so adjust the DEF appropriately.
729 */
730static void
731Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
732 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
733 td->der_encoder = asn1_DEF_IA5String.der_encoder;
734 td->free_struct = asn1_DEF_IA5String.free_struct;
735 td->print_struct = asn1_DEF_IA5String.print_struct;
736 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
737 td->elements = asn1_DEF_IA5String.elements;
738 td->elements_count = asn1_DEF_IA5String.elements_count;
739 td->specifics = asn1_DEF_IA5String.specifics;
740}
741
742ber_dec_rval_t
743Str1_decode_ber(asn1_TYPE_descriptor_t *td,
744 void **structure, void *bufptr, size_t size, int tag_mode) {
745 Str1_inherit_TYPE_descriptor(td);
746 return td->ber_decoder(td, structure,
747 bufptr, size, tag_mode);
748}
749
750der_enc_rval_t
751Str1_encode_der(asn1_TYPE_descriptor_t *td,
752 void *structure, int tag_mode, ber_tlv_tag_t tag,
753 asn_app_consume_bytes_f *cb, void *app_key) {
754 Str1_inherit_TYPE_descriptor(td);
755 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
756}
757
758int
759Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
760 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
761 Str1_inherit_TYPE_descriptor(td);
762 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
763}
764
765void
766Str1_free(asn1_TYPE_descriptor_t *td,
767 void *struct_ptr, int contents_only) {
768 Str1_inherit_TYPE_descriptor(td);
769 td->free_struct(td, struct_ptr, contents_only);
770}
771
772
773/*** <<< STAT-DEFS [Str1] >>> ***/
774
775static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
776 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
777};
778asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
779 "Str1",
780 Str1_constraint,
781 Str1_decode_ber,
782 Str1_encode_der,
783 Str1_print,
784 Str1_free,
785 0, /* Use generic outmost tag fetcher */
786 asn1_DEF_Str1_tags,
787 sizeof(asn1_DEF_Str1_tags)
788 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
789 1, /* Tags to skip */
790 -0, /* Unknown yet */
791 0, 0, /* No members */
792 0 /* No specifics */
793};
794
795
796/*** <<< INCLUDES [Str2] >>> ***/
797
798#include <Str1.h>
799
800/*** <<< TYPE-DECLS [Str2] >>> ***/
801
802
803typedef Str1_t Str2_t;
804
vlm7d576b32004-08-20 13:37:45 +0000805/*** <<< FUNC-DECLS [Str2] >>> ***/
806
807extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
808asn_constr_check_f Str2_constraint;
809ber_type_decoder_f Str2_decode_ber;
810der_type_encoder_f Str2_encode_der;
811asn_struct_print_f Str2_print;
812asn_struct_free_f Str2_free;
813
814/*** <<< CTABLES [Str2] >>> ***/
815
816static int check_permitted_alphabet_1(const void *sptr) {
817 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000818 const IA5String_t *st = sptr;
819 const uint8_t *ch = st->buf;
820 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000821
822 for(; ch < end; ch++) {
823 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000824 if(!(cv <= 127)) return -1;
vlm7d576b32004-08-20 13:37:45 +0000825 }
vlmcdf661b2004-08-22 12:47:03 +0000826 return 0;
vlm7d576b32004-08-20 13:37:45 +0000827}
828
829
830/*** <<< CODE [Str2] >>> ***/
831
832int
833Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
834 asn_app_consume_bytes_f *app_errlog, void *app_key) {
835
vlmb08de152004-08-22 03:30:05 +0000836 const Str1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000837 size_t size;
838
839 if(!sptr) {
840 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000841 "%s: value not given (%s:%d)",
842 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000843 return -1;
844 }
845
846 size = st->size;
847
848 if(((size <= 20) || (size >= 25 && size <= 30))
vlm7e20dfc2004-08-22 13:11:40 +0000849 && !check_permitted_alphabet_1(sptr)) {
vlm7d576b32004-08-20 13:37:45 +0000850 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000851 return 0;
vlm7d576b32004-08-20 13:37:45 +0000852 } else {
853 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000854 "%s: constraint failed (%s:%d)",
855 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000856 return -1;
857 }
858}
859
860/*
861 * This type is implemented using Str1,
862 * so adjust the DEF appropriately.
863 */
864static void
865Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
866 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
867 td->der_encoder = asn1_DEF_Str1.der_encoder;
868 td->free_struct = asn1_DEF_Str1.free_struct;
869 td->print_struct = asn1_DEF_Str1.print_struct;
870 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
871 td->elements = asn1_DEF_Str1.elements;
872 td->elements_count = asn1_DEF_Str1.elements_count;
873 td->specifics = asn1_DEF_Str1.specifics;
874}
875
876ber_dec_rval_t
877Str2_decode_ber(asn1_TYPE_descriptor_t *td,
878 void **structure, void *bufptr, size_t size, int tag_mode) {
879 Str2_inherit_TYPE_descriptor(td);
880 return td->ber_decoder(td, structure,
881 bufptr, size, tag_mode);
882}
883
884der_enc_rval_t
885Str2_encode_der(asn1_TYPE_descriptor_t *td,
886 void *structure, int tag_mode, ber_tlv_tag_t tag,
887 asn_app_consume_bytes_f *cb, void *app_key) {
888 Str2_inherit_TYPE_descriptor(td);
889 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
890}
891
892int
893Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
894 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
895 Str2_inherit_TYPE_descriptor(td);
896 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
897}
898
899void
900Str2_free(asn1_TYPE_descriptor_t *td,
901 void *struct_ptr, int contents_only) {
902 Str2_inherit_TYPE_descriptor(td);
903 td->free_struct(td, struct_ptr, contents_only);
904}
905
906
907/*** <<< STAT-DEFS [Str2] >>> ***/
908
909static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
910 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
911};
912asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
913 "Str2",
914 Str2_constraint,
915 Str2_decode_ber,
916 Str2_encode_der,
917 Str2_print,
918 Str2_free,
919 0, /* Use generic outmost tag fetcher */
920 asn1_DEF_Str2_tags,
921 sizeof(asn1_DEF_Str2_tags)
922 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
923 1, /* Tags to skip */
924 -0, /* Unknown yet */
925 0, 0, /* No members */
926 0 /* No specifics */
927};
928
929
930/*** <<< INCLUDES [Str3] >>> ***/
931
932#include <Str2.h>
933
934/*** <<< TYPE-DECLS [Str3] >>> ***/
935
936
937typedef Str2_t Str3_t;
938
vlm7d576b32004-08-20 13:37:45 +0000939/*** <<< FUNC-DECLS [Str3] >>> ***/
940
941extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
942asn_constr_check_f Str3_constraint;
943ber_type_decoder_f Str3_decode_ber;
944der_type_encoder_f Str3_encode_der;
945asn_struct_print_f Str3_print;
946asn_struct_free_f Str3_free;
947
948/*** <<< CTABLES [Str3] >>> ***/
949
950static int permitted_alphabet_table_2[256] = {
9510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9550,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9570,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
958};
959
960static int check_permitted_alphabet_2(const void *sptr) {
961 int *table = permitted_alphabet_table_2;
962 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000963 const IA5String_t *st = sptr;
964 const uint8_t *ch = st->buf;
965 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000966
967 for(; ch < end; ch++) {
968 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000969 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +0000970 }
vlmcdf661b2004-08-22 12:47:03 +0000971 return 0;
vlm7d576b32004-08-20 13:37:45 +0000972}
973
974
975/*** <<< CODE [Str3] >>> ***/
976
977int
978Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
979 asn_app_consume_bytes_f *app_errlog, void *app_key) {
980
vlmb08de152004-08-22 03:30:05 +0000981 const Str2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000982 size_t size;
983
984 if(!sptr) {
985 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000986 "%s: value not given (%s:%d)",
987 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000988 return -1;
989 }
990
991 size = st->size;
992
993 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
vlm7e20dfc2004-08-22 13:11:40 +0000994 && !check_permitted_alphabet_2(sptr)) {
vlm7d576b32004-08-20 13:37:45 +0000995 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000996 return 0;
vlm7d576b32004-08-20 13:37:45 +0000997 } else {
998 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000999 "%s: constraint failed (%s:%d)",
1000 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001001 return -1;
1002 }
1003}
1004
1005/*
1006 * This type is implemented using Str2,
1007 * so adjust the DEF appropriately.
1008 */
1009static void
1010Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1011 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1012 td->der_encoder = asn1_DEF_Str2.der_encoder;
1013 td->free_struct = asn1_DEF_Str2.free_struct;
1014 td->print_struct = asn1_DEF_Str2.print_struct;
1015 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1016 td->elements = asn1_DEF_Str2.elements;
1017 td->elements_count = asn1_DEF_Str2.elements_count;
1018 td->specifics = asn1_DEF_Str2.specifics;
1019}
1020
1021ber_dec_rval_t
1022Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1023 void **structure, void *bufptr, size_t size, int tag_mode) {
1024 Str3_inherit_TYPE_descriptor(td);
1025 return td->ber_decoder(td, structure,
1026 bufptr, size, tag_mode);
1027}
1028
1029der_enc_rval_t
1030Str3_encode_der(asn1_TYPE_descriptor_t *td,
1031 void *structure, int tag_mode, ber_tlv_tag_t tag,
1032 asn_app_consume_bytes_f *cb, void *app_key) {
1033 Str3_inherit_TYPE_descriptor(td);
1034 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1035}
1036
1037int
1038Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1039 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1040 Str3_inherit_TYPE_descriptor(td);
1041 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1042}
1043
1044void
1045Str3_free(asn1_TYPE_descriptor_t *td,
1046 void *struct_ptr, int contents_only) {
1047 Str3_inherit_TYPE_descriptor(td);
1048 td->free_struct(td, struct_ptr, contents_only);
1049}
1050
1051
1052/*** <<< STAT-DEFS [Str3] >>> ***/
1053
1054static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
1055 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1056};
1057asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1058 "Str3",
1059 Str3_constraint,
1060 Str3_decode_ber,
1061 Str3_encode_der,
1062 Str3_print,
1063 Str3_free,
1064 0, /* Use generic outmost tag fetcher */
1065 asn1_DEF_Str3_tags,
1066 sizeof(asn1_DEF_Str3_tags)
1067 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
1068 1, /* Tags to skip */
1069 -0, /* Unknown yet */
1070 0, 0, /* No members */
1071 0 /* No specifics */
1072};
1073
1074
1075/*** <<< INCLUDES [PER-Visible] >>> ***/
1076
1077#include <IA5String.h>
1078
1079/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1080
1081
1082typedef IA5String_t PER_Visible_t;
1083
vlm7d576b32004-08-20 13:37:45 +00001084/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1085
1086extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1087asn_constr_check_f PER_Visible_constraint;
1088ber_type_decoder_f PER_Visible_decode_ber;
1089der_type_encoder_f PER_Visible_encode_der;
1090asn_struct_print_f PER_Visible_print;
1091asn_struct_free_f PER_Visible_free;
1092
1093/*** <<< CTABLES [PER-Visible] >>> ***/
1094
1095static int check_permitted_alphabet_3(const void *sptr) {
1096 /* The underlying type is IA5String */
vlm4fdaead2004-08-21 07:34:17 +00001097 const IA5String_t *st = sptr;
vlmb08de152004-08-22 03:30:05 +00001098 const uint8_t *ch = st->buf;
1099 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001100
1101 for(; ch < end; ch++) {
1102 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001103 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001104 }
vlmcdf661b2004-08-22 12:47:03 +00001105 return 0;
vlm7d576b32004-08-20 13:37:45 +00001106}
1107
1108
1109/*** <<< CODE [PER-Visible] >>> ***/
1110
1111int
1112PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1113 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1114
vlmb08de152004-08-22 03:30:05 +00001115 const IA5String_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001116
1117 if(!sptr) {
1118 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001119 "%s: value not given (%s:%d)",
1120 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001121 return -1;
1122 }
1123
1124
vlm7e20dfc2004-08-22 13:11:40 +00001125 if(!check_permitted_alphabet_3(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001126 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001127 return 0;
vlm7d576b32004-08-20 13:37:45 +00001128 } else {
1129 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001130 "%s: constraint failed (%s:%d)",
1131 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001132 return -1;
1133 }
1134}
1135
1136/*
1137 * This type is implemented using IA5String,
1138 * so adjust the DEF appropriately.
1139 */
1140static void
1141PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1142 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1143 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1144 td->free_struct = asn1_DEF_IA5String.free_struct;
1145 td->print_struct = asn1_DEF_IA5String.print_struct;
1146 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1147 td->elements = asn1_DEF_IA5String.elements;
1148 td->elements_count = asn1_DEF_IA5String.elements_count;
1149 td->specifics = asn1_DEF_IA5String.specifics;
1150}
1151
1152ber_dec_rval_t
1153PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1154 void **structure, void *bufptr, size_t size, int tag_mode) {
1155 PER_Visible_inherit_TYPE_descriptor(td);
1156 return td->ber_decoder(td, structure,
1157 bufptr, size, tag_mode);
1158}
1159
1160der_enc_rval_t
1161PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1162 void *structure, int tag_mode, ber_tlv_tag_t tag,
1163 asn_app_consume_bytes_f *cb, void *app_key) {
1164 PER_Visible_inherit_TYPE_descriptor(td);
1165 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1166}
1167
1168int
1169PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1170 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1171 PER_Visible_inherit_TYPE_descriptor(td);
1172 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1173}
1174
1175void
1176PER_Visible_free(asn1_TYPE_descriptor_t *td,
1177 void *struct_ptr, int contents_only) {
1178 PER_Visible_inherit_TYPE_descriptor(td);
1179 td->free_struct(td, struct_ptr, contents_only);
1180}
1181
1182
1183/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1184
1185static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1186 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1187};
1188asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1189 "PER-Visible",
1190 PER_Visible_constraint,
1191 PER_Visible_decode_ber,
1192 PER_Visible_encode_der,
1193 PER_Visible_print,
1194 PER_Visible_free,
1195 0, /* Use generic outmost tag fetcher */
1196 asn1_DEF_PER_Visible_tags,
1197 sizeof(asn1_DEF_PER_Visible_tags)
1198 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
1199 1, /* Tags to skip */
1200 -0, /* Unknown yet */
1201 0, 0, /* No members */
1202 0 /* No specifics */
1203};
1204
1205
1206/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1207
1208#include <PER-Visible.h>
1209
1210/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1211
1212
1213typedef PER_Visible_t PER_Visible_2_t;
1214
vlm7d576b32004-08-20 13:37:45 +00001215/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1216
1217extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1218asn_constr_check_f PER_Visible_2_constraint;
1219ber_type_decoder_f PER_Visible_2_decode_ber;
1220der_type_encoder_f PER_Visible_2_encode_der;
1221asn_struct_print_f PER_Visible_2_print;
1222asn_struct_free_f PER_Visible_2_free;
1223
1224/*** <<< CTABLES [PER-Visible-2] >>> ***/
1225
1226static int check_permitted_alphabet_4(const void *sptr) {
1227 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001228 const IA5String_t *st = sptr;
1229 const uint8_t *ch = st->buf;
1230 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001231
1232 for(; ch < end; ch++) {
1233 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001234 if(!(cv >= 69 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001235 }
vlmcdf661b2004-08-22 12:47:03 +00001236 return 0;
vlm7d576b32004-08-20 13:37:45 +00001237}
1238
1239
1240/*** <<< CODE [PER-Visible-2] >>> ***/
1241
1242int
1243PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1244 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1245
vlmb08de152004-08-22 03:30:05 +00001246 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001247
1248 if(!sptr) {
1249 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001250 "%s: value not given (%s:%d)",
1251 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001252 return -1;
1253 }
1254
1255
vlm7e20dfc2004-08-22 13:11:40 +00001256 if(!check_permitted_alphabet_4(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001257 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001258 return 0;
vlm7d576b32004-08-20 13:37:45 +00001259 } else {
1260 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001261 "%s: constraint failed (%s:%d)",
1262 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001263 return -1;
1264 }
1265}
1266
1267/*
1268 * This type is implemented using PER_Visible,
1269 * so adjust the DEF appropriately.
1270 */
1271static void
1272PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1273 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1274 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1275 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1276 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1277 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1278 td->elements = asn1_DEF_PER_Visible.elements;
1279 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1280 td->specifics = asn1_DEF_PER_Visible.specifics;
1281}
1282
1283ber_dec_rval_t
1284PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1285 void **structure, void *bufptr, size_t size, int tag_mode) {
1286 PER_Visible_2_inherit_TYPE_descriptor(td);
1287 return td->ber_decoder(td, structure,
1288 bufptr, size, tag_mode);
1289}
1290
1291der_enc_rval_t
1292PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1293 void *structure, int tag_mode, ber_tlv_tag_t tag,
1294 asn_app_consume_bytes_f *cb, void *app_key) {
1295 PER_Visible_2_inherit_TYPE_descriptor(td);
1296 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1297}
1298
1299int
1300PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1301 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1302 PER_Visible_2_inherit_TYPE_descriptor(td);
1303 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1304}
1305
1306void
1307PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1308 void *struct_ptr, int contents_only) {
1309 PER_Visible_2_inherit_TYPE_descriptor(td);
1310 td->free_struct(td, struct_ptr, contents_only);
1311}
1312
1313
1314/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1315
1316static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
1317 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1318};
1319asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1320 "PER-Visible-2",
1321 PER_Visible_2_constraint,
1322 PER_Visible_2_decode_ber,
1323 PER_Visible_2_encode_der,
1324 PER_Visible_2_print,
1325 PER_Visible_2_free,
1326 0, /* Use generic outmost tag fetcher */
1327 asn1_DEF_PER_Visible_2_tags,
1328 sizeof(asn1_DEF_PER_Visible_2_tags)
1329 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
1330 1, /* Tags to skip */
1331 -0, /* Unknown yet */
1332 0, 0, /* No members */
1333 0 /* No specifics */
1334};
1335
1336
1337/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1338
1339#include <PER-Visible.h>
1340
1341/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1342
1343
1344typedef PER_Visible_t Not_PER_Visible_1_t;
1345
vlm7d576b32004-08-20 13:37:45 +00001346/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1347
1348extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1349asn_constr_check_f Not_PER_Visible_1_constraint;
1350ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1351der_type_encoder_f Not_PER_Visible_1_encode_der;
1352asn_struct_print_f Not_PER_Visible_1_print;
1353asn_struct_free_f Not_PER_Visible_1_free;
1354
1355/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1356
1357static int check_permitted_alphabet_5(const void *sptr) {
1358 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001359 const IA5String_t *st = sptr;
1360 const uint8_t *ch = st->buf;
1361 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001362
1363 for(; ch < end; ch++) {
1364 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001365 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001366 }
vlmcdf661b2004-08-22 12:47:03 +00001367 return 0;
vlm7d576b32004-08-20 13:37:45 +00001368}
1369
1370
1371/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1372
1373int
1374Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1375 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1376
vlmb08de152004-08-22 03:30:05 +00001377 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001378
1379 if(!sptr) {
1380 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001381 "%s: value not given (%s:%d)",
1382 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001383 return -1;
1384 }
1385
1386
vlm7e20dfc2004-08-22 13:11:40 +00001387 if(!check_permitted_alphabet_5(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001388 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001389 return 0;
vlm7d576b32004-08-20 13:37:45 +00001390 } else {
1391 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001392 "%s: constraint failed (%s:%d)",
1393 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001394 return -1;
1395 }
1396}
1397
1398/*
1399 * This type is implemented using PER_Visible,
1400 * so adjust the DEF appropriately.
1401 */
1402static void
1403Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1404 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1405 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1406 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1407 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1408 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1409 td->elements = asn1_DEF_PER_Visible.elements;
1410 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1411 td->specifics = asn1_DEF_PER_Visible.specifics;
1412}
1413
1414ber_dec_rval_t
1415Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1416 void **structure, void *bufptr, size_t size, int tag_mode) {
1417 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1418 return td->ber_decoder(td, structure,
1419 bufptr, size, tag_mode);
1420}
1421
1422der_enc_rval_t
1423Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1424 void *structure, int tag_mode, ber_tlv_tag_t tag,
1425 asn_app_consume_bytes_f *cb, void *app_key) {
1426 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1427 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1428}
1429
1430int
1431Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1432 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1433 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1434 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1435}
1436
1437void
1438Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1439 void *struct_ptr, int contents_only) {
1440 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1441 td->free_struct(td, struct_ptr, contents_only);
1442}
1443
1444
1445/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1446
1447static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
1448 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1449};
1450asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1451 "Not-PER-Visible-1",
1452 Not_PER_Visible_1_constraint,
1453 Not_PER_Visible_1_decode_ber,
1454 Not_PER_Visible_1_encode_der,
1455 Not_PER_Visible_1_print,
1456 Not_PER_Visible_1_free,
1457 0, /* Use generic outmost tag fetcher */
1458 asn1_DEF_Not_PER_Visible_1_tags,
1459 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1460 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1461 1, /* Tags to skip */
1462 -0, /* Unknown yet */
1463 0, 0, /* No members */
1464 0 /* No specifics */
1465};
1466
1467
1468/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1469
1470#include <PER-Visible.h>
1471
1472/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1473
1474
1475typedef PER_Visible_t Not_PER_Visible_2_t;
1476
vlm7d576b32004-08-20 13:37:45 +00001477/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1478
1479extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1480asn_constr_check_f Not_PER_Visible_2_constraint;
1481ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1482der_type_encoder_f Not_PER_Visible_2_encode_der;
1483asn_struct_print_f Not_PER_Visible_2_print;
1484asn_struct_free_f Not_PER_Visible_2_free;
1485
1486/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1487
1488int
1489Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1490 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1491
vlmb08de152004-08-22 03:30:05 +00001492 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001493
1494 if(!sptr) {
1495 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001496 "%s: value not given (%s:%d)",
1497 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001498 return -1;
1499 }
1500
1501
1502 if(1 /* No applicable constraints whatsoever */) {
1503 /* Nothing is here. See below */
1504 }
1505
1506 /* Make the underlying type checker permanent */
1507 td->check_constraints = asn1_DEF_PER_Visible.check_constraints;
1508 return td->check_constraints
1509 (td, sptr, app_errlog, app_key);
1510}
1511
1512/*
1513 * This type is implemented using PER_Visible,
1514 * so adjust the DEF appropriately.
1515 */
1516static void
1517Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1518 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1519 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1520 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1521 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1522 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1523 td->elements = asn1_DEF_PER_Visible.elements;
1524 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1525 td->specifics = asn1_DEF_PER_Visible.specifics;
1526}
1527
1528ber_dec_rval_t
1529Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1530 void **structure, void *bufptr, size_t size, int tag_mode) {
1531 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1532 return td->ber_decoder(td, structure,
1533 bufptr, size, tag_mode);
1534}
1535
1536der_enc_rval_t
1537Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1538 void *structure, int tag_mode, ber_tlv_tag_t tag,
1539 asn_app_consume_bytes_f *cb, void *app_key) {
1540 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1541 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1542}
1543
1544int
1545Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1546 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1547 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1548 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1549}
1550
1551void
1552Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1553 void *struct_ptr, int contents_only) {
1554 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1555 td->free_struct(td, struct_ptr, contents_only);
1556}
1557
1558
1559/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1560
1561static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
1562 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1563};
1564asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1565 "Not-PER-Visible-2",
1566 Not_PER_Visible_2_constraint,
1567 Not_PER_Visible_2_decode_ber,
1568 Not_PER_Visible_2_encode_der,
1569 Not_PER_Visible_2_print,
1570 Not_PER_Visible_2_free,
1571 0, /* Use generic outmost tag fetcher */
1572 asn1_DEF_Not_PER_Visible_2_tags,
1573 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1574 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1575 1, /* Tags to skip */
1576 -0, /* Unknown yet */
1577 0, 0, /* No members */
1578 0 /* No specifics */
1579};
1580
1581
1582/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1583
1584#include <PER-Visible.h>
1585
1586/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1587
1588
1589typedef PER_Visible_t Not_PER_Visible_3_t;
1590
vlm7d576b32004-08-20 13:37:45 +00001591/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1592
1593extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1594asn_constr_check_f Not_PER_Visible_3_constraint;
1595ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1596der_type_encoder_f Not_PER_Visible_3_encode_der;
1597asn_struct_print_f Not_PER_Visible_3_print;
1598asn_struct_free_f Not_PER_Visible_3_free;
1599
1600/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1601
1602int
1603Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1604 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1605
vlmb08de152004-08-22 03:30:05 +00001606 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001607
1608 if(!sptr) {
1609 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001610 "%s: value not given (%s:%d)",
1611 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001612 return -1;
1613 }
1614
1615
1616 if(1 /* No applicable constraints whatsoever */) {
1617 /* Nothing is here. See below */
1618 }
1619
1620 /* Make the underlying type checker permanent */
1621 td->check_constraints = asn1_DEF_PER_Visible.check_constraints;
1622 return td->check_constraints
1623 (td, sptr, app_errlog, app_key);
1624}
1625
1626/*
1627 * This type is implemented using PER_Visible,
1628 * so adjust the DEF appropriately.
1629 */
1630static void
1631Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1632 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1633 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1634 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1635 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1636 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1637 td->elements = asn1_DEF_PER_Visible.elements;
1638 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1639 td->specifics = asn1_DEF_PER_Visible.specifics;
1640}
1641
1642ber_dec_rval_t
1643Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1644 void **structure, void *bufptr, size_t size, int tag_mode) {
1645 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1646 return td->ber_decoder(td, structure,
1647 bufptr, size, tag_mode);
1648}
1649
1650der_enc_rval_t
1651Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1652 void *structure, int tag_mode, ber_tlv_tag_t tag,
1653 asn_app_consume_bytes_f *cb, void *app_key) {
1654 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1655 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1656}
1657
1658int
1659Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1660 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1661 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1662 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1663}
1664
1665void
1666Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1667 void *struct_ptr, int contents_only) {
1668 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1669 td->free_struct(td, struct_ptr, contents_only);
1670}
1671
1672
1673/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1674
1675static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
1676 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1677};
1678asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1679 "Not-PER-Visible-3",
1680 Not_PER_Visible_3_constraint,
1681 Not_PER_Visible_3_decode_ber,
1682 Not_PER_Visible_3_encode_der,
1683 Not_PER_Visible_3_print,
1684 Not_PER_Visible_3_free,
1685 0, /* Use generic outmost tag fetcher */
1686 asn1_DEF_Not_PER_Visible_3_tags,
1687 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1688 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1689 1, /* Tags to skip */
1690 -0, /* Unknown yet */
1691 0, 0, /* No members */
1692 0 /* No specifics */
1693};
1694
1695
1696/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1697
1698#include <PER-Visible.h>
1699
1700/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1701
1702
1703typedef PER_Visible_t SIZE_but_not_FROM_t;
1704
vlm7d576b32004-08-20 13:37:45 +00001705/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1706
1707extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1708asn_constr_check_f SIZE_but_not_FROM_constraint;
1709ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1710der_type_encoder_f SIZE_but_not_FROM_encode_der;
1711asn_struct_print_f SIZE_but_not_FROM_print;
1712asn_struct_free_f SIZE_but_not_FROM_free;
1713
1714/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1715
1716static int check_permitted_alphabet_6(const void *sptr) {
1717 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001718 const IA5String_t *st = sptr;
1719 const uint8_t *ch = st->buf;
1720 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001721
1722 for(; ch < end; ch++) {
1723 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001724 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001725 }
vlmcdf661b2004-08-22 12:47:03 +00001726 return 0;
vlm7d576b32004-08-20 13:37:45 +00001727}
1728
1729
1730/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1731
1732int
1733SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1734 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1735
vlmb08de152004-08-22 03:30:05 +00001736 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001737 size_t size;
1738
1739 if(!sptr) {
1740 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001741 "%s: value not given (%s:%d)",
1742 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001743 return -1;
1744 }
1745
1746 size = st->size;
1747
1748 if((size >= 1 && size <= 4)
vlm7e20dfc2004-08-22 13:11:40 +00001749 && !check_permitted_alphabet_6(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001750 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001751 return 0;
vlm7d576b32004-08-20 13:37:45 +00001752 } else {
1753 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001754 "%s: constraint failed (%s:%d)",
1755 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001756 return -1;
1757 }
1758}
1759
1760/*
1761 * This type is implemented using PER_Visible,
1762 * so adjust the DEF appropriately.
1763 */
1764static void
1765SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1766 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1767 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1768 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1769 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1770 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1771 td->elements = asn1_DEF_PER_Visible.elements;
1772 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1773 td->specifics = asn1_DEF_PER_Visible.specifics;
1774}
1775
1776ber_dec_rval_t
1777SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1778 void **structure, void *bufptr, size_t size, int tag_mode) {
1779 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1780 return td->ber_decoder(td, structure,
1781 bufptr, size, tag_mode);
1782}
1783
1784der_enc_rval_t
1785SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1786 void *structure, int tag_mode, ber_tlv_tag_t tag,
1787 asn_app_consume_bytes_f *cb, void *app_key) {
1788 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1789 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1790}
1791
1792int
1793SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1794 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1795 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1796 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1797}
1798
1799void
1800SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1801 void *struct_ptr, int contents_only) {
1802 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1803 td->free_struct(td, struct_ptr, contents_only);
1804}
1805
1806
1807/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1808
1809static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
1810 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1811};
1812asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
1813 "SIZE-but-not-FROM",
1814 SIZE_but_not_FROM_constraint,
1815 SIZE_but_not_FROM_decode_ber,
1816 SIZE_but_not_FROM_encode_der,
1817 SIZE_but_not_FROM_print,
1818 SIZE_but_not_FROM_free,
1819 0, /* Use generic outmost tag fetcher */
1820 asn1_DEF_SIZE_but_not_FROM_tags,
1821 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
1822 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
1823 1, /* Tags to skip */
1824 -0, /* Unknown yet */
1825 0, 0, /* No members */
1826 0 /* No specifics */
1827};
1828
1829
1830/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
1831
1832#include <PER-Visible.h>
1833
1834/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
1835
1836
1837typedef PER_Visible_t SIZE_and_FROM_t;
1838
vlm7d576b32004-08-20 13:37:45 +00001839/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
1840
1841extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
1842asn_constr_check_f SIZE_and_FROM_constraint;
1843ber_type_decoder_f SIZE_and_FROM_decode_ber;
1844der_type_encoder_f SIZE_and_FROM_encode_der;
1845asn_struct_print_f SIZE_and_FROM_print;
1846asn_struct_free_f SIZE_and_FROM_free;
1847
1848/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
1849
1850static int check_permitted_alphabet_7(const void *sptr) {
1851 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001852 const IA5String_t *st = sptr;
1853 const uint8_t *ch = st->buf;
1854 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001855
1856 for(; ch < end; ch++) {
1857 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001858 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001859 }
vlmcdf661b2004-08-22 12:47:03 +00001860 return 0;
vlm7d576b32004-08-20 13:37:45 +00001861}
1862
1863
1864/*** <<< CODE [SIZE-and-FROM] >>> ***/
1865
1866int
1867SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1868 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1869
vlmb08de152004-08-22 03:30:05 +00001870 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001871 size_t size;
1872
1873 if(!sptr) {
1874 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001875 "%s: value not given (%s:%d)",
1876 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001877 return -1;
1878 }
1879
1880 size = st->size;
1881
1882 if((size >= 1 && size <= 4)
vlm7e20dfc2004-08-22 13:11:40 +00001883 && !check_permitted_alphabet_7(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001884 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001885 return 0;
vlm7d576b32004-08-20 13:37:45 +00001886 } else {
1887 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001888 "%s: constraint failed (%s:%d)",
1889 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001890 return -1;
1891 }
1892}
1893
1894/*
1895 * This type is implemented using PER_Visible,
1896 * so adjust the DEF appropriately.
1897 */
1898static void
1899SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1900 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1901 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1902 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1903 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1904 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1905 td->elements = asn1_DEF_PER_Visible.elements;
1906 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1907 td->specifics = asn1_DEF_PER_Visible.specifics;
1908}
1909
1910ber_dec_rval_t
1911SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1912 void **structure, void *bufptr, size_t size, int tag_mode) {
1913 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1914 return td->ber_decoder(td, structure,
1915 bufptr, size, tag_mode);
1916}
1917
1918der_enc_rval_t
1919SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1920 void *structure, int tag_mode, ber_tlv_tag_t tag,
1921 asn_app_consume_bytes_f *cb, void *app_key) {
1922 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1923 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1924}
1925
1926int
1927SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1928 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1929 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1930 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1931}
1932
1933void
1934SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
1935 void *struct_ptr, int contents_only) {
1936 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1937 td->free_struct(td, struct_ptr, contents_only);
1938}
1939
1940
1941/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
1942
1943static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
1944 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1945};
1946asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
1947 "SIZE-and-FROM",
1948 SIZE_and_FROM_constraint,
1949 SIZE_and_FROM_decode_ber,
1950 SIZE_and_FROM_encode_der,
1951 SIZE_and_FROM_print,
1952 SIZE_and_FROM_free,
1953 0, /* Use generic outmost tag fetcher */
1954 asn1_DEF_SIZE_and_FROM_tags,
1955 sizeof(asn1_DEF_SIZE_and_FROM_tags)
1956 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
1957 1, /* Tags to skip */
1958 -0, /* Unknown yet */
1959 0, 0, /* No members */
1960 0 /* No specifics */
1961};
1962
1963
1964/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
1965
1966#include <PER-Visible.h>
1967
1968/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
1969
1970
1971typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
1972
vlm7d576b32004-08-20 13:37:45 +00001973/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
1974
1975extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
1976asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
1977ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
1978der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
1979asn_struct_print_f Neither_SIZE_nor_FROM_print;
1980asn_struct_free_f Neither_SIZE_nor_FROM_free;
1981
1982/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
1983
1984static int check_permitted_alphabet_8(const void *sptr) {
1985 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001986 const IA5String_t *st = sptr;
1987 const uint8_t *ch = st->buf;
1988 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001989
1990 for(; ch < end; ch++) {
1991 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001992 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001993 }
vlmcdf661b2004-08-22 12:47:03 +00001994 return 0;
vlm7d576b32004-08-20 13:37:45 +00001995}
1996
1997
1998/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
1999
2000int
2001Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2002 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2003
vlmb08de152004-08-22 03:30:05 +00002004 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002005
2006 if(!sptr) {
2007 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002008 "%s: value not given (%s:%d)",
2009 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002010 return -1;
2011 }
2012
2013
vlm7e20dfc2004-08-22 13:11:40 +00002014 if(!check_permitted_alphabet_8(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002015 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002016 return 0;
vlm7d576b32004-08-20 13:37:45 +00002017 } else {
2018 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002019 "%s: constraint failed (%s:%d)",
2020 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002021 return -1;
2022 }
2023}
2024
2025/*
2026 * This type is implemented using PER_Visible,
2027 * so adjust the DEF appropriately.
2028 */
2029static void
2030Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2031 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2032 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2033 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2034 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2035 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2036 td->elements = asn1_DEF_PER_Visible.elements;
2037 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2038 td->specifics = asn1_DEF_PER_Visible.specifics;
2039}
2040
2041ber_dec_rval_t
2042Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2043 void **structure, void *bufptr, size_t size, int tag_mode) {
2044 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2045 return td->ber_decoder(td, structure,
2046 bufptr, size, tag_mode);
2047}
2048
2049der_enc_rval_t
2050Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2051 void *structure, int tag_mode, ber_tlv_tag_t tag,
2052 asn_app_consume_bytes_f *cb, void *app_key) {
2053 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2054 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2055}
2056
2057int
2058Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2059 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2060 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2061 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2062}
2063
2064void
2065Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2066 void *struct_ptr, int contents_only) {
2067 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2068 td->free_struct(td, struct_ptr, contents_only);
2069}
2070
2071
2072/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2073
2074static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
2075 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2076};
2077asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2078 "Neither-SIZE-nor-FROM",
2079 Neither_SIZE_nor_FROM_constraint,
2080 Neither_SIZE_nor_FROM_decode_ber,
2081 Neither_SIZE_nor_FROM_encode_der,
2082 Neither_SIZE_nor_FROM_print,
2083 Neither_SIZE_nor_FROM_free,
2084 0, /* Use generic outmost tag fetcher */
2085 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2086 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2087 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2088 1, /* Tags to skip */
2089 -0, /* Unknown yet */
2090 0, 0, /* No members */
2091 0 /* No specifics */
2092};
2093
2094
2095/*** <<< INCLUDES [Utf8-3] >>> ***/
2096
2097#include <Utf8-2.h>
2098
2099/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2100
2101
2102typedef Utf8_2_t Utf8_3_t;
2103
vlm7d576b32004-08-20 13:37:45 +00002104/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2105
2106extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2107asn_constr_check_f Utf8_3_constraint;
2108ber_type_decoder_f Utf8_3_decode_ber;
2109der_type_encoder_f Utf8_3_encode_der;
2110asn_struct_print_f Utf8_3_print;
2111asn_struct_free_f Utf8_3_free;
2112
2113/*** <<< CTABLES [Utf8-3] >>> ***/
2114
2115static int permitted_alphabet_table_9[128] = {
21160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21200,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
21211,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
21220,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
21231,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2124};
2125
2126static int check_permitted_alphabet_9(const void *sptr) {
2127 int *table = permitted_alphabet_table_9;
2128 /* The underlying type is UTF8String */
vlmb08de152004-08-22 03:30:05 +00002129 const UTF8String_t *st = sptr;
2130 const uint8_t *ch = st->buf;
2131 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002132
2133 for(; ch < end; ch++) {
2134 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002135 if(cv >= 0x80) return -1;
2136 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +00002137 }
vlmcdf661b2004-08-22 12:47:03 +00002138 return 0;
vlm7d576b32004-08-20 13:37:45 +00002139}
2140
2141
2142/*** <<< CODE [Utf8-3] >>> ***/
2143
2144int
2145Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2146 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2147
vlmb08de152004-08-22 03:30:05 +00002148 const Utf8_2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002149 size_t size;
2150
2151 if(!sptr) {
2152 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002153 "%s: value not given (%s:%d)",
2154 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002155 return -1;
2156 }
2157
2158 size = UTF8String_length(st, td->name, app_errlog, app_key);
2159 if(size == (size_t)-1) return -1;
2160
2161 if((size >= 1 && size <= 2)
vlm7e20dfc2004-08-22 13:11:40 +00002162 && !check_permitted_alphabet_9(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002163 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002164 return 0;
vlm7d576b32004-08-20 13:37:45 +00002165 } else {
2166 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002167 "%s: constraint failed (%s:%d)",
2168 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002169 return -1;
2170 }
2171}
2172
2173/*
2174 * This type is implemented using Utf8_2,
2175 * so adjust the DEF appropriately.
2176 */
2177static void
2178Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2179 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2180 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2181 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2182 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2183 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2184 td->elements = asn1_DEF_Utf8_2.elements;
2185 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2186 td->specifics = asn1_DEF_Utf8_2.specifics;
2187}
2188
2189ber_dec_rval_t
2190Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2191 void **structure, void *bufptr, size_t size, int tag_mode) {
2192 Utf8_3_inherit_TYPE_descriptor(td);
2193 return td->ber_decoder(td, structure,
2194 bufptr, size, tag_mode);
2195}
2196
2197der_enc_rval_t
2198Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2199 void *structure, int tag_mode, ber_tlv_tag_t tag,
2200 asn_app_consume_bytes_f *cb, void *app_key) {
2201 Utf8_3_inherit_TYPE_descriptor(td);
2202 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2203}
2204
2205int
2206Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2207 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2208 Utf8_3_inherit_TYPE_descriptor(td);
2209 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2210}
2211
2212void
2213Utf8_3_free(asn1_TYPE_descriptor_t *td,
2214 void *struct_ptr, int contents_only) {
2215 Utf8_3_inherit_TYPE_descriptor(td);
2216 td->free_struct(td, struct_ptr, contents_only);
2217}
2218
2219
2220/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2221
2222static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
2223 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2224};
2225asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2226 "Utf8-3",
2227 Utf8_3_constraint,
2228 Utf8_3_decode_ber,
2229 Utf8_3_encode_der,
2230 Utf8_3_print,
2231 Utf8_3_free,
2232 0, /* Use generic outmost tag fetcher */
2233 asn1_DEF_Utf8_3_tags,
2234 sizeof(asn1_DEF_Utf8_3_tags)
2235 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
2236 1, /* Tags to skip */
2237 -0, /* Unknown yet */
2238 0, 0, /* No members */
2239 0 /* No specifics */
2240};
2241
2242
2243/*** <<< INCLUDES [Utf8-2] >>> ***/
2244
2245#include <Utf8-1.h>
2246
2247/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2248
2249
2250typedef Utf8_1_t Utf8_2_t;
2251
vlm7d576b32004-08-20 13:37:45 +00002252/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2253
2254extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2255asn_constr_check_f Utf8_2_constraint;
2256ber_type_decoder_f Utf8_2_decode_ber;
2257der_type_encoder_f Utf8_2_encode_der;
2258asn_struct_print_f Utf8_2_print;
2259asn_struct_free_f Utf8_2_free;
2260
2261/*** <<< CODE [Utf8-2] >>> ***/
2262
2263int
2264Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2265 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2266
vlmb08de152004-08-22 03:30:05 +00002267 const Utf8_1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002268 size_t size;
2269
2270 if(!sptr) {
2271 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002272 "%s: value not given (%s:%d)",
2273 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002274 return -1;
2275 }
2276
2277 size = UTF8String_length(st, td->name, app_errlog, app_key);
2278 if(size == (size_t)-1) return -1;
2279
2280 if((size >= 1 && size <= 2)) {
2281 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002282 return 0;
vlm7d576b32004-08-20 13:37:45 +00002283 } else {
2284 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002285 "%s: constraint failed (%s:%d)",
2286 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002287 return -1;
2288 }
2289}
2290
2291/*
2292 * This type is implemented using Utf8_1,
2293 * so adjust the DEF appropriately.
2294 */
2295static void
2296Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2297 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2298 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2299 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2300 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2301 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2302 td->elements = asn1_DEF_Utf8_1.elements;
2303 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2304 td->specifics = asn1_DEF_Utf8_1.specifics;
2305}
2306
2307ber_dec_rval_t
2308Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2309 void **structure, void *bufptr, size_t size, int tag_mode) {
2310 Utf8_2_inherit_TYPE_descriptor(td);
2311 return td->ber_decoder(td, structure,
2312 bufptr, size, tag_mode);
2313}
2314
2315der_enc_rval_t
2316Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2317 void *structure, int tag_mode, ber_tlv_tag_t tag,
2318 asn_app_consume_bytes_f *cb, void *app_key) {
2319 Utf8_2_inherit_TYPE_descriptor(td);
2320 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2321}
2322
2323int
2324Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2325 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2326 Utf8_2_inherit_TYPE_descriptor(td);
2327 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2328}
2329
2330void
2331Utf8_2_free(asn1_TYPE_descriptor_t *td,
2332 void *struct_ptr, int contents_only) {
2333 Utf8_2_inherit_TYPE_descriptor(td);
2334 td->free_struct(td, struct_ptr, contents_only);
2335}
2336
2337
2338/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2339
2340static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
2341 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2342};
2343asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2344 "Utf8-2",
2345 Utf8_2_constraint,
2346 Utf8_2_decode_ber,
2347 Utf8_2_encode_der,
2348 Utf8_2_print,
2349 Utf8_2_free,
2350 0, /* Use generic outmost tag fetcher */
2351 asn1_DEF_Utf8_2_tags,
2352 sizeof(asn1_DEF_Utf8_2_tags)
2353 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
2354 1, /* Tags to skip */
2355 -0, /* Unknown yet */
2356 0, 0, /* No members */
2357 0 /* No specifics */
2358};
2359
2360
2361/*** <<< INCLUDES [Utf8-1] >>> ***/
2362
2363#include <UTF8String.h>
2364
2365/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2366
2367
2368typedef UTF8String_t Utf8_1_t;
2369
vlm7d576b32004-08-20 13:37:45 +00002370/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2371
2372extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2373asn_constr_check_f Utf8_1_constraint;
2374ber_type_decoder_f Utf8_1_decode_ber;
2375der_type_encoder_f Utf8_1_encode_der;
2376asn_struct_print_f Utf8_1_print;
2377asn_struct_free_f Utf8_1_free;
2378
2379/*** <<< CODE [Utf8-1] >>> ***/
2380
2381int
2382Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2383 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2384
2385 /* Make the underlying type checker permanent */
2386 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2387 return td->check_constraints
2388 (td, sptr, app_errlog, app_key);
2389}
2390
2391/*
2392 * This type is implemented using UTF8String,
2393 * so adjust the DEF appropriately.
2394 */
2395static void
2396Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2397 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2398 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2399 td->free_struct = asn1_DEF_UTF8String.free_struct;
2400 td->print_struct = asn1_DEF_UTF8String.print_struct;
2401 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2402 td->elements = asn1_DEF_UTF8String.elements;
2403 td->elements_count = asn1_DEF_UTF8String.elements_count;
2404 td->specifics = asn1_DEF_UTF8String.specifics;
2405}
2406
2407ber_dec_rval_t
2408Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2409 void **structure, void *bufptr, size_t size, int tag_mode) {
2410 Utf8_1_inherit_TYPE_descriptor(td);
2411 return td->ber_decoder(td, structure,
2412 bufptr, size, tag_mode);
2413}
2414
2415der_enc_rval_t
2416Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2417 void *structure, int tag_mode, ber_tlv_tag_t tag,
2418 asn_app_consume_bytes_f *cb, void *app_key) {
2419 Utf8_1_inherit_TYPE_descriptor(td);
2420 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2421}
2422
2423int
2424Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2425 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2426 Utf8_1_inherit_TYPE_descriptor(td);
2427 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2428}
2429
2430void
2431Utf8_1_free(asn1_TYPE_descriptor_t *td,
2432 void *struct_ptr, int contents_only) {
2433 Utf8_1_inherit_TYPE_descriptor(td);
2434 td->free_struct(td, struct_ptr, contents_only);
2435}
2436
2437
2438/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2439
2440static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2441 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2442};
2443asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2444 "Utf8-1",
2445 Utf8_1_constraint,
2446 Utf8_1_decode_ber,
2447 Utf8_1_encode_der,
2448 Utf8_1_print,
2449 Utf8_1_free,
2450 0, /* Use generic outmost tag fetcher */
2451 asn1_DEF_Utf8_1_tags,
2452 sizeof(asn1_DEF_Utf8_1_tags)
2453 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
2454 1, /* Tags to skip */
2455 -0, /* Unknown yet */
2456 0, 0, /* No members */
2457 0 /* No specifics */
2458};
2459