blob: 4459f5359a63af03eb95efef048edfb8b7d3b563 [file] [log] [blame]
Lev Walkin006de1c2004-08-20 13:37:45 +00001
2/*** <<< INCLUDES [Int1] >>> ***/
3
4#include <INTEGER.h>
5
6/*** <<< TYPE-DECLS [Int1] >>> ***/
7
8
9typedef INTEGER_t Int1_t;
10
Lev Walkin006de1c2004-08-20 13:37:45 +000011/*** <<< FUNC-DECLS [Int1] >>> ***/
12
13extern asn1_TYPE_descriptor_t asn1_DEF_Int1;
14asn_constr_check_f Int1_constraint;
15ber_type_decoder_f Int1_decode_ber;
16der_type_encoder_f Int1_encode_der;
17asn_struct_print_f Int1_print;
18asn_struct_free_f Int1_free;
19
20/*** <<< CODE [Int1] >>> ***/
21
22int
23Int1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
24 asn_app_consume_bytes_f *app_errlog, void *app_key) {
25
26 /* Make the underlying type checker permanent */
27 td->check_constraints = asn1_DEF_INTEGER.check_constraints;
28 return td->check_constraints
29 (td, sptr, app_errlog, app_key);
30}
31
32/*
33 * This type is implemented using INTEGER,
34 * so adjust the DEF appropriately.
35 */
36static void
37Int1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
38 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
39 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
40 td->free_struct = asn1_DEF_INTEGER.free_struct;
41 td->print_struct = asn1_DEF_INTEGER.print_struct;
42 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
43 td->elements = asn1_DEF_INTEGER.elements;
44 td->elements_count = asn1_DEF_INTEGER.elements_count;
45 td->specifics = asn1_DEF_INTEGER.specifics;
46}
47
48ber_dec_rval_t
49Int1_decode_ber(asn1_TYPE_descriptor_t *td,
50 void **structure, void *bufptr, size_t size, int tag_mode) {
51 Int1_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +000052 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-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 */
Lev Walkin006de1c2004-08-20 13:37:45 +000094 -0, /* Unknown yet */
95 0, 0, /* No members */
96 0 /* No specifics */
97};
98
99
100/*** <<< INCLUDES [Int2] >>> ***/
101
102#include <Int1.h>
103
104/*** <<< TYPE-DECLS [Int2] >>> ***/
105
106
107typedef Int1_t Int2_t;
108
Lev Walkin006de1c2004-08-20 13:37:45 +0000109/*** <<< FUNC-DECLS [Int2] >>> ***/
110
111extern asn1_TYPE_descriptor_t asn1_DEF_Int2;
112asn_constr_check_f Int2_constraint;
113ber_type_decoder_f Int2_decode_ber;
114der_type_encoder_f Int2_encode_der;
115asn_struct_print_f Int2_print;
116asn_struct_free_f Int2_free;
117
118/*** <<< CODE [Int2] >>> ***/
119
120int
121Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
122 asn_app_consume_bytes_f *app_errlog, void *app_key) {
123
Lev Walkin634a3b82004-08-22 03:30:05 +0000124 const Int1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000125 long value;
126
127 if(!sptr) {
128 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000129 "%s: value not given (%s:%d)",
130 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000131 return -1;
132 }
133
Lev Walkin44467432004-09-07 06:43:57 +0000134 /* Check if the sign bit is present */
135 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000136
137 if((value >= 0)) {
138 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000139 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000140 } else {
141 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000142 "%s: constraint failed (%s:%d)",
143 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000144 return -1;
145 }
146}
147
148/*
149 * This type is implemented using Int1,
150 * so adjust the DEF appropriately.
151 */
152static void
153Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
154 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
155 td->der_encoder = asn1_DEF_Int1.der_encoder;
156 td->free_struct = asn1_DEF_Int1.free_struct;
157 td->print_struct = asn1_DEF_Int1.print_struct;
158 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
159 td->elements = asn1_DEF_Int1.elements;
160 td->elements_count = asn1_DEF_Int1.elements_count;
161 td->specifics = asn1_DEF_Int1.specifics;
162}
163
164ber_dec_rval_t
165Int2_decode_ber(asn1_TYPE_descriptor_t *td,
166 void **structure, void *bufptr, size_t size, int tag_mode) {
167 Int2_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000168 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000169}
170
171der_enc_rval_t
172Int2_encode_der(asn1_TYPE_descriptor_t *td,
173 void *structure, int tag_mode, ber_tlv_tag_t tag,
174 asn_app_consume_bytes_f *cb, void *app_key) {
175 Int2_inherit_TYPE_descriptor(td);
176 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
177}
178
179int
180Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
181 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
182 Int2_inherit_TYPE_descriptor(td);
183 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
184}
185
186void
187Int2_free(asn1_TYPE_descriptor_t *td,
188 void *struct_ptr, int contents_only) {
189 Int2_inherit_TYPE_descriptor(td);
190 td->free_struct(td, struct_ptr, contents_only);
191}
192
193
194/*** <<< STAT-DEFS [Int2] >>> ***/
195
196static ber_tlv_tag_t asn1_DEF_Int2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000197 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000198};
199asn1_TYPE_descriptor_t asn1_DEF_Int2 = {
200 "Int2",
201 Int2_constraint,
202 Int2_decode_ber,
203 Int2_encode_der,
204 Int2_print,
205 Int2_free,
206 0, /* Use generic outmost tag fetcher */
207 asn1_DEF_Int2_tags,
208 sizeof(asn1_DEF_Int2_tags)
209 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000210 -0, /* Unknown yet */
211 0, 0, /* No members */
212 0 /* No specifics */
213};
214
215
216/*** <<< INCLUDES [Int3] >>> ***/
217
218#include <Int2.h>
219
220/*** <<< TYPE-DECLS [Int3] >>> ***/
221
222
223typedef Int2_t Int3_t;
224
Lev Walkin006de1c2004-08-20 13:37:45 +0000225/*** <<< FUNC-DECLS [Int3] >>> ***/
226
227extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
228asn_constr_check_f Int3_constraint;
229ber_type_decoder_f Int3_decode_ber;
230der_type_encoder_f Int3_encode_der;
231asn_struct_print_f Int3_print;
232asn_struct_free_f Int3_free;
233
234/*** <<< CODE [Int3] >>> ***/
235
236int
237Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
238 asn_app_consume_bytes_f *app_errlog, void *app_key) {
239
Lev Walkin634a3b82004-08-22 03:30:05 +0000240 const Int2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000241 long value;
242
243 if(!sptr) {
244 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000245 "%s: value not given (%s:%d)",
246 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000247 return -1;
248 }
249
250 if(asn1_INTEGER2long(st, &value)) {
251 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000252 "%s: value too large (%s:%d)",
253 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000254 return -1;
255 }
256
257 if((value >= 0 && value <= 10)) {
258 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000259 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000260 } else {
261 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000262 "%s: constraint failed (%s:%d)",
263 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000264 return -1;
265 }
266}
267
268/*
269 * This type is implemented using Int2,
270 * so adjust the DEF appropriately.
271 */
272static void
273Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
274 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
275 td->der_encoder = asn1_DEF_Int2.der_encoder;
276 td->free_struct = asn1_DEF_Int2.free_struct;
277 td->print_struct = asn1_DEF_Int2.print_struct;
278 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
279 td->elements = asn1_DEF_Int2.elements;
280 td->elements_count = asn1_DEF_Int2.elements_count;
281 td->specifics = asn1_DEF_Int2.specifics;
282}
283
284ber_dec_rval_t
285Int3_decode_ber(asn1_TYPE_descriptor_t *td,
286 void **structure, void *bufptr, size_t size, int tag_mode) {
287 Int3_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000288 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000289}
290
291der_enc_rval_t
292Int3_encode_der(asn1_TYPE_descriptor_t *td,
293 void *structure, int tag_mode, ber_tlv_tag_t tag,
294 asn_app_consume_bytes_f *cb, void *app_key) {
295 Int3_inherit_TYPE_descriptor(td);
296 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
297}
298
299int
300Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
301 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
302 Int3_inherit_TYPE_descriptor(td);
303 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
304}
305
306void
307Int3_free(asn1_TYPE_descriptor_t *td,
308 void *struct_ptr, int contents_only) {
309 Int3_inherit_TYPE_descriptor(td);
310 td->free_struct(td, struct_ptr, contents_only);
311}
312
313
314/*** <<< STAT-DEFS [Int3] >>> ***/
315
316static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000317 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000318};
319asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
320 "Int3",
321 Int3_constraint,
322 Int3_decode_ber,
323 Int3_encode_der,
324 Int3_print,
325 Int3_free,
326 0, /* Use generic outmost tag fetcher */
327 asn1_DEF_Int3_tags,
328 sizeof(asn1_DEF_Int3_tags)
329 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000330 -0, /* Unknown yet */
331 0, 0, /* No members */
332 0 /* No specifics */
333};
334
335
336/*** <<< INCLUDES [Int4] >>> ***/
337
338#include <Int3.h>
339
340/*** <<< TYPE-DECLS [Int4] >>> ***/
341
342
343typedef Int3_t Int4_t;
344
Lev Walkin006de1c2004-08-20 13:37:45 +0000345/*** <<< FUNC-DECLS [Int4] >>> ***/
346
347extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
348asn_constr_check_f Int4_constraint;
349ber_type_decoder_f Int4_decode_ber;
350der_type_encoder_f Int4_encode_der;
351asn_struct_print_f Int4_print;
352asn_struct_free_f Int4_free;
353
354/*** <<< CODE [Int4] >>> ***/
355
356int
357Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
358 asn_app_consume_bytes_f *app_errlog, void *app_key) {
359
Lev Walkin634a3b82004-08-22 03:30:05 +0000360 const Int3_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000361 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000362
363 if(!sptr) {
364 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000365 "%s: value not given (%s:%d)",
366 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000367 return -1;
368 }
369
Lev Walkind35c8b52004-08-25 02:08:08 +0000370 if(asn1_INTEGER2long(st, &value)) {
371 _ASN_ERRLOG(app_errlog, app_key,
372 "%s: value too large (%s:%d)",
373 td->name, __FILE__, __LINE__);
374 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000375 }
376
Lev Walkind35c8b52004-08-25 02:08:08 +0000377 if((value >= 1 && value <= 10)) {
378 /* Constraint check succeeded */
379 return 0;
380 } else {
381 _ASN_ERRLOG(app_errlog, app_key,
382 "%s: constraint failed (%s:%d)",
383 td->name, __FILE__, __LINE__);
384 return -1;
385 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000386}
387
388/*
389 * This type is implemented using Int3,
390 * so adjust the DEF appropriately.
391 */
392static void
393Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
394 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
395 td->der_encoder = asn1_DEF_Int3.der_encoder;
396 td->free_struct = asn1_DEF_Int3.free_struct;
397 td->print_struct = asn1_DEF_Int3.print_struct;
398 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
399 td->elements = asn1_DEF_Int3.elements;
400 td->elements_count = asn1_DEF_Int3.elements_count;
401 td->specifics = asn1_DEF_Int3.specifics;
402}
403
404ber_dec_rval_t
405Int4_decode_ber(asn1_TYPE_descriptor_t *td,
406 void **structure, void *bufptr, size_t size, int tag_mode) {
407 Int4_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000408 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000409}
410
411der_enc_rval_t
412Int4_encode_der(asn1_TYPE_descriptor_t *td,
413 void *structure, int tag_mode, ber_tlv_tag_t tag,
414 asn_app_consume_bytes_f *cb, void *app_key) {
415 Int4_inherit_TYPE_descriptor(td);
416 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
417}
418
419int
420Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
421 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
422 Int4_inherit_TYPE_descriptor(td);
423 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
424}
425
426void
427Int4_free(asn1_TYPE_descriptor_t *td,
428 void *struct_ptr, int contents_only) {
429 Int4_inherit_TYPE_descriptor(td);
430 td->free_struct(td, struct_ptr, contents_only);
431}
432
433
434/*** <<< STAT-DEFS [Int4] >>> ***/
435
436static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000437 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000438};
439asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
440 "Int4",
441 Int4_constraint,
442 Int4_decode_ber,
443 Int4_encode_der,
444 Int4_print,
445 Int4_free,
446 0, /* Use generic outmost tag fetcher */
447 asn1_DEF_Int4_tags,
448 sizeof(asn1_DEF_Int4_tags)
449 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000450 -0, /* Unknown yet */
451 0, 0, /* No members */
452 0 /* No specifics */
453};
454
455
456/*** <<< INCLUDES [Int5] >>> ***/
457
458#include <Int4.h>
459
460/*** <<< TYPE-DECLS [Int5] >>> ***/
461
462
463typedef Int4_t Int5_t;
464
Lev Walkin006de1c2004-08-20 13:37:45 +0000465/*** <<< FUNC-DECLS [Int5] >>> ***/
466
467extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
468asn_constr_check_f Int5_constraint;
469ber_type_decoder_f Int5_decode_ber;
470der_type_encoder_f Int5_encode_der;
471asn_struct_print_f Int5_print;
472asn_struct_free_f Int5_free;
473
474/*** <<< CODE [Int5] >>> ***/
475
476int
477Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
478 asn_app_consume_bytes_f *app_errlog, void *app_key) {
479
Lev Walkin634a3b82004-08-22 03:30:05 +0000480 const Int4_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000481 long value;
482
483 if(!sptr) {
484 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000485 "%s: value not given (%s:%d)",
486 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000487 return -1;
488 }
489
490 if(asn1_INTEGER2long(st, &value)) {
491 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000492 "%s: value too large (%s:%d)",
493 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000494 return -1;
495 }
496
497 if((value == 5)) {
498 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000499 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000500 } else {
501 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000502 "%s: constraint failed (%s:%d)",
503 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000504 return -1;
505 }
506}
507
508/*
509 * This type is implemented using Int4,
510 * so adjust the DEF appropriately.
511 */
512static void
513Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
514 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
515 td->der_encoder = asn1_DEF_Int4.der_encoder;
516 td->free_struct = asn1_DEF_Int4.free_struct;
517 td->print_struct = asn1_DEF_Int4.print_struct;
518 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
519 td->elements = asn1_DEF_Int4.elements;
520 td->elements_count = asn1_DEF_Int4.elements_count;
521 td->specifics = asn1_DEF_Int4.specifics;
522}
523
524ber_dec_rval_t
525Int5_decode_ber(asn1_TYPE_descriptor_t *td,
526 void **structure, void *bufptr, size_t size, int tag_mode) {
527 Int5_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000528 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000529}
530
531der_enc_rval_t
532Int5_encode_der(asn1_TYPE_descriptor_t *td,
533 void *structure, int tag_mode, ber_tlv_tag_t tag,
534 asn_app_consume_bytes_f *cb, void *app_key) {
535 Int5_inherit_TYPE_descriptor(td);
536 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
537}
538
539int
540Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
541 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
542 Int5_inherit_TYPE_descriptor(td);
543 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
544}
545
546void
547Int5_free(asn1_TYPE_descriptor_t *td,
548 void *struct_ptr, int contents_only) {
549 Int5_inherit_TYPE_descriptor(td);
550 td->free_struct(td, struct_ptr, contents_only);
551}
552
553
554/*** <<< STAT-DEFS [Int5] >>> ***/
555
556static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000557 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000558};
559asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
560 "Int5",
561 Int5_constraint,
562 Int5_decode_ber,
563 Int5_encode_der,
564 Int5_print,
565 Int5_free,
566 0, /* Use generic outmost tag fetcher */
567 asn1_DEF_Int5_tags,
568 sizeof(asn1_DEF_Int5_tags)
569 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000570 -0, /* Unknown yet */
571 0, 0, /* No members */
572 0 /* No specifics */
573};
574
575
576/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
577
578#include <INTEGER.h>
579
580/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
581
582
583typedef INTEGER_t ExtensibleExtensions_t;
584
Lev Walkin006de1c2004-08-20 13:37:45 +0000585/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
586
587extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
588asn_constr_check_f ExtensibleExtensions_constraint;
589ber_type_decoder_f ExtensibleExtensions_decode_ber;
590der_type_encoder_f ExtensibleExtensions_encode_der;
591asn_struct_print_f ExtensibleExtensions_print;
592asn_struct_free_f ExtensibleExtensions_free;
593
594/*** <<< CODE [ExtensibleExtensions] >>> ***/
595
596int
597ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
598 asn_app_consume_bytes_f *app_errlog, void *app_key) {
599
Lev Walkin634a3b82004-08-22 03:30:05 +0000600 const INTEGER_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000601 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000602
603 if(!sptr) {
604 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000605 "%s: value not given (%s:%d)",
606 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000607 return -1;
608 }
609
Lev Walkind35c8b52004-08-25 02:08:08 +0000610 if(asn1_INTEGER2long(st, &value)) {
611 _ASN_ERRLOG(app_errlog, app_key,
612 "%s: value too large (%s:%d)",
613 td->name, __FILE__, __LINE__);
614 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000615 }
616
Lev Walkind35c8b52004-08-25 02:08:08 +0000617 if((value >= 1 && value <= 256)) {
618 /* Constraint check succeeded */
619 return 0;
620 } else {
621 _ASN_ERRLOG(app_errlog, app_key,
622 "%s: constraint failed (%s:%d)",
623 td->name, __FILE__, __LINE__);
624 return -1;
625 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000626}
627
628/*
629 * This type is implemented using INTEGER,
630 * so adjust the DEF appropriately.
631 */
632static void
633ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
634 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
635 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
636 td->free_struct = asn1_DEF_INTEGER.free_struct;
637 td->print_struct = asn1_DEF_INTEGER.print_struct;
638 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
639 td->elements = asn1_DEF_INTEGER.elements;
640 td->elements_count = asn1_DEF_INTEGER.elements_count;
641 td->specifics = asn1_DEF_INTEGER.specifics;
642}
643
644ber_dec_rval_t
645ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
646 void **structure, void *bufptr, size_t size, int tag_mode) {
647 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000648 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000649}
650
651der_enc_rval_t
652ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
653 void *structure, int tag_mode, ber_tlv_tag_t tag,
654 asn_app_consume_bytes_f *cb, void *app_key) {
655 ExtensibleExtensions_inherit_TYPE_descriptor(td);
656 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
657}
658
659int
660ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
661 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
662 ExtensibleExtensions_inherit_TYPE_descriptor(td);
663 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
664}
665
666void
667ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
668 void *struct_ptr, int contents_only) {
669 ExtensibleExtensions_inherit_TYPE_descriptor(td);
670 td->free_struct(td, struct_ptr, contents_only);
671}
672
673
674/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
675
676static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
677 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
678};
679asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
680 "ExtensibleExtensions",
681 ExtensibleExtensions_constraint,
682 ExtensibleExtensions_decode_ber,
683 ExtensibleExtensions_encode_der,
684 ExtensibleExtensions_print,
685 ExtensibleExtensions_free,
686 0, /* Use generic outmost tag fetcher */
687 asn1_DEF_ExtensibleExtensions_tags,
688 sizeof(asn1_DEF_ExtensibleExtensions_tags)
689 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000690 -0, /* Unknown yet */
691 0, 0, /* No members */
692 0 /* No specifics */
693};
694
695
696/*** <<< INCLUDES [Str1] >>> ***/
697
698#include <IA5String.h>
699
700/*** <<< TYPE-DECLS [Str1] >>> ***/
701
702
703typedef IA5String_t Str1_t;
704
Lev Walkin006de1c2004-08-20 13:37:45 +0000705/*** <<< FUNC-DECLS [Str1] >>> ***/
706
707extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
708asn_constr_check_f Str1_constraint;
709ber_type_decoder_f Str1_decode_ber;
710der_type_encoder_f Str1_encode_der;
711asn_struct_print_f Str1_print;
712asn_struct_free_f Str1_free;
713
714/*** <<< CODE [Str1] >>> ***/
715
716int
717Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
718 asn_app_consume_bytes_f *app_errlog, void *app_key) {
719
720 /* Make the underlying type checker permanent */
721 td->check_constraints = asn1_DEF_IA5String.check_constraints;
722 return td->check_constraints
723 (td, sptr, app_errlog, app_key);
724}
725
726/*
727 * This type is implemented using IA5String,
728 * so adjust the DEF appropriately.
729 */
730static void
731Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
732 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
733 td->der_encoder = asn1_DEF_IA5String.der_encoder;
734 td->free_struct = asn1_DEF_IA5String.free_struct;
735 td->print_struct = asn1_DEF_IA5String.print_struct;
736 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
737 td->elements = asn1_DEF_IA5String.elements;
738 td->elements_count = asn1_DEF_IA5String.elements_count;
739 td->specifics = asn1_DEF_IA5String.specifics;
740}
741
742ber_dec_rval_t
743Str1_decode_ber(asn1_TYPE_descriptor_t *td,
744 void **structure, void *bufptr, size_t size, int tag_mode) {
745 Str1_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000746 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000747}
748
749der_enc_rval_t
750Str1_encode_der(asn1_TYPE_descriptor_t *td,
751 void *structure, int tag_mode, ber_tlv_tag_t tag,
752 asn_app_consume_bytes_f *cb, void *app_key) {
753 Str1_inherit_TYPE_descriptor(td);
754 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
755}
756
757int
758Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
759 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
760 Str1_inherit_TYPE_descriptor(td);
761 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
762}
763
764void
765Str1_free(asn1_TYPE_descriptor_t *td,
766 void *struct_ptr, int contents_only) {
767 Str1_inherit_TYPE_descriptor(td);
768 td->free_struct(td, struct_ptr, contents_only);
769}
770
771
772/*** <<< STAT-DEFS [Str1] >>> ***/
773
774static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
775 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
776};
777asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
778 "Str1",
779 Str1_constraint,
780 Str1_decode_ber,
781 Str1_encode_der,
782 Str1_print,
783 Str1_free,
784 0, /* Use generic outmost tag fetcher */
785 asn1_DEF_Str1_tags,
786 sizeof(asn1_DEF_Str1_tags)
787 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000788 -0, /* Unknown yet */
789 0, 0, /* No members */
790 0 /* No specifics */
791};
792
793
794/*** <<< INCLUDES [Str2] >>> ***/
795
796#include <Str1.h>
797
798/*** <<< TYPE-DECLS [Str2] >>> ***/
799
800
801typedef Str1_t Str2_t;
802
Lev Walkin006de1c2004-08-20 13:37:45 +0000803/*** <<< FUNC-DECLS [Str2] >>> ***/
804
805extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
806asn_constr_check_f Str2_constraint;
807ber_type_decoder_f Str2_decode_ber;
808der_type_encoder_f Str2_encode_der;
809asn_struct_print_f Str2_print;
810asn_struct_free_f Str2_free;
811
812/*** <<< CTABLES [Str2] >>> ***/
813
814static int check_permitted_alphabet_1(const void *sptr) {
815 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000816 const IA5String_t *st = sptr;
817 const uint8_t *ch = st->buf;
818 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000819
820 for(; ch < end; ch++) {
821 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000822 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000823 }
Lev Walkin775885e2004-08-22 12:47:03 +0000824 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000825}
826
827
828/*** <<< CODE [Str2] >>> ***/
829
830int
831Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
832 asn_app_consume_bytes_f *app_errlog, void *app_key) {
833
Lev Walkin634a3b82004-08-22 03:30:05 +0000834 const Str1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000835 size_t size;
836
837 if(!sptr) {
838 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000839 "%s: value not given (%s:%d)",
840 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000841 return -1;
842 }
843
844 size = st->size;
845
846 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000847 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000848 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000849 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000850 } else {
851 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000852 "%s: constraint failed (%s:%d)",
853 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000854 return -1;
855 }
856}
857
858/*
859 * This type is implemented using Str1,
860 * so adjust the DEF appropriately.
861 */
862static void
863Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
864 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
865 td->der_encoder = asn1_DEF_Str1.der_encoder;
866 td->free_struct = asn1_DEF_Str1.free_struct;
867 td->print_struct = asn1_DEF_Str1.print_struct;
868 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
869 td->elements = asn1_DEF_Str1.elements;
870 td->elements_count = asn1_DEF_Str1.elements_count;
871 td->specifics = asn1_DEF_Str1.specifics;
872}
873
874ber_dec_rval_t
875Str2_decode_ber(asn1_TYPE_descriptor_t *td,
876 void **structure, void *bufptr, size_t size, int tag_mode) {
877 Str2_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +0000878 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +0000879}
880
881der_enc_rval_t
882Str2_encode_der(asn1_TYPE_descriptor_t *td,
883 void *structure, int tag_mode, ber_tlv_tag_t tag,
884 asn_app_consume_bytes_f *cb, void *app_key) {
885 Str2_inherit_TYPE_descriptor(td);
886 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
887}
888
889int
890Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
891 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
892 Str2_inherit_TYPE_descriptor(td);
893 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
894}
895
896void
897Str2_free(asn1_TYPE_descriptor_t *td,
898 void *struct_ptr, int contents_only) {
899 Str2_inherit_TYPE_descriptor(td);
900 td->free_struct(td, struct_ptr, contents_only);
901}
902
903
904/*** <<< STAT-DEFS [Str2] >>> ***/
905
906static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000907 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000908};
909asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
910 "Str2",
911 Str2_constraint,
912 Str2_decode_ber,
913 Str2_encode_der,
914 Str2_print,
915 Str2_free,
916 0, /* Use generic outmost tag fetcher */
917 asn1_DEF_Str2_tags,
918 sizeof(asn1_DEF_Str2_tags)
919 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000920 -0, /* Unknown yet */
921 0, 0, /* No members */
922 0 /* No specifics */
923};
924
925
926/*** <<< INCLUDES [Str3] >>> ***/
927
928#include <Str2.h>
929
930/*** <<< TYPE-DECLS [Str3] >>> ***/
931
932
933typedef Str2_t Str3_t;
934
Lev Walkin006de1c2004-08-20 13:37:45 +0000935/*** <<< FUNC-DECLS [Str3] >>> ***/
936
937extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
938asn_constr_check_f Str3_constraint;
939ber_type_decoder_f Str3_decode_ber;
940der_type_encoder_f Str3_encode_der;
941asn_struct_print_f Str3_print;
942asn_struct_free_f Str3_free;
943
944/*** <<< CTABLES [Str3] >>> ***/
945
946static int permitted_alphabet_table_2[256] = {
9470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9510,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9530,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
954};
955
956static int check_permitted_alphabet_2(const void *sptr) {
957 int *table = permitted_alphabet_table_2;
958 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000959 const IA5String_t *st = sptr;
960 const uint8_t *ch = st->buf;
961 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000962
963 for(; ch < end; ch++) {
964 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000965 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000966 }
Lev Walkin775885e2004-08-22 12:47:03 +0000967 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000968}
969
970
971/*** <<< CODE [Str3] >>> ***/
972
973int
974Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
975 asn_app_consume_bytes_f *app_errlog, void *app_key) {
976
Lev Walkin634a3b82004-08-22 03:30:05 +0000977 const Str2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000978 size_t size;
979
980 if(!sptr) {
981 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000982 "%s: value not given (%s:%d)",
983 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000984 return -1;
985 }
986
987 size = st->size;
988
989 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +0000990 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000991 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000992 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000993 } else {
994 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000995 "%s: constraint failed (%s:%d)",
996 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000997 return -1;
998 }
999}
1000
1001/*
1002 * This type is implemented using Str2,
1003 * so adjust the DEF appropriately.
1004 */
1005static void
1006Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1007 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1008 td->der_encoder = asn1_DEF_Str2.der_encoder;
1009 td->free_struct = asn1_DEF_Str2.free_struct;
1010 td->print_struct = asn1_DEF_Str2.print_struct;
1011 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1012 td->elements = asn1_DEF_Str2.elements;
1013 td->elements_count = asn1_DEF_Str2.elements_count;
1014 td->specifics = asn1_DEF_Str2.specifics;
1015}
1016
1017ber_dec_rval_t
1018Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1019 void **structure, void *bufptr, size_t size, int tag_mode) {
1020 Str3_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001021 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001022}
1023
1024der_enc_rval_t
1025Str3_encode_der(asn1_TYPE_descriptor_t *td,
1026 void *structure, int tag_mode, ber_tlv_tag_t tag,
1027 asn_app_consume_bytes_f *cb, void *app_key) {
1028 Str3_inherit_TYPE_descriptor(td);
1029 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1030}
1031
1032int
1033Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1034 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1035 Str3_inherit_TYPE_descriptor(td);
1036 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1037}
1038
1039void
1040Str3_free(asn1_TYPE_descriptor_t *td,
1041 void *struct_ptr, int contents_only) {
1042 Str3_inherit_TYPE_descriptor(td);
1043 td->free_struct(td, struct_ptr, contents_only);
1044}
1045
1046
1047/*** <<< STAT-DEFS [Str3] >>> ***/
1048
1049static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001050 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001051};
1052asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1053 "Str3",
1054 Str3_constraint,
1055 Str3_decode_ber,
1056 Str3_encode_der,
1057 Str3_print,
1058 Str3_free,
1059 0, /* Use generic outmost tag fetcher */
1060 asn1_DEF_Str3_tags,
1061 sizeof(asn1_DEF_Str3_tags)
1062 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001063 -0, /* Unknown yet */
1064 0, 0, /* No members */
1065 0 /* No specifics */
1066};
1067
1068
Lev Walkin8a99bf72004-09-10 06:07:39 +00001069/*** <<< INCLUDES [Str4] >>> ***/
1070
1071#include <IA5String.h>
1072
1073/*** <<< TYPE-DECLS [Str4] >>> ***/
1074
1075
1076typedef IA5String_t Str4_t;
1077
1078/*** <<< FUNC-DECLS [Str4] >>> ***/
1079
1080extern asn1_TYPE_descriptor_t asn1_DEF_Str4;
1081asn_constr_check_f Str4_constraint;
1082ber_type_decoder_f Str4_decode_ber;
1083der_type_encoder_f Str4_encode_der;
1084asn_struct_print_f Str4_print;
1085asn_struct_free_f Str4_free;
1086
1087/*** <<< CTABLES [Str4] >>> ***/
1088
1089static int check_permitted_alphabet_3(const void *sptr) {
1090 /* The underlying type is IA5String */
1091 const IA5String_t *st = sptr;
1092 const uint8_t *ch = st->buf;
1093 const uint8_t *end = ch + st->size;
1094
1095 for(; ch < end; ch++) {
1096 uint8_t cv = *ch;
1097 if(!(cv <= 127)) return -1;
1098 }
1099 return 0;
1100}
1101
1102
1103/*** <<< CODE [Str4] >>> ***/
1104
1105int
1106Str4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1107 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1108
1109 const IA5String_t *st = sptr;
1110
1111 if(!sptr) {
1112 _ASN_ERRLOG(app_errlog, app_key,
1113 "%s: value not given (%s:%d)",
1114 td->name, __FILE__, __LINE__);
1115 return -1;
1116 }
1117
1118
1119 if(!check_permitted_alphabet_3(sptr)) {
1120 /* Constraint check succeeded */
1121 return 0;
1122 } else {
1123 _ASN_ERRLOG(app_errlog, app_key,
1124 "%s: constraint failed (%s:%d)",
1125 td->name, __FILE__, __LINE__);
1126 return -1;
1127 }
1128}
1129
1130/*
1131 * This type is implemented using IA5String,
1132 * so adjust the DEF appropriately.
1133 */
1134static void
1135Str4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1136 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1137 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1138 td->free_struct = asn1_DEF_IA5String.free_struct;
1139 td->print_struct = asn1_DEF_IA5String.print_struct;
1140 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1141 td->elements = asn1_DEF_IA5String.elements;
1142 td->elements_count = asn1_DEF_IA5String.elements_count;
1143 td->specifics = asn1_DEF_IA5String.specifics;
1144}
1145
1146ber_dec_rval_t
1147Str4_decode_ber(asn1_TYPE_descriptor_t *td,
1148 void **structure, void *bufptr, size_t size, int tag_mode) {
1149 Str4_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001150 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001151}
1152
1153der_enc_rval_t
1154Str4_encode_der(asn1_TYPE_descriptor_t *td,
1155 void *structure, int tag_mode, ber_tlv_tag_t tag,
1156 asn_app_consume_bytes_f *cb, void *app_key) {
1157 Str4_inherit_TYPE_descriptor(td);
1158 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1159}
1160
1161int
1162Str4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1163 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1164 Str4_inherit_TYPE_descriptor(td);
1165 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1166}
1167
1168void
1169Str4_free(asn1_TYPE_descriptor_t *td,
1170 void *struct_ptr, int contents_only) {
1171 Str4_inherit_TYPE_descriptor(td);
1172 td->free_struct(td, struct_ptr, contents_only);
1173}
1174
1175
1176/*** <<< STAT-DEFS [Str4] >>> ***/
1177
1178static ber_tlv_tag_t asn1_DEF_Str4_tags[] = {
1179 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1180};
1181asn1_TYPE_descriptor_t asn1_DEF_Str4 = {
1182 "Str4",
1183 Str4_constraint,
1184 Str4_decode_ber,
1185 Str4_encode_der,
1186 Str4_print,
1187 Str4_free,
1188 0, /* Use generic outmost tag fetcher */
1189 asn1_DEF_Str4_tags,
1190 sizeof(asn1_DEF_Str4_tags)
1191 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001192 -0, /* Unknown yet */
1193 0, 0, /* No members */
1194 0 /* No specifics */
1195};
1196
1197
Lev Walkin006de1c2004-08-20 13:37:45 +00001198/*** <<< INCLUDES [PER-Visible] >>> ***/
1199
1200#include <IA5String.h>
1201
1202/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1203
1204
1205typedef IA5String_t PER_Visible_t;
1206
Lev Walkin006de1c2004-08-20 13:37:45 +00001207/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1208
1209extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
1210asn_constr_check_f PER_Visible_constraint;
1211ber_type_decoder_f PER_Visible_decode_ber;
1212der_type_encoder_f PER_Visible_encode_der;
1213asn_struct_print_f PER_Visible_print;
1214asn_struct_free_f PER_Visible_free;
1215
1216/*** <<< CTABLES [PER-Visible] >>> ***/
1217
Lev Walkin8a99bf72004-09-10 06:07:39 +00001218static int check_permitted_alphabet_4(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001219 /* The underlying type is IA5String */
Lev Walkind1e54942004-08-21 07:34:17 +00001220 const IA5String_t *st = sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001221 const uint8_t *ch = st->buf;
1222 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001223
1224 for(; ch < end; ch++) {
1225 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001226 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001227 }
Lev Walkin775885e2004-08-22 12:47:03 +00001228 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001229}
1230
1231
1232/*** <<< CODE [PER-Visible] >>> ***/
1233
1234int
1235PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1236 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1237
Lev Walkin634a3b82004-08-22 03:30:05 +00001238 const IA5String_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001239
1240 if(!sptr) {
1241 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001242 "%s: value not given (%s:%d)",
1243 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001244 return -1;
1245 }
1246
1247
Lev Walkin8a99bf72004-09-10 06:07:39 +00001248 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001249 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001250 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001251 } else {
1252 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001253 "%s: constraint failed (%s:%d)",
1254 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001255 return -1;
1256 }
1257}
1258
1259/*
1260 * This type is implemented using IA5String,
1261 * so adjust the DEF appropriately.
1262 */
1263static void
1264PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1265 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1266 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1267 td->free_struct = asn1_DEF_IA5String.free_struct;
1268 td->print_struct = asn1_DEF_IA5String.print_struct;
1269 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1270 td->elements = asn1_DEF_IA5String.elements;
1271 td->elements_count = asn1_DEF_IA5String.elements_count;
1272 td->specifics = asn1_DEF_IA5String.specifics;
1273}
1274
1275ber_dec_rval_t
1276PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1277 void **structure, void *bufptr, size_t size, int tag_mode) {
1278 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001279 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001280}
1281
1282der_enc_rval_t
1283PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1284 void *structure, int tag_mode, ber_tlv_tag_t tag,
1285 asn_app_consume_bytes_f *cb, void *app_key) {
1286 PER_Visible_inherit_TYPE_descriptor(td);
1287 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1288}
1289
1290int
1291PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1292 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1293 PER_Visible_inherit_TYPE_descriptor(td);
1294 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1295}
1296
1297void
1298PER_Visible_free(asn1_TYPE_descriptor_t *td,
1299 void *struct_ptr, int contents_only) {
1300 PER_Visible_inherit_TYPE_descriptor(td);
1301 td->free_struct(td, struct_ptr, contents_only);
1302}
1303
1304
1305/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1306
1307static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1308 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1309};
1310asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1311 "PER-Visible",
1312 PER_Visible_constraint,
1313 PER_Visible_decode_ber,
1314 PER_Visible_encode_der,
1315 PER_Visible_print,
1316 PER_Visible_free,
1317 0, /* Use generic outmost tag fetcher */
1318 asn1_DEF_PER_Visible_tags,
1319 sizeof(asn1_DEF_PER_Visible_tags)
1320 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001321 -0, /* Unknown yet */
1322 0, 0, /* No members */
1323 0 /* No specifics */
1324};
1325
1326
1327/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1328
1329#include <PER-Visible.h>
1330
1331/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1332
1333
1334typedef PER_Visible_t PER_Visible_2_t;
1335
Lev Walkin006de1c2004-08-20 13:37:45 +00001336/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1337
1338extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
1339asn_constr_check_f PER_Visible_2_constraint;
1340ber_type_decoder_f PER_Visible_2_decode_ber;
1341der_type_encoder_f PER_Visible_2_encode_der;
1342asn_struct_print_f PER_Visible_2_print;
1343asn_struct_free_f PER_Visible_2_free;
1344
1345/*** <<< CTABLES [PER-Visible-2] >>> ***/
1346
Lev Walkin8a99bf72004-09-10 06:07:39 +00001347static int check_permitted_alphabet_5(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001348 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001349 const IA5String_t *st = sptr;
1350 const uint8_t *ch = st->buf;
1351 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001352
1353 for(; ch < end; ch++) {
1354 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001355 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001356 }
Lev Walkin775885e2004-08-22 12:47:03 +00001357 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001358}
1359
1360
1361/*** <<< CODE [PER-Visible-2] >>> ***/
1362
1363int
1364PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1365 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1366
Lev Walkin634a3b82004-08-22 03:30:05 +00001367 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001368
1369 if(!sptr) {
1370 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001371 "%s: value not given (%s:%d)",
1372 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001373 return -1;
1374 }
1375
1376
Lev Walkin8a99bf72004-09-10 06:07:39 +00001377 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001378 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001379 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001380 } else {
1381 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001382 "%s: constraint failed (%s:%d)",
1383 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001384 return -1;
1385 }
1386}
1387
1388/*
1389 * This type is implemented using PER_Visible,
1390 * so adjust the DEF appropriately.
1391 */
1392static void
1393PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1394 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1395 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1396 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1397 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1398 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1399 td->elements = asn1_DEF_PER_Visible.elements;
1400 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1401 td->specifics = asn1_DEF_PER_Visible.specifics;
1402}
1403
1404ber_dec_rval_t
1405PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1406 void **structure, void *bufptr, size_t size, int tag_mode) {
1407 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001408 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001409}
1410
1411der_enc_rval_t
1412PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1413 void *structure, int tag_mode, ber_tlv_tag_t tag,
1414 asn_app_consume_bytes_f *cb, void *app_key) {
1415 PER_Visible_2_inherit_TYPE_descriptor(td);
1416 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1417}
1418
1419int
1420PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1421 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1422 PER_Visible_2_inherit_TYPE_descriptor(td);
1423 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1424}
1425
1426void
1427PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1428 void *struct_ptr, int contents_only) {
1429 PER_Visible_2_inherit_TYPE_descriptor(td);
1430 td->free_struct(td, struct_ptr, contents_only);
1431}
1432
1433
1434/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1435
1436static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001437 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001438};
1439asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1440 "PER-Visible-2",
1441 PER_Visible_2_constraint,
1442 PER_Visible_2_decode_ber,
1443 PER_Visible_2_encode_der,
1444 PER_Visible_2_print,
1445 PER_Visible_2_free,
1446 0, /* Use generic outmost tag fetcher */
1447 asn1_DEF_PER_Visible_2_tags,
1448 sizeof(asn1_DEF_PER_Visible_2_tags)
1449 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001450 -0, /* Unknown yet */
1451 0, 0, /* No members */
1452 0 /* No specifics */
1453};
1454
1455
1456/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1457
1458#include <PER-Visible.h>
1459
1460/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1461
1462
1463typedef PER_Visible_t Not_PER_Visible_1_t;
1464
Lev Walkin006de1c2004-08-20 13:37:45 +00001465/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1466
1467extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
1468asn_constr_check_f Not_PER_Visible_1_constraint;
1469ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1470der_type_encoder_f Not_PER_Visible_1_encode_der;
1471asn_struct_print_f Not_PER_Visible_1_print;
1472asn_struct_free_f Not_PER_Visible_1_free;
1473
1474/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1475
Lev Walkin8a99bf72004-09-10 06:07:39 +00001476static int check_permitted_alphabet_6(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001477 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001478 const IA5String_t *st = sptr;
1479 const uint8_t *ch = st->buf;
1480 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001481
1482 for(; ch < end; ch++) {
1483 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001484 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001485 }
Lev Walkin775885e2004-08-22 12:47:03 +00001486 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001487}
1488
1489
1490/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1491
1492int
1493Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1494 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1495
Lev Walkin634a3b82004-08-22 03:30:05 +00001496 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001497
1498 if(!sptr) {
1499 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001500 "%s: value not given (%s:%d)",
1501 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001502 return -1;
1503 }
1504
1505
Lev Walkin8a99bf72004-09-10 06:07:39 +00001506 if(!check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001507 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001508 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001509 } else {
1510 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001511 "%s: constraint failed (%s:%d)",
1512 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001513 return -1;
1514 }
1515}
1516
1517/*
1518 * This type is implemented using PER_Visible,
1519 * so adjust the DEF appropriately.
1520 */
1521static void
1522Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1523 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1524 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1525 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1526 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1527 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1528 td->elements = asn1_DEF_PER_Visible.elements;
1529 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1530 td->specifics = asn1_DEF_PER_Visible.specifics;
1531}
1532
1533ber_dec_rval_t
1534Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1535 void **structure, void *bufptr, size_t size, int tag_mode) {
1536 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001537 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001538}
1539
1540der_enc_rval_t
1541Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1542 void *structure, int tag_mode, ber_tlv_tag_t tag,
1543 asn_app_consume_bytes_f *cb, void *app_key) {
1544 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1545 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1546}
1547
1548int
1549Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1550 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1551 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1552 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1553}
1554
1555void
1556Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1557 void *struct_ptr, int contents_only) {
1558 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1559 td->free_struct(td, struct_ptr, contents_only);
1560}
1561
1562
1563/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1564
1565static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001566 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001567};
1568asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1569 "Not-PER-Visible-1",
1570 Not_PER_Visible_1_constraint,
1571 Not_PER_Visible_1_decode_ber,
1572 Not_PER_Visible_1_encode_der,
1573 Not_PER_Visible_1_print,
1574 Not_PER_Visible_1_free,
1575 0, /* Use generic outmost tag fetcher */
1576 asn1_DEF_Not_PER_Visible_1_tags,
1577 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1578 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001579 -0, /* Unknown yet */
1580 0, 0, /* No members */
1581 0 /* No specifics */
1582};
1583
1584
1585/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1586
1587#include <PER-Visible.h>
1588
1589/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1590
1591
1592typedef PER_Visible_t Not_PER_Visible_2_t;
1593
Lev Walkin006de1c2004-08-20 13:37:45 +00001594/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1595
1596extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
1597asn_constr_check_f Not_PER_Visible_2_constraint;
1598ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1599der_type_encoder_f Not_PER_Visible_2_encode_der;
1600asn_struct_print_f Not_PER_Visible_2_print;
1601asn_struct_free_f Not_PER_Visible_2_free;
1602
Lev Walkind35c8b52004-08-25 02:08:08 +00001603/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1604
Lev Walkin8a99bf72004-09-10 06:07:39 +00001605static int check_permitted_alphabet_7(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001606 /* The underlying type is IA5String */
1607 const IA5String_t *st = sptr;
1608 const uint8_t *ch = st->buf;
1609 const uint8_t *end = ch + st->size;
1610
1611 for(; ch < end; ch++) {
1612 uint8_t cv = *ch;
1613 if(!(cv >= 65 && cv <= 66)) return -1;
1614 }
1615 return 0;
1616}
1617
1618
Lev Walkin006de1c2004-08-20 13:37:45 +00001619/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1620
1621int
1622Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1623 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1624
Lev Walkin634a3b82004-08-22 03:30:05 +00001625 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001626
1627 if(!sptr) {
1628 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001629 "%s: value not given (%s:%d)",
1630 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001631 return -1;
1632 }
1633
1634
Lev Walkin8a99bf72004-09-10 06:07:39 +00001635 if(!check_permitted_alphabet_7(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001636 /* Constraint check succeeded */
1637 return 0;
1638 } else {
1639 _ASN_ERRLOG(app_errlog, app_key,
1640 "%s: constraint failed (%s:%d)",
1641 td->name, __FILE__, __LINE__);
1642 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001643 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001644}
1645
1646/*
1647 * This type is implemented using PER_Visible,
1648 * so adjust the DEF appropriately.
1649 */
1650static void
1651Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1652 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1653 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1654 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1655 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1656 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1657 td->elements = asn1_DEF_PER_Visible.elements;
1658 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1659 td->specifics = asn1_DEF_PER_Visible.specifics;
1660}
1661
1662ber_dec_rval_t
1663Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1664 void **structure, void *bufptr, size_t size, int tag_mode) {
1665 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001666 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001667}
1668
1669der_enc_rval_t
1670Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1671 void *structure, int tag_mode, ber_tlv_tag_t tag,
1672 asn_app_consume_bytes_f *cb, void *app_key) {
1673 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1674 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1675}
1676
1677int
1678Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1679 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1680 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1681 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1682}
1683
1684void
1685Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1686 void *struct_ptr, int contents_only) {
1687 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1688 td->free_struct(td, struct_ptr, contents_only);
1689}
1690
1691
1692/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1693
1694static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001695 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001696};
1697asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1698 "Not-PER-Visible-2",
1699 Not_PER_Visible_2_constraint,
1700 Not_PER_Visible_2_decode_ber,
1701 Not_PER_Visible_2_encode_der,
1702 Not_PER_Visible_2_print,
1703 Not_PER_Visible_2_free,
1704 0, /* Use generic outmost tag fetcher */
1705 asn1_DEF_Not_PER_Visible_2_tags,
1706 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1707 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001708 -0, /* Unknown yet */
1709 0, 0, /* No members */
1710 0 /* No specifics */
1711};
1712
1713
1714/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1715
1716#include <PER-Visible.h>
1717
1718/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1719
1720
1721typedef PER_Visible_t Not_PER_Visible_3_t;
1722
Lev Walkin006de1c2004-08-20 13:37:45 +00001723/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1724
1725extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
1726asn_constr_check_f Not_PER_Visible_3_constraint;
1727ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1728der_type_encoder_f Not_PER_Visible_3_encode_der;
1729asn_struct_print_f Not_PER_Visible_3_print;
1730asn_struct_free_f Not_PER_Visible_3_free;
1731
Lev Walkind35c8b52004-08-25 02:08:08 +00001732/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1733
Lev Walkin8a99bf72004-09-10 06:07:39 +00001734static int check_permitted_alphabet_8(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001735 /* The underlying type is IA5String */
1736 const IA5String_t *st = sptr;
1737 const uint8_t *ch = st->buf;
1738 const uint8_t *end = ch + st->size;
1739
1740 for(; ch < end; ch++) {
1741 uint8_t cv = *ch;
1742 if(!(cv >= 65 && cv <= 66)) return -1;
1743 }
1744 return 0;
1745}
1746
1747
Lev Walkin006de1c2004-08-20 13:37:45 +00001748/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1749
1750int
1751Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1752 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1753
Lev Walkin634a3b82004-08-22 03:30:05 +00001754 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001755
1756 if(!sptr) {
1757 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001758 "%s: value not given (%s:%d)",
1759 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001760 return -1;
1761 }
1762
1763
Lev Walkin8a99bf72004-09-10 06:07:39 +00001764 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001765 /* Constraint check succeeded */
1766 return 0;
1767 } else {
1768 _ASN_ERRLOG(app_errlog, app_key,
1769 "%s: constraint failed (%s:%d)",
1770 td->name, __FILE__, __LINE__);
1771 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001772 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001773}
1774
1775/*
1776 * This type is implemented using PER_Visible,
1777 * so adjust the DEF appropriately.
1778 */
1779static void
1780Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1781 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1782 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1783 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1784 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1785 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1786 td->elements = asn1_DEF_PER_Visible.elements;
1787 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1788 td->specifics = asn1_DEF_PER_Visible.specifics;
1789}
1790
1791ber_dec_rval_t
1792Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
1793 void **structure, void *bufptr, size_t size, int tag_mode) {
1794 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001795 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001796}
1797
1798der_enc_rval_t
1799Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
1800 void *structure, int tag_mode, ber_tlv_tag_t tag,
1801 asn_app_consume_bytes_f *cb, void *app_key) {
1802 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1803 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1804}
1805
1806int
1807Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1808 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1809 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1810 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1811}
1812
1813void
1814Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
1815 void *struct_ptr, int contents_only) {
1816 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1817 td->free_struct(td, struct_ptr, contents_only);
1818}
1819
1820
1821/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1822
1823static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001824 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001825};
1826asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
1827 "Not-PER-Visible-3",
1828 Not_PER_Visible_3_constraint,
1829 Not_PER_Visible_3_decode_ber,
1830 Not_PER_Visible_3_encode_der,
1831 Not_PER_Visible_3_print,
1832 Not_PER_Visible_3_free,
1833 0, /* Use generic outmost tag fetcher */
1834 asn1_DEF_Not_PER_Visible_3_tags,
1835 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
1836 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001837 -0, /* Unknown yet */
1838 0, 0, /* No members */
1839 0 /* No specifics */
1840};
1841
1842
1843/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1844
1845#include <PER-Visible.h>
1846
1847/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1848
1849
1850typedef PER_Visible_t SIZE_but_not_FROM_t;
1851
Lev Walkin006de1c2004-08-20 13:37:45 +00001852/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1853
1854extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
1855asn_constr_check_f SIZE_but_not_FROM_constraint;
1856ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1857der_type_encoder_f SIZE_but_not_FROM_encode_der;
1858asn_struct_print_f SIZE_but_not_FROM_print;
1859asn_struct_free_f SIZE_but_not_FROM_free;
1860
1861/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1862
Lev Walkin8a99bf72004-09-10 06:07:39 +00001863static int check_permitted_alphabet_9(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001864 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001865 const IA5String_t *st = sptr;
1866 const uint8_t *ch = st->buf;
1867 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001868
1869 for(; ch < end; ch++) {
1870 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00001871 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001872 }
Lev Walkin775885e2004-08-22 12:47:03 +00001873 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001874}
1875
1876
1877/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1878
1879int
1880SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1881 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1882
Lev Walkin634a3b82004-08-22 03:30:05 +00001883 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001884 size_t size;
1885
1886 if(!sptr) {
1887 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001888 "%s: value not given (%s:%d)",
1889 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001890 return -1;
1891 }
1892
1893 size = st->size;
1894
1895 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00001896 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001897 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001898 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001899 } else {
1900 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001901 "%s: constraint failed (%s:%d)",
1902 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001903 return -1;
1904 }
1905}
1906
1907/*
1908 * This type is implemented using PER_Visible,
1909 * so adjust the DEF appropriately.
1910 */
1911static void
1912SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
1913 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1914 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1915 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1916 td->print_struct = asn1_DEF_PER_Visible.print_struct;
1917 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1918 td->elements = asn1_DEF_PER_Visible.elements;
1919 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1920 td->specifics = asn1_DEF_PER_Visible.specifics;
1921}
1922
1923ber_dec_rval_t
1924SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
1925 void **structure, void *bufptr, size_t size, int tag_mode) {
1926 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00001927 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00001928}
1929
1930der_enc_rval_t
1931SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
1932 void *structure, int tag_mode, ber_tlv_tag_t tag,
1933 asn_app_consume_bytes_f *cb, void *app_key) {
1934 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1935 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1936}
1937
1938int
1939SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1940 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1941 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1942 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1943}
1944
1945void
1946SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
1947 void *struct_ptr, int contents_only) {
1948 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1949 td->free_struct(td, struct_ptr, contents_only);
1950}
1951
1952
1953/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1954
1955static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001956 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001957};
1958asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
1959 "SIZE-but-not-FROM",
1960 SIZE_but_not_FROM_constraint,
1961 SIZE_but_not_FROM_decode_ber,
1962 SIZE_but_not_FROM_encode_der,
1963 SIZE_but_not_FROM_print,
1964 SIZE_but_not_FROM_free,
1965 0, /* Use generic outmost tag fetcher */
1966 asn1_DEF_SIZE_but_not_FROM_tags,
1967 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
1968 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001969 -0, /* Unknown yet */
1970 0, 0, /* No members */
1971 0 /* No specifics */
1972};
1973
1974
1975/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
1976
1977#include <PER-Visible.h>
1978
1979/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
1980
1981
1982typedef PER_Visible_t SIZE_and_FROM_t;
1983
Lev Walkin006de1c2004-08-20 13:37:45 +00001984/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
1985
1986extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
1987asn_constr_check_f SIZE_and_FROM_constraint;
1988ber_type_decoder_f SIZE_and_FROM_decode_ber;
1989der_type_encoder_f SIZE_and_FROM_encode_der;
1990asn_struct_print_f SIZE_and_FROM_print;
1991asn_struct_free_f SIZE_and_FROM_free;
1992
1993/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
1994
Lev Walkin8a99bf72004-09-10 06:07:39 +00001995static int check_permitted_alphabet_10(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001996 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001997 const IA5String_t *st = sptr;
1998 const uint8_t *ch = st->buf;
1999 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002000
2001 for(; ch < end; ch++) {
2002 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002003 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002004 }
Lev Walkin775885e2004-08-22 12:47:03 +00002005 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002006}
2007
2008
2009/*** <<< CODE [SIZE-and-FROM] >>> ***/
2010
2011int
2012SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2013 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2014
Lev Walkin634a3b82004-08-22 03:30:05 +00002015 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002016 size_t size;
2017
2018 if(!sptr) {
2019 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002020 "%s: value not given (%s:%d)",
2021 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002022 return -1;
2023 }
2024
2025 size = st->size;
2026
2027 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002028 && !check_permitted_alphabet_10(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002029 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002030 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002031 } else {
2032 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002033 "%s: constraint failed (%s:%d)",
2034 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002035 return -1;
2036 }
2037}
2038
2039/*
2040 * This type is implemented using PER_Visible,
2041 * so adjust the DEF appropriately.
2042 */
2043static void
2044SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2045 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2046 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2047 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2048 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2049 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2050 td->elements = asn1_DEF_PER_Visible.elements;
2051 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2052 td->specifics = asn1_DEF_PER_Visible.specifics;
2053}
2054
2055ber_dec_rval_t
2056SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2057 void **structure, void *bufptr, size_t size, int tag_mode) {
2058 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00002059 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00002060}
2061
2062der_enc_rval_t
2063SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2064 void *structure, int tag_mode, ber_tlv_tag_t tag,
2065 asn_app_consume_bytes_f *cb, void *app_key) {
2066 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2067 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2068}
2069
2070int
2071SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2072 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2073 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2074 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2075}
2076
2077void
2078SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
2079 void *struct_ptr, int contents_only) {
2080 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2081 td->free_struct(td, struct_ptr, contents_only);
2082}
2083
2084
2085/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2086
2087static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002088 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002089};
2090asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
2091 "SIZE-and-FROM",
2092 SIZE_and_FROM_constraint,
2093 SIZE_and_FROM_decode_ber,
2094 SIZE_and_FROM_encode_der,
2095 SIZE_and_FROM_print,
2096 SIZE_and_FROM_free,
2097 0, /* Use generic outmost tag fetcher */
2098 asn1_DEF_SIZE_and_FROM_tags,
2099 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2100 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002101 -0, /* Unknown yet */
2102 0, 0, /* No members */
2103 0 /* No specifics */
2104};
2105
2106
2107/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2108
2109#include <PER-Visible.h>
2110
2111/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2112
2113
2114typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2115
Lev Walkin006de1c2004-08-20 13:37:45 +00002116/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2117
2118extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
2119asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2120ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2121der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
2122asn_struct_print_f Neither_SIZE_nor_FROM_print;
2123asn_struct_free_f Neither_SIZE_nor_FROM_free;
2124
2125/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2126
Lev Walkin8a99bf72004-09-10 06:07:39 +00002127static int check_permitted_alphabet_11(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002128 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002129 const IA5String_t *st = sptr;
2130 const uint8_t *ch = st->buf;
2131 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002132
2133 for(; ch < end; ch++) {
2134 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002135 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002136 }
Lev Walkin775885e2004-08-22 12:47:03 +00002137 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002138}
2139
2140
2141/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2142
2143int
2144Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2145 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2146
Lev Walkin634a3b82004-08-22 03:30:05 +00002147 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002148
2149 if(!sptr) {
2150 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002151 "%s: value not given (%s:%d)",
2152 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002153 return -1;
2154 }
2155
2156
Lev Walkin8a99bf72004-09-10 06:07:39 +00002157 if(!check_permitted_alphabet_11(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002158 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002159 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002160 } else {
2161 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002162 "%s: constraint failed (%s:%d)",
2163 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002164 return -1;
2165 }
2166}
2167
2168/*
2169 * This type is implemented using PER_Visible,
2170 * so adjust the DEF appropriately.
2171 */
2172static void
2173Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2174 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2175 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2176 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2177 td->print_struct = asn1_DEF_PER_Visible.print_struct;
2178 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2179 td->elements = asn1_DEF_PER_Visible.elements;
2180 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2181 td->specifics = asn1_DEF_PER_Visible.specifics;
2182}
2183
2184ber_dec_rval_t
2185Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2186 void **structure, void *bufptr, size_t size, int tag_mode) {
2187 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00002188 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00002189}
2190
2191der_enc_rval_t
2192Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2193 void *structure, int tag_mode, ber_tlv_tag_t tag,
2194 asn_app_consume_bytes_f *cb, void *app_key) {
2195 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2196 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2197}
2198
2199int
2200Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2201 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2202 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2203 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2204}
2205
2206void
2207Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2208 void *struct_ptr, int contents_only) {
2209 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2210 td->free_struct(td, struct_ptr, contents_only);
2211}
2212
2213
2214/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2215
2216static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002217 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002218};
2219asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2220 "Neither-SIZE-nor-FROM",
2221 Neither_SIZE_nor_FROM_constraint,
2222 Neither_SIZE_nor_FROM_decode_ber,
2223 Neither_SIZE_nor_FROM_encode_der,
2224 Neither_SIZE_nor_FROM_print,
2225 Neither_SIZE_nor_FROM_free,
2226 0, /* Use generic outmost tag fetcher */
2227 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2228 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2229 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002230 -0, /* Unknown yet */
2231 0, 0, /* No members */
2232 0 /* No specifics */
2233};
2234
2235
2236/*** <<< INCLUDES [Utf8-3] >>> ***/
2237
2238#include <Utf8-2.h>
2239
2240/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2241
2242
2243typedef Utf8_2_t Utf8_3_t;
2244
Lev Walkin006de1c2004-08-20 13:37:45 +00002245/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2246
2247extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
2248asn_constr_check_f Utf8_3_constraint;
2249ber_type_decoder_f Utf8_3_decode_ber;
2250der_type_encoder_f Utf8_3_encode_der;
2251asn_struct_print_f Utf8_3_print;
2252asn_struct_free_f Utf8_3_free;
2253
2254/*** <<< CTABLES [Utf8-3] >>> ***/
2255
Lev Walkin8a99bf72004-09-10 06:07:39 +00002256static int permitted_alphabet_table_12[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000022570,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22580,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22590,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22600,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
22610,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
22621,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
22630,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
22641,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2265};
2266
Lev Walkin8a99bf72004-09-10 06:07:39 +00002267static int check_permitted_alphabet_12(const void *sptr) {
2268 int *table = permitted_alphabet_table_12;
Lev Walkin006de1c2004-08-20 13:37:45 +00002269 /* The underlying type is UTF8String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002270 const UTF8String_t *st = sptr;
2271 const uint8_t *ch = st->buf;
2272 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002273
2274 for(; ch < end; ch++) {
2275 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002276 if(cv >= 0x80) return -1;
2277 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002278 }
Lev Walkin775885e2004-08-22 12:47:03 +00002279 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002280}
2281
2282
2283/*** <<< CODE [Utf8-3] >>> ***/
2284
2285int
2286Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2287 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2288
Lev Walkin634a3b82004-08-22 03:30:05 +00002289 const Utf8_2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002290 size_t size;
2291
2292 if(!sptr) {
2293 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002294 "%s: value not given (%s:%d)",
2295 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002296 return -1;
2297 }
2298
2299 size = UTF8String_length(st, td->name, app_errlog, app_key);
2300 if(size == (size_t)-1) return -1;
2301
2302 if((size >= 1 && size <= 2)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002303 && !check_permitted_alphabet_12(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002304 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002305 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002306 } else {
2307 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002308 "%s: constraint failed (%s:%d)",
2309 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002310 return -1;
2311 }
2312}
2313
2314/*
2315 * This type is implemented using Utf8_2,
2316 * so adjust the DEF appropriately.
2317 */
2318static void
2319Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2320 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2321 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2322 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2323 td->print_struct = asn1_DEF_Utf8_2.print_struct;
2324 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2325 td->elements = asn1_DEF_Utf8_2.elements;
2326 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2327 td->specifics = asn1_DEF_Utf8_2.specifics;
2328}
2329
2330ber_dec_rval_t
2331Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2332 void **structure, void *bufptr, size_t size, int tag_mode) {
2333 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00002334 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00002335}
2336
2337der_enc_rval_t
2338Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2339 void *structure, int tag_mode, ber_tlv_tag_t tag,
2340 asn_app_consume_bytes_f *cb, void *app_key) {
2341 Utf8_3_inherit_TYPE_descriptor(td);
2342 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2343}
2344
2345int
2346Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2347 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2348 Utf8_3_inherit_TYPE_descriptor(td);
2349 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2350}
2351
2352void
2353Utf8_3_free(asn1_TYPE_descriptor_t *td,
2354 void *struct_ptr, int contents_only) {
2355 Utf8_3_inherit_TYPE_descriptor(td);
2356 td->free_struct(td, struct_ptr, contents_only);
2357}
2358
2359
2360/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2361
2362static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002363 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002364};
2365asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2366 "Utf8-3",
2367 Utf8_3_constraint,
2368 Utf8_3_decode_ber,
2369 Utf8_3_encode_der,
2370 Utf8_3_print,
2371 Utf8_3_free,
2372 0, /* Use generic outmost tag fetcher */
2373 asn1_DEF_Utf8_3_tags,
2374 sizeof(asn1_DEF_Utf8_3_tags)
2375 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002376 -0, /* Unknown yet */
2377 0, 0, /* No members */
2378 0 /* No specifics */
2379};
2380
2381
2382/*** <<< INCLUDES [Utf8-2] >>> ***/
2383
2384#include <Utf8-1.h>
2385
2386/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2387
2388
2389typedef Utf8_1_t Utf8_2_t;
2390
Lev Walkin006de1c2004-08-20 13:37:45 +00002391/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2392
2393extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
2394asn_constr_check_f Utf8_2_constraint;
2395ber_type_decoder_f Utf8_2_decode_ber;
2396der_type_encoder_f Utf8_2_encode_der;
2397asn_struct_print_f Utf8_2_print;
2398asn_struct_free_f Utf8_2_free;
2399
2400/*** <<< CODE [Utf8-2] >>> ***/
2401
2402int
2403Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2404 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2405
Lev Walkin634a3b82004-08-22 03:30:05 +00002406 const Utf8_1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002407 size_t size;
2408
2409 if(!sptr) {
2410 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002411 "%s: value not given (%s:%d)",
2412 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002413 return -1;
2414 }
2415
2416 size = UTF8String_length(st, td->name, app_errlog, app_key);
2417 if(size == (size_t)-1) return -1;
2418
2419 if((size >= 1 && size <= 2)) {
2420 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002421 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002422 } else {
2423 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002424 "%s: constraint failed (%s:%d)",
2425 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002426 return -1;
2427 }
2428}
2429
2430/*
2431 * This type is implemented using Utf8_1,
2432 * so adjust the DEF appropriately.
2433 */
2434static void
2435Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2436 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2437 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2438 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2439 td->print_struct = asn1_DEF_Utf8_1.print_struct;
2440 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2441 td->elements = asn1_DEF_Utf8_1.elements;
2442 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2443 td->specifics = asn1_DEF_Utf8_1.specifics;
2444}
2445
2446ber_dec_rval_t
2447Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2448 void **structure, void *bufptr, size_t size, int tag_mode) {
2449 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00002450 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00002451}
2452
2453der_enc_rval_t
2454Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2455 void *structure, int tag_mode, ber_tlv_tag_t tag,
2456 asn_app_consume_bytes_f *cb, void *app_key) {
2457 Utf8_2_inherit_TYPE_descriptor(td);
2458 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2459}
2460
2461int
2462Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2463 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2464 Utf8_2_inherit_TYPE_descriptor(td);
2465 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2466}
2467
2468void
2469Utf8_2_free(asn1_TYPE_descriptor_t *td,
2470 void *struct_ptr, int contents_only) {
2471 Utf8_2_inherit_TYPE_descriptor(td);
2472 td->free_struct(td, struct_ptr, contents_only);
2473}
2474
2475
2476/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2477
2478static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002479 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002480};
2481asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2482 "Utf8-2",
2483 Utf8_2_constraint,
2484 Utf8_2_decode_ber,
2485 Utf8_2_encode_der,
2486 Utf8_2_print,
2487 Utf8_2_free,
2488 0, /* Use generic outmost tag fetcher */
2489 asn1_DEF_Utf8_2_tags,
2490 sizeof(asn1_DEF_Utf8_2_tags)
2491 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002492 -0, /* Unknown yet */
2493 0, 0, /* No members */
2494 0 /* No specifics */
2495};
2496
2497
2498/*** <<< INCLUDES [Utf8-1] >>> ***/
2499
2500#include <UTF8String.h>
2501
2502/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2503
2504
2505typedef UTF8String_t Utf8_1_t;
2506
Lev Walkin006de1c2004-08-20 13:37:45 +00002507/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2508
2509extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
2510asn_constr_check_f Utf8_1_constraint;
2511ber_type_decoder_f Utf8_1_decode_ber;
2512der_type_encoder_f Utf8_1_encode_der;
2513asn_struct_print_f Utf8_1_print;
2514asn_struct_free_f Utf8_1_free;
2515
2516/*** <<< CODE [Utf8-1] >>> ***/
2517
2518int
2519Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2520 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2521
2522 /* Make the underlying type checker permanent */
2523 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2524 return td->check_constraints
2525 (td, sptr, app_errlog, app_key);
2526}
2527
2528/*
2529 * This type is implemented using UTF8String,
2530 * so adjust the DEF appropriately.
2531 */
2532static void
2533Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
2534 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2535 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2536 td->free_struct = asn1_DEF_UTF8String.free_struct;
2537 td->print_struct = asn1_DEF_UTF8String.print_struct;
2538 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2539 td->elements = asn1_DEF_UTF8String.elements;
2540 td->elements_count = asn1_DEF_UTF8String.elements_count;
2541 td->specifics = asn1_DEF_UTF8String.specifics;
2542}
2543
2544ber_dec_rval_t
2545Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2546 void **structure, void *bufptr, size_t size, int tag_mode) {
2547 Utf8_1_inherit_TYPE_descriptor(td);
Lev Walkin906654e2004-09-10 15:49:15 +00002548 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
Lev Walkin006de1c2004-08-20 13:37:45 +00002549}
2550
2551der_enc_rval_t
2552Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2553 void *structure, int tag_mode, ber_tlv_tag_t tag,
2554 asn_app_consume_bytes_f *cb, void *app_key) {
2555 Utf8_1_inherit_TYPE_descriptor(td);
2556 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2557}
2558
2559int
2560Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2561 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2562 Utf8_1_inherit_TYPE_descriptor(td);
2563 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2564}
2565
2566void
2567Utf8_1_free(asn1_TYPE_descriptor_t *td,
2568 void *struct_ptr, int contents_only) {
2569 Utf8_1_inherit_TYPE_descriptor(td);
2570 td->free_struct(td, struct_ptr, contents_only);
2571}
2572
2573
2574/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2575
2576static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2577 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2578};
2579asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2580 "Utf8-1",
2581 Utf8_1_constraint,
2582 Utf8_1_decode_ber,
2583 Utf8_1_encode_der,
2584 Utf8_1_print,
2585 Utf8_1_free,
2586 0, /* Use generic outmost tag fetcher */
2587 asn1_DEF_Utf8_1_tags,
2588 sizeof(asn1_DEF_Utf8_1_tags)
2589 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002590 -0, /* Unknown yet */
2591 0, 0, /* No members */
2592 0 /* No specifics */
2593};
2594