blob: 305dc5023a10d91201c2142625e4526c92d7bcc6 [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);
vlm1308d2b2004-09-10 15:49:15 +000052 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +000053}
54
55der_enc_rval_t
56Int1_encode_der(asn1_TYPE_descriptor_t *td,
57 void *structure, int tag_mode, ber_tlv_tag_t tag,
58 asn_app_consume_bytes_f *cb, void *app_key) {
59 Int1_inherit_TYPE_descriptor(td);
60 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
61}
62
63int
64Int1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
65 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
66 Int1_inherit_TYPE_descriptor(td);
67 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
68}
69
70void
71Int1_free(asn1_TYPE_descriptor_t *td,
72 void *struct_ptr, int contents_only) {
73 Int1_inherit_TYPE_descriptor(td);
74 td->free_struct(td, struct_ptr, contents_only);
75}
76
77
78/*** <<< STAT-DEFS [Int1] >>> ***/
79
80static ber_tlv_tag_t asn1_DEF_Int1_tags[] = {
81 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
82};
83asn1_TYPE_descriptor_t asn1_DEF_Int1 = {
84 "Int1",
85 Int1_constraint,
86 Int1_decode_ber,
87 Int1_encode_der,
88 Int1_print,
89 Int1_free,
90 0, /* Use generic outmost tag fetcher */
91 asn1_DEF_Int1_tags,
92 sizeof(asn1_DEF_Int1_tags)
93 /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +000094 asn1_DEF_Int1_tags, /* Same as above */
95 sizeof(asn1_DEF_Int1_tags)
96 /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +000097 -0, /* Unknown yet */
98 0, 0, /* No members */
99 0 /* No specifics */
100};
101
102
103/*** <<< INCLUDES [Int2] >>> ***/
104
105#include <Int1.h>
106
107/*** <<< TYPE-DECLS [Int2] >>> ***/
108
109
110typedef Int1_t Int2_t;
111
vlm7d576b32004-08-20 13:37:45 +0000112/*** <<< FUNC-DECLS [Int2] >>> ***/
113
114extern asn1_TYPE_descriptor_t asn1_DEF_Int2;
115asn_constr_check_f Int2_constraint;
116ber_type_decoder_f Int2_decode_ber;
117der_type_encoder_f Int2_encode_der;
118asn_struct_print_f Int2_print;
119asn_struct_free_f Int2_free;
120
121/*** <<< CODE [Int2] >>> ***/
122
123int
124Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
125 asn_app_consume_bytes_f *app_errlog, void *app_key) {
126
vlmb08de152004-08-22 03:30:05 +0000127 const Int1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000128 long value;
129
130 if(!sptr) {
131 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000132 "%s: value not given (%s:%d)",
133 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000134 return -1;
135 }
136
vlm34ce8ad2004-09-07 06:43:57 +0000137 /* Check if the sign bit is present */
138 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
vlm7d576b32004-08-20 13:37:45 +0000139
140 if((value >= 0)) {
141 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000142 return 0;
vlm7d576b32004-08-20 13:37:45 +0000143 } else {
144 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000145 "%s: constraint failed (%s:%d)",
146 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000147 return -1;
148 }
149}
150
151/*
152 * This type is implemented using Int1,
153 * so adjust the DEF appropriately.
154 */
155static void
156Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
157 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
158 td->der_encoder = asn1_DEF_Int1.der_encoder;
159 td->free_struct = asn1_DEF_Int1.free_struct;
160 td->print_struct = asn1_DEF_Int1.print_struct;
161 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
162 td->elements = asn1_DEF_Int1.elements;
163 td->elements_count = asn1_DEF_Int1.elements_count;
164 td->specifics = asn1_DEF_Int1.specifics;
165}
166
167ber_dec_rval_t
168Int2_decode_ber(asn1_TYPE_descriptor_t *td,
169 void **structure, void *bufptr, size_t size, int tag_mode) {
170 Int2_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000171 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000172}
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[] = {
vlm1308d2b2004-09-10 15:49:15 +0000200 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
vlm7d576b32004-08-20 13:37:45 +0000201};
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 */
vlm72425de2004-09-13 08:31:01 +0000213 asn1_DEF_Int2_tags, /* Same as above */
214 sizeof(asn1_DEF_Int2_tags)
215 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000216 -0, /* Unknown yet */
217 0, 0, /* No members */
218 0 /* No specifics */
219};
220
221
222/*** <<< INCLUDES [Int3] >>> ***/
223
224#include <Int2.h>
225
226/*** <<< TYPE-DECLS [Int3] >>> ***/
227
228
229typedef Int2_t Int3_t;
230
vlm7d576b32004-08-20 13:37:45 +0000231/*** <<< FUNC-DECLS [Int3] >>> ***/
232
233extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
234asn_constr_check_f Int3_constraint;
235ber_type_decoder_f Int3_decode_ber;
236der_type_encoder_f Int3_encode_der;
237asn_struct_print_f Int3_print;
238asn_struct_free_f Int3_free;
239
240/*** <<< CODE [Int3] >>> ***/
241
242int
243Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
244 asn_app_consume_bytes_f *app_errlog, void *app_key) {
245
vlmb08de152004-08-22 03:30:05 +0000246 const Int2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000247 long value;
248
249 if(!sptr) {
250 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000251 "%s: value not given (%s:%d)",
252 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000253 return -1;
254 }
255
256 if(asn1_INTEGER2long(st, &value)) {
257 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000258 "%s: value too large (%s:%d)",
259 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000260 return -1;
261 }
262
263 if((value >= 0 && value <= 10)) {
264 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000265 return 0;
vlm7d576b32004-08-20 13:37:45 +0000266 } else {
267 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000268 "%s: constraint failed (%s:%d)",
269 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000270 return -1;
271 }
272}
273
274/*
275 * This type is implemented using Int2,
276 * so adjust the DEF appropriately.
277 */
278static void
279Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
280 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
281 td->der_encoder = asn1_DEF_Int2.der_encoder;
282 td->free_struct = asn1_DEF_Int2.free_struct;
283 td->print_struct = asn1_DEF_Int2.print_struct;
284 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
285 td->elements = asn1_DEF_Int2.elements;
286 td->elements_count = asn1_DEF_Int2.elements_count;
287 td->specifics = asn1_DEF_Int2.specifics;
288}
289
290ber_dec_rval_t
291Int3_decode_ber(asn1_TYPE_descriptor_t *td,
292 void **structure, void *bufptr, size_t size, int tag_mode) {
293 Int3_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000294 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000295}
296
297der_enc_rval_t
298Int3_encode_der(asn1_TYPE_descriptor_t *td,
299 void *structure, int tag_mode, ber_tlv_tag_t tag,
300 asn_app_consume_bytes_f *cb, void *app_key) {
301 Int3_inherit_TYPE_descriptor(td);
302 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
303}
304
305int
306Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
307 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
308 Int3_inherit_TYPE_descriptor(td);
309 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
310}
311
312void
313Int3_free(asn1_TYPE_descriptor_t *td,
314 void *struct_ptr, int contents_only) {
315 Int3_inherit_TYPE_descriptor(td);
316 td->free_struct(td, struct_ptr, contents_only);
317}
318
319
320/*** <<< STAT-DEFS [Int3] >>> ***/
321
322static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +0000323 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
vlm7d576b32004-08-20 13:37:45 +0000324};
325asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
326 "Int3",
327 Int3_constraint,
328 Int3_decode_ber,
329 Int3_encode_der,
330 Int3_print,
331 Int3_free,
332 0, /* Use generic outmost tag fetcher */
333 asn1_DEF_Int3_tags,
334 sizeof(asn1_DEF_Int3_tags)
335 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +0000336 asn1_DEF_Int3_tags, /* Same as above */
337 sizeof(asn1_DEF_Int3_tags)
338 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000339 -0, /* Unknown yet */
340 0, 0, /* No members */
341 0 /* No specifics */
342};
343
344
345/*** <<< INCLUDES [Int4] >>> ***/
346
347#include <Int3.h>
348
349/*** <<< TYPE-DECLS [Int4] >>> ***/
350
351
352typedef Int3_t Int4_t;
353
vlm7d576b32004-08-20 13:37:45 +0000354/*** <<< FUNC-DECLS [Int4] >>> ***/
355
356extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
357asn_constr_check_f Int4_constraint;
358ber_type_decoder_f Int4_decode_ber;
359der_type_encoder_f Int4_encode_der;
360asn_struct_print_f Int4_print;
361asn_struct_free_f Int4_free;
362
363/*** <<< CODE [Int4] >>> ***/
364
365int
366Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
367 asn_app_consume_bytes_f *app_errlog, void *app_key) {
368
vlmb08de152004-08-22 03:30:05 +0000369 const Int3_t *st = sptr;
vlm26afd202004-08-25 02:08:08 +0000370 long value;
vlm7d576b32004-08-20 13:37:45 +0000371
372 if(!sptr) {
373 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000374 "%s: value not given (%s:%d)",
375 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000376 return -1;
377 }
378
vlm26afd202004-08-25 02:08:08 +0000379 if(asn1_INTEGER2long(st, &value)) {
380 _ASN_ERRLOG(app_errlog, app_key,
381 "%s: value too large (%s:%d)",
382 td->name, __FILE__, __LINE__);
383 return -1;
vlm7d576b32004-08-20 13:37:45 +0000384 }
385
vlm26afd202004-08-25 02:08:08 +0000386 if((value >= 1 && value <= 10)) {
387 /* Constraint check succeeded */
388 return 0;
389 } else {
390 _ASN_ERRLOG(app_errlog, app_key,
391 "%s: constraint failed (%s:%d)",
392 td->name, __FILE__, __LINE__);
393 return -1;
394 }
vlm7d576b32004-08-20 13:37:45 +0000395}
396
397/*
398 * This type is implemented using Int3,
399 * so adjust the DEF appropriately.
400 */
401static void
402Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
403 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
404 td->der_encoder = asn1_DEF_Int3.der_encoder;
405 td->free_struct = asn1_DEF_Int3.free_struct;
406 td->print_struct = asn1_DEF_Int3.print_struct;
407 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
408 td->elements = asn1_DEF_Int3.elements;
409 td->elements_count = asn1_DEF_Int3.elements_count;
410 td->specifics = asn1_DEF_Int3.specifics;
411}
412
413ber_dec_rval_t
414Int4_decode_ber(asn1_TYPE_descriptor_t *td,
415 void **structure, void *bufptr, size_t size, int tag_mode) {
416 Int4_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000417 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000418}
419
420der_enc_rval_t
421Int4_encode_der(asn1_TYPE_descriptor_t *td,
422 void *structure, int tag_mode, ber_tlv_tag_t tag,
423 asn_app_consume_bytes_f *cb, void *app_key) {
424 Int4_inherit_TYPE_descriptor(td);
425 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
426}
427
428int
429Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
430 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
431 Int4_inherit_TYPE_descriptor(td);
432 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
433}
434
435void
436Int4_free(asn1_TYPE_descriptor_t *td,
437 void *struct_ptr, int contents_only) {
438 Int4_inherit_TYPE_descriptor(td);
439 td->free_struct(td, struct_ptr, contents_only);
440}
441
442
443/*** <<< STAT-DEFS [Int4] >>> ***/
444
445static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +0000446 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
vlm7d576b32004-08-20 13:37:45 +0000447};
448asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
449 "Int4",
450 Int4_constraint,
451 Int4_decode_ber,
452 Int4_encode_der,
453 Int4_print,
454 Int4_free,
455 0, /* Use generic outmost tag fetcher */
456 asn1_DEF_Int4_tags,
457 sizeof(asn1_DEF_Int4_tags)
458 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +0000459 asn1_DEF_Int4_tags, /* Same as above */
460 sizeof(asn1_DEF_Int4_tags)
461 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000462 -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);
vlm1308d2b2004-09-10 15:49:15 +0000540 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000541}
542
543der_enc_rval_t
544Int5_encode_der(asn1_TYPE_descriptor_t *td,
545 void *structure, int tag_mode, ber_tlv_tag_t tag,
546 asn_app_consume_bytes_f *cb, void *app_key) {
547 Int5_inherit_TYPE_descriptor(td);
548 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
549}
550
551int
552Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
553 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
554 Int5_inherit_TYPE_descriptor(td);
555 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
556}
557
558void
559Int5_free(asn1_TYPE_descriptor_t *td,
560 void *struct_ptr, int contents_only) {
561 Int5_inherit_TYPE_descriptor(td);
562 td->free_struct(td, struct_ptr, contents_only);
563}
564
565
566/*** <<< STAT-DEFS [Int5] >>> ***/
567
568static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +0000569 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
vlm7d576b32004-08-20 13:37:45 +0000570};
571asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
572 "Int5",
573 Int5_constraint,
574 Int5_decode_ber,
575 Int5_encode_der,
576 Int5_print,
577 Int5_free,
578 0, /* Use generic outmost tag fetcher */
579 asn1_DEF_Int5_tags,
580 sizeof(asn1_DEF_Int5_tags)
581 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +0000582 asn1_DEF_Int5_tags, /* Same as above */
583 sizeof(asn1_DEF_Int5_tags)
584 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000585 -0, /* Unknown yet */
586 0, 0, /* No members */
587 0 /* No specifics */
588};
589
590
591/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
592
593#include <INTEGER.h>
594
595/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
596
597
598typedef INTEGER_t ExtensibleExtensions_t;
599
vlm7d576b32004-08-20 13:37:45 +0000600/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
601
602extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
603asn_constr_check_f ExtensibleExtensions_constraint;
604ber_type_decoder_f ExtensibleExtensions_decode_ber;
605der_type_encoder_f ExtensibleExtensions_encode_der;
606asn_struct_print_f ExtensibleExtensions_print;
607asn_struct_free_f ExtensibleExtensions_free;
608
609/*** <<< CODE [ExtensibleExtensions] >>> ***/
610
611int
612ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
613 asn_app_consume_bytes_f *app_errlog, void *app_key) {
614
vlmb08de152004-08-22 03:30:05 +0000615 const INTEGER_t *st = sptr;
vlm26afd202004-08-25 02:08:08 +0000616 long value;
vlm7d576b32004-08-20 13:37:45 +0000617
618 if(!sptr) {
619 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000620 "%s: value not given (%s:%d)",
621 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000622 return -1;
623 }
624
vlm26afd202004-08-25 02:08:08 +0000625 if(asn1_INTEGER2long(st, &value)) {
626 _ASN_ERRLOG(app_errlog, app_key,
627 "%s: value too large (%s:%d)",
628 td->name, __FILE__, __LINE__);
629 return -1;
vlm7d576b32004-08-20 13:37:45 +0000630 }
631
vlm26afd202004-08-25 02:08:08 +0000632 if((value >= 1 && value <= 256)) {
633 /* Constraint check succeeded */
634 return 0;
635 } else {
636 _ASN_ERRLOG(app_errlog, app_key,
637 "%s: constraint failed (%s:%d)",
638 td->name, __FILE__, __LINE__);
639 return -1;
640 }
vlm7d576b32004-08-20 13:37:45 +0000641}
642
643/*
644 * This type is implemented using INTEGER,
645 * so adjust the DEF appropriately.
646 */
647static void
648ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
649 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
650 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
651 td->free_struct = asn1_DEF_INTEGER.free_struct;
652 td->print_struct = asn1_DEF_INTEGER.print_struct;
653 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
654 td->elements = asn1_DEF_INTEGER.elements;
655 td->elements_count = asn1_DEF_INTEGER.elements_count;
656 td->specifics = asn1_DEF_INTEGER.specifics;
657}
658
659ber_dec_rval_t
660ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
661 void **structure, void *bufptr, size_t size, int tag_mode) {
662 ExtensibleExtensions_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000663 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000664}
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 */
vlm72425de2004-09-13 08:31:01 +0000705 asn1_DEF_ExtensibleExtensions_tags, /* Same as above */
706 sizeof(asn1_DEF_ExtensibleExtensions_tags)
707 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000708 -0, /* Unknown yet */
709 0, 0, /* No members */
710 0 /* No specifics */
711};
712
713
714/*** <<< INCLUDES [Str1] >>> ***/
715
716#include <IA5String.h>
717
718/*** <<< TYPE-DECLS [Str1] >>> ***/
719
720
721typedef IA5String_t Str1_t;
722
vlm7d576b32004-08-20 13:37:45 +0000723/*** <<< FUNC-DECLS [Str1] >>> ***/
724
725extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
726asn_constr_check_f Str1_constraint;
727ber_type_decoder_f Str1_decode_ber;
728der_type_encoder_f Str1_encode_der;
729asn_struct_print_f Str1_print;
730asn_struct_free_f Str1_free;
731
732/*** <<< CODE [Str1] >>> ***/
733
734int
735Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
736 asn_app_consume_bytes_f *app_errlog, void *app_key) {
737
738 /* Make the underlying type checker permanent */
739 td->check_constraints = asn1_DEF_IA5String.check_constraints;
740 return td->check_constraints
741 (td, sptr, app_errlog, app_key);
742}
743
744/*
745 * This type is implemented using IA5String,
746 * so adjust the DEF appropriately.
747 */
748static void
749Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
750 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
751 td->der_encoder = asn1_DEF_IA5String.der_encoder;
752 td->free_struct = asn1_DEF_IA5String.free_struct;
753 td->print_struct = asn1_DEF_IA5String.print_struct;
754 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
755 td->elements = asn1_DEF_IA5String.elements;
756 td->elements_count = asn1_DEF_IA5String.elements_count;
757 td->specifics = asn1_DEF_IA5String.specifics;
758}
759
760ber_dec_rval_t
761Str1_decode_ber(asn1_TYPE_descriptor_t *td,
762 void **structure, void *bufptr, size_t size, int tag_mode) {
763 Str1_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000764 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000765}
766
767der_enc_rval_t
768Str1_encode_der(asn1_TYPE_descriptor_t *td,
769 void *structure, int tag_mode, ber_tlv_tag_t tag,
770 asn_app_consume_bytes_f *cb, void *app_key) {
771 Str1_inherit_TYPE_descriptor(td);
772 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
773}
774
775int
776Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
777 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
778 Str1_inherit_TYPE_descriptor(td);
779 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
780}
781
782void
783Str1_free(asn1_TYPE_descriptor_t *td,
784 void *struct_ptr, int contents_only) {
785 Str1_inherit_TYPE_descriptor(td);
786 td->free_struct(td, struct_ptr, contents_only);
787}
788
789
790/*** <<< STAT-DEFS [Str1] >>> ***/
791
792static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
793 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
794};
795asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
796 "Str1",
797 Str1_constraint,
798 Str1_decode_ber,
799 Str1_encode_der,
800 Str1_print,
801 Str1_free,
802 0, /* Use generic outmost tag fetcher */
803 asn1_DEF_Str1_tags,
804 sizeof(asn1_DEF_Str1_tags)
805 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +0000806 asn1_DEF_Str1_tags, /* Same as above */
807 sizeof(asn1_DEF_Str1_tags)
808 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000809 -0, /* Unknown yet */
810 0, 0, /* No members */
811 0 /* No specifics */
812};
813
814
815/*** <<< INCLUDES [Str2] >>> ***/
816
817#include <Str1.h>
818
819/*** <<< TYPE-DECLS [Str2] >>> ***/
820
821
822typedef Str1_t Str2_t;
823
vlm7d576b32004-08-20 13:37:45 +0000824/*** <<< FUNC-DECLS [Str2] >>> ***/
825
826extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
827asn_constr_check_f Str2_constraint;
828ber_type_decoder_f Str2_decode_ber;
829der_type_encoder_f Str2_encode_der;
830asn_struct_print_f Str2_print;
831asn_struct_free_f Str2_free;
832
833/*** <<< CTABLES [Str2] >>> ***/
834
835static int check_permitted_alphabet_1(const void *sptr) {
836 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000837 const IA5String_t *st = sptr;
838 const uint8_t *ch = st->buf;
839 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000840
841 for(; ch < end; ch++) {
842 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000843 if(!(cv <= 127)) return -1;
vlm7d576b32004-08-20 13:37:45 +0000844 }
vlmcdf661b2004-08-22 12:47:03 +0000845 return 0;
vlm7d576b32004-08-20 13:37:45 +0000846}
847
848
849/*** <<< CODE [Str2] >>> ***/
850
851int
852Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
853 asn_app_consume_bytes_f *app_errlog, void *app_key) {
854
vlmb08de152004-08-22 03:30:05 +0000855 const Str1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +0000856 size_t size;
857
858 if(!sptr) {
859 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000860 "%s: value not given (%s:%d)",
861 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000862 return -1;
863 }
864
865 size = st->size;
866
867 if(((size <= 20) || (size >= 25 && size <= 30))
vlm7e20dfc2004-08-22 13:11:40 +0000868 && !check_permitted_alphabet_1(sptr)) {
vlm7d576b32004-08-20 13:37:45 +0000869 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +0000870 return 0;
vlm7d576b32004-08-20 13:37:45 +0000871 } else {
872 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +0000873 "%s: constraint failed (%s:%d)",
874 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +0000875 return -1;
876 }
877}
878
879/*
880 * This type is implemented using Str1,
881 * so adjust the DEF appropriately.
882 */
883static void
884Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
885 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
886 td->der_encoder = asn1_DEF_Str1.der_encoder;
887 td->free_struct = asn1_DEF_Str1.free_struct;
888 td->print_struct = asn1_DEF_Str1.print_struct;
889 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
890 td->elements = asn1_DEF_Str1.elements;
891 td->elements_count = asn1_DEF_Str1.elements_count;
892 td->specifics = asn1_DEF_Str1.specifics;
893}
894
895ber_dec_rval_t
896Str2_decode_ber(asn1_TYPE_descriptor_t *td,
897 void **structure, void *bufptr, size_t size, int tag_mode) {
898 Str2_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +0000899 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +0000900}
901
902der_enc_rval_t
903Str2_encode_der(asn1_TYPE_descriptor_t *td,
904 void *structure, int tag_mode, ber_tlv_tag_t tag,
905 asn_app_consume_bytes_f *cb, void *app_key) {
906 Str2_inherit_TYPE_descriptor(td);
907 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
908}
909
910int
911Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
912 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
913 Str2_inherit_TYPE_descriptor(td);
914 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
915}
916
917void
918Str2_free(asn1_TYPE_descriptor_t *td,
919 void *struct_ptr, int contents_only) {
920 Str2_inherit_TYPE_descriptor(td);
921 td->free_struct(td, struct_ptr, contents_only);
922}
923
924
925/*** <<< STAT-DEFS [Str2] >>> ***/
926
927static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +0000928 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +0000929};
930asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
931 "Str2",
932 Str2_constraint,
933 Str2_decode_ber,
934 Str2_encode_der,
935 Str2_print,
936 Str2_free,
937 0, /* Use generic outmost tag fetcher */
938 asn1_DEF_Str2_tags,
939 sizeof(asn1_DEF_Str2_tags)
940 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +0000941 asn1_DEF_Str2_tags, /* Same as above */
942 sizeof(asn1_DEF_Str2_tags)
943 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +0000944 -0, /* Unknown yet */
945 0, 0, /* No members */
946 0 /* No specifics */
947};
948
949
950/*** <<< INCLUDES [Str3] >>> ***/
951
952#include <Str2.h>
953
954/*** <<< TYPE-DECLS [Str3] >>> ***/
955
956
957typedef Str2_t Str3_t;
958
vlm7d576b32004-08-20 13:37:45 +0000959/*** <<< FUNC-DECLS [Str3] >>> ***/
960
961extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
962asn_constr_check_f Str3_constraint;
963ber_type_decoder_f Str3_decode_ber;
964der_type_encoder_f Str3_encode_der;
965asn_struct_print_f Str3_print;
966asn_struct_free_f Str3_free;
967
968/*** <<< CTABLES [Str3] >>> ***/
969
970static int permitted_alphabet_table_2[256] = {
9710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9730,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9740,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9750,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9770,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
978};
979
980static int check_permitted_alphabet_2(const void *sptr) {
981 int *table = permitted_alphabet_table_2;
982 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +0000983 const IA5String_t *st = sptr;
984 const uint8_t *ch = st->buf;
985 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +0000986
987 for(; ch < end; ch++) {
988 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +0000989 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +0000990 }
vlmcdf661b2004-08-22 12:47:03 +0000991 return 0;
vlm7d576b32004-08-20 13:37:45 +0000992}
993
994
995/*** <<< CODE [Str3] >>> ***/
996
997int
998Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
999 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1000
vlmb08de152004-08-22 03:30:05 +00001001 const Str2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001002 size_t size;
1003
1004 if(!sptr) {
1005 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001006 "%s: value not given (%s:%d)",
1007 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001008 return -1;
1009 }
1010
1011 size = st->size;
1012
1013 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
vlm7e20dfc2004-08-22 13:11:40 +00001014 && !check_permitted_alphabet_2(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001015 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001016 return 0;
vlm7d576b32004-08-20 13:37:45 +00001017 } else {
1018 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001019 "%s: constraint failed (%s:%d)",
1020 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001021 return -1;
1022 }
1023}
1024
1025/*
1026 * This type is implemented using Str2,
1027 * so adjust the DEF appropriately.
1028 */
1029static void
1030Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1031 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1032 td->der_encoder = asn1_DEF_Str2.der_encoder;
1033 td->free_struct = asn1_DEF_Str2.free_struct;
1034 td->print_struct = asn1_DEF_Str2.print_struct;
1035 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1036 td->elements = asn1_DEF_Str2.elements;
1037 td->elements_count = asn1_DEF_Str2.elements_count;
1038 td->specifics = asn1_DEF_Str2.specifics;
1039}
1040
1041ber_dec_rval_t
1042Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1043 void **structure, void *bufptr, size_t size, int tag_mode) {
1044 Str3_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001045 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001046}
1047
1048der_enc_rval_t
1049Str3_encode_der(asn1_TYPE_descriptor_t *td,
1050 void *structure, int tag_mode, ber_tlv_tag_t tag,
1051 asn_app_consume_bytes_f *cb, void *app_key) {
1052 Str3_inherit_TYPE_descriptor(td);
1053 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1054}
1055
1056int
1057Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1058 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1059 Str3_inherit_TYPE_descriptor(td);
1060 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1061}
1062
1063void
1064Str3_free(asn1_TYPE_descriptor_t *td,
1065 void *struct_ptr, int contents_only) {
1066 Str3_inherit_TYPE_descriptor(td);
1067 td->free_struct(td, struct_ptr, contents_only);
1068}
1069
1070
1071/*** <<< STAT-DEFS [Str3] >>> ***/
1072
1073static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00001074 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00001075};
1076asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1077 "Str3",
1078 Str3_constraint,
1079 Str3_decode_ber,
1080 Str3_encode_der,
1081 Str3_print,
1082 Str3_free,
1083 0, /* Use generic outmost tag fetcher */
1084 asn1_DEF_Str3_tags,
1085 sizeof(asn1_DEF_Str3_tags)
1086 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001087 asn1_DEF_Str3_tags, /* Same as above */
1088 sizeof(asn1_DEF_Str3_tags)
1089 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001090 -0, /* Unknown yet */
1091 0, 0, /* No members */
1092 0 /* No specifics */
1093};
1094
1095
vlm25e12932004-09-10 06:07:39 +00001096/*** <<< INCLUDES [Str4] >>> ***/
1097
1098#include <IA5String.h>
1099
1100/*** <<< TYPE-DECLS [Str4] >>> ***/
1101
1102
1103typedef IA5String_t Str4_t;
1104
1105/*** <<< FUNC-DECLS [Str4] >>> ***/
1106
1107extern asn1_TYPE_descriptor_t asn1_DEF_Str4;
1108asn_constr_check_f Str4_constraint;
1109ber_type_decoder_f Str4_decode_ber;
1110der_type_encoder_f Str4_encode_der;
1111asn_struct_print_f Str4_print;
1112asn_struct_free_f Str4_free;
1113
1114/*** <<< CTABLES [Str4] >>> ***/
1115
1116static int check_permitted_alphabet_3(const void *sptr) {
1117 /* The underlying type is IA5String */
1118 const IA5String_t *st = sptr;
1119 const uint8_t *ch = st->buf;
1120 const uint8_t *end = ch + st->size;
1121
1122 for(; ch < end; ch++) {
1123 uint8_t cv = *ch;
1124 if(!(cv <= 127)) return -1;
1125 }
1126 return 0;
1127}
1128
1129
1130/*** <<< CODE [Str4] >>> ***/
1131
1132int
1133Str4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1134 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1135
1136 const IA5String_t *st = sptr;
1137
1138 if(!sptr) {
1139 _ASN_ERRLOG(app_errlog, app_key,
1140 "%s: value not given (%s:%d)",
1141 td->name, __FILE__, __LINE__);
1142 return -1;
1143 }
1144
1145
1146 if(!check_permitted_alphabet_3(sptr)) {
1147 /* Constraint check succeeded */
1148 return 0;
1149 } else {
1150 _ASN_ERRLOG(app_errlog, app_key,
1151 "%s: constraint failed (%s:%d)",
1152 td->name, __FILE__, __LINE__);
1153 return -1;
1154 }
1155}
1156
1157/*
1158 * This type is implemented using IA5String,
1159 * so adjust the DEF appropriately.
1160 */
1161static void
1162Str4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1163 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1164 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1165 td->free_struct = asn1_DEF_IA5String.free_struct;
1166 td->print_struct = asn1_DEF_IA5String.print_struct;
1167 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1168 td->elements = asn1_DEF_IA5String.elements;
1169 td->elements_count = asn1_DEF_IA5String.elements_count;
1170 td->specifics = asn1_DEF_IA5String.specifics;
1171}
1172
1173ber_dec_rval_t
1174Str4_decode_ber(asn1_TYPE_descriptor_t *td,
1175 void **structure, void *bufptr, size_t size, int tag_mode) {
1176 Str4_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001177 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm25e12932004-09-10 06:07:39 +00001178}
1179
1180der_enc_rval_t
1181Str4_encode_der(asn1_TYPE_descriptor_t *td,
1182 void *structure, int tag_mode, ber_tlv_tag_t tag,
1183 asn_app_consume_bytes_f *cb, void *app_key) {
1184 Str4_inherit_TYPE_descriptor(td);
1185 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1186}
1187
1188int
1189Str4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1190 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1191 Str4_inherit_TYPE_descriptor(td);
1192 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1193}
1194
1195void
1196Str4_free(asn1_TYPE_descriptor_t *td,
1197 void *struct_ptr, int contents_only) {
1198 Str4_inherit_TYPE_descriptor(td);
1199 td->free_struct(td, struct_ptr, contents_only);
1200}
1201
1202
1203/*** <<< STAT-DEFS [Str4] >>> ***/
1204
1205static ber_tlv_tag_t asn1_DEF_Str4_tags[] = {
1206 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1207};
1208asn1_TYPE_descriptor_t asn1_DEF_Str4 = {
1209 "Str4",
1210 Str4_constraint,
1211 Str4_decode_ber,
1212 Str4_encode_der,
1213 Str4_print,
1214 Str4_free,
1215 0, /* Use generic outmost tag fetcher */
1216 asn1_DEF_Str4_tags,
1217 sizeof(asn1_DEF_Str4_tags)
1218 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001219 asn1_DEF_Str4_tags, /* Same as above */
1220 sizeof(asn1_DEF_Str4_tags)
1221 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
vlm25e12932004-09-10 06:07:39 +00001222 -0, /* Unknown yet */
1223 0, 0, /* No members */
1224 0 /* No specifics */
1225};
1226
1227
vlm7d576b32004-08-20 13:37:45 +00001228/*** <<< INCLUDES [PER-Visible] >>> ***/
1229
1230#include <IA5String.h>
1231
1232/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1233
1234
1235typedef IA5String_t PER_Visible_t;
1236
vlm7d576b32004-08-20 13:37:45 +00001237/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1238
1239extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1240asn_constr_check_f PER_Visible_constraint;
1241ber_type_decoder_f PER_Visible_decode_ber;
1242der_type_encoder_f PER_Visible_encode_der;
1243asn_struct_print_f PER_Visible_print;
1244asn_struct_free_f PER_Visible_free;
1245
1246/*** <<< CTABLES [PER-Visible] >>> ***/
1247
vlm25e12932004-09-10 06:07:39 +00001248static int check_permitted_alphabet_4(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001249 /* The underlying type is IA5String */
vlm4fdaead2004-08-21 07:34:17 +00001250 const IA5String_t *st = sptr;
vlmb08de152004-08-22 03:30:05 +00001251 const uint8_t *ch = st->buf;
1252 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001253
1254 for(; ch < end; ch++) {
1255 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001256 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001257 }
vlmcdf661b2004-08-22 12:47:03 +00001258 return 0;
vlm7d576b32004-08-20 13:37:45 +00001259}
1260
1261
1262/*** <<< CODE [PER-Visible] >>> ***/
1263
1264int
1265PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1266 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1267
vlmb08de152004-08-22 03:30:05 +00001268 const IA5String_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001269
1270 if(!sptr) {
1271 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001272 "%s: value not given (%s:%d)",
1273 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001274 return -1;
1275 }
1276
1277
vlm25e12932004-09-10 06:07:39 +00001278 if(!check_permitted_alphabet_4(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001279 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001280 return 0;
vlm7d576b32004-08-20 13:37:45 +00001281 } else {
1282 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001283 "%s: constraint failed (%s:%d)",
1284 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001285 return -1;
1286 }
1287}
1288
1289/*
1290 * This type is implemented using IA5String,
1291 * so adjust the DEF appropriately.
1292 */
1293static void
1294PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1295 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1296 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1297 td->free_struct = asn1_DEF_IA5String.free_struct;
1298 td->print_struct = asn1_DEF_IA5String.print_struct;
1299 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1300 td->elements = asn1_DEF_IA5String.elements;
1301 td->elements_count = asn1_DEF_IA5String.elements_count;
1302 td->specifics = asn1_DEF_IA5String.specifics;
1303}
1304
1305ber_dec_rval_t
1306PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1307 void **structure, void *bufptr, size_t size, int tag_mode) {
1308 PER_Visible_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001309 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001310}
1311
1312der_enc_rval_t
1313PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1314 void *structure, int tag_mode, ber_tlv_tag_t tag,
1315 asn_app_consume_bytes_f *cb, void *app_key) {
1316 PER_Visible_inherit_TYPE_descriptor(td);
1317 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1318}
1319
1320int
1321PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1322 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1323 PER_Visible_inherit_TYPE_descriptor(td);
1324 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1325}
1326
1327void
1328PER_Visible_free(asn1_TYPE_descriptor_t *td,
1329 void *struct_ptr, int contents_only) {
1330 PER_Visible_inherit_TYPE_descriptor(td);
1331 td->free_struct(td, struct_ptr, contents_only);
1332}
1333
1334
1335/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1336
1337static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1338 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1339};
1340asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1341 "PER-Visible",
1342 PER_Visible_constraint,
1343 PER_Visible_decode_ber,
1344 PER_Visible_encode_der,
1345 PER_Visible_print,
1346 PER_Visible_free,
1347 0, /* Use generic outmost tag fetcher */
1348 asn1_DEF_PER_Visible_tags,
1349 sizeof(asn1_DEF_PER_Visible_tags)
1350 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001351 asn1_DEF_PER_Visible_tags, /* Same as above */
1352 sizeof(asn1_DEF_PER_Visible_tags)
1353 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001354 -0, /* Unknown yet */
1355 0, 0, /* No members */
1356 0 /* No specifics */
1357};
1358
1359
1360/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1361
1362#include <PER-Visible.h>
1363
1364/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1365
1366
1367typedef PER_Visible_t PER_Visible_2_t;
1368
vlm7d576b32004-08-20 13:37:45 +00001369/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1370
1371extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1372asn_constr_check_f PER_Visible_2_constraint;
1373ber_type_decoder_f PER_Visible_2_decode_ber;
1374der_type_encoder_f PER_Visible_2_encode_der;
1375asn_struct_print_f PER_Visible_2_print;
1376asn_struct_free_f PER_Visible_2_free;
1377
1378/*** <<< CTABLES [PER-Visible-2] >>> ***/
1379
vlm25e12932004-09-10 06:07:39 +00001380static int check_permitted_alphabet_5(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001381 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001382 const IA5String_t *st = sptr;
1383 const uint8_t *ch = st->buf;
1384 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001385
1386 for(; ch < end; ch++) {
1387 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001388 if(!(cv >= 69 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001389 }
vlmcdf661b2004-08-22 12:47:03 +00001390 return 0;
vlm7d576b32004-08-20 13:37:45 +00001391}
1392
1393
1394/*** <<< CODE [PER-Visible-2] >>> ***/
1395
1396int
1397PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1398 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1399
vlmb08de152004-08-22 03:30:05 +00001400 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001401
1402 if(!sptr) {
1403 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001404 "%s: value not given (%s:%d)",
1405 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001406 return -1;
1407 }
1408
1409
vlm25e12932004-09-10 06:07:39 +00001410 if(!check_permitted_alphabet_5(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001411 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001412 return 0;
vlm7d576b32004-08-20 13:37:45 +00001413 } else {
1414 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001415 "%s: constraint failed (%s:%d)",
1416 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001417 return -1;
1418 }
1419}
1420
1421/*
1422 * This type is implemented using PER_Visible,
1423 * so adjust the DEF appropriately.
1424 */
1425static void
1426PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1427 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1428 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1429 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1430 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1431 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1432 td->elements = asn1_DEF_PER_Visible.elements;
1433 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1434 td->specifics = asn1_DEF_PER_Visible.specifics;
1435}
1436
1437ber_dec_rval_t
1438PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1439 void **structure, void *bufptr, size_t size, int tag_mode) {
1440 PER_Visible_2_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001441 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001442}
1443
1444der_enc_rval_t
1445PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1446 void *structure, int tag_mode, ber_tlv_tag_t tag,
1447 asn_app_consume_bytes_f *cb, void *app_key) {
1448 PER_Visible_2_inherit_TYPE_descriptor(td);
1449 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1450}
1451
1452int
1453PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1454 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1455 PER_Visible_2_inherit_TYPE_descriptor(td);
1456 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1457}
1458
1459void
1460PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1461 void *struct_ptr, int contents_only) {
1462 PER_Visible_2_inherit_TYPE_descriptor(td);
1463 td->free_struct(td, struct_ptr, contents_only);
1464}
1465
1466
1467/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1468
1469static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00001470 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00001471};
1472asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1473 "PER-Visible-2",
1474 PER_Visible_2_constraint,
1475 PER_Visible_2_decode_ber,
1476 PER_Visible_2_encode_der,
1477 PER_Visible_2_print,
1478 PER_Visible_2_free,
1479 0, /* Use generic outmost tag fetcher */
1480 asn1_DEF_PER_Visible_2_tags,
1481 sizeof(asn1_DEF_PER_Visible_2_tags)
1482 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001483 asn1_DEF_PER_Visible_2_tags, /* Same as above */
1484 sizeof(asn1_DEF_PER_Visible_2_tags)
1485 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001486 -0, /* Unknown yet */
1487 0, 0, /* No members */
1488 0 /* No specifics */
1489};
1490
1491
1492/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1493
1494#include <PER-Visible.h>
1495
1496/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1497
1498
1499typedef PER_Visible_t Not_PER_Visible_1_t;
1500
vlm7d576b32004-08-20 13:37:45 +00001501/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1502
1503extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1504asn_constr_check_f Not_PER_Visible_1_constraint;
1505ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1506der_type_encoder_f Not_PER_Visible_1_encode_der;
1507asn_struct_print_f Not_PER_Visible_1_print;
1508asn_struct_free_f Not_PER_Visible_1_free;
1509
1510/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1511
vlm25e12932004-09-10 06:07:39 +00001512static int check_permitted_alphabet_6(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001513 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001514 const IA5String_t *st = sptr;
1515 const uint8_t *ch = st->buf;
1516 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001517
1518 for(; ch < end; ch++) {
1519 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00001520 if(!(cv >= 65 && cv <= 70)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001521 }
vlmcdf661b2004-08-22 12:47:03 +00001522 return 0;
vlm7d576b32004-08-20 13:37:45 +00001523}
1524
1525
1526/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1527
1528int
1529Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1530 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1531
vlmb08de152004-08-22 03:30:05 +00001532 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001533
1534 if(!sptr) {
1535 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001536 "%s: value not given (%s:%d)",
1537 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001538 return -1;
1539 }
1540
1541
vlm25e12932004-09-10 06:07:39 +00001542 if(!check_permitted_alphabet_6(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001543 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001544 return 0;
vlm7d576b32004-08-20 13:37:45 +00001545 } else {
1546 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001547 "%s: constraint failed (%s:%d)",
1548 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001549 return -1;
1550 }
1551}
1552
1553/*
1554 * This type is implemented using PER_Visible,
1555 * so adjust the DEF appropriately.
1556 */
1557static void
1558Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1559 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1560 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1561 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1562 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1563 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1564 td->elements = asn1_DEF_PER_Visible.elements;
1565 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1566 td->specifics = asn1_DEF_PER_Visible.specifics;
1567}
1568
1569ber_dec_rval_t
1570Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1571 void **structure, void *bufptr, size_t size, int tag_mode) {
1572 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001573 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001574}
1575
1576der_enc_rval_t
1577Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1578 void *structure, int tag_mode, ber_tlv_tag_t tag,
1579 asn_app_consume_bytes_f *cb, void *app_key) {
1580 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1581 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1582}
1583
1584int
1585Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1586 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1587 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1588 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1589}
1590
1591void
1592Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1593 void *struct_ptr, int contents_only) {
1594 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1595 td->free_struct(td, struct_ptr, contents_only);
1596}
1597
1598
1599/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1600
1601static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00001602 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00001603};
1604asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1605 "Not-PER-Visible-1",
1606 Not_PER_Visible_1_constraint,
1607 Not_PER_Visible_1_decode_ber,
1608 Not_PER_Visible_1_encode_der,
1609 Not_PER_Visible_1_print,
1610 Not_PER_Visible_1_free,
1611 0, /* Use generic outmost tag fetcher */
1612 asn1_DEF_Not_PER_Visible_1_tags,
1613 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1614 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001615 asn1_DEF_Not_PER_Visible_1_tags, /* Same as above */
1616 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1617 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001618 -0, /* Unknown yet */
1619 0, 0, /* No members */
1620 0 /* No specifics */
1621};
1622
1623
1624/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1625
1626#include <PER-Visible.h>
1627
1628/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1629
1630
1631typedef PER_Visible_t Not_PER_Visible_2_t;
1632
vlm7d576b32004-08-20 13:37:45 +00001633/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1634
1635extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1636asn_constr_check_f Not_PER_Visible_2_constraint;
1637ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1638der_type_encoder_f Not_PER_Visible_2_encode_der;
1639asn_struct_print_f Not_PER_Visible_2_print;
1640asn_struct_free_f Not_PER_Visible_2_free;
1641
vlm26afd202004-08-25 02:08:08 +00001642/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1643
vlm25e12932004-09-10 06:07:39 +00001644static int check_permitted_alphabet_7(const void *sptr) {
vlm26afd202004-08-25 02:08:08 +00001645 /* The underlying type is IA5String */
1646 const IA5String_t *st = sptr;
1647 const uint8_t *ch = st->buf;
1648 const uint8_t *end = ch + st->size;
1649
1650 for(; ch < end; ch++) {
1651 uint8_t cv = *ch;
1652 if(!(cv >= 65 && cv <= 66)) return -1;
1653 }
1654 return 0;
1655}
1656
1657
vlm7d576b32004-08-20 13:37:45 +00001658/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1659
1660int
1661Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1662 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1663
vlmb08de152004-08-22 03:30:05 +00001664 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001665
1666 if(!sptr) {
1667 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001668 "%s: value not given (%s:%d)",
1669 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001670 return -1;
1671 }
1672
1673
vlm25e12932004-09-10 06:07:39 +00001674 if(!check_permitted_alphabet_7(sptr)) {
vlm26afd202004-08-25 02:08:08 +00001675 /* Constraint check succeeded */
1676 return 0;
1677 } else {
1678 _ASN_ERRLOG(app_errlog, app_key,
1679 "%s: constraint failed (%s:%d)",
1680 td->name, __FILE__, __LINE__);
1681 return -1;
vlm7d576b32004-08-20 13:37:45 +00001682 }
vlm7d576b32004-08-20 13:37:45 +00001683}
1684
1685/*
1686 * This type is implemented using PER_Visible,
1687 * so adjust the DEF appropriately.
1688 */
1689static void
1690Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1691 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1692 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1693 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1694 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1695 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1696 td->elements = asn1_DEF_PER_Visible.elements;
1697 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1698 td->specifics = asn1_DEF_PER_Visible.specifics;
1699}
1700
1701ber_dec_rval_t
1702Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1703 void **structure, void *bufptr, size_t size, int tag_mode) {
1704 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001705 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001706}
1707
1708der_enc_rval_t
1709Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1710 void *structure, int tag_mode, ber_tlv_tag_t tag,
1711 asn_app_consume_bytes_f *cb, void *app_key) {
1712 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1713 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1714}
1715
1716int
1717Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1718 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1719 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1720 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1721}
1722
1723void
1724Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1725 void *struct_ptr, int contents_only) {
1726 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1727 td->free_struct(td, struct_ptr, contents_only);
1728}
1729
1730
1731/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1732
1733static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00001734 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00001735};
1736asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1737 "Not-PER-Visible-2",
1738 Not_PER_Visible_2_constraint,
1739 Not_PER_Visible_2_decode_ber,
1740 Not_PER_Visible_2_encode_der,
1741 Not_PER_Visible_2_print,
1742 Not_PER_Visible_2_free,
1743 0, /* Use generic outmost tag fetcher */
1744 asn1_DEF_Not_PER_Visible_2_tags,
1745 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1746 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001747 asn1_DEF_Not_PER_Visible_2_tags, /* Same as above */
1748 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1749 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001750 -0, /* Unknown yet */
1751 0, 0, /* No members */
1752 0 /* No specifics */
1753};
1754
1755
1756/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1757
1758#include <PER-Visible.h>
1759
1760/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1761
1762
1763typedef PER_Visible_t Not_PER_Visible_3_t;
1764
vlm7d576b32004-08-20 13:37:45 +00001765/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1766
1767extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1768asn_constr_check_f Not_PER_Visible_3_constraint;
1769ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1770der_type_encoder_f Not_PER_Visible_3_encode_der;
1771asn_struct_print_f Not_PER_Visible_3_print;
1772asn_struct_free_f Not_PER_Visible_3_free;
1773
vlm26afd202004-08-25 02:08:08 +00001774/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1775
vlm25e12932004-09-10 06:07:39 +00001776static int check_permitted_alphabet_8(const void *sptr) {
vlm26afd202004-08-25 02:08:08 +00001777 /* The underlying type is IA5String */
1778 const IA5String_t *st = sptr;
1779 const uint8_t *ch = st->buf;
1780 const uint8_t *end = ch + st->size;
1781
1782 for(; ch < end; ch++) {
1783 uint8_t cv = *ch;
1784 if(!(cv >= 65 && cv <= 66)) return -1;
1785 }
1786 return 0;
1787}
1788
1789
vlm7d576b32004-08-20 13:37:45 +00001790/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1791
1792int
1793Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1794 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1795
vlmb08de152004-08-22 03:30:05 +00001796 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001797
1798 if(!sptr) {
1799 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001800 "%s: value not given (%s:%d)",
1801 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001802 return -1;
1803 }
1804
1805
vlm25e12932004-09-10 06:07:39 +00001806 if(!check_permitted_alphabet_8(sptr)) {
vlm26afd202004-08-25 02:08:08 +00001807 /* Constraint check succeeded */
1808 return 0;
1809 } else {
1810 _ASN_ERRLOG(app_errlog, app_key,
1811 "%s: constraint failed (%s:%d)",
1812 td->name, __FILE__, __LINE__);
1813 return -1;
vlm7d576b32004-08-20 13:37:45 +00001814 }
vlm7d576b32004-08-20 13:37:45 +00001815}
1816
1817/*
1818 * This type is implemented using PER_Visible,
1819 * so adjust the DEF appropriately.
1820 */
1821static void
1822Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1823 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1824 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1825 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1826 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1827 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1828 td->elements = asn1_DEF_PER_Visible.elements;
1829 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1830 td->specifics = asn1_DEF_PER_Visible.specifics;
1831}
1832
1833ber_dec_rval_t
1834Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1835 void **structure, void *bufptr, size_t size, int tag_mode) {
1836 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001837 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001838}
1839
1840der_enc_rval_t
1841Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1842 void *structure, int tag_mode, ber_tlv_tag_t tag,
1843 asn_app_consume_bytes_f *cb, void *app_key) {
1844 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1845 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1846}
1847
1848int
1849Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1850 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1851 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1852 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1853}
1854
1855void
1856Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1857 void *struct_ptr, int contents_only) {
1858 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1859 td->free_struct(td, struct_ptr, contents_only);
1860}
1861
1862
1863/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1864
1865static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00001866 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00001867};
1868asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1869 "Not-PER-Visible-3",
1870 Not_PER_Visible_3_constraint,
1871 Not_PER_Visible_3_decode_ber,
1872 Not_PER_Visible_3_encode_der,
1873 Not_PER_Visible_3_print,
1874 Not_PER_Visible_3_free,
1875 0, /* Use generic outmost tag fetcher */
1876 asn1_DEF_Not_PER_Visible_3_tags,
1877 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1878 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00001879 asn1_DEF_Not_PER_Visible_3_tags, /* Same as above */
1880 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1881 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00001882 -0, /* Unknown yet */
1883 0, 0, /* No members */
1884 0 /* No specifics */
1885};
1886
1887
1888/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1889
1890#include <PER-Visible.h>
1891
1892/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1893
1894
1895typedef PER_Visible_t SIZE_but_not_FROM_t;
1896
vlm7d576b32004-08-20 13:37:45 +00001897/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1898
1899extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1900asn_constr_check_f SIZE_but_not_FROM_constraint;
1901ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1902der_type_encoder_f SIZE_but_not_FROM_encode_der;
1903asn_struct_print_f SIZE_but_not_FROM_print;
1904asn_struct_free_f SIZE_but_not_FROM_free;
1905
1906/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1907
vlm25e12932004-09-10 06:07:39 +00001908static int check_permitted_alphabet_9(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00001909 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00001910 const IA5String_t *st = sptr;
1911 const uint8_t *ch = st->buf;
1912 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00001913
1914 for(; ch < end; ch++) {
1915 uint8_t cv = *ch;
vlm26afd202004-08-25 02:08:08 +00001916 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00001917 }
vlmcdf661b2004-08-22 12:47:03 +00001918 return 0;
vlm7d576b32004-08-20 13:37:45 +00001919}
1920
1921
1922/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1923
1924int
1925SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1926 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1927
vlmb08de152004-08-22 03:30:05 +00001928 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00001929 size_t size;
1930
1931 if(!sptr) {
1932 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001933 "%s: value not given (%s:%d)",
1934 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001935 return -1;
1936 }
1937
1938 size = st->size;
1939
1940 if((size >= 1 && size <= 4)
vlm25e12932004-09-10 06:07:39 +00001941 && !check_permitted_alphabet_9(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00001942 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00001943 return 0;
vlm7d576b32004-08-20 13:37:45 +00001944 } else {
1945 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00001946 "%s: constraint failed (%s:%d)",
1947 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00001948 return -1;
1949 }
1950}
1951
1952/*
1953 * This type is implemented using PER_Visible,
1954 * so adjust the DEF appropriately.
1955 */
1956static void
1957SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1958 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1959 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1960 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1961 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1962 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1963 td->elements = asn1_DEF_PER_Visible.elements;
1964 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1965 td->specifics = asn1_DEF_PER_Visible.specifics;
1966}
1967
1968ber_dec_rval_t
1969SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1970 void **structure, void *bufptr, size_t size, int tag_mode) {
1971 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00001972 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00001973}
1974
1975der_enc_rval_t
1976SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1977 void *structure, int tag_mode, ber_tlv_tag_t tag,
1978 asn_app_consume_bytes_f *cb, void *app_key) {
1979 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1980 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1981}
1982
1983int
1984SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1985 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1986 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1987 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1988}
1989
1990void
1991SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1992 void *struct_ptr, int contents_only) {
1993 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1994 td->free_struct(td, struct_ptr, contents_only);
1995}
1996
1997
1998/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1999
2000static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00002001 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00002002};
2003asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
2004 "SIZE-but-not-FROM",
2005 SIZE_but_not_FROM_constraint,
2006 SIZE_but_not_FROM_decode_ber,
2007 SIZE_but_not_FROM_encode_der,
2008 SIZE_but_not_FROM_print,
2009 SIZE_but_not_FROM_free,
2010 0, /* Use generic outmost tag fetcher */
2011 asn1_DEF_SIZE_but_not_FROM_tags,
2012 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
2013 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002014 asn1_DEF_SIZE_but_not_FROM_tags, /* Same as above */
2015 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
2016 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002017 -0, /* Unknown yet */
2018 0, 0, /* No members */
2019 0 /* No specifics */
2020};
2021
2022
2023/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2024
2025#include <PER-Visible.h>
2026
2027/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2028
2029
2030typedef PER_Visible_t SIZE_and_FROM_t;
2031
vlm7d576b32004-08-20 13:37:45 +00002032/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2033
2034extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
2035asn_constr_check_f SIZE_and_FROM_constraint;
2036ber_type_decoder_f SIZE_and_FROM_decode_ber;
2037der_type_encoder_f SIZE_and_FROM_encode_der;
2038asn_struct_print_f SIZE_and_FROM_print;
2039asn_struct_free_f SIZE_and_FROM_free;
2040
2041/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2042
vlm25e12932004-09-10 06:07:39 +00002043static int check_permitted_alphabet_10(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00002044 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00002045 const IA5String_t *st = sptr;
2046 const uint8_t *ch = st->buf;
2047 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002048
2049 for(; ch < end; ch++) {
2050 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002051 if(!(cv >= 65 && cv <= 68)) return -1;
vlm7d576b32004-08-20 13:37:45 +00002052 }
vlmcdf661b2004-08-22 12:47:03 +00002053 return 0;
vlm7d576b32004-08-20 13:37:45 +00002054}
2055
2056
2057/*** <<< CODE [SIZE-and-FROM] >>> ***/
2058
2059int
2060SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2061 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2062
vlmb08de152004-08-22 03:30:05 +00002063 const PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002064 size_t size;
2065
2066 if(!sptr) {
2067 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002068 "%s: value not given (%s:%d)",
2069 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002070 return -1;
2071 }
2072
2073 size = st->size;
2074
2075 if((size >= 1 && size <= 4)
vlm25e12932004-09-10 06:07:39 +00002076 && !check_permitted_alphabet_10(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002077 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002078 return 0;
vlm7d576b32004-08-20 13:37:45 +00002079 } else {
2080 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002081 "%s: constraint failed (%s:%d)",
2082 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002083 return -1;
2084 }
2085}
2086
2087/*
2088 * This type is implemented using PER_Visible,
2089 * so adjust the DEF appropriately.
2090 */
2091static void
2092SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2093 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2094 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2095 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2096 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2097 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2098 td->elements = asn1_DEF_PER_Visible.elements;
2099 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2100 td->specifics = asn1_DEF_PER_Visible.specifics;
2101}
2102
2103ber_dec_rval_t
2104SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2105 void **structure, void *bufptr, size_t size, int tag_mode) {
2106 SIZE_and_FROM_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00002107 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00002108}
2109
2110der_enc_rval_t
2111SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2112 void *structure, int tag_mode, ber_tlv_tag_t tag,
2113 asn_app_consume_bytes_f *cb, void *app_key) {
2114 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2115 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2116}
2117
2118int
2119SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2120 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2121 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2122 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2123}
2124
2125void
2126SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
2127 void *struct_ptr, int contents_only) {
2128 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2129 td->free_struct(td, struct_ptr, contents_only);
2130}
2131
2132
2133/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2134
2135static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00002136 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00002137};
2138asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
2139 "SIZE-and-FROM",
2140 SIZE_and_FROM_constraint,
2141 SIZE_and_FROM_decode_ber,
2142 SIZE_and_FROM_encode_der,
2143 SIZE_and_FROM_print,
2144 SIZE_and_FROM_free,
2145 0, /* Use generic outmost tag fetcher */
2146 asn1_DEF_SIZE_and_FROM_tags,
2147 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2148 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002149 asn1_DEF_SIZE_and_FROM_tags, /* Same as above */
2150 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2151 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002152 -0, /* Unknown yet */
2153 0, 0, /* No members */
2154 0 /* No specifics */
2155};
2156
2157
2158/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2159
2160#include <PER-Visible.h>
2161
2162/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2163
2164
2165typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2166
vlm7d576b32004-08-20 13:37:45 +00002167/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2168
2169extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
2170asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2171ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2172der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
2173asn_struct_print_f Neither_SIZE_nor_FROM_print;
2174asn_struct_free_f Neither_SIZE_nor_FROM_free;
2175
2176/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2177
vlm25e12932004-09-10 06:07:39 +00002178static int check_permitted_alphabet_11(const void *sptr) {
vlm7d576b32004-08-20 13:37:45 +00002179 /* The underlying type is IA5String */
vlmb08de152004-08-22 03:30:05 +00002180 const IA5String_t *st = sptr;
2181 const uint8_t *ch = st->buf;
2182 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002183
2184 for(; ch < end; ch++) {
2185 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002186 if(!(cv >= 65 && cv <= 70)) 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 [Neither-SIZE-nor-FROM] >>> ***/
2193
2194int
2195Neither_SIZE_nor_FROM_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 PER_Visible_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002199
2200 if(!sptr) {
2201 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002202 "%s: value not given (%s:%d)",
2203 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002204 return -1;
2205 }
2206
2207
vlm25e12932004-09-10 06:07:39 +00002208 if(!check_permitted_alphabet_11(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002209 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002210 return 0;
vlm7d576b32004-08-20 13:37:45 +00002211 } else {
2212 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002213 "%s: constraint failed (%s:%d)",
2214 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002215 return -1;
2216 }
2217}
2218
2219/*
2220 * This type is implemented using PER_Visible,
2221 * so adjust the DEF appropriately.
2222 */
2223static void
2224Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2225 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2226 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2227 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2228 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2229 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2230 td->elements = asn1_DEF_PER_Visible.elements;
2231 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2232 td->specifics = asn1_DEF_PER_Visible.specifics;
2233}
2234
2235ber_dec_rval_t
2236Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2237 void **structure, void *bufptr, size_t size, int tag_mode) {
2238 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00002239 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00002240}
2241
2242der_enc_rval_t
2243Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2244 void *structure, int tag_mode, ber_tlv_tag_t tag,
2245 asn_app_consume_bytes_f *cb, void *app_key) {
2246 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2247 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2248}
2249
2250int
2251Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2252 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2253 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2254 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2255}
2256
2257void
2258Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2259 void *struct_ptr, int contents_only) {
2260 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2261 td->free_struct(td, struct_ptr, contents_only);
2262}
2263
2264
2265/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2266
2267static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00002268 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
vlm7d576b32004-08-20 13:37:45 +00002269};
2270asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2271 "Neither-SIZE-nor-FROM",
2272 Neither_SIZE_nor_FROM_constraint,
2273 Neither_SIZE_nor_FROM_decode_ber,
2274 Neither_SIZE_nor_FROM_encode_der,
2275 Neither_SIZE_nor_FROM_print,
2276 Neither_SIZE_nor_FROM_free,
2277 0, /* Use generic outmost tag fetcher */
2278 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2279 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2280 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002281 asn1_DEF_Neither_SIZE_nor_FROM_tags, /* Same as above */
2282 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2283 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002284 -0, /* Unknown yet */
2285 0, 0, /* No members */
2286 0 /* No specifics */
2287};
2288
2289
2290/*** <<< INCLUDES [Utf8-3] >>> ***/
2291
2292#include <Utf8-2.h>
2293
2294/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2295
2296
2297typedef Utf8_2_t Utf8_3_t;
2298
vlm7d576b32004-08-20 13:37:45 +00002299/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2300
2301extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2302asn_constr_check_f Utf8_3_constraint;
2303ber_type_decoder_f Utf8_3_decode_ber;
2304der_type_encoder_f Utf8_3_encode_der;
2305asn_struct_print_f Utf8_3_print;
2306asn_struct_free_f Utf8_3_free;
2307
2308/*** <<< CTABLES [Utf8-3] >>> ***/
2309
vlm25e12932004-09-10 06:07:39 +00002310static int permitted_alphabet_table_12[128] = {
vlm7d576b32004-08-20 13:37:45 +000023110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
23120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
23130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
23140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
23150,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
23161,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
23170,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
23181,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2319};
2320
vlm25e12932004-09-10 06:07:39 +00002321static int check_permitted_alphabet_12(const void *sptr) {
2322 int *table = permitted_alphabet_table_12;
vlm7d576b32004-08-20 13:37:45 +00002323 /* The underlying type is UTF8String */
vlmb08de152004-08-22 03:30:05 +00002324 const UTF8String_t *st = sptr;
2325 const uint8_t *ch = st->buf;
2326 const uint8_t *end = ch + st->size;
vlm7d576b32004-08-20 13:37:45 +00002327
2328 for(; ch < end; ch++) {
2329 uint8_t cv = *ch;
vlmcdf661b2004-08-22 12:47:03 +00002330 if(cv >= 0x80) return -1;
2331 if(!table[cv]) return -1;
vlm7d576b32004-08-20 13:37:45 +00002332 }
vlmcdf661b2004-08-22 12:47:03 +00002333 return 0;
vlm7d576b32004-08-20 13:37:45 +00002334}
2335
2336
2337/*** <<< CODE [Utf8-3] >>> ***/
2338
2339int
2340Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2341 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2342
vlmb08de152004-08-22 03:30:05 +00002343 const Utf8_2_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002344 size_t size;
2345
2346 if(!sptr) {
2347 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002348 "%s: value not given (%s:%d)",
2349 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002350 return -1;
2351 }
2352
2353 size = UTF8String_length(st, td->name, app_errlog, app_key);
2354 if(size == (size_t)-1) return -1;
2355
2356 if((size >= 1 && size <= 2)
vlm25e12932004-09-10 06:07:39 +00002357 && !check_permitted_alphabet_12(sptr)) {
vlm7d576b32004-08-20 13:37:45 +00002358 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002359 return 0;
vlm7d576b32004-08-20 13:37:45 +00002360 } else {
2361 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002362 "%s: constraint failed (%s:%d)",
2363 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002364 return -1;
2365 }
2366}
2367
2368/*
2369 * This type is implemented using Utf8_2,
2370 * so adjust the DEF appropriately.
2371 */
2372static void
2373Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2374 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2375 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2376 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2377 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2378 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2379 td->elements = asn1_DEF_Utf8_2.elements;
2380 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2381 td->specifics = asn1_DEF_Utf8_2.specifics;
2382}
2383
2384ber_dec_rval_t
2385Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2386 void **structure, void *bufptr, size_t size, int tag_mode) {
2387 Utf8_3_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00002388 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00002389}
2390
2391der_enc_rval_t
2392Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2393 void *structure, int tag_mode, ber_tlv_tag_t tag,
2394 asn_app_consume_bytes_f *cb, void *app_key) {
2395 Utf8_3_inherit_TYPE_descriptor(td);
2396 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2397}
2398
2399int
2400Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2401 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2402 Utf8_3_inherit_TYPE_descriptor(td);
2403 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2404}
2405
2406void
2407Utf8_3_free(asn1_TYPE_descriptor_t *td,
2408 void *struct_ptr, int contents_only) {
2409 Utf8_3_inherit_TYPE_descriptor(td);
2410 td->free_struct(td, struct_ptr, contents_only);
2411}
2412
2413
2414/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2415
2416static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00002417 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
vlm7d576b32004-08-20 13:37:45 +00002418};
2419asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2420 "Utf8-3",
2421 Utf8_3_constraint,
2422 Utf8_3_decode_ber,
2423 Utf8_3_encode_der,
2424 Utf8_3_print,
2425 Utf8_3_free,
2426 0, /* Use generic outmost tag fetcher */
2427 asn1_DEF_Utf8_3_tags,
2428 sizeof(asn1_DEF_Utf8_3_tags)
2429 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002430 asn1_DEF_Utf8_3_tags, /* Same as above */
2431 sizeof(asn1_DEF_Utf8_3_tags)
2432 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002433 -0, /* Unknown yet */
2434 0, 0, /* No members */
2435 0 /* No specifics */
2436};
2437
2438
2439/*** <<< INCLUDES [Utf8-2] >>> ***/
2440
2441#include <Utf8-1.h>
2442
2443/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2444
2445
2446typedef Utf8_1_t Utf8_2_t;
2447
vlm7d576b32004-08-20 13:37:45 +00002448/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2449
2450extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2451asn_constr_check_f Utf8_2_constraint;
2452ber_type_decoder_f Utf8_2_decode_ber;
2453der_type_encoder_f Utf8_2_encode_der;
2454asn_struct_print_f Utf8_2_print;
2455asn_struct_free_f Utf8_2_free;
2456
2457/*** <<< CODE [Utf8-2] >>> ***/
2458
2459int
2460Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2461 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2462
vlmb08de152004-08-22 03:30:05 +00002463 const Utf8_1_t *st = sptr;
vlm7d576b32004-08-20 13:37:45 +00002464 size_t size;
2465
2466 if(!sptr) {
2467 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002468 "%s: value not given (%s:%d)",
2469 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002470 return -1;
2471 }
2472
2473 size = UTF8String_length(st, td->name, app_errlog, app_key);
2474 if(size == (size_t)-1) return -1;
2475
2476 if((size >= 1 && size <= 2)) {
2477 /* Constraint check succeeded */
vlmcdf661b2004-08-22 12:47:03 +00002478 return 0;
vlm7d576b32004-08-20 13:37:45 +00002479 } else {
2480 _ASN_ERRLOG(app_errlog, app_key,
vlm758530a2004-08-22 13:47:59 +00002481 "%s: constraint failed (%s:%d)",
2482 td->name, __FILE__, __LINE__);
vlm7d576b32004-08-20 13:37:45 +00002483 return -1;
2484 }
2485}
2486
2487/*
2488 * This type is implemented using Utf8_1,
2489 * so adjust the DEF appropriately.
2490 */
2491static void
2492Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2493 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2494 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2495 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2496 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2497 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2498 td->elements = asn1_DEF_Utf8_1.elements;
2499 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2500 td->specifics = asn1_DEF_Utf8_1.specifics;
2501}
2502
2503ber_dec_rval_t
2504Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2505 void **structure, void *bufptr, size_t size, int tag_mode) {
2506 Utf8_2_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00002507 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00002508}
2509
2510der_enc_rval_t
2511Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2512 void *structure, int tag_mode, ber_tlv_tag_t tag,
2513 asn_app_consume_bytes_f *cb, void *app_key) {
2514 Utf8_2_inherit_TYPE_descriptor(td);
2515 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2516}
2517
2518int
2519Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2520 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2521 Utf8_2_inherit_TYPE_descriptor(td);
2522 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2523}
2524
2525void
2526Utf8_2_free(asn1_TYPE_descriptor_t *td,
2527 void *struct_ptr, int contents_only) {
2528 Utf8_2_inherit_TYPE_descriptor(td);
2529 td->free_struct(td, struct_ptr, contents_only);
2530}
2531
2532
2533/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2534
2535static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
vlm1308d2b2004-09-10 15:49:15 +00002536 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
vlm7d576b32004-08-20 13:37:45 +00002537};
2538asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2539 "Utf8-2",
2540 Utf8_2_constraint,
2541 Utf8_2_decode_ber,
2542 Utf8_2_encode_der,
2543 Utf8_2_print,
2544 Utf8_2_free,
2545 0, /* Use generic outmost tag fetcher */
2546 asn1_DEF_Utf8_2_tags,
2547 sizeof(asn1_DEF_Utf8_2_tags)
2548 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002549 asn1_DEF_Utf8_2_tags, /* Same as above */
2550 sizeof(asn1_DEF_Utf8_2_tags)
2551 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002552 -0, /* Unknown yet */
2553 0, 0, /* No members */
2554 0 /* No specifics */
2555};
2556
2557
2558/*** <<< INCLUDES [Utf8-1] >>> ***/
2559
2560#include <UTF8String.h>
2561
2562/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2563
2564
2565typedef UTF8String_t Utf8_1_t;
2566
vlm7d576b32004-08-20 13:37:45 +00002567/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2568
2569extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2570asn_constr_check_f Utf8_1_constraint;
2571ber_type_decoder_f Utf8_1_decode_ber;
2572der_type_encoder_f Utf8_1_encode_der;
2573asn_struct_print_f Utf8_1_print;
2574asn_struct_free_f Utf8_1_free;
2575
2576/*** <<< CODE [Utf8-1] >>> ***/
2577
2578int
2579Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2580 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2581
2582 /* Make the underlying type checker permanent */
2583 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2584 return td->check_constraints
2585 (td, sptr, app_errlog, app_key);
2586}
2587
2588/*
2589 * This type is implemented using UTF8String,
2590 * so adjust the DEF appropriately.
2591 */
2592static void
2593Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2594 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2595 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2596 td->free_struct = asn1_DEF_UTF8String.free_struct;
2597 td->print_struct = asn1_DEF_UTF8String.print_struct;
2598 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2599 td->elements = asn1_DEF_UTF8String.elements;
2600 td->elements_count = asn1_DEF_UTF8String.elements_count;
2601 td->specifics = asn1_DEF_UTF8String.specifics;
2602}
2603
2604ber_dec_rval_t
2605Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2606 void **structure, void *bufptr, size_t size, int tag_mode) {
2607 Utf8_1_inherit_TYPE_descriptor(td);
vlm1308d2b2004-09-10 15:49:15 +00002608 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
vlm7d576b32004-08-20 13:37:45 +00002609}
2610
2611der_enc_rval_t
2612Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2613 void *structure, int tag_mode, ber_tlv_tag_t tag,
2614 asn_app_consume_bytes_f *cb, void *app_key) {
2615 Utf8_1_inherit_TYPE_descriptor(td);
2616 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2617}
2618
2619int
2620Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2621 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2622 Utf8_1_inherit_TYPE_descriptor(td);
2623 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2624}
2625
2626void
2627Utf8_1_free(asn1_TYPE_descriptor_t *td,
2628 void *struct_ptr, int contents_only) {
2629 Utf8_1_inherit_TYPE_descriptor(td);
2630 td->free_struct(td, struct_ptr, contents_only);
2631}
2632
2633
2634/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2635
2636static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2637 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2638};
2639asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2640 "Utf8-1",
2641 Utf8_1_constraint,
2642 Utf8_1_decode_ber,
2643 Utf8_1_encode_der,
2644 Utf8_1_print,
2645 Utf8_1_free,
2646 0, /* Use generic outmost tag fetcher */
2647 asn1_DEF_Utf8_1_tags,
2648 sizeof(asn1_DEF_Utf8_1_tags)
2649 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
vlm72425de2004-09-13 08:31:01 +00002650 asn1_DEF_Utf8_1_tags, /* Same as above */
2651 sizeof(asn1_DEF_Utf8_1_tags)
2652 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
vlm7d576b32004-08-20 13:37:45 +00002653 -0, /* Unknown yet */
2654 0, 0, /* No members */
2655 0 /* No specifics */
2656};
2657
vlm63c808c2004-09-15 11:44:13 +00002658
2659/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
2660
2661#include <Identifier.h>
2662
2663/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
2664
2665
2666typedef Identifier_t VisibleIdentifier_t;
2667
2668/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
2669
2670extern asn1_TYPE_descriptor_t asn1_DEF_VisibleIdentifier;
2671asn_constr_check_f VisibleIdentifier_constraint;
2672ber_type_decoder_f VisibleIdentifier_decode_ber;
2673der_type_encoder_f VisibleIdentifier_encode_der;
2674asn_struct_print_f VisibleIdentifier_print;
2675asn_struct_free_f VisibleIdentifier_free;
2676
2677/*** <<< CTABLES [VisibleIdentifier] >>> ***/
2678
2679static int permitted_alphabet_table_14[256] = {
26800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
26810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
26820,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
26831,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
26840,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
26851,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
26860,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
26871,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2688};
2689
2690static int check_permitted_alphabet_14(const void *sptr) {
2691 int *table = permitted_alphabet_table_14;
2692 /* The underlying type is VisibleString */
2693 const VisibleString_t *st = sptr;
2694 const uint8_t *ch = st->buf;
2695 const uint8_t *end = ch + st->size;
2696
2697 for(; ch < end; ch++) {
2698 uint8_t cv = *ch;
2699 if(!table[cv]) return -1;
2700 }
2701 return 0;
2702}
2703
2704
2705/*** <<< CODE [VisibleIdentifier] >>> ***/
2706
2707int
2708VisibleIdentifier_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2709 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2710
2711 const Identifier_t *st = sptr;
2712 size_t size;
2713
2714 if(!sptr) {
2715 _ASN_ERRLOG(app_errlog, app_key,
2716 "%s: value not given (%s:%d)",
2717 td->name, __FILE__, __LINE__);
2718 return -1;
2719 }
2720
2721 size = st->size;
2722
2723 if((size >= 1 && size <= 32)
2724 && !check_permitted_alphabet_14(sptr)) {
2725 /* Constraint check succeeded */
2726 return 0;
2727 } else {
2728 _ASN_ERRLOG(app_errlog, app_key,
2729 "%s: constraint failed (%s:%d)",
2730 td->name, __FILE__, __LINE__);
2731 return -1;
2732 }
2733}
2734
2735/*
2736 * This type is implemented using Identifier,
2737 * so adjust the DEF appropriately.
2738 */
2739static void
2740VisibleIdentifier_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2741 td->ber_decoder = asn1_DEF_Identifier.ber_decoder;
2742 td->der_encoder = asn1_DEF_Identifier.der_encoder;
2743 td->free_struct = asn1_DEF_Identifier.free_struct;
2744 td->print_struct = asn1_DEF_Identifier.print_struct;
2745 td->last_tag_form = asn1_DEF_Identifier.last_tag_form;
2746 td->elements = asn1_DEF_Identifier.elements;
2747 td->elements_count = asn1_DEF_Identifier.elements_count;
2748 td->specifics = asn1_DEF_Identifier.specifics;
2749}
2750
2751ber_dec_rval_t
2752VisibleIdentifier_decode_ber(asn1_TYPE_descriptor_t *td,
2753 void **structure, void *bufptr, size_t size, int tag_mode) {
2754 VisibleIdentifier_inherit_TYPE_descriptor(td);
2755 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2756}
2757
2758der_enc_rval_t
2759VisibleIdentifier_encode_der(asn1_TYPE_descriptor_t *td,
2760 void *structure, int tag_mode, ber_tlv_tag_t tag,
2761 asn_app_consume_bytes_f *cb, void *app_key) {
2762 VisibleIdentifier_inherit_TYPE_descriptor(td);
2763 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2764}
2765
2766int
2767VisibleIdentifier_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2768 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2769 VisibleIdentifier_inherit_TYPE_descriptor(td);
2770 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2771}
2772
2773void
2774VisibleIdentifier_free(asn1_TYPE_descriptor_t *td,
2775 void *struct_ptr, int contents_only) {
2776 VisibleIdentifier_inherit_TYPE_descriptor(td);
2777 td->free_struct(td, struct_ptr, contents_only);
2778}
2779
2780
2781/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
2782
2783static ber_tlv_tag_t asn1_DEF_VisibleIdentifier_tags[] = {
2784 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
2785};
2786asn1_TYPE_descriptor_t asn1_DEF_VisibleIdentifier = {
2787 "VisibleIdentifier",
2788 VisibleIdentifier_constraint,
2789 VisibleIdentifier_decode_ber,
2790 VisibleIdentifier_encode_der,
2791 VisibleIdentifier_print,
2792 VisibleIdentifier_free,
2793 0, /* Use generic outmost tag fetcher */
2794 asn1_DEF_VisibleIdentifier_tags,
2795 sizeof(asn1_DEF_VisibleIdentifier_tags)
2796 /sizeof(asn1_DEF_VisibleIdentifier_tags[0]), /* 1 */
2797 asn1_DEF_VisibleIdentifier_tags, /* Same as above */
2798 sizeof(asn1_DEF_VisibleIdentifier_tags)
2799 /sizeof(asn1_DEF_VisibleIdentifier_tags[0]), /* 1 */
2800 -0, /* Unknown yet */
2801 0, 0, /* No members */
2802 0 /* No specifics */
2803};
2804
2805
2806/*** <<< INCLUDES [Identifier] >>> ***/
2807
2808#include <VisibleString.h>
2809
2810/*** <<< TYPE-DECLS [Identifier] >>> ***/
2811
2812
2813typedef VisibleString_t Identifier_t;
2814
2815/*** <<< FUNC-DECLS [Identifier] >>> ***/
2816
2817extern asn1_TYPE_descriptor_t asn1_DEF_Identifier;
2818asn_constr_check_f Identifier_constraint;
2819ber_type_decoder_f Identifier_decode_ber;
2820der_type_encoder_f Identifier_encode_der;
2821asn_struct_print_f Identifier_print;
2822asn_struct_free_f Identifier_free;
2823
2824/*** <<< CTABLES [Identifier] >>> ***/
2825
2826static int permitted_alphabet_table_15[256] = {
28270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28290,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
28301,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
28310,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
28321,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
28330,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
28341,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2835};
2836
2837static int check_permitted_alphabet_15(const void *sptr) {
2838 int *table = permitted_alphabet_table_15;
2839 /* The underlying type is VisibleString */
2840 const VisibleString_t *st = sptr;
2841 const uint8_t *ch = st->buf;
2842 const uint8_t *end = ch + st->size;
2843
2844 for(; ch < end; ch++) {
2845 uint8_t cv = *ch;
2846 if(!table[cv]) return -1;
2847 }
2848 return 0;
2849}
2850
2851
2852/*** <<< CODE [Identifier] >>> ***/
2853
2854int
2855Identifier_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2856 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2857
2858 const VisibleString_t *st = sptr;
2859 size_t size;
2860
2861 if(!sptr) {
2862 _ASN_ERRLOG(app_errlog, app_key,
2863 "%s: value not given (%s:%d)",
2864 td->name, __FILE__, __LINE__);
2865 return -1;
2866 }
2867
2868 size = st->size;
2869
2870 if((size >= 1 && size <= 32)
2871 && !check_permitted_alphabet_15(sptr)) {
2872 /* Constraint check succeeded */
2873 return 0;
2874 } else {
2875 _ASN_ERRLOG(app_errlog, app_key,
2876 "%s: constraint failed (%s:%d)",
2877 td->name, __FILE__, __LINE__);
2878 return -1;
2879 }
2880}
2881
2882/*
2883 * This type is implemented using VisibleString,
2884 * so adjust the DEF appropriately.
2885 */
2886static void
2887Identifier_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2888 td->ber_decoder = asn1_DEF_VisibleString.ber_decoder;
2889 td->der_encoder = asn1_DEF_VisibleString.der_encoder;
2890 td->free_struct = asn1_DEF_VisibleString.free_struct;
2891 td->print_struct = asn1_DEF_VisibleString.print_struct;
2892 td->last_tag_form = asn1_DEF_VisibleString.last_tag_form;
2893 td->elements = asn1_DEF_VisibleString.elements;
2894 td->elements_count = asn1_DEF_VisibleString.elements_count;
2895 td->specifics = asn1_DEF_VisibleString.specifics;
2896}
2897
2898ber_dec_rval_t
2899Identifier_decode_ber(asn1_TYPE_descriptor_t *td,
2900 void **structure, void *bufptr, size_t size, int tag_mode) {
2901 Identifier_inherit_TYPE_descriptor(td);
2902 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2903}
2904
2905der_enc_rval_t
2906Identifier_encode_der(asn1_TYPE_descriptor_t *td,
2907 void *structure, int tag_mode, ber_tlv_tag_t tag,
2908 asn_app_consume_bytes_f *cb, void *app_key) {
2909 Identifier_inherit_TYPE_descriptor(td);
2910 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2911}
2912
2913int
2914Identifier_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2915 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2916 Identifier_inherit_TYPE_descriptor(td);
2917 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2918}
2919
2920void
2921Identifier_free(asn1_TYPE_descriptor_t *td,
2922 void *struct_ptr, int contents_only) {
2923 Identifier_inherit_TYPE_descriptor(td);
2924 td->free_struct(td, struct_ptr, contents_only);
2925}
2926
2927
2928/*** <<< STAT-DEFS [Identifier] >>> ***/
2929
2930static ber_tlv_tag_t asn1_DEF_Identifier_tags[] = {
2931 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
2932};
2933asn1_TYPE_descriptor_t asn1_DEF_Identifier = {
2934 "Identifier",
2935 Identifier_constraint,
2936 Identifier_decode_ber,
2937 Identifier_encode_der,
2938 Identifier_print,
2939 Identifier_free,
2940 0, /* Use generic outmost tag fetcher */
2941 asn1_DEF_Identifier_tags,
2942 sizeof(asn1_DEF_Identifier_tags)
2943 /sizeof(asn1_DEF_Identifier_tags[0]), /* 1 */
2944 asn1_DEF_Identifier_tags, /* Same as above */
2945 sizeof(asn1_DEF_Identifier_tags)
2946 /sizeof(asn1_DEF_Identifier_tags[0]), /* 1 */
2947 -0, /* Unknown yet */
2948 0, 0, /* No members */
2949 0 /* No specifics */
2950};
2951