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