blob: 591ce0f90596f7c27402a40fe9ba02b61c89bbaf [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;
vlm26afd202004-08-25 02:08:08 +0000371 long value;
vlm7d576b32004-08-20 13:37:45 +0000372
373 if(!sptr) {
374 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000375 "%s: value not given (%s:%d)",
376 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000377 return -1;
378 }
379
vlm26afd202004-08-25 02:08:08 +0000380 if(asn1_INTEGER2long(st, &value)) {
381 _ASN_ERRLOG(app_errlog, app_key,
382 "%s: value too large (%s:%d)",
383 td->name, __FILE__, __LINE__);
384 return -1;
vlm7d576b32004-08-20 13:37:45 +0000385 }
386
vlm26afd202004-08-25 02:08:08 +0000387 if((value >= 1 && value <= 10)) {
388 /* Constraint check succeeded */
389 return 0;
390 } else {
391 _ASN_ERRLOG(app_errlog, app_key,
392 "%s: constraint failed (%s:%d)",
393 td->name, __FILE__, __LINE__);
394 return -1;
395 }
vlm7d576b32004-08-20 13:37:45 +0000396}
397
398/*
399 * This type is implemented using Int3,
400 * so adjust the DEF appropriately.
401 */
402static void
403Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
404 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
405 td->der_encoder = asn1_DEF_Int3.der_encoder;
406 td->free_struct = asn1_DEF_Int3.free_struct;
407 td->print_struct = asn1_DEF_Int3.print_struct;
408 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
409 td->elements = asn1_DEF_Int3.elements;
410 td->elements_count = asn1_DEF_Int3.elements_count;
411 td->specifics = asn1_DEF_Int3.specifics;
412}
413
414ber_dec_rval_t
415Int4_decode_ber(asn1_TYPE_descriptor_t *td,
416 void **structure, void *bufptr, size_t size, int tag_mode) {
417 Int4_inherit_TYPE_descriptor(td);
418 return td->ber_decoder(td, structure,
419 bufptr, size, tag_mode);
420}
421
422der_enc_rval_t
423Int4_encode_der(asn1_TYPE_descriptor_t *td,
424 void *structure, int tag_mode, ber_tlv_tag_t tag,
425 asn_app_consume_bytes_f *cb, void *app_key) {
426 Int4_inherit_TYPE_descriptor(td);
427 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
428}
429
430int
431Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
432 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
433 Int4_inherit_TYPE_descriptor(td);
434 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
435}
436
437void
438Int4_free(asn1_TYPE_descriptor_t *td,
439 void *struct_ptr, int contents_only) {
440 Int4_inherit_TYPE_descriptor(td);
441 td->free_struct(td, struct_ptr, contents_only);
442}
443
444
445/*** <<< STAT-DEFS [Int4] >>> ***/
446
447static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
448 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
449};
450asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
451 "Int4",
452 Int4_constraint,
453 Int4_decode_ber,
454 Int4_encode_der,
455 Int4_print,
456 Int4_free,
457 0, /* Use generic outmost tag fetcher */
458 asn1_DEF_Int4_tags,
459 sizeof(asn1_DEF_Int4_tags)
460 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
461 1, /* Tags to skip */
462 -0, /* Unknown yet */
463 0, 0, /* No members */
464 0 /* No specifics */
465};
466
467
468/*** <<< INCLUDES [Int5] >>> ***/
469
470#include <Int4.h>
471
472/*** <<< TYPE-DECLS [Int5] >>> ***/
473
474
475typedef Int4_t Int5_t;
476
vlm7d576b32004-08-20 13:37:45 +0000477/*** <<< FUNC-DECLS [Int5] >>> ***/
478
479extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
480asn_constr_check_f Int5_constraint;
481ber_type_decoder_f Int5_decode_ber;
482der_type_encoder_f Int5_encode_der;
483asn_struct_print_f Int5_print;
484asn_struct_free_f Int5_free;
485
486/*** <<< CODE [Int5] >>> ***/
487
488int
489Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
490 asn_app_consume_bytes_f *app_errlog, void *app_key) {
491
vlmb08de152004-08-22 03:30:05 +0000492 const Int4_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000493 long value;
494
495 if(!sptr) {
496 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000497 "%s: value not given (%s:%d)",
498 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000499 return -1;
500 }
501
502 if(asn1_INTEGER2long(st, &value)) {
503 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000504 "%s: value too large (%s:%d)",
505 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000506 return -1;
507 }
508
509 if((value == 5)) {
510 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000511 return 0;
vlm7d576b32004-08-20 13:37:45 +0000512 } else {
513 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000514 "%s: constraint failed (%s:%d)",
515 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000516 return -1;
517 }
518}
519
520/*
521 * This type is implemented using Int4,
522 * so adjust the DEF appropriately.
523 */
524static void
525Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
526 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
527 td->der_encoder = asn1_DEF_Int4.der_encoder;
528 td->free_struct = asn1_DEF_Int4.free_struct;
529 td->print_struct = asn1_DEF_Int4.print_struct;
530 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
531 td->elements = asn1_DEF_Int4.elements;
532 td->elements_count = asn1_DEF_Int4.elements_count;
533 td->specifics = asn1_DEF_Int4.specifics;
534}
535
536ber_dec_rval_t
537Int5_decode_ber(asn1_TYPE_descriptor_t *td,
538 void **structure, void *bufptr, size_t size, int tag_mode) {
539 Int5_inherit_TYPE_descriptor(td);
540 return td->ber_decoder(td, structure,
541 bufptr, size, tag_mode);
542}
543
544der_enc_rval_t
545Int5_encode_der(asn1_TYPE_descriptor_t *td,
546 void *structure, int tag_mode, ber_tlv_tag_t tag,
547 asn_app_consume_bytes_f *cb, void *app_key) {
548 Int5_inherit_TYPE_descriptor(td);
549 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
550}
551
552int
553Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
554 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
555 Int5_inherit_TYPE_descriptor(td);
556 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
557}
558
559void
560Int5_free(asn1_TYPE_descriptor_t *td,
561 void *struct_ptr, int contents_only) {
562 Int5_inherit_TYPE_descriptor(td);
563 td->free_struct(td, struct_ptr, contents_only);
564}
565
566
567/*** <<< STAT-DEFS [Int5] >>> ***/
568
569static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
570 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
571};
572asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
573 "Int5",
574 Int5_constraint,
575 Int5_decode_ber,
576 Int5_encode_der,
577 Int5_print,
578 Int5_free,
579 0, /* Use generic outmost tag fetcher */
580 asn1_DEF_Int5_tags,
581 sizeof(asn1_DEF_Int5_tags)
582 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
583 1, /* Tags to skip */
584 -0, /* Unknown yet */
585 0, 0, /* No members */
586 0 /* No specifics */
587};
588
589
590/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
591
592#include <INTEGER.h>
593
594/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
595
596
597typedef INTEGER_t ExtensibleExtensions_t;
598
vlm7d576b32004-08-20 13:37:45 +0000599/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
600
601extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
602asn_constr_check_f ExtensibleExtensions_constraint;
603ber_type_decoder_f ExtensibleExtensions_decode_ber;
604der_type_encoder_f ExtensibleExtensions_encode_der;
605asn_struct_print_f ExtensibleExtensions_print;
606asn_struct_free_f ExtensibleExtensions_free;
607
608/*** <<< CODE [ExtensibleExtensions] >>> ***/
609
610int
611ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
612 asn_app_consume_bytes_f *app_errlog, void *app_key) {
613
vlmb08de152004-08-22 03:30:05 +0000614 const INTEGER_t *st = sptr;
vlm26afd202004-08-25 02:08:08 +0000615 long value;
vlm7d576b32004-08-20 13:37:45 +0000616
617 if(!sptr) {
618 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000619 "%s: value not given (%s:%d)",
620 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000621 return -1;
622 }
623
vlm26afd202004-08-25 02:08:08 +0000624 if(asn1_INTEGER2long(st, &value)) {
625 _ASN_ERRLOG(app_errlog, app_key,
626 "%s: value too large (%s:%d)",
627 td->name, __FILE__, __LINE__);
628 return -1;
vlm7d576b32004-08-20 13:37:45 +0000629 }
630
vlm26afd202004-08-25 02:08:08 +0000631 if((value >= 1 && value <= 256)) {
632 /* Constraint check succeeded */
633 return 0;
634 } else {
635 _ASN_ERRLOG(app_errlog, app_key,
636 "%s: constraint failed (%s:%d)",
637 td->name, __FILE__, __LINE__);
638 return -1;
639 }
vlm7d576b32004-08-20 13:37:45 +0000640}
641
642/*
643 * This type is implemented using INTEGER,
644 * so adjust the DEF appropriately.
645 */
646static void
647ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
648 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
649 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
650 td->free_struct = asn1_DEF_INTEGER.free_struct;
651 td->print_struct = asn1_DEF_INTEGER.print_struct;
652 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
653 td->elements = asn1_DEF_INTEGER.elements;
654 td->elements_count = asn1_DEF_INTEGER.elements_count;
655 td->specifics = asn1_DEF_INTEGER.specifics;
656}
657
658ber_dec_rval_t
659ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
660 void **structure, void *bufptr, size_t size, int tag_mode) {
661 ExtensibleExtensions_inherit_TYPE_descriptor(td);
662 return td->ber_decoder(td, structure,
663 bufptr, size, tag_mode);
664}
665
666der_enc_rval_t
667ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
668 void *structure, int tag_mode, ber_tlv_tag_t tag,
669 asn_app_consume_bytes_f *cb, void *app_key) {
670 ExtensibleExtensions_inherit_TYPE_descriptor(td);
671 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
672}
673
674int
675ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
676 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
677 ExtensibleExtensions_inherit_TYPE_descriptor(td);
678 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
679}
680
681void
682ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
683 void *struct_ptr, int contents_only) {
684 ExtensibleExtensions_inherit_TYPE_descriptor(td);
685 td->free_struct(td, struct_ptr, contents_only);
686}
687
688
689/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
690
691static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
692 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
693};
694asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
695 "ExtensibleExtensions",
696 ExtensibleExtensions_constraint,
697 ExtensibleExtensions_decode_ber,
698 ExtensibleExtensions_encode_der,
699 ExtensibleExtensions_print,
700 ExtensibleExtensions_free,
701 0, /* Use generic outmost tag fetcher */
702 asn1_DEF_ExtensibleExtensions_tags,
703 sizeof(asn1_DEF_ExtensibleExtensions_tags)
704 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
705 1, /* Tags to skip */
706 -0, /* Unknown yet */
707 0, 0, /* No members */
708 0 /* No specifics */
709};
710
711
712/*** <<< INCLUDES [Str1] >>> ***/
713
714#include <IA5String.h>
715
716/*** <<< TYPE-DECLS [Str1] >>> ***/
717
718
719typedef IA5String_t Str1_t;
720
vlm7d576b32004-08-20 13:37:45 +0000721/*** <<< FUNC-DECLS [Str1] >>> ***/
722
723extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
724asn_constr_check_f Str1_constraint;
725ber_type_decoder_f Str1_decode_ber;
726der_type_encoder_f Str1_encode_der;
727asn_struct_print_f Str1_print;
728asn_struct_free_f Str1_free;
729
730/*** <<< CODE [Str1] >>> ***/
731
732int
733Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
734 asn_app_consume_bytes_f *app_errlog, void *app_key) {
735
736 /* Make the underlying type checker permanent */
737 td->check_constraints = asn1_DEF_IA5String.check_constraints;
738 return td->check_constraints
739 (td, sptr, app_errlog, app_key);
740}
741
742/*
743 * This type is implemented using IA5String,
744 * so adjust the DEF appropriately.
745 */
746static void
747Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
748 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
749 td->der_encoder = asn1_DEF_IA5String.der_encoder;
750 td->free_struct = asn1_DEF_IA5String.free_struct;
751 td->print_struct = asn1_DEF_IA5String.print_struct;
752 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
753 td->elements = asn1_DEF_IA5String.elements;
754 td->elements_count = asn1_DEF_IA5String.elements_count;
755 td->specifics = asn1_DEF_IA5String.specifics;
756}
757
758ber_dec_rval_t
759Str1_decode_ber(asn1_TYPE_descriptor_t *td,
760 void **structure, void *bufptr, size_t size, int tag_mode) {
761 Str1_inherit_TYPE_descriptor(td);
762 return td->ber_decoder(td, structure,
763 bufptr, size, tag_mode);
764}
765
766der_enc_rval_t
767Str1_encode_der(asn1_TYPE_descriptor_t *td,
768 void *structure, int tag_mode, ber_tlv_tag_t tag,
769 asn_app_consume_bytes_f *cb, void *app_key) {
770 Str1_inherit_TYPE_descriptor(td);
771 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
772}
773
774int
775Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
776 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
777 Str1_inherit_TYPE_descriptor(td);
778 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
779}
780
781void
782Str1_free(asn1_TYPE_descriptor_t *td,
783 void *struct_ptr, int contents_only) {
784 Str1_inherit_TYPE_descriptor(td);
785 td->free_struct(td, struct_ptr, contents_only);
786}
787
788
789/*** <<< STAT-DEFS [Str1] >>> ***/
790
791static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
792 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
793};
794asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
795 "Str1",
796 Str1_constraint,
797 Str1_decode_ber,
798 Str1_encode_der,
799 Str1_print,
800 Str1_free,
801 0, /* Use generic outmost tag fetcher */
802 asn1_DEF_Str1_tags,
803 sizeof(asn1_DEF_Str1_tags)
804 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
805 1, /* Tags to skip */
806 -0, /* Unknown yet */
807 0, 0, /* No members */
808 0 /* No specifics */
809};
810
811
812/*** <<< INCLUDES [Str2] >>> ***/
813
814#include <Str1.h>
815
816/*** <<< TYPE-DECLS [Str2] >>> ***/
817
818
819typedef Str1_t Str2_t;
820
vlm7d576b32004-08-20 13:37:45 +0000821/*** <<< FUNC-DECLS [Str2] >>> ***/
822
823extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
824asn_constr_check_f Str2_constraint;
825ber_type_decoder_f Str2_decode_ber;
826der_type_encoder_f Str2_encode_der;
827asn_struct_print_f Str2_print;
828asn_struct_free_f Str2_free;
829
830/*** <<< CTABLES [Str2] >>> ***/
831
832static int check_permitted_alphabet_1(const void *sptr) {
833 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000834 const IA5String_t *st = sptr;
835 const uint8_t *ch = st->buf;
836 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000837
838 for(; ch < end; ch++) {
839 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000840 if(!(cv <= 127)) return -1;
vlm7d576b32004-08-20 13:37:45 +0000841 }
vlmcdf661b2004-08-22 12:47:03 +0000842 return 0;
vlm7d576b32004-08-20 13:37:45 +0000843}
844
845
846/*** <<< CODE [Str2] >>> ***/
847
848int
849Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
850 asn_app_consume_bytes_f *app_errlog, void *app_key) {
851
vlmb08de152004-08-22 03:30:05 +0000852 const Str1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000853 size_t size;
854
855 if(!sptr) {
856 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000857 "%s: value not given (%s:%d)",
858 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000859 return -1;
860 }
861
862 size = st->size;
863
864 if(((size <= 20) || (size >= 25 && size <= 30))
vlm7e20dfc2004-08-22 13:11:40 +0000865 && !check_permitted_alphabet_1(sptr)) {
vlm7d576b32004-08-20 13:37:45 +0000866 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000867 return 0;
vlm7d576b32004-08-20 13:37:45 +0000868 } else {
869 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000870 "%s: constraint failed (%s:%d)",
871 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000872 return -1;
873 }
874}
875
876/*
877 * This type is implemented using Str1,
878 * so adjust the DEF appropriately.
879 */
880static void
881Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
882 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
883 td->der_encoder = asn1_DEF_Str1.der_encoder;
884 td->free_struct = asn1_DEF_Str1.free_struct;
885 td->print_struct = asn1_DEF_Str1.print_struct;
886 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
887 td->elements = asn1_DEF_Str1.elements;
888 td->elements_count = asn1_DEF_Str1.elements_count;
889 td->specifics = asn1_DEF_Str1.specifics;
890}
891
892ber_dec_rval_t
893Str2_decode_ber(asn1_TYPE_descriptor_t *td,
894 void **structure, void *bufptr, size_t size, int tag_mode) {
895 Str2_inherit_TYPE_descriptor(td);
896 return td->ber_decoder(td, structure,
897 bufptr, size, tag_mode);
898}
899
900der_enc_rval_t
901Str2_encode_der(asn1_TYPE_descriptor_t *td,
902 void *structure, int tag_mode, ber_tlv_tag_t tag,
903 asn_app_consume_bytes_f *cb, void *app_key) {
904 Str2_inherit_TYPE_descriptor(td);
905 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
906}
907
908int
909Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
910 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
911 Str2_inherit_TYPE_descriptor(td);
912 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
913}
914
915void
916Str2_free(asn1_TYPE_descriptor_t *td,
917 void *struct_ptr, int contents_only) {
918 Str2_inherit_TYPE_descriptor(td);
919 td->free_struct(td, struct_ptr, contents_only);
920}
921
922
923/*** <<< STAT-DEFS [Str2] >>> ***/
924
925static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
926 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
927};
928asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
929 "Str2",
930 Str2_constraint,
931 Str2_decode_ber,
932 Str2_encode_der,
933 Str2_print,
934 Str2_free,
935 0, /* Use generic outmost tag fetcher */
936 asn1_DEF_Str2_tags,
937 sizeof(asn1_DEF_Str2_tags)
938 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
939 1, /* Tags to skip */
940 -0, /* Unknown yet */
941 0, 0, /* No members */
942 0 /* No specifics */
943};
944
945
946/*** <<< INCLUDES [Str3] >>> ***/
947
948#include <Str2.h>
949
950/*** <<< TYPE-DECLS [Str3] >>> ***/
951
952
953typedef Str2_t Str3_t;
954
vlm7d576b32004-08-20 13:37:45 +0000955/*** <<< FUNC-DECLS [Str3] >>> ***/
956
957extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
958asn_constr_check_f Str3_constraint;
959ber_type_decoder_f Str3_decode_ber;
960der_type_encoder_f Str3_encode_der;
961asn_struct_print_f Str3_print;
962asn_struct_free_f Str3_free;
963
964/*** <<< CTABLES [Str3] >>> ***/
965
966static int permitted_alphabet_table_2[256] = {
9670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9700,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9710,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9730,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
974};
975
976static int check_permitted_alphabet_2(const void *sptr) {
977 int *table = permitted_alphabet_table_2;
978 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000979 const IA5String_t *st = sptr;
980 const uint8_t *ch = st->buf;
981 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000982
983 for(; ch < end; ch++) {
984 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000985 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +0000986 }
vlmcdf661b2004-08-22 12:47:03 +0000987 return 0;
vlm7d576b32004-08-20 13:37:45 +0000988}
989
990
991/*** <<< CODE [Str3] >>> ***/
992
993int
994Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
995 asn_app_consume_bytes_f *app_errlog, void *app_key) {
996
vlmb08de152004-08-22 03:30:05 +0000997 const Str2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000998 size_t size;
999
1000 if(!sptr) {
1001 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001002 "%s: value not given (%s:%d)",
1003 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001004 return -1;
1005 }
1006
1007 size = st->size;
1008
1009 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
vlm7e20dfc2004-08-22 13:11:40 +00001010 && !check_permitted_alphabet_2(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001011 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001012 return 0;
vlm7d576b32004-08-20 13:37:45 +00001013 } else {
1014 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001015 "%s: constraint failed (%s:%d)",
1016 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001017 return -1;
1018 }
1019}
1020
1021/*
1022 * This type is implemented using Str2,
1023 * so adjust the DEF appropriately.
1024 */
1025static void
1026Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1027 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1028 td->der_encoder = asn1_DEF_Str2.der_encoder;
1029 td->free_struct = asn1_DEF_Str2.free_struct;
1030 td->print_struct = asn1_DEF_Str2.print_struct;
1031 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1032 td->elements = asn1_DEF_Str2.elements;
1033 td->elements_count = asn1_DEF_Str2.elements_count;
1034 td->specifics = asn1_DEF_Str2.specifics;
1035}
1036
1037ber_dec_rval_t
1038Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1039 void **structure, void *bufptr, size_t size, int tag_mode) {
1040 Str3_inherit_TYPE_descriptor(td);
1041 return td->ber_decoder(td, structure,
1042 bufptr, size, tag_mode);
1043}
1044
1045der_enc_rval_t
1046Str3_encode_der(asn1_TYPE_descriptor_t *td,
1047 void *structure, int tag_mode, ber_tlv_tag_t tag,
1048 asn_app_consume_bytes_f *cb, void *app_key) {
1049 Str3_inherit_TYPE_descriptor(td);
1050 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1051}
1052
1053int
1054Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1055 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1056 Str3_inherit_TYPE_descriptor(td);
1057 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1058}
1059
1060void
1061Str3_free(asn1_TYPE_descriptor_t *td,
1062 void *struct_ptr, int contents_only) {
1063 Str3_inherit_TYPE_descriptor(td);
1064 td->free_struct(td, struct_ptr, contents_only);
1065}
1066
1067
1068/*** <<< STAT-DEFS [Str3] >>> ***/
1069
1070static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
1071 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1072};
1073asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1074 "Str3",
1075 Str3_constraint,
1076 Str3_decode_ber,
1077 Str3_encode_der,
1078 Str3_print,
1079 Str3_free,
1080 0, /* Use generic outmost tag fetcher */
1081 asn1_DEF_Str3_tags,
1082 sizeof(asn1_DEF_Str3_tags)
1083 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
1084 1, /* Tags to skip */
1085 -0, /* Unknown yet */
1086 0, 0, /* No members */
1087 0 /* No specifics */
1088};
1089
1090
1091/*** <<< INCLUDES [PER-Visible] >>> ***/
1092
1093#include <IA5String.h>
1094
1095/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1096
1097
1098typedef IA5String_t PER_Visible_t;
1099
vlm7d576b32004-08-20 13:37:45 +00001100/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1101
1102extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1103asn_constr_check_f PER_Visible_constraint;
1104ber_type_decoder_f PER_Visible_decode_ber;
1105der_type_encoder_f PER_Visible_encode_der;
1106asn_struct_print_f PER_Visible_print;
1107asn_struct_free_f PER_Visible_free;
1108
1109/*** <<< CTABLES [PER-Visible] >>> ***/
1110
1111static int check_permitted_alphabet_3(const void *sptr) {
1112 /* The underlying type is IA5String */
vlm4fdaead2004-08-21 07:34:17 +00001113 const IA5String_t *st = sptr;
vlmb08de152004-08-22 03:30:05 +00001114 const uint8_t *ch = st->buf;
1115 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001116
1117 for(; ch < end; ch++) {
1118 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001119 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001120 }
vlmcdf661b2004-08-22 12:47:03 +00001121 return 0;
vlm7d576b32004-08-20 13:37:45 +00001122}
1123
1124
1125/*** <<< CODE [PER-Visible] >>> ***/
1126
1127int
1128PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1129 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1130
vlmb08de152004-08-22 03:30:05 +00001131 const IA5String_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001132
1133 if(!sptr) {
1134 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001135 "%s: value not given (%s:%d)",
1136 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001137 return -1;
1138 }
1139
1140
vlm7e20dfc2004-08-22 13:11:40 +00001141 if(!check_permitted_alphabet_3(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001142 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001143 return 0;
vlm7d576b32004-08-20 13:37:45 +00001144 } else {
1145 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001146 "%s: constraint failed (%s:%d)",
1147 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001148 return -1;
1149 }
1150}
1151
1152/*
1153 * This type is implemented using IA5String,
1154 * so adjust the DEF appropriately.
1155 */
1156static void
1157PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1158 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1159 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1160 td->free_struct = asn1_DEF_IA5String.free_struct;
1161 td->print_struct = asn1_DEF_IA5String.print_struct;
1162 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1163 td->elements = asn1_DEF_IA5String.elements;
1164 td->elements_count = asn1_DEF_IA5String.elements_count;
1165 td->specifics = asn1_DEF_IA5String.specifics;
1166}
1167
1168ber_dec_rval_t
1169PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1170 void **structure, void *bufptr, size_t size, int tag_mode) {
1171 PER_Visible_inherit_TYPE_descriptor(td);
1172 return td->ber_decoder(td, structure,
1173 bufptr, size, tag_mode);
1174}
1175
1176der_enc_rval_t
1177PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1178 void *structure, int tag_mode, ber_tlv_tag_t tag,
1179 asn_app_consume_bytes_f *cb, void *app_key) {
1180 PER_Visible_inherit_TYPE_descriptor(td);
1181 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1182}
1183
1184int
1185PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1186 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1187 PER_Visible_inherit_TYPE_descriptor(td);
1188 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1189}
1190
1191void
1192PER_Visible_free(asn1_TYPE_descriptor_t *td,
1193 void *struct_ptr, int contents_only) {
1194 PER_Visible_inherit_TYPE_descriptor(td);
1195 td->free_struct(td, struct_ptr, contents_only);
1196}
1197
1198
1199/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1200
1201static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1202 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1203};
1204asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1205 "PER-Visible",
1206 PER_Visible_constraint,
1207 PER_Visible_decode_ber,
1208 PER_Visible_encode_der,
1209 PER_Visible_print,
1210 PER_Visible_free,
1211 0, /* Use generic outmost tag fetcher */
1212 asn1_DEF_PER_Visible_tags,
1213 sizeof(asn1_DEF_PER_Visible_tags)
1214 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
1215 1, /* Tags to skip */
1216 -0, /* Unknown yet */
1217 0, 0, /* No members */
1218 0 /* No specifics */
1219};
1220
1221
1222/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1223
1224#include <PER-Visible.h>
1225
1226/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1227
1228
1229typedef PER_Visible_t PER_Visible_2_t;
1230
vlm7d576b32004-08-20 13:37:45 +00001231/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1232
1233extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1234asn_constr_check_f PER_Visible_2_constraint;
1235ber_type_decoder_f PER_Visible_2_decode_ber;
1236der_type_encoder_f PER_Visible_2_encode_der;
1237asn_struct_print_f PER_Visible_2_print;
1238asn_struct_free_f PER_Visible_2_free;
1239
1240/*** <<< CTABLES [PER-Visible-2] >>> ***/
1241
1242static int check_permitted_alphabet_4(const void *sptr) {
1243 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001244 const IA5String_t *st = sptr;
1245 const uint8_t *ch = st->buf;
1246 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001247
1248 for(; ch < end; ch++) {
1249 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001250 if(!(cv >= 69 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001251 }
vlmcdf661b2004-08-22 12:47:03 +00001252 return 0;
vlm7d576b32004-08-20 13:37:45 +00001253}
1254
1255
1256/*** <<< CODE [PER-Visible-2] >>> ***/
1257
1258int
1259PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1260 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1261
vlmb08de152004-08-22 03:30:05 +00001262 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001263
1264 if(!sptr) {
1265 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001266 "%s: value not given (%s:%d)",
1267 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001268 return -1;
1269 }
1270
1271
vlm7e20dfc2004-08-22 13:11:40 +00001272 if(!check_permitted_alphabet_4(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001273 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001274 return 0;
vlm7d576b32004-08-20 13:37:45 +00001275 } else {
1276 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001277 "%s: constraint failed (%s:%d)",
1278 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001279 return -1;
1280 }
1281}
1282
1283/*
1284 * This type is implemented using PER_Visible,
1285 * so adjust the DEF appropriately.
1286 */
1287static void
1288PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1289 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1290 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1291 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1292 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1293 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1294 td->elements = asn1_DEF_PER_Visible.elements;
1295 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1296 td->specifics = asn1_DEF_PER_Visible.specifics;
1297}
1298
1299ber_dec_rval_t
1300PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1301 void **structure, void *bufptr, size_t size, int tag_mode) {
1302 PER_Visible_2_inherit_TYPE_descriptor(td);
1303 return td->ber_decoder(td, structure,
1304 bufptr, size, tag_mode);
1305}
1306
1307der_enc_rval_t
1308PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1309 void *structure, int tag_mode, ber_tlv_tag_t tag,
1310 asn_app_consume_bytes_f *cb, void *app_key) {
1311 PER_Visible_2_inherit_TYPE_descriptor(td);
1312 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1313}
1314
1315int
1316PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1317 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1318 PER_Visible_2_inherit_TYPE_descriptor(td);
1319 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1320}
1321
1322void
1323PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1324 void *struct_ptr, int contents_only) {
1325 PER_Visible_2_inherit_TYPE_descriptor(td);
1326 td->free_struct(td, struct_ptr, contents_only);
1327}
1328
1329
1330/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1331
1332static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
1333 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1334};
1335asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1336 "PER-Visible-2",
1337 PER_Visible_2_constraint,
1338 PER_Visible_2_decode_ber,
1339 PER_Visible_2_encode_der,
1340 PER_Visible_2_print,
1341 PER_Visible_2_free,
1342 0, /* Use generic outmost tag fetcher */
1343 asn1_DEF_PER_Visible_2_tags,
1344 sizeof(asn1_DEF_PER_Visible_2_tags)
1345 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
1346 1, /* Tags to skip */
1347 -0, /* Unknown yet */
1348 0, 0, /* No members */
1349 0 /* No specifics */
1350};
1351
1352
1353/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1354
1355#include <PER-Visible.h>
1356
1357/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1358
1359
1360typedef PER_Visible_t Not_PER_Visible_1_t;
1361
vlm7d576b32004-08-20 13:37:45 +00001362/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1363
1364extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1365asn_constr_check_f Not_PER_Visible_1_constraint;
1366ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1367der_type_encoder_f Not_PER_Visible_1_encode_der;
1368asn_struct_print_f Not_PER_Visible_1_print;
1369asn_struct_free_f Not_PER_Visible_1_free;
1370
1371/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1372
1373static int check_permitted_alphabet_5(const void *sptr) {
1374 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001375 const IA5String_t *st = sptr;
1376 const uint8_t *ch = st->buf;
1377 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001378
1379 for(; ch < end; ch++) {
1380 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001381 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001382 }
vlmcdf661b2004-08-22 12:47:03 +00001383 return 0;
vlm7d576b32004-08-20 13:37:45 +00001384}
1385
1386
1387/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1388
1389int
1390Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1391 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1392
vlmb08de152004-08-22 03:30:05 +00001393 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001394
1395 if(!sptr) {
1396 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001397 "%s: value not given (%s:%d)",
1398 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001399 return -1;
1400 }
1401
1402
vlm7e20dfc2004-08-22 13:11:40 +00001403 if(!check_permitted_alphabet_5(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001404 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001405 return 0;
vlm7d576b32004-08-20 13:37:45 +00001406 } else {
1407 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001408 "%s: constraint failed (%s:%d)",
1409 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001410 return -1;
1411 }
1412}
1413
1414/*
1415 * This type is implemented using PER_Visible,
1416 * so adjust the DEF appropriately.
1417 */
1418static void
1419Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1420 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1421 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1422 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1423 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1424 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1425 td->elements = asn1_DEF_PER_Visible.elements;
1426 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1427 td->specifics = asn1_DEF_PER_Visible.specifics;
1428}
1429
1430ber_dec_rval_t
1431Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1432 void **structure, void *bufptr, size_t size, int tag_mode) {
1433 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1434 return td->ber_decoder(td, structure,
1435 bufptr, size, tag_mode);
1436}
1437
1438der_enc_rval_t
1439Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1440 void *structure, int tag_mode, ber_tlv_tag_t tag,
1441 asn_app_consume_bytes_f *cb, void *app_key) {
1442 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1443 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1444}
1445
1446int
1447Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1448 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1449 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1450 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1451}
1452
1453void
1454Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1455 void *struct_ptr, int contents_only) {
1456 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1457 td->free_struct(td, struct_ptr, contents_only);
1458}
1459
1460
1461/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1462
1463static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
1464 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1465};
1466asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1467 "Not-PER-Visible-1",
1468 Not_PER_Visible_1_constraint,
1469 Not_PER_Visible_1_decode_ber,
1470 Not_PER_Visible_1_encode_der,
1471 Not_PER_Visible_1_print,
1472 Not_PER_Visible_1_free,
1473 0, /* Use generic outmost tag fetcher */
1474 asn1_DEF_Not_PER_Visible_1_tags,
1475 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1476 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1477 1, /* Tags to skip */
1478 -0, /* Unknown yet */
1479 0, 0, /* No members */
1480 0 /* No specifics */
1481};
1482
1483
1484/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1485
1486#include <PER-Visible.h>
1487
1488/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1489
1490
1491typedef PER_Visible_t Not_PER_Visible_2_t;
1492
vlm7d576b32004-08-20 13:37:45 +00001493/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1494
1495extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1496asn_constr_check_f Not_PER_Visible_2_constraint;
1497ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1498der_type_encoder_f Not_PER_Visible_2_encode_der;
1499asn_struct_print_f Not_PER_Visible_2_print;
1500asn_struct_free_f Not_PER_Visible_2_free;
1501
vlm26afd202004-08-25 02:08:08 +00001502/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1503
1504static int check_permitted_alphabet_6(const void *sptr) {
1505 /* The underlying type is IA5String */
1506 const IA5String_t *st = sptr;
1507 const uint8_t *ch = st->buf;
1508 const uint8_t *end = ch + st->size;
1509
1510 for(; ch < end; ch++) {
1511 uint8_t cv = *ch;
1512 if(!(cv >= 65 && cv <= 66)) return -1;
1513 }
1514 return 0;
1515}
1516
1517
vlm7d576b32004-08-20 13:37:45 +00001518/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1519
1520int
1521Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1522 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1523
vlmb08de152004-08-22 03:30:05 +00001524 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001525
1526 if(!sptr) {
1527 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001528 "%s: value not given (%s:%d)",
1529 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001530 return -1;
1531 }
1532
1533
vlm26afd202004-08-25 02:08:08 +00001534 if(!check_permitted_alphabet_6(sptr)) {
1535 /* Constraint check succeeded */
1536 return 0;
1537 } else {
1538 _ASN_ERRLOG(app_errlog, app_key,
1539 "%s: constraint failed (%s:%d)",
1540 td->name, __FILE__, __LINE__);
1541 return -1;
vlm7d576b32004-08-20 13:37:45 +00001542 }
vlm7d576b32004-08-20 13:37:45 +00001543}
1544
1545/*
1546 * This type is implemented using PER_Visible,
1547 * so adjust the DEF appropriately.
1548 */
1549static void
1550Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1551 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1552 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1553 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1554 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1555 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1556 td->elements = asn1_DEF_PER_Visible.elements;
1557 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1558 td->specifics = asn1_DEF_PER_Visible.specifics;
1559}
1560
1561ber_dec_rval_t
1562Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1563 void **structure, void *bufptr, size_t size, int tag_mode) {
1564 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1565 return td->ber_decoder(td, structure,
1566 bufptr, size, tag_mode);
1567}
1568
1569der_enc_rval_t
1570Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1571 void *structure, int tag_mode, ber_tlv_tag_t tag,
1572 asn_app_consume_bytes_f *cb, void *app_key) {
1573 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1574 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1575}
1576
1577int
1578Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1579 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1580 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1581 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1582}
1583
1584void
1585Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1586 void *struct_ptr, int contents_only) {
1587 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1588 td->free_struct(td, struct_ptr, contents_only);
1589}
1590
1591
1592/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1593
1594static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
1595 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1596};
1597asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1598 "Not-PER-Visible-2",
1599 Not_PER_Visible_2_constraint,
1600 Not_PER_Visible_2_decode_ber,
1601 Not_PER_Visible_2_encode_der,
1602 Not_PER_Visible_2_print,
1603 Not_PER_Visible_2_free,
1604 0, /* Use generic outmost tag fetcher */
1605 asn1_DEF_Not_PER_Visible_2_tags,
1606 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1607 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1608 1, /* Tags to skip */
1609 -0, /* Unknown yet */
1610 0, 0, /* No members */
1611 0 /* No specifics */
1612};
1613
1614
1615/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1616
1617#include <PER-Visible.h>
1618
1619/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1620
1621
1622typedef PER_Visible_t Not_PER_Visible_3_t;
1623
vlm7d576b32004-08-20 13:37:45 +00001624/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1625
1626extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1627asn_constr_check_f Not_PER_Visible_3_constraint;
1628ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1629der_type_encoder_f Not_PER_Visible_3_encode_der;
1630asn_struct_print_f Not_PER_Visible_3_print;
1631asn_struct_free_f Not_PER_Visible_3_free;
1632
vlm26afd202004-08-25 02:08:08 +00001633/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1634
1635static int check_permitted_alphabet_7(const void *sptr) {
1636 /* The underlying type is IA5String */
1637 const IA5String_t *st = sptr;
1638 const uint8_t *ch = st->buf;
1639 const uint8_t *end = ch + st->size;
1640
1641 for(; ch < end; ch++) {
1642 uint8_t cv = *ch;
1643 if(!(cv >= 65 && cv <= 66)) return -1;
1644 }
1645 return 0;
1646}
1647
1648
vlm7d576b32004-08-20 13:37:45 +00001649/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1650
1651int
1652Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1653 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1654
vlmb08de152004-08-22 03:30:05 +00001655 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001656
1657 if(!sptr) {
1658 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001659 "%s: value not given (%s:%d)",
1660 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001661 return -1;
1662 }
1663
1664
vlm26afd202004-08-25 02:08:08 +00001665 if(!check_permitted_alphabet_7(sptr)) {
1666 /* Constraint check succeeded */
1667 return 0;
1668 } else {
1669 _ASN_ERRLOG(app_errlog, app_key,
1670 "%s: constraint failed (%s:%d)",
1671 td->name, __FILE__, __LINE__);
1672 return -1;
vlm7d576b32004-08-20 13:37:45 +00001673 }
vlm7d576b32004-08-20 13:37:45 +00001674}
1675
1676/*
1677 * This type is implemented using PER_Visible,
1678 * so adjust the DEF appropriately.
1679 */
1680static void
1681Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1682 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1683 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1684 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1685 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1686 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1687 td->elements = asn1_DEF_PER_Visible.elements;
1688 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1689 td->specifics = asn1_DEF_PER_Visible.specifics;
1690}
1691
1692ber_dec_rval_t
1693Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1694 void **structure, void *bufptr, size_t size, int tag_mode) {
1695 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1696 return td->ber_decoder(td, structure,
1697 bufptr, size, tag_mode);
1698}
1699
1700der_enc_rval_t
1701Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1702 void *structure, int tag_mode, ber_tlv_tag_t tag,
1703 asn_app_consume_bytes_f *cb, void *app_key) {
1704 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1705 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1706}
1707
1708int
1709Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1710 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1711 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1712 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1713}
1714
1715void
1716Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1717 void *struct_ptr, int contents_only) {
1718 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1719 td->free_struct(td, struct_ptr, contents_only);
1720}
1721
1722
1723/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1724
1725static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
1726 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1727};
1728asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1729 "Not-PER-Visible-3",
1730 Not_PER_Visible_3_constraint,
1731 Not_PER_Visible_3_decode_ber,
1732 Not_PER_Visible_3_encode_der,
1733 Not_PER_Visible_3_print,
1734 Not_PER_Visible_3_free,
1735 0, /* Use generic outmost tag fetcher */
1736 asn1_DEF_Not_PER_Visible_3_tags,
1737 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1738 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1739 1, /* Tags to skip */
1740 -0, /* Unknown yet */
1741 0, 0, /* No members */
1742 0 /* No specifics */
1743};
1744
1745
1746/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1747
1748#include <PER-Visible.h>
1749
1750/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1751
1752
1753typedef PER_Visible_t SIZE_but_not_FROM_t;
1754
vlm7d576b32004-08-20 13:37:45 +00001755/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1756
1757extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1758asn_constr_check_f SIZE_but_not_FROM_constraint;
1759ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1760der_type_encoder_f SIZE_but_not_FROM_encode_der;
1761asn_struct_print_f SIZE_but_not_FROM_print;
1762asn_struct_free_f SIZE_but_not_FROM_free;
1763
1764/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1765
vlm26afd202004-08-25 02:08:08 +00001766static int check_permitted_alphabet_8(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001767 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001768 const IA5String_t *st = sptr;
1769 const uint8_t *ch = st->buf;
1770 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001771
1772 for(; ch < end; ch++) {
1773 uint8_t cv = *ch;
vlm26afd202004-08-25 02:08:08 +00001774 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001775 }
vlmcdf661b2004-08-22 12:47:03 +00001776 return 0;
vlm7d576b32004-08-20 13:37:45 +00001777}
1778
1779
1780/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1781
1782int
1783SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1784 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1785
vlmb08de152004-08-22 03:30:05 +00001786 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001787 size_t size;
1788
1789 if(!sptr) {
1790 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001791 "%s: value not given (%s:%d)",
1792 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001793 return -1;
1794 }
1795
1796 size = st->size;
1797
1798 if((size >= 1 && size <= 4)
vlm26afd202004-08-25 02:08:08 +00001799 && !check_permitted_alphabet_8(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001800 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001801 return 0;
vlm7d576b32004-08-20 13:37:45 +00001802 } else {
1803 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001804 "%s: constraint failed (%s:%d)",
1805 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001806 return -1;
1807 }
1808}
1809
1810/*
1811 * This type is implemented using PER_Visible,
1812 * so adjust the DEF appropriately.
1813 */
1814static void
1815SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1816 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1817 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1818 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1819 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1820 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1821 td->elements = asn1_DEF_PER_Visible.elements;
1822 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1823 td->specifics = asn1_DEF_PER_Visible.specifics;
1824}
1825
1826ber_dec_rval_t
1827SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1828 void **structure, void *bufptr, size_t size, int tag_mode) {
1829 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1830 return td->ber_decoder(td, structure,
1831 bufptr, size, tag_mode);
1832}
1833
1834der_enc_rval_t
1835SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1836 void *structure, int tag_mode, ber_tlv_tag_t tag,
1837 asn_app_consume_bytes_f *cb, void *app_key) {
1838 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1839 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1840}
1841
1842int
1843SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1844 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1845 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1846 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1847}
1848
1849void
1850SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1851 void *struct_ptr, int contents_only) {
1852 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1853 td->free_struct(td, struct_ptr, contents_only);
1854}
1855
1856
1857/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1858
1859static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
1860 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1861};
1862asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
1863 "SIZE-but-not-FROM",
1864 SIZE_but_not_FROM_constraint,
1865 SIZE_but_not_FROM_decode_ber,
1866 SIZE_but_not_FROM_encode_der,
1867 SIZE_but_not_FROM_print,
1868 SIZE_but_not_FROM_free,
1869 0, /* Use generic outmost tag fetcher */
1870 asn1_DEF_SIZE_but_not_FROM_tags,
1871 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
1872 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
1873 1, /* Tags to skip */
1874 -0, /* Unknown yet */
1875 0, 0, /* No members */
1876 0 /* No specifics */
1877};
1878
1879
1880/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
1881
1882#include <PER-Visible.h>
1883
1884/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
1885
1886
1887typedef PER_Visible_t SIZE_and_FROM_t;
1888
vlm7d576b32004-08-20 13:37:45 +00001889/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
1890
1891extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
1892asn_constr_check_f SIZE_and_FROM_constraint;
1893ber_type_decoder_f SIZE_and_FROM_decode_ber;
1894der_type_encoder_f SIZE_and_FROM_encode_der;
1895asn_struct_print_f SIZE_and_FROM_print;
1896asn_struct_free_f SIZE_and_FROM_free;
1897
1898/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
1899
vlm26afd202004-08-25 02:08:08 +00001900static int check_permitted_alphabet_9(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001901 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001902 const IA5String_t *st = sptr;
1903 const uint8_t *ch = st->buf;
1904 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001905
1906 for(; ch < end; ch++) {
1907 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001908 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001909 }
vlmcdf661b2004-08-22 12:47:03 +00001910 return 0;
vlm7d576b32004-08-20 13:37:45 +00001911}
1912
1913
1914/*** <<< CODE [SIZE-and-FROM] >>> ***/
1915
1916int
1917SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1918 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1919
vlmb08de152004-08-22 03:30:05 +00001920 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001921 size_t size;
1922
1923 if(!sptr) {
1924 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001925 "%s: value not given (%s:%d)",
1926 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001927 return -1;
1928 }
1929
1930 size = st->size;
1931
1932 if((size >= 1 && size <= 4)
vlm26afd202004-08-25 02:08:08 +00001933 && !check_permitted_alphabet_9(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001934 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001935 return 0;
vlm7d576b32004-08-20 13:37:45 +00001936 } else {
1937 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001938 "%s: constraint failed (%s:%d)",
1939 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001940 return -1;
1941 }
1942}
1943
1944/*
1945 * This type is implemented using PER_Visible,
1946 * so adjust the DEF appropriately.
1947 */
1948static void
1949SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1950 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1951 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1952 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1953 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1954 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1955 td->elements = asn1_DEF_PER_Visible.elements;
1956 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1957 td->specifics = asn1_DEF_PER_Visible.specifics;
1958}
1959
1960ber_dec_rval_t
1961SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1962 void **structure, void *bufptr, size_t size, int tag_mode) {
1963 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1964 return td->ber_decoder(td, structure,
1965 bufptr, size, tag_mode);
1966}
1967
1968der_enc_rval_t
1969SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1970 void *structure, int tag_mode, ber_tlv_tag_t tag,
1971 asn_app_consume_bytes_f *cb, void *app_key) {
1972 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1973 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1974}
1975
1976int
1977SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1978 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1979 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1980 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1981}
1982
1983void
1984SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
1985 void *struct_ptr, int contents_only) {
1986 SIZE_and_FROM_inherit_TYPE_descriptor(td);
1987 td->free_struct(td, struct_ptr, contents_only);
1988}
1989
1990
1991/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
1992
1993static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
1994 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
1995};
1996asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
1997 "SIZE-and-FROM",
1998 SIZE_and_FROM_constraint,
1999 SIZE_and_FROM_decode_ber,
2000 SIZE_and_FROM_encode_der,
2001 SIZE_and_FROM_print,
2002 SIZE_and_FROM_free,
2003 0, /* Use generic outmost tag fetcher */
2004 asn1_DEF_SIZE_and_FROM_tags,
2005 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2006 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
2007 1, /* Tags to skip */
2008 -0, /* Unknown yet */
2009 0, 0, /* No members */
2010 0 /* No specifics */
2011};
2012
2013
2014/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2015
2016#include <PER-Visible.h>
2017
2018/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2019
2020
2021typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2022
vlm7d576b32004-08-20 13:37:45 +00002023/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2024
2025extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
2026asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2027ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2028der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
2029asn_struct_print_f Neither_SIZE_nor_FROM_print;
2030asn_struct_free_f Neither_SIZE_nor_FROM_free;
2031
2032/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2033
vlm26afd202004-08-25 02:08:08 +00002034static int check_permitted_alphabet_10(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00002035 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00002036 const IA5String_t *st = sptr;
2037 const uint8_t *ch = st->buf;
2038 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002039
2040 for(; ch < end; ch++) {
2041 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002042 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00002043 }
vlmcdf661b2004-08-22 12:47:03 +00002044 return 0;
vlm7d576b32004-08-20 13:37:45 +00002045}
2046
2047
2048/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2049
2050int
2051Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2052 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2053
vlmb08de152004-08-22 03:30:05 +00002054 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002055
2056 if(!sptr) {
2057 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002058 "%s: value not given (%s:%d)",
2059 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002060 return -1;
2061 }
2062
2063
vlm26afd202004-08-25 02:08:08 +00002064 if(!check_permitted_alphabet_10(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002065 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002066 return 0;
vlm7d576b32004-08-20 13:37:45 +00002067 } else {
2068 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002069 "%s: constraint failed (%s:%d)",
2070 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002071 return -1;
2072 }
2073}
2074
2075/*
2076 * This type is implemented using PER_Visible,
2077 * so adjust the DEF appropriately.
2078 */
2079static void
2080Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2081 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2082 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2083 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2084 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2085 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2086 td->elements = asn1_DEF_PER_Visible.elements;
2087 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2088 td->specifics = asn1_DEF_PER_Visible.specifics;
2089}
2090
2091ber_dec_rval_t
2092Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2093 void **structure, void *bufptr, size_t size, int tag_mode) {
2094 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2095 return td->ber_decoder(td, structure,
2096 bufptr, size, tag_mode);
2097}
2098
2099der_enc_rval_t
2100Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2101 void *structure, int tag_mode, ber_tlv_tag_t tag,
2102 asn_app_consume_bytes_f *cb, void *app_key) {
2103 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2104 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2105}
2106
2107int
2108Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2109 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2110 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2111 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2112}
2113
2114void
2115Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2116 void *struct_ptr, int contents_only) {
2117 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2118 td->free_struct(td, struct_ptr, contents_only);
2119}
2120
2121
2122/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2123
2124static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
2125 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2126};
2127asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2128 "Neither-SIZE-nor-FROM",
2129 Neither_SIZE_nor_FROM_constraint,
2130 Neither_SIZE_nor_FROM_decode_ber,
2131 Neither_SIZE_nor_FROM_encode_der,
2132 Neither_SIZE_nor_FROM_print,
2133 Neither_SIZE_nor_FROM_free,
2134 0, /* Use generic outmost tag fetcher */
2135 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2136 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2137 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2138 1, /* Tags to skip */
2139 -0, /* Unknown yet */
2140 0, 0, /* No members */
2141 0 /* No specifics */
2142};
2143
2144
2145/*** <<< INCLUDES [Utf8-3] >>> ***/
2146
2147#include <Utf8-2.h>
2148
2149/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2150
2151
2152typedef Utf8_2_t Utf8_3_t;
2153
vlm7d576b32004-08-20 13:37:45 +00002154/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2155
2156extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2157asn_constr_check_f Utf8_3_constraint;
2158ber_type_decoder_f Utf8_3_decode_ber;
2159der_type_encoder_f Utf8_3_encode_der;
2160asn_struct_print_f Utf8_3_print;
2161asn_struct_free_f Utf8_3_free;
2162
2163/*** <<< CTABLES [Utf8-3] >>> ***/
2164
vlm26afd202004-08-25 02:08:08 +00002165static int permitted_alphabet_table_11[128] = {
vlm7d576b32004-08-20 13:37:45 +000021660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
21700,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
21711,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
21720,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
21731,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2174};
2175
vlm26afd202004-08-25 02:08:08 +00002176static int check_permitted_alphabet_11(const void *sptr) {
2177 int *table = permitted_alphabet_table_11;
vlm7d576b32004-08-20 13:37:45 +00002178 /* The underlying type is UTF8String */
vlmb08de152004-08-22 03:30:05 +00002179 const UTF8String_t *st = sptr;
2180 const uint8_t *ch = st->buf;
2181 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002182
2183 for(; ch < end; ch++) {
2184 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002185 if(cv >= 0x80) return -1;
2186 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +00002187 }
vlmcdf661b2004-08-22 12:47:03 +00002188 return 0;
vlm7d576b32004-08-20 13:37:45 +00002189}
2190
2191
2192/*** <<< CODE [Utf8-3] >>> ***/
2193
2194int
2195Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2196 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2197
vlmb08de152004-08-22 03:30:05 +00002198 const Utf8_2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002199 size_t size;
2200
2201 if(!sptr) {
2202 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002203 "%s: value not given (%s:%d)",
2204 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002205 return -1;
2206 }
2207
2208 size = UTF8String_length(st, td->name, app_errlog, app_key);
2209 if(size == (size_t)-1) return -1;
2210
2211 if((size >= 1 && size <= 2)
vlm26afd202004-08-25 02:08:08 +00002212 && !check_permitted_alphabet_11(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002213 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002214 return 0;
vlm7d576b32004-08-20 13:37:45 +00002215 } else {
2216 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002217 "%s: constraint failed (%s:%d)",
2218 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002219 return -1;
2220 }
2221}
2222
2223/*
2224 * This type is implemented using Utf8_2,
2225 * so adjust the DEF appropriately.
2226 */
2227static void
2228Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2229 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2230 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2231 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2232 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2233 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2234 td->elements = asn1_DEF_Utf8_2.elements;
2235 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2236 td->specifics = asn1_DEF_Utf8_2.specifics;
2237}
2238
2239ber_dec_rval_t
2240Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2241 void **structure, void *bufptr, size_t size, int tag_mode) {
2242 Utf8_3_inherit_TYPE_descriptor(td);
2243 return td->ber_decoder(td, structure,
2244 bufptr, size, tag_mode);
2245}
2246
2247der_enc_rval_t
2248Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2249 void *structure, int tag_mode, ber_tlv_tag_t tag,
2250 asn_app_consume_bytes_f *cb, void *app_key) {
2251 Utf8_3_inherit_TYPE_descriptor(td);
2252 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2253}
2254
2255int
2256Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2257 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2258 Utf8_3_inherit_TYPE_descriptor(td);
2259 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2260}
2261
2262void
2263Utf8_3_free(asn1_TYPE_descriptor_t *td,
2264 void *struct_ptr, int contents_only) {
2265 Utf8_3_inherit_TYPE_descriptor(td);
2266 td->free_struct(td, struct_ptr, contents_only);
2267}
2268
2269
2270/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2271
2272static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
2273 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2274};
2275asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2276 "Utf8-3",
2277 Utf8_3_constraint,
2278 Utf8_3_decode_ber,
2279 Utf8_3_encode_der,
2280 Utf8_3_print,
2281 Utf8_3_free,
2282 0, /* Use generic outmost tag fetcher */
2283 asn1_DEF_Utf8_3_tags,
2284 sizeof(asn1_DEF_Utf8_3_tags)
2285 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
2286 1, /* Tags to skip */
2287 -0, /* Unknown yet */
2288 0, 0, /* No members */
2289 0 /* No specifics */
2290};
2291
2292
2293/*** <<< INCLUDES [Utf8-2] >>> ***/
2294
2295#include <Utf8-1.h>
2296
2297/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2298
2299
2300typedef Utf8_1_t Utf8_2_t;
2301
vlm7d576b32004-08-20 13:37:45 +00002302/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2303
2304extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2305asn_constr_check_f Utf8_2_constraint;
2306ber_type_decoder_f Utf8_2_decode_ber;
2307der_type_encoder_f Utf8_2_encode_der;
2308asn_struct_print_f Utf8_2_print;
2309asn_struct_free_f Utf8_2_free;
2310
2311/*** <<< CODE [Utf8-2] >>> ***/
2312
2313int
2314Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2315 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2316
vlmb08de152004-08-22 03:30:05 +00002317 const Utf8_1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002318 size_t size;
2319
2320 if(!sptr) {
2321 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002322 "%s: value not given (%s:%d)",
2323 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002324 return -1;
2325 }
2326
2327 size = UTF8String_length(st, td->name, app_errlog, app_key);
2328 if(size == (size_t)-1) return -1;
2329
2330 if((size >= 1 && size <= 2)) {
2331 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002332 return 0;
vlm7d576b32004-08-20 13:37:45 +00002333 } else {
2334 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002335 "%s: constraint failed (%s:%d)",
2336 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002337 return -1;
2338 }
2339}
2340
2341/*
2342 * This type is implemented using Utf8_1,
2343 * so adjust the DEF appropriately.
2344 */
2345static void
2346Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2347 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2348 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2349 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2350 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2351 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2352 td->elements = asn1_DEF_Utf8_1.elements;
2353 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2354 td->specifics = asn1_DEF_Utf8_1.specifics;
2355}
2356
2357ber_dec_rval_t
2358Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2359 void **structure, void *bufptr, size_t size, int tag_mode) {
2360 Utf8_2_inherit_TYPE_descriptor(td);
2361 return td->ber_decoder(td, structure,
2362 bufptr, size, tag_mode);
2363}
2364
2365der_enc_rval_t
2366Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2367 void *structure, int tag_mode, ber_tlv_tag_t tag,
2368 asn_app_consume_bytes_f *cb, void *app_key) {
2369 Utf8_2_inherit_TYPE_descriptor(td);
2370 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2371}
2372
2373int
2374Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2375 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2376 Utf8_2_inherit_TYPE_descriptor(td);
2377 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2378}
2379
2380void
2381Utf8_2_free(asn1_TYPE_descriptor_t *td,
2382 void *struct_ptr, int contents_only) {
2383 Utf8_2_inherit_TYPE_descriptor(td);
2384 td->free_struct(td, struct_ptr, contents_only);
2385}
2386
2387
2388/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2389
2390static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
2391 (ASN_TAG_CLASS_UNIVERSAL | (0 << 2))
2392};
2393asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2394 "Utf8-2",
2395 Utf8_2_constraint,
2396 Utf8_2_decode_ber,
2397 Utf8_2_encode_der,
2398 Utf8_2_print,
2399 Utf8_2_free,
2400 0, /* Use generic outmost tag fetcher */
2401 asn1_DEF_Utf8_2_tags,
2402 sizeof(asn1_DEF_Utf8_2_tags)
2403 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
2404 1, /* Tags to skip */
2405 -0, /* Unknown yet */
2406 0, 0, /* No members */
2407 0 /* No specifics */
2408};
2409
2410
2411/*** <<< INCLUDES [Utf8-1] >>> ***/
2412
2413#include <UTF8String.h>
2414
2415/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2416
2417
2418typedef UTF8String_t Utf8_1_t;
2419
vlm7d576b32004-08-20 13:37:45 +00002420/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2421
2422extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2423asn_constr_check_f Utf8_1_constraint;
2424ber_type_decoder_f Utf8_1_decode_ber;
2425der_type_encoder_f Utf8_1_encode_der;
2426asn_struct_print_f Utf8_1_print;
2427asn_struct_free_f Utf8_1_free;
2428
2429/*** <<< CODE [Utf8-1] >>> ***/
2430
2431int
2432Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2433 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2434
2435 /* Make the underlying type checker permanent */
2436 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2437 return td->check_constraints
2438 (td, sptr, app_errlog, app_key);
2439}
2440
2441/*
2442 * This type is implemented using UTF8String,
2443 * so adjust the DEF appropriately.
2444 */
2445static void
2446Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2447 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2448 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2449 td->free_struct = asn1_DEF_UTF8String.free_struct;
2450 td->print_struct = asn1_DEF_UTF8String.print_struct;
2451 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2452 td->elements = asn1_DEF_UTF8String.elements;
2453 td->elements_count = asn1_DEF_UTF8String.elements_count;
2454 td->specifics = asn1_DEF_UTF8String.specifics;
2455}
2456
2457ber_dec_rval_t
2458Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2459 void **structure, void *bufptr, size_t size, int tag_mode) {
2460 Utf8_1_inherit_TYPE_descriptor(td);
2461 return td->ber_decoder(td, structure,
2462 bufptr, size, tag_mode);
2463}
2464
2465der_enc_rval_t
2466Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2467 void *structure, int tag_mode, ber_tlv_tag_t tag,
2468 asn_app_consume_bytes_f *cb, void *app_key) {
2469 Utf8_1_inherit_TYPE_descriptor(td);
2470 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2471}
2472
2473int
2474Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2475 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2476 Utf8_1_inherit_TYPE_descriptor(td);
2477 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2478}
2479
2480void
2481Utf8_1_free(asn1_TYPE_descriptor_t *td,
2482 void *struct_ptr, int contents_only) {
2483 Utf8_1_inherit_TYPE_descriptor(td);
2484 td->free_struct(td, struct_ptr, contents_only);
2485}
2486
2487
2488/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2489
2490static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2491 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2492};
2493asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2494 "Utf8-1",
2495 Utf8_1_constraint,
2496 Utf8_1_decode_ber,
2497 Utf8_1_encode_der,
2498 Utf8_1_print,
2499 Utf8_1_free,
2500 0, /* Use generic outmost tag fetcher */
2501 asn1_DEF_Utf8_1_tags,
2502 sizeof(asn1_DEF_Utf8_1_tags)
2503 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
2504 1, /* Tags to skip */
2505 -0, /* Unknown yet */
2506 0, 0, /* No members */
2507 0 /* No specifics */
2508};
2509