blob: 197474f9405853111771f16b12af4e22689f1ceb [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;
Lev Walkina9cc46e2004-09-22 16:06:28 +000014asn_struct_free_f Int1_free;
15asn_struct_print_f Int1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +000016asn_constr_check_f Int1_constraint;
17ber_type_decoder_f Int1_decode_ber;
18der_type_encoder_f Int1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +000019xer_type_encoder_f Int1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +000020
21/*** <<< CODE [Int1] >>> ***/
22
23int
24Int1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
25 asn_app_consume_bytes_f *app_errlog, void *app_key) {
26
27 /* Make the underlying type checker permanent */
28 td->check_constraints = asn1_DEF_INTEGER.check_constraints;
29 return td->check_constraints
30 (td, sptr, app_errlog, app_key);
31}
32
33/*
34 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +000035 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +000036 */
37static void
38Int1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +000039 td->free_struct = asn1_DEF_INTEGER.free_struct;
40 td->print_struct = asn1_DEF_INTEGER.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +000041 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
42 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
43 td->xer_decoder = asn1_DEF_INTEGER.xer_decoder;
44 td->xer_encoder = asn1_DEF_INTEGER.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +000045 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
46 td->elements = asn1_DEF_INTEGER.elements;
47 td->elements_count = asn1_DEF_INTEGER.elements_count;
48 td->specifics = asn1_DEF_INTEGER.specifics;
49}
50
Lev Walkina9cc46e2004-09-22 16:06:28 +000051void
52Int1_free(asn1_TYPE_descriptor_t *td,
53 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +000054 Int1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +000055 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +000056}
57
58int
59Int1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
60 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
61 Int1_inherit_TYPE_descriptor(td);
62 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
63}
64
Lev Walkina9cc46e2004-09-22 16:06:28 +000065ber_dec_rval_t
66Int1_decode_ber(asn1_TYPE_descriptor_t *td,
67 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +000068 Int1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +000069 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
70}
71
72asn_enc_rval_t
73Int1_encode_der(asn1_TYPE_descriptor_t *td,
74 void *structure, int tag_mode, ber_tlv_tag_t tag,
75 asn_app_consume_bytes_f *cb, void *app_key) {
76 Int1_inherit_TYPE_descriptor(td);
77 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
78}
79
80asn_enc_rval_t
81Int1_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
82 int ilevel, enum xer_encoder_flags_e flags,
83 asn_app_consume_bytes_f *cb, void *app_key) {
84 Int1_inherit_TYPE_descriptor(td);
85 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +000086}
87
88
89/*** <<< STAT-DEFS [Int1] >>> ***/
90
91static ber_tlv_tag_t asn1_DEF_Int1_tags[] = {
92 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
93};
94asn1_TYPE_descriptor_t asn1_DEF_Int1 = {
95 "Int1",
Lev Walkina9cc46e2004-09-22 16:06:28 +000096 Int1_free,
97 Int1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +000098 Int1_constraint,
99 Int1_decode_ber,
100 Int1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000101 0, /* Not implemented yet */
102 Int1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000103 0, /* Use generic outmost tag fetcher */
104 asn1_DEF_Int1_tags,
105 sizeof(asn1_DEF_Int1_tags)
106 /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000107 asn1_DEF_Int1_tags, /* Same as above */
108 sizeof(asn1_DEF_Int1_tags)
109 /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000110 -0, /* Unknown yet */
111 0, 0, /* No members */
112 0 /* No specifics */
113};
114
115
116/*** <<< INCLUDES [Int2] >>> ***/
117
118#include <Int1.h>
119
120/*** <<< TYPE-DECLS [Int2] >>> ***/
121
122
123typedef Int1_t Int2_t;
124
Lev Walkin006de1c2004-08-20 13:37:45 +0000125/*** <<< FUNC-DECLS [Int2] >>> ***/
126
127extern asn1_TYPE_descriptor_t asn1_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000128asn_struct_free_f Int2_free;
129asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000130asn_constr_check_f Int2_constraint;
131ber_type_decoder_f Int2_decode_ber;
132der_type_encoder_f Int2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000133xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000134
135/*** <<< CODE [Int2] >>> ***/
136
137int
138Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
139 asn_app_consume_bytes_f *app_errlog, void *app_key) {
140
Lev Walkin634a3b82004-08-22 03:30:05 +0000141 const Int1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000142 long value;
143
144 if(!sptr) {
145 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000146 "%s: value not given (%s:%d)",
147 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000148 return -1;
149 }
150
Lev Walkin44467432004-09-07 06:43:57 +0000151 /* Check if the sign bit is present */
152 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000153
154 if((value >= 0)) {
155 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000156 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000157 } else {
158 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000159 "%s: constraint failed (%s:%d)",
160 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000161 return -1;
162 }
163}
164
165/*
166 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000167 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000168 */
169static void
170Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000171 td->free_struct = asn1_DEF_Int1.free_struct;
172 td->print_struct = asn1_DEF_Int1.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000173 td->ber_decoder = asn1_DEF_Int1.ber_decoder;
174 td->der_encoder = asn1_DEF_Int1.der_encoder;
175 td->xer_decoder = asn1_DEF_Int1.xer_decoder;
176 td->xer_encoder = asn1_DEF_Int1.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000177 td->last_tag_form = asn1_DEF_Int1.last_tag_form;
178 td->elements = asn1_DEF_Int1.elements;
179 td->elements_count = asn1_DEF_Int1.elements_count;
180 td->specifics = asn1_DEF_Int1.specifics;
181}
182
Lev Walkina9cc46e2004-09-22 16:06:28 +0000183void
184Int2_free(asn1_TYPE_descriptor_t *td,
185 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000186 Int2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000187 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000188}
189
190int
191Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
192 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
193 Int2_inherit_TYPE_descriptor(td);
194 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
195}
196
Lev Walkina9cc46e2004-09-22 16:06:28 +0000197ber_dec_rval_t
198Int2_decode_ber(asn1_TYPE_descriptor_t *td,
199 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000200 Int2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000201 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
202}
203
204asn_enc_rval_t
205Int2_encode_der(asn1_TYPE_descriptor_t *td,
206 void *structure, int tag_mode, ber_tlv_tag_t tag,
207 asn_app_consume_bytes_f *cb, void *app_key) {
208 Int2_inherit_TYPE_descriptor(td);
209 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
210}
211
212asn_enc_rval_t
213Int2_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
214 int ilevel, enum xer_encoder_flags_e flags,
215 asn_app_consume_bytes_f *cb, void *app_key) {
216 Int2_inherit_TYPE_descriptor(td);
217 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000218}
219
220
221/*** <<< STAT-DEFS [Int2] >>> ***/
222
223static ber_tlv_tag_t asn1_DEF_Int2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000224 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000225};
226asn1_TYPE_descriptor_t asn1_DEF_Int2 = {
227 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000228 Int2_free,
229 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000230 Int2_constraint,
231 Int2_decode_ber,
232 Int2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000233 0, /* Not implemented yet */
234 Int2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000235 0, /* Use generic outmost tag fetcher */
236 asn1_DEF_Int2_tags,
237 sizeof(asn1_DEF_Int2_tags)
238 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000239 asn1_DEF_Int2_tags, /* Same as above */
240 sizeof(asn1_DEF_Int2_tags)
241 /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000242 -0, /* Unknown yet */
243 0, 0, /* No members */
244 0 /* No specifics */
245};
246
247
248/*** <<< INCLUDES [Int3] >>> ***/
249
250#include <Int2.h>
251
252/*** <<< TYPE-DECLS [Int3] >>> ***/
253
254
255typedef Int2_t Int3_t;
256
Lev Walkin006de1c2004-08-20 13:37:45 +0000257/*** <<< FUNC-DECLS [Int3] >>> ***/
258
259extern asn1_TYPE_descriptor_t asn1_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000260asn_struct_free_f Int3_free;
261asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000262asn_constr_check_f Int3_constraint;
263ber_type_decoder_f Int3_decode_ber;
264der_type_encoder_f Int3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000265xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000266
267/*** <<< CODE [Int3] >>> ***/
268
269int
270Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
271 asn_app_consume_bytes_f *app_errlog, void *app_key) {
272
Lev Walkin634a3b82004-08-22 03:30:05 +0000273 const Int2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000274 long value;
275
276 if(!sptr) {
277 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000278 "%s: value not given (%s:%d)",
279 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000280 return -1;
281 }
282
283 if(asn1_INTEGER2long(st, &value)) {
284 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000285 "%s: value too large (%s:%d)",
286 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000287 return -1;
288 }
289
290 if((value >= 0 && value <= 10)) {
291 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000292 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000293 } else {
294 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000295 "%s: constraint failed (%s:%d)",
296 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000297 return -1;
298 }
299}
300
301/*
302 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000303 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000304 */
305static void
306Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000307 td->free_struct = asn1_DEF_Int2.free_struct;
308 td->print_struct = asn1_DEF_Int2.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000309 td->ber_decoder = asn1_DEF_Int2.ber_decoder;
310 td->der_encoder = asn1_DEF_Int2.der_encoder;
311 td->xer_decoder = asn1_DEF_Int2.xer_decoder;
312 td->xer_encoder = asn1_DEF_Int2.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000313 td->last_tag_form = asn1_DEF_Int2.last_tag_form;
314 td->elements = asn1_DEF_Int2.elements;
315 td->elements_count = asn1_DEF_Int2.elements_count;
316 td->specifics = asn1_DEF_Int2.specifics;
317}
318
Lev Walkina9cc46e2004-09-22 16:06:28 +0000319void
320Int3_free(asn1_TYPE_descriptor_t *td,
321 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000322 Int3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000323 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000324}
325
326int
327Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
328 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
329 Int3_inherit_TYPE_descriptor(td);
330 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
331}
332
Lev Walkina9cc46e2004-09-22 16:06:28 +0000333ber_dec_rval_t
334Int3_decode_ber(asn1_TYPE_descriptor_t *td,
335 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000336 Int3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000337 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
338}
339
340asn_enc_rval_t
341Int3_encode_der(asn1_TYPE_descriptor_t *td,
342 void *structure, int tag_mode, ber_tlv_tag_t tag,
343 asn_app_consume_bytes_f *cb, void *app_key) {
344 Int3_inherit_TYPE_descriptor(td);
345 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
346}
347
348asn_enc_rval_t
349Int3_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
350 int ilevel, enum xer_encoder_flags_e flags,
351 asn_app_consume_bytes_f *cb, void *app_key) {
352 Int3_inherit_TYPE_descriptor(td);
353 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000354}
355
356
357/*** <<< STAT-DEFS [Int3] >>> ***/
358
359static ber_tlv_tag_t asn1_DEF_Int3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000360 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000361};
362asn1_TYPE_descriptor_t asn1_DEF_Int3 = {
363 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000364 Int3_free,
365 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000366 Int3_constraint,
367 Int3_decode_ber,
368 Int3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000369 0, /* Not implemented yet */
370 Int3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000371 0, /* Use generic outmost tag fetcher */
372 asn1_DEF_Int3_tags,
373 sizeof(asn1_DEF_Int3_tags)
374 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000375 asn1_DEF_Int3_tags, /* Same as above */
376 sizeof(asn1_DEF_Int3_tags)
377 /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000378 -0, /* Unknown yet */
379 0, 0, /* No members */
380 0 /* No specifics */
381};
382
383
384/*** <<< INCLUDES [Int4] >>> ***/
385
386#include <Int3.h>
387
388/*** <<< TYPE-DECLS [Int4] >>> ***/
389
390
391typedef Int3_t Int4_t;
392
Lev Walkin006de1c2004-08-20 13:37:45 +0000393/*** <<< FUNC-DECLS [Int4] >>> ***/
394
395extern asn1_TYPE_descriptor_t asn1_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000396asn_struct_free_f Int4_free;
397asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000398asn_constr_check_f Int4_constraint;
399ber_type_decoder_f Int4_decode_ber;
400der_type_encoder_f Int4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000401xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000402
403/*** <<< CODE [Int4] >>> ***/
404
405int
406Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
407 asn_app_consume_bytes_f *app_errlog, void *app_key) {
408
Lev Walkin634a3b82004-08-22 03:30:05 +0000409 const Int3_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000410 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000411
412 if(!sptr) {
413 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000414 "%s: value not given (%s:%d)",
415 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000416 return -1;
417 }
418
Lev Walkind35c8b52004-08-25 02:08:08 +0000419 if(asn1_INTEGER2long(st, &value)) {
420 _ASN_ERRLOG(app_errlog, app_key,
421 "%s: value too large (%s:%d)",
422 td->name, __FILE__, __LINE__);
423 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000424 }
425
Lev Walkind35c8b52004-08-25 02:08:08 +0000426 if((value >= 1 && value <= 10)) {
427 /* Constraint check succeeded */
428 return 0;
429 } else {
430 _ASN_ERRLOG(app_errlog, app_key,
431 "%s: constraint failed (%s:%d)",
432 td->name, __FILE__, __LINE__);
433 return -1;
434 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000435}
436
437/*
438 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000439 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000440 */
441static void
442Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000443 td->free_struct = asn1_DEF_Int3.free_struct;
444 td->print_struct = asn1_DEF_Int3.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000445 td->ber_decoder = asn1_DEF_Int3.ber_decoder;
446 td->der_encoder = asn1_DEF_Int3.der_encoder;
447 td->xer_decoder = asn1_DEF_Int3.xer_decoder;
448 td->xer_encoder = asn1_DEF_Int3.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000449 td->last_tag_form = asn1_DEF_Int3.last_tag_form;
450 td->elements = asn1_DEF_Int3.elements;
451 td->elements_count = asn1_DEF_Int3.elements_count;
452 td->specifics = asn1_DEF_Int3.specifics;
453}
454
Lev Walkina9cc46e2004-09-22 16:06:28 +0000455void
456Int4_free(asn1_TYPE_descriptor_t *td,
457 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000458 Int4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000459 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000460}
461
462int
463Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
464 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
465 Int4_inherit_TYPE_descriptor(td);
466 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
467}
468
Lev Walkina9cc46e2004-09-22 16:06:28 +0000469ber_dec_rval_t
470Int4_decode_ber(asn1_TYPE_descriptor_t *td,
471 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000472 Int4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000473 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
474}
475
476asn_enc_rval_t
477Int4_encode_der(asn1_TYPE_descriptor_t *td,
478 void *structure, int tag_mode, ber_tlv_tag_t tag,
479 asn_app_consume_bytes_f *cb, void *app_key) {
480 Int4_inherit_TYPE_descriptor(td);
481 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
482}
483
484asn_enc_rval_t
485Int4_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
486 int ilevel, enum xer_encoder_flags_e flags,
487 asn_app_consume_bytes_f *cb, void *app_key) {
488 Int4_inherit_TYPE_descriptor(td);
489 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000490}
491
492
493/*** <<< STAT-DEFS [Int4] >>> ***/
494
495static ber_tlv_tag_t asn1_DEF_Int4_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000496 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000497};
498asn1_TYPE_descriptor_t asn1_DEF_Int4 = {
499 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000500 Int4_free,
501 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000502 Int4_constraint,
503 Int4_decode_ber,
504 Int4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000505 0, /* Not implemented yet */
506 Int4_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000507 0, /* Use generic outmost tag fetcher */
508 asn1_DEF_Int4_tags,
509 sizeof(asn1_DEF_Int4_tags)
510 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000511 asn1_DEF_Int4_tags, /* Same as above */
512 sizeof(asn1_DEF_Int4_tags)
513 /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000514 -0, /* Unknown yet */
515 0, 0, /* No members */
516 0 /* No specifics */
517};
518
519
520/*** <<< INCLUDES [Int5] >>> ***/
521
522#include <Int4.h>
523
524/*** <<< TYPE-DECLS [Int5] >>> ***/
525
526
527typedef Int4_t Int5_t;
528
Lev Walkin006de1c2004-08-20 13:37:45 +0000529/*** <<< FUNC-DECLS [Int5] >>> ***/
530
531extern asn1_TYPE_descriptor_t asn1_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000532asn_struct_free_f Int5_free;
533asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000534asn_constr_check_f Int5_constraint;
535ber_type_decoder_f Int5_decode_ber;
536der_type_encoder_f Int5_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000537xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000538
539/*** <<< CODE [Int5] >>> ***/
540
541int
542Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
543 asn_app_consume_bytes_f *app_errlog, void *app_key) {
544
Lev Walkin634a3b82004-08-22 03:30:05 +0000545 const Int4_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000546 long value;
547
548 if(!sptr) {
549 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000550 "%s: value not given (%s:%d)",
551 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000552 return -1;
553 }
554
555 if(asn1_INTEGER2long(st, &value)) {
556 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000557 "%s: value too large (%s:%d)",
558 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000559 return -1;
560 }
561
562 if((value == 5)) {
563 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000564 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000565 } else {
566 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000567 "%s: constraint failed (%s:%d)",
568 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000569 return -1;
570 }
571}
572
573/*
574 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000575 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000576 */
577static void
578Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000579 td->free_struct = asn1_DEF_Int4.free_struct;
580 td->print_struct = asn1_DEF_Int4.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000581 td->ber_decoder = asn1_DEF_Int4.ber_decoder;
582 td->der_encoder = asn1_DEF_Int4.der_encoder;
583 td->xer_decoder = asn1_DEF_Int4.xer_decoder;
584 td->xer_encoder = asn1_DEF_Int4.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000585 td->last_tag_form = asn1_DEF_Int4.last_tag_form;
586 td->elements = asn1_DEF_Int4.elements;
587 td->elements_count = asn1_DEF_Int4.elements_count;
588 td->specifics = asn1_DEF_Int4.specifics;
589}
590
Lev Walkina9cc46e2004-09-22 16:06:28 +0000591void
592Int5_free(asn1_TYPE_descriptor_t *td,
593 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000594 Int5_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000595 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000596}
597
598int
599Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
600 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
601 Int5_inherit_TYPE_descriptor(td);
602 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
603}
604
Lev Walkina9cc46e2004-09-22 16:06:28 +0000605ber_dec_rval_t
606Int5_decode_ber(asn1_TYPE_descriptor_t *td,
607 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000608 Int5_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000609 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
610}
611
612asn_enc_rval_t
613Int5_encode_der(asn1_TYPE_descriptor_t *td,
614 void *structure, int tag_mode, ber_tlv_tag_t tag,
615 asn_app_consume_bytes_f *cb, void *app_key) {
616 Int5_inherit_TYPE_descriptor(td);
617 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
618}
619
620asn_enc_rval_t
621Int5_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
622 int ilevel, enum xer_encoder_flags_e flags,
623 asn_app_consume_bytes_f *cb, void *app_key) {
624 Int5_inherit_TYPE_descriptor(td);
625 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000626}
627
628
629/*** <<< STAT-DEFS [Int5] >>> ***/
630
631static ber_tlv_tag_t asn1_DEF_Int5_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000632 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000633};
634asn1_TYPE_descriptor_t asn1_DEF_Int5 = {
635 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000636 Int5_free,
637 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000638 Int5_constraint,
639 Int5_decode_ber,
640 Int5_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000641 0, /* Not implemented yet */
642 Int5_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000643 0, /* Use generic outmost tag fetcher */
644 asn1_DEF_Int5_tags,
645 sizeof(asn1_DEF_Int5_tags)
646 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000647 asn1_DEF_Int5_tags, /* Same as above */
648 sizeof(asn1_DEF_Int5_tags)
649 /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000650 -0, /* Unknown yet */
651 0, 0, /* No members */
652 0 /* No specifics */
653};
654
655
656/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
657
658#include <INTEGER.h>
659
660/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
661
662
663typedef INTEGER_t ExtensibleExtensions_t;
664
Lev Walkin006de1c2004-08-20 13:37:45 +0000665/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
666
667extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000668asn_struct_free_f ExtensibleExtensions_free;
669asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000670asn_constr_check_f ExtensibleExtensions_constraint;
671ber_type_decoder_f ExtensibleExtensions_decode_ber;
672der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000673xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000674
675/*** <<< CODE [ExtensibleExtensions] >>> ***/
676
677int
678ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
679 asn_app_consume_bytes_f *app_errlog, void *app_key) {
680
Lev Walkin634a3b82004-08-22 03:30:05 +0000681 const INTEGER_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000682 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000683
684 if(!sptr) {
685 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000686 "%s: value not given (%s:%d)",
687 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000688 return -1;
689 }
690
Lev Walkind35c8b52004-08-25 02:08:08 +0000691 if(asn1_INTEGER2long(st, &value)) {
692 _ASN_ERRLOG(app_errlog, app_key,
693 "%s: value too large (%s:%d)",
694 td->name, __FILE__, __LINE__);
695 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000696 }
697
Lev Walkind35c8b52004-08-25 02:08:08 +0000698 if((value >= 1 && value <= 256)) {
699 /* Constraint check succeeded */
700 return 0;
701 } else {
702 _ASN_ERRLOG(app_errlog, app_key,
703 "%s: constraint failed (%s:%d)",
704 td->name, __FILE__, __LINE__);
705 return -1;
706 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000707}
708
709/*
710 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000711 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000712 */
713static void
714ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000715 td->free_struct = asn1_DEF_INTEGER.free_struct;
716 td->print_struct = asn1_DEF_INTEGER.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000717 td->ber_decoder = asn1_DEF_INTEGER.ber_decoder;
718 td->der_encoder = asn1_DEF_INTEGER.der_encoder;
719 td->xer_decoder = asn1_DEF_INTEGER.xer_decoder;
720 td->xer_encoder = asn1_DEF_INTEGER.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000721 td->last_tag_form = asn1_DEF_INTEGER.last_tag_form;
722 td->elements = asn1_DEF_INTEGER.elements;
723 td->elements_count = asn1_DEF_INTEGER.elements_count;
724 td->specifics = asn1_DEF_INTEGER.specifics;
725}
726
Lev Walkina9cc46e2004-09-22 16:06:28 +0000727void
728ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td,
729 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000730 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000731 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000732}
733
734int
735ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
736 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
737 ExtensibleExtensions_inherit_TYPE_descriptor(td);
738 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
739}
740
Lev Walkina9cc46e2004-09-22 16:06:28 +0000741ber_dec_rval_t
742ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td,
743 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000744 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000745 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
746}
747
748asn_enc_rval_t
749ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td,
750 void *structure, int tag_mode, ber_tlv_tag_t tag,
751 asn_app_consume_bytes_f *cb, void *app_key) {
752 ExtensibleExtensions_inherit_TYPE_descriptor(td);
753 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
754}
755
756asn_enc_rval_t
757ExtensibleExtensions_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
758 int ilevel, enum xer_encoder_flags_e flags,
759 asn_app_consume_bytes_f *cb, void *app_key) {
760 ExtensibleExtensions_inherit_TYPE_descriptor(td);
761 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000762}
763
764
765/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
766
767static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = {
768 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
769};
770asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = {
771 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000772 ExtensibleExtensions_free,
773 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000774 ExtensibleExtensions_constraint,
775 ExtensibleExtensions_decode_ber,
776 ExtensibleExtensions_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000777 0, /* Not implemented yet */
778 ExtensibleExtensions_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000779 0, /* Use generic outmost tag fetcher */
780 asn1_DEF_ExtensibleExtensions_tags,
781 sizeof(asn1_DEF_ExtensibleExtensions_tags)
782 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000783 asn1_DEF_ExtensibleExtensions_tags, /* Same as above */
784 sizeof(asn1_DEF_ExtensibleExtensions_tags)
785 /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000786 -0, /* Unknown yet */
787 0, 0, /* No members */
788 0 /* No specifics */
789};
790
791
792/*** <<< INCLUDES [Str1] >>> ***/
793
794#include <IA5String.h>
795
796/*** <<< TYPE-DECLS [Str1] >>> ***/
797
798
799typedef IA5String_t Str1_t;
800
Lev Walkin006de1c2004-08-20 13:37:45 +0000801/*** <<< FUNC-DECLS [Str1] >>> ***/
802
803extern asn1_TYPE_descriptor_t asn1_DEF_Str1;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000804asn_struct_free_f Str1_free;
805asn_struct_print_f Str1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000806asn_constr_check_f Str1_constraint;
807ber_type_decoder_f Str1_decode_ber;
808der_type_encoder_f Str1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000809xer_type_encoder_f Str1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000810
811/*** <<< CODE [Str1] >>> ***/
812
813int
814Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
815 asn_app_consume_bytes_f *app_errlog, void *app_key) {
816
817 /* Make the underlying type checker permanent */
818 td->check_constraints = asn1_DEF_IA5String.check_constraints;
819 return td->check_constraints
820 (td, sptr, app_errlog, app_key);
821}
822
823/*
824 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +0000825 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000826 */
827static void
828Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000829 td->free_struct = asn1_DEF_IA5String.free_struct;
830 td->print_struct = asn1_DEF_IA5String.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000831 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
832 td->der_encoder = asn1_DEF_IA5String.der_encoder;
833 td->xer_decoder = asn1_DEF_IA5String.xer_decoder;
834 td->xer_encoder = asn1_DEF_IA5String.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000835 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
836 td->elements = asn1_DEF_IA5String.elements;
837 td->elements_count = asn1_DEF_IA5String.elements_count;
838 td->specifics = asn1_DEF_IA5String.specifics;
839}
840
Lev Walkina9cc46e2004-09-22 16:06:28 +0000841void
842Str1_free(asn1_TYPE_descriptor_t *td,
843 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000844 Str1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000845 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000846}
847
848int
849Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
850 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
851 Str1_inherit_TYPE_descriptor(td);
852 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
853}
854
Lev Walkina9cc46e2004-09-22 16:06:28 +0000855ber_dec_rval_t
856Str1_decode_ber(asn1_TYPE_descriptor_t *td,
857 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000858 Str1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000859 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
860}
861
862asn_enc_rval_t
863Str1_encode_der(asn1_TYPE_descriptor_t *td,
864 void *structure, int tag_mode, ber_tlv_tag_t tag,
865 asn_app_consume_bytes_f *cb, void *app_key) {
866 Str1_inherit_TYPE_descriptor(td);
867 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
868}
869
870asn_enc_rval_t
871Str1_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
872 int ilevel, enum xer_encoder_flags_e flags,
873 asn_app_consume_bytes_f *cb, void *app_key) {
874 Str1_inherit_TYPE_descriptor(td);
875 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000876}
877
878
879/*** <<< STAT-DEFS [Str1] >>> ***/
880
881static ber_tlv_tag_t asn1_DEF_Str1_tags[] = {
882 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
883};
884asn1_TYPE_descriptor_t asn1_DEF_Str1 = {
885 "Str1",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000886 Str1_free,
887 Str1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000888 Str1_constraint,
889 Str1_decode_ber,
890 Str1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000891 0, /* Not implemented yet */
892 Str1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000893 0, /* Use generic outmost tag fetcher */
894 asn1_DEF_Str1_tags,
895 sizeof(asn1_DEF_Str1_tags)
896 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +0000897 asn1_DEF_Str1_tags, /* Same as above */
898 sizeof(asn1_DEF_Str1_tags)
899 /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000900 -0, /* Unknown yet */
901 0, 0, /* No members */
902 0 /* No specifics */
903};
904
905
906/*** <<< INCLUDES [Str2] >>> ***/
907
908#include <Str1.h>
909
910/*** <<< TYPE-DECLS [Str2] >>> ***/
911
912
913typedef Str1_t Str2_t;
914
Lev Walkin006de1c2004-08-20 13:37:45 +0000915/*** <<< FUNC-DECLS [Str2] >>> ***/
916
917extern asn1_TYPE_descriptor_t asn1_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000918asn_struct_free_f Str2_free;
919asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000920asn_constr_check_f Str2_constraint;
921ber_type_decoder_f Str2_decode_ber;
922der_type_encoder_f Str2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000923xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000924
925/*** <<< CTABLES [Str2] >>> ***/
926
927static int check_permitted_alphabet_1(const void *sptr) {
928 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000929 const IA5String_t *st = sptr;
930 const uint8_t *ch = st->buf;
931 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000932
933 for(; ch < end; ch++) {
934 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000935 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000936 }
Lev Walkin775885e2004-08-22 12:47:03 +0000937 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000938}
939
940
941/*** <<< CODE [Str2] >>> ***/
942
943int
944Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
945 asn_app_consume_bytes_f *app_errlog, void *app_key) {
946
Lev Walkin634a3b82004-08-22 03:30:05 +0000947 const Str1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000948 size_t size;
949
950 if(!sptr) {
951 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000952 "%s: value not given (%s:%d)",
953 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000954 return -1;
955 }
956
957 size = st->size;
958
959 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000960 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000961 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000962 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000963 } else {
964 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000965 "%s: constraint failed (%s:%d)",
966 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000967 return -1;
968 }
969}
970
971/*
972 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000973 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000974 */
975static void
976Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000977 td->free_struct = asn1_DEF_Str1.free_struct;
978 td->print_struct = asn1_DEF_Str1.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000979 td->ber_decoder = asn1_DEF_Str1.ber_decoder;
980 td->der_encoder = asn1_DEF_Str1.der_encoder;
981 td->xer_decoder = asn1_DEF_Str1.xer_decoder;
982 td->xer_encoder = asn1_DEF_Str1.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +0000983 td->last_tag_form = asn1_DEF_Str1.last_tag_form;
984 td->elements = asn1_DEF_Str1.elements;
985 td->elements_count = asn1_DEF_Str1.elements_count;
986 td->specifics = asn1_DEF_Str1.specifics;
987}
988
Lev Walkina9cc46e2004-09-22 16:06:28 +0000989void
990Str2_free(asn1_TYPE_descriptor_t *td,
991 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000992 Str2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000993 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000994}
995
996int
997Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
998 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
999 Str2_inherit_TYPE_descriptor(td);
1000 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1001}
1002
Lev Walkina9cc46e2004-09-22 16:06:28 +00001003ber_dec_rval_t
1004Str2_decode_ber(asn1_TYPE_descriptor_t *td,
1005 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001006 Str2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001007 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1008}
1009
1010asn_enc_rval_t
1011Str2_encode_der(asn1_TYPE_descriptor_t *td,
1012 void *structure, int tag_mode, ber_tlv_tag_t tag,
1013 asn_app_consume_bytes_f *cb, void *app_key) {
1014 Str2_inherit_TYPE_descriptor(td);
1015 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1016}
1017
1018asn_enc_rval_t
1019Str2_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1020 int ilevel, enum xer_encoder_flags_e flags,
1021 asn_app_consume_bytes_f *cb, void *app_key) {
1022 Str2_inherit_TYPE_descriptor(td);
1023 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001024}
1025
1026
1027/*** <<< STAT-DEFS [Str2] >>> ***/
1028
1029static ber_tlv_tag_t asn1_DEF_Str2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001030 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001031};
1032asn1_TYPE_descriptor_t asn1_DEF_Str2 = {
1033 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001034 Str2_free,
1035 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001036 Str2_constraint,
1037 Str2_decode_ber,
1038 Str2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001039 0, /* Not implemented yet */
1040 Str2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001041 0, /* Use generic outmost tag fetcher */
1042 asn1_DEF_Str2_tags,
1043 sizeof(asn1_DEF_Str2_tags)
1044 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001045 asn1_DEF_Str2_tags, /* Same as above */
1046 sizeof(asn1_DEF_Str2_tags)
1047 /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001048 -0, /* Unknown yet */
1049 0, 0, /* No members */
1050 0 /* No specifics */
1051};
1052
1053
1054/*** <<< INCLUDES [Str3] >>> ***/
1055
1056#include <Str2.h>
1057
1058/*** <<< TYPE-DECLS [Str3] >>> ***/
1059
1060
1061typedef Str2_t Str3_t;
1062
Lev Walkin006de1c2004-08-20 13:37:45 +00001063/*** <<< FUNC-DECLS [Str3] >>> ***/
1064
1065extern asn1_TYPE_descriptor_t asn1_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001066asn_struct_free_f Str3_free;
1067asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001068asn_constr_check_f Str3_constraint;
1069ber_type_decoder_f Str3_decode_ber;
1070der_type_encoder_f Str3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001071xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001072
1073/*** <<< CTABLES [Str3] >>> ***/
1074
1075static int permitted_alphabet_table_2[256] = {
10760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
10770,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
10780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
10790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
10800,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
10810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
10820,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
1083};
1084
1085static int check_permitted_alphabet_2(const void *sptr) {
1086 int *table = permitted_alphabet_table_2;
1087 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001088 const IA5String_t *st = sptr;
1089 const uint8_t *ch = st->buf;
1090 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001091
1092 for(; ch < end; ch++) {
1093 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001094 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001095 }
Lev Walkin775885e2004-08-22 12:47:03 +00001096 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001097}
1098
1099
1100/*** <<< CODE [Str3] >>> ***/
1101
1102int
1103Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1104 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1105
Lev Walkin634a3b82004-08-22 03:30:05 +00001106 const Str2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001107 size_t size;
1108
1109 if(!sptr) {
1110 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001111 "%s: value not given (%s:%d)",
1112 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001113 return -1;
1114 }
1115
1116 size = st->size;
1117
1118 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +00001119 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001120 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001121 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001122 } else {
1123 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001124 "%s: constraint failed (%s:%d)",
1125 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001126 return -1;
1127 }
1128}
1129
1130/*
1131 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +00001132 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001133 */
1134static void
1135Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001136 td->free_struct = asn1_DEF_Str2.free_struct;
1137 td->print_struct = asn1_DEF_Str2.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001138 td->ber_decoder = asn1_DEF_Str2.ber_decoder;
1139 td->der_encoder = asn1_DEF_Str2.der_encoder;
1140 td->xer_decoder = asn1_DEF_Str2.xer_decoder;
1141 td->xer_encoder = asn1_DEF_Str2.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00001142 td->last_tag_form = asn1_DEF_Str2.last_tag_form;
1143 td->elements = asn1_DEF_Str2.elements;
1144 td->elements_count = asn1_DEF_Str2.elements_count;
1145 td->specifics = asn1_DEF_Str2.specifics;
1146}
1147
Lev Walkina9cc46e2004-09-22 16:06:28 +00001148void
1149Str3_free(asn1_TYPE_descriptor_t *td,
1150 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001151 Str3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001152 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001153}
1154
1155int
1156Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1157 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1158 Str3_inherit_TYPE_descriptor(td);
1159 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1160}
1161
Lev Walkina9cc46e2004-09-22 16:06:28 +00001162ber_dec_rval_t
1163Str3_decode_ber(asn1_TYPE_descriptor_t *td,
1164 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001165 Str3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001166 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1167}
1168
1169asn_enc_rval_t
1170Str3_encode_der(asn1_TYPE_descriptor_t *td,
1171 void *structure, int tag_mode, ber_tlv_tag_t tag,
1172 asn_app_consume_bytes_f *cb, void *app_key) {
1173 Str3_inherit_TYPE_descriptor(td);
1174 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1175}
1176
1177asn_enc_rval_t
1178Str3_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1179 int ilevel, enum xer_encoder_flags_e flags,
1180 asn_app_consume_bytes_f *cb, void *app_key) {
1181 Str3_inherit_TYPE_descriptor(td);
1182 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001183}
1184
1185
1186/*** <<< STAT-DEFS [Str3] >>> ***/
1187
1188static ber_tlv_tag_t asn1_DEF_Str3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001189 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001190};
1191asn1_TYPE_descriptor_t asn1_DEF_Str3 = {
1192 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001193 Str3_free,
1194 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001195 Str3_constraint,
1196 Str3_decode_ber,
1197 Str3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001198 0, /* Not implemented yet */
1199 Str3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001200 0, /* Use generic outmost tag fetcher */
1201 asn1_DEF_Str3_tags,
1202 sizeof(asn1_DEF_Str3_tags)
1203 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001204 asn1_DEF_Str3_tags, /* Same as above */
1205 sizeof(asn1_DEF_Str3_tags)
1206 /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001207 -0, /* Unknown yet */
1208 0, 0, /* No members */
1209 0 /* No specifics */
1210};
1211
1212
Lev Walkin8a99bf72004-09-10 06:07:39 +00001213/*** <<< INCLUDES [Str4] >>> ***/
1214
1215#include <IA5String.h>
1216
1217/*** <<< TYPE-DECLS [Str4] >>> ***/
1218
1219
1220typedef IA5String_t Str4_t;
1221
1222/*** <<< FUNC-DECLS [Str4] >>> ***/
1223
1224extern asn1_TYPE_descriptor_t asn1_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001225asn_struct_free_f Str4_free;
1226asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001227asn_constr_check_f Str4_constraint;
1228ber_type_decoder_f Str4_decode_ber;
1229der_type_encoder_f Str4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001230xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001231
1232/*** <<< CTABLES [Str4] >>> ***/
1233
1234static int check_permitted_alphabet_3(const void *sptr) {
1235 /* The underlying type is IA5String */
1236 const IA5String_t *st = sptr;
1237 const uint8_t *ch = st->buf;
1238 const uint8_t *end = ch + st->size;
1239
1240 for(; ch < end; ch++) {
1241 uint8_t cv = *ch;
1242 if(!(cv <= 127)) return -1;
1243 }
1244 return 0;
1245}
1246
1247
1248/*** <<< CODE [Str4] >>> ***/
1249
1250int
1251Str4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1252 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1253
1254 const IA5String_t *st = sptr;
1255
1256 if(!sptr) {
1257 _ASN_ERRLOG(app_errlog, app_key,
1258 "%s: value not given (%s:%d)",
1259 td->name, __FILE__, __LINE__);
1260 return -1;
1261 }
1262
1263
1264 if(!check_permitted_alphabet_3(sptr)) {
1265 /* Constraint check succeeded */
1266 return 0;
1267 } else {
1268 _ASN_ERRLOG(app_errlog, app_key,
1269 "%s: constraint failed (%s:%d)",
1270 td->name, __FILE__, __LINE__);
1271 return -1;
1272 }
1273}
1274
1275/*
1276 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001277 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001278 */
1279static void
1280Str4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001281 td->free_struct = asn1_DEF_IA5String.free_struct;
1282 td->print_struct = asn1_DEF_IA5String.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001283 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1284 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1285 td->xer_decoder = asn1_DEF_IA5String.xer_decoder;
1286 td->xer_encoder = asn1_DEF_IA5String.xer_encoder;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001287 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1288 td->elements = asn1_DEF_IA5String.elements;
1289 td->elements_count = asn1_DEF_IA5String.elements_count;
1290 td->specifics = asn1_DEF_IA5String.specifics;
1291}
1292
Lev Walkina9cc46e2004-09-22 16:06:28 +00001293void
1294Str4_free(asn1_TYPE_descriptor_t *td,
1295 void *struct_ptr, int contents_only) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001296 Str4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001297 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001298}
1299
1300int
1301Str4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1302 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1303 Str4_inherit_TYPE_descriptor(td);
1304 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1305}
1306
Lev Walkina9cc46e2004-09-22 16:06:28 +00001307ber_dec_rval_t
1308Str4_decode_ber(asn1_TYPE_descriptor_t *td,
1309 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001310 Str4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001311 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1312}
1313
1314asn_enc_rval_t
1315Str4_encode_der(asn1_TYPE_descriptor_t *td,
1316 void *structure, int tag_mode, ber_tlv_tag_t tag,
1317 asn_app_consume_bytes_f *cb, void *app_key) {
1318 Str4_inherit_TYPE_descriptor(td);
1319 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1320}
1321
1322asn_enc_rval_t
1323Str4_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1324 int ilevel, enum xer_encoder_flags_e flags,
1325 asn_app_consume_bytes_f *cb, void *app_key) {
1326 Str4_inherit_TYPE_descriptor(td);
1327 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001328}
1329
1330
1331/*** <<< STAT-DEFS [Str4] >>> ***/
1332
1333static ber_tlv_tag_t asn1_DEF_Str4_tags[] = {
1334 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1335};
1336asn1_TYPE_descriptor_t asn1_DEF_Str4 = {
1337 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001338 Str4_free,
1339 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001340 Str4_constraint,
1341 Str4_decode_ber,
1342 Str4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001343 0, /* Not implemented yet */
1344 Str4_encode_xer,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001345 0, /* Use generic outmost tag fetcher */
1346 asn1_DEF_Str4_tags,
1347 sizeof(asn1_DEF_Str4_tags)
1348 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001349 asn1_DEF_Str4_tags, /* Same as above */
1350 sizeof(asn1_DEF_Str4_tags)
1351 /sizeof(asn1_DEF_Str4_tags[0]), /* 1 */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001352 -0, /* Unknown yet */
1353 0, 0, /* No members */
1354 0 /* No specifics */
1355};
1356
1357
Lev Walkin006de1c2004-08-20 13:37:45 +00001358/*** <<< INCLUDES [PER-Visible] >>> ***/
1359
1360#include <IA5String.h>
1361
1362/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1363
1364
1365typedef IA5String_t PER_Visible_t;
1366
Lev Walkin006de1c2004-08-20 13:37:45 +00001367/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1368
1369extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001370asn_struct_free_f PER_Visible_free;
1371asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001372asn_constr_check_f PER_Visible_constraint;
1373ber_type_decoder_f PER_Visible_decode_ber;
1374der_type_encoder_f PER_Visible_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001375xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001376
1377/*** <<< CTABLES [PER-Visible] >>> ***/
1378
Lev Walkin8a99bf72004-09-10 06:07:39 +00001379static int check_permitted_alphabet_4(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001380 /* The underlying type is IA5String */
Lev Walkind1e54942004-08-21 07:34:17 +00001381 const IA5String_t *st = sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001382 const uint8_t *ch = st->buf;
1383 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001384
1385 for(; ch < end; ch++) {
1386 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001387 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001388 }
Lev Walkin775885e2004-08-22 12:47:03 +00001389 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001390}
1391
1392
1393/*** <<< CODE [PER-Visible] >>> ***/
1394
1395int
1396PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1397 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1398
Lev Walkin634a3b82004-08-22 03:30:05 +00001399 const IA5String_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001400
1401 if(!sptr) {
1402 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001403 "%s: value not given (%s:%d)",
1404 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001405 return -1;
1406 }
1407
1408
Lev Walkin8a99bf72004-09-10 06:07:39 +00001409 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001410 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001411 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001412 } else {
1413 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001414 "%s: constraint failed (%s:%d)",
1415 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001416 return -1;
1417 }
1418}
1419
1420/*
1421 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001422 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001423 */
1424static void
1425PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001426 td->free_struct = asn1_DEF_IA5String.free_struct;
1427 td->print_struct = asn1_DEF_IA5String.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001428 td->ber_decoder = asn1_DEF_IA5String.ber_decoder;
1429 td->der_encoder = asn1_DEF_IA5String.der_encoder;
1430 td->xer_decoder = asn1_DEF_IA5String.xer_decoder;
1431 td->xer_encoder = asn1_DEF_IA5String.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00001432 td->last_tag_form = asn1_DEF_IA5String.last_tag_form;
1433 td->elements = asn1_DEF_IA5String.elements;
1434 td->elements_count = asn1_DEF_IA5String.elements_count;
1435 td->specifics = asn1_DEF_IA5String.specifics;
1436}
1437
Lev Walkina9cc46e2004-09-22 16:06:28 +00001438void
1439PER_Visible_free(asn1_TYPE_descriptor_t *td,
1440 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001441 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001442 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001443}
1444
1445int
1446PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1447 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1448 PER_Visible_inherit_TYPE_descriptor(td);
1449 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1450}
1451
Lev Walkina9cc46e2004-09-22 16:06:28 +00001452ber_dec_rval_t
1453PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td,
1454 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001455 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001456 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1457}
1458
1459asn_enc_rval_t
1460PER_Visible_encode_der(asn1_TYPE_descriptor_t *td,
1461 void *structure, int tag_mode, ber_tlv_tag_t tag,
1462 asn_app_consume_bytes_f *cb, void *app_key) {
1463 PER_Visible_inherit_TYPE_descriptor(td);
1464 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1465}
1466
1467asn_enc_rval_t
1468PER_Visible_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1469 int ilevel, enum xer_encoder_flags_e flags,
1470 asn_app_consume_bytes_f *cb, void *app_key) {
1471 PER_Visible_inherit_TYPE_descriptor(td);
1472 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001473}
1474
1475
1476/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1477
1478static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = {
1479 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1480};
1481asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = {
1482 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001483 PER_Visible_free,
1484 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001485 PER_Visible_constraint,
1486 PER_Visible_decode_ber,
1487 PER_Visible_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001488 0, /* Not implemented yet */
1489 PER_Visible_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001490 0, /* Use generic outmost tag fetcher */
1491 asn1_DEF_PER_Visible_tags,
1492 sizeof(asn1_DEF_PER_Visible_tags)
1493 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001494 asn1_DEF_PER_Visible_tags, /* Same as above */
1495 sizeof(asn1_DEF_PER_Visible_tags)
1496 /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001497 -0, /* Unknown yet */
1498 0, 0, /* No members */
1499 0 /* No specifics */
1500};
1501
1502
1503/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1504
1505#include <PER-Visible.h>
1506
1507/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1508
1509
1510typedef PER_Visible_t PER_Visible_2_t;
1511
Lev Walkin006de1c2004-08-20 13:37:45 +00001512/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1513
1514extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001515asn_struct_free_f PER_Visible_2_free;
1516asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001517asn_constr_check_f PER_Visible_2_constraint;
1518ber_type_decoder_f PER_Visible_2_decode_ber;
1519der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001520xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001521
1522/*** <<< CTABLES [PER-Visible-2] >>> ***/
1523
Lev Walkin8a99bf72004-09-10 06:07:39 +00001524static int check_permitted_alphabet_5(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001525 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001526 const IA5String_t *st = sptr;
1527 const uint8_t *ch = st->buf;
1528 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001529
1530 for(; ch < end; ch++) {
1531 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001532 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001533 }
Lev Walkin775885e2004-08-22 12:47:03 +00001534 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001535}
1536
1537
1538/*** <<< CODE [PER-Visible-2] >>> ***/
1539
1540int
1541PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1542 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1543
Lev Walkin634a3b82004-08-22 03:30:05 +00001544 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001545
1546 if(!sptr) {
1547 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001548 "%s: value not given (%s:%d)",
1549 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001550 return -1;
1551 }
1552
1553
Lev Walkin8a99bf72004-09-10 06:07:39 +00001554 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001555 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001556 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001557 } else {
1558 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001559 "%s: constraint failed (%s:%d)",
1560 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001561 return -1;
1562 }
1563}
1564
1565/*
1566 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001567 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001568 */
1569static void
1570PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001571 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1572 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001573 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1574 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1575 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
1576 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00001577 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1578 td->elements = asn1_DEF_PER_Visible.elements;
1579 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1580 td->specifics = asn1_DEF_PER_Visible.specifics;
1581}
1582
Lev Walkina9cc46e2004-09-22 16:06:28 +00001583void
1584PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1585 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001586 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001587 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001588}
1589
1590int
1591PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1592 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1593 PER_Visible_2_inherit_TYPE_descriptor(td);
1594 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1595}
1596
Lev Walkina9cc46e2004-09-22 16:06:28 +00001597ber_dec_rval_t
1598PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1599 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001600 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001601 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1602}
1603
1604asn_enc_rval_t
1605PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1606 void *structure, int tag_mode, ber_tlv_tag_t tag,
1607 asn_app_consume_bytes_f *cb, void *app_key) {
1608 PER_Visible_2_inherit_TYPE_descriptor(td);
1609 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1610}
1611
1612asn_enc_rval_t
1613PER_Visible_2_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1614 int ilevel, enum xer_encoder_flags_e flags,
1615 asn_app_consume_bytes_f *cb, void *app_key) {
1616 PER_Visible_2_inherit_TYPE_descriptor(td);
1617 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001618}
1619
1620
1621/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1622
1623static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001624 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001625};
1626asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = {
1627 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001628 PER_Visible_2_free,
1629 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001630 PER_Visible_2_constraint,
1631 PER_Visible_2_decode_ber,
1632 PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001633 0, /* Not implemented yet */
1634 PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001635 0, /* Use generic outmost tag fetcher */
1636 asn1_DEF_PER_Visible_2_tags,
1637 sizeof(asn1_DEF_PER_Visible_2_tags)
1638 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001639 asn1_DEF_PER_Visible_2_tags, /* Same as above */
1640 sizeof(asn1_DEF_PER_Visible_2_tags)
1641 /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001642 -0, /* Unknown yet */
1643 0, 0, /* No members */
1644 0 /* No specifics */
1645};
1646
1647
1648/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1649
1650#include <PER-Visible.h>
1651
1652/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1653
1654
1655typedef PER_Visible_t Not_PER_Visible_1_t;
1656
Lev Walkin006de1c2004-08-20 13:37:45 +00001657/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1658
1659extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001660asn_struct_free_f Not_PER_Visible_1_free;
1661asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001662asn_constr_check_f Not_PER_Visible_1_constraint;
1663ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1664der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001665xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001666
1667/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1668
Lev Walkin8a99bf72004-09-10 06:07:39 +00001669static int check_permitted_alphabet_6(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001670 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001671 const IA5String_t *st = sptr;
1672 const uint8_t *ch = st->buf;
1673 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001674
1675 for(; ch < end; ch++) {
1676 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001677 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001678 }
Lev Walkin775885e2004-08-22 12:47:03 +00001679 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001680}
1681
1682
1683/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1684
1685int
1686Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1687 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1688
Lev Walkin634a3b82004-08-22 03:30:05 +00001689 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001690
1691 if(!sptr) {
1692 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001693 "%s: value not given (%s:%d)",
1694 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001695 return -1;
1696 }
1697
1698
Lev Walkin8a99bf72004-09-10 06:07:39 +00001699 if(!check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001700 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001701 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001702 } else {
1703 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001704 "%s: constraint failed (%s:%d)",
1705 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001706 return -1;
1707 }
1708}
1709
1710/*
1711 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001712 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001713 */
1714static void
1715Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001716 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1717 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001718 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1719 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1720 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
1721 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00001722 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1723 td->elements = asn1_DEF_PER_Visible.elements;
1724 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1725 td->specifics = asn1_DEF_PER_Visible.specifics;
1726}
1727
Lev Walkina9cc46e2004-09-22 16:06:28 +00001728void
1729Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td,
1730 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001731 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001732 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001733}
1734
1735int
1736Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1737 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1738 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1739 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1740}
1741
Lev Walkina9cc46e2004-09-22 16:06:28 +00001742ber_dec_rval_t
1743Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td,
1744 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001745 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001746 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1747}
1748
1749asn_enc_rval_t
1750Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td,
1751 void *structure, int tag_mode, ber_tlv_tag_t tag,
1752 asn_app_consume_bytes_f *cb, void *app_key) {
1753 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1754 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1755}
1756
1757asn_enc_rval_t
1758Not_PER_Visible_1_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1759 int ilevel, enum xer_encoder_flags_e flags,
1760 asn_app_consume_bytes_f *cb, void *app_key) {
1761 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1762 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001763}
1764
1765
1766/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1767
1768static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001769 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001770};
1771asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = {
1772 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001773 Not_PER_Visible_1_free,
1774 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001775 Not_PER_Visible_1_constraint,
1776 Not_PER_Visible_1_decode_ber,
1777 Not_PER_Visible_1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001778 0, /* Not implemented yet */
1779 Not_PER_Visible_1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001780 0, /* Use generic outmost tag fetcher */
1781 asn1_DEF_Not_PER_Visible_1_tags,
1782 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1783 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001784 asn1_DEF_Not_PER_Visible_1_tags, /* Same as above */
1785 sizeof(asn1_DEF_Not_PER_Visible_1_tags)
1786 /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001787 -0, /* Unknown yet */
1788 0, 0, /* No members */
1789 0 /* No specifics */
1790};
1791
1792
1793/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1794
1795#include <PER-Visible.h>
1796
1797/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1798
1799
1800typedef PER_Visible_t Not_PER_Visible_2_t;
1801
Lev Walkin006de1c2004-08-20 13:37:45 +00001802/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1803
1804extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001805asn_struct_free_f Not_PER_Visible_2_free;
1806asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001807asn_constr_check_f Not_PER_Visible_2_constraint;
1808ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1809der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001810xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001811
Lev Walkind35c8b52004-08-25 02:08:08 +00001812/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1813
Lev Walkin8a99bf72004-09-10 06:07:39 +00001814static int check_permitted_alphabet_7(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001815 /* The underlying type is IA5String */
1816 const IA5String_t *st = sptr;
1817 const uint8_t *ch = st->buf;
1818 const uint8_t *end = ch + st->size;
1819
1820 for(; ch < end; ch++) {
1821 uint8_t cv = *ch;
1822 if(!(cv >= 65 && cv <= 66)) return -1;
1823 }
1824 return 0;
1825}
1826
1827
Lev Walkin006de1c2004-08-20 13:37:45 +00001828/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1829
1830int
1831Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1832 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1833
Lev Walkin634a3b82004-08-22 03:30:05 +00001834 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001835
1836 if(!sptr) {
1837 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001838 "%s: value not given (%s:%d)",
1839 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001840 return -1;
1841 }
1842
1843
Lev Walkin8a99bf72004-09-10 06:07:39 +00001844 if(!check_permitted_alphabet_7(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001845 /* Constraint check succeeded */
1846 return 0;
1847 } else {
1848 _ASN_ERRLOG(app_errlog, app_key,
1849 "%s: constraint failed (%s:%d)",
1850 td->name, __FILE__, __LINE__);
1851 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001852 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001853}
1854
1855/*
1856 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001857 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001858 */
1859static void
1860Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001861 td->free_struct = asn1_DEF_PER_Visible.free_struct;
1862 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001863 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
1864 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
1865 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
1866 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00001867 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
1868 td->elements = asn1_DEF_PER_Visible.elements;
1869 td->elements_count = asn1_DEF_PER_Visible.elements_count;
1870 td->specifics = asn1_DEF_PER_Visible.specifics;
1871}
1872
Lev Walkina9cc46e2004-09-22 16:06:28 +00001873void
1874Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td,
1875 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001876 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001877 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001878}
1879
1880int
1881Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
1882 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1883 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1884 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1885}
1886
Lev Walkina9cc46e2004-09-22 16:06:28 +00001887ber_dec_rval_t
1888Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td,
1889 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001890 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001891 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
1892}
1893
1894asn_enc_rval_t
1895Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td,
1896 void *structure, int tag_mode, ber_tlv_tag_t tag,
1897 asn_app_consume_bytes_f *cb, void *app_key) {
1898 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1899 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1900}
1901
1902asn_enc_rval_t
1903Not_PER_Visible_2_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
1904 int ilevel, enum xer_encoder_flags_e flags,
1905 asn_app_consume_bytes_f *cb, void *app_key) {
1906 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1907 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001908}
1909
1910
1911/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1912
1913static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001914 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001915};
1916asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = {
1917 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001918 Not_PER_Visible_2_free,
1919 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001920 Not_PER_Visible_2_constraint,
1921 Not_PER_Visible_2_decode_ber,
1922 Not_PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001923 0, /* Not implemented yet */
1924 Not_PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001925 0, /* Use generic outmost tag fetcher */
1926 asn1_DEF_Not_PER_Visible_2_tags,
1927 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1928 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00001929 asn1_DEF_Not_PER_Visible_2_tags, /* Same as above */
1930 sizeof(asn1_DEF_Not_PER_Visible_2_tags)
1931 /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001932 -0, /* Unknown yet */
1933 0, 0, /* No members */
1934 0 /* No specifics */
1935};
1936
1937
1938/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1939
1940#include <PER-Visible.h>
1941
1942/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1943
1944
1945typedef PER_Visible_t Not_PER_Visible_3_t;
1946
Lev Walkin006de1c2004-08-20 13:37:45 +00001947/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1948
1949extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001950asn_struct_free_f Not_PER_Visible_3_free;
1951asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001952asn_constr_check_f Not_PER_Visible_3_constraint;
1953ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1954der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001955xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001956
Lev Walkind35c8b52004-08-25 02:08:08 +00001957/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1958
Lev Walkin8a99bf72004-09-10 06:07:39 +00001959static int check_permitted_alphabet_8(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001960 /* The underlying type is IA5String */
1961 const IA5String_t *st = sptr;
1962 const uint8_t *ch = st->buf;
1963 const uint8_t *end = ch + st->size;
1964
1965 for(; ch < end; ch++) {
1966 uint8_t cv = *ch;
1967 if(!(cv >= 65 && cv <= 66)) return -1;
1968 }
1969 return 0;
1970}
1971
1972
Lev Walkin006de1c2004-08-20 13:37:45 +00001973/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1974
1975int
1976Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
1977 asn_app_consume_bytes_f *app_errlog, void *app_key) {
1978
Lev Walkin634a3b82004-08-22 03:30:05 +00001979 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001980
1981 if(!sptr) {
1982 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001983 "%s: value not given (%s:%d)",
1984 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001985 return -1;
1986 }
1987
1988
Lev Walkin8a99bf72004-09-10 06:07:39 +00001989 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001990 /* Constraint check succeeded */
1991 return 0;
1992 } else {
1993 _ASN_ERRLOG(app_errlog, app_key,
1994 "%s: constraint failed (%s:%d)",
1995 td->name, __FILE__, __LINE__);
1996 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001997 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001998}
1999
2000/*
2001 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002002 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002003 */
2004static void
2005Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002006 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2007 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002008 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2009 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2010 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
2011 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002012 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2013 td->elements = asn1_DEF_PER_Visible.elements;
2014 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2015 td->specifics = asn1_DEF_PER_Visible.specifics;
2016}
2017
Lev Walkina9cc46e2004-09-22 16:06:28 +00002018void
2019Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td,
2020 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002021 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002022 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002023}
2024
2025int
2026Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2027 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2028 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
2029 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2030}
2031
Lev Walkina9cc46e2004-09-22 16:06:28 +00002032ber_dec_rval_t
2033Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td,
2034 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002035 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002036 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2037}
2038
2039asn_enc_rval_t
2040Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td,
2041 void *structure, int tag_mode, ber_tlv_tag_t tag,
2042 asn_app_consume_bytes_f *cb, void *app_key) {
2043 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
2044 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2045}
2046
2047asn_enc_rval_t
2048Not_PER_Visible_3_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2049 int ilevel, enum xer_encoder_flags_e flags,
2050 asn_app_consume_bytes_f *cb, void *app_key) {
2051 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
2052 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002053}
2054
2055
2056/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
2057
2058static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002059 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002060};
2061asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = {
2062 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002063 Not_PER_Visible_3_free,
2064 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002065 Not_PER_Visible_3_constraint,
2066 Not_PER_Visible_3_decode_ber,
2067 Not_PER_Visible_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002068 0, /* Not implemented yet */
2069 Not_PER_Visible_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002070 0, /* Use generic outmost tag fetcher */
2071 asn1_DEF_Not_PER_Visible_3_tags,
2072 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
2073 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002074 asn1_DEF_Not_PER_Visible_3_tags, /* Same as above */
2075 sizeof(asn1_DEF_Not_PER_Visible_3_tags)
2076 /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002077 -0, /* Unknown yet */
2078 0, 0, /* No members */
2079 0 /* No specifics */
2080};
2081
2082
2083/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
2084
2085#include <PER-Visible.h>
2086
2087/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
2088
2089
2090typedef PER_Visible_t SIZE_but_not_FROM_t;
2091
Lev Walkin006de1c2004-08-20 13:37:45 +00002092/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
2093
2094extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002095asn_struct_free_f SIZE_but_not_FROM_free;
2096asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002097asn_constr_check_f SIZE_but_not_FROM_constraint;
2098ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
2099der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002100xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002101
2102/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
2103
Lev Walkin8a99bf72004-09-10 06:07:39 +00002104static int check_permitted_alphabet_9(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002105 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002106 const IA5String_t *st = sptr;
2107 const uint8_t *ch = st->buf;
2108 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002109
2110 for(; ch < end; ch++) {
2111 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00002112 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002113 }
Lev Walkin775885e2004-08-22 12:47:03 +00002114 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002115}
2116
2117
2118/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
2119
2120int
2121SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2122 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2123
Lev Walkin634a3b82004-08-22 03:30:05 +00002124 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002125 size_t size;
2126
2127 if(!sptr) {
2128 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002129 "%s: value not given (%s:%d)",
2130 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002131 return -1;
2132 }
2133
2134 size = st->size;
2135
2136 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002137 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002138 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002139 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002140 } else {
2141 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002142 "%s: constraint failed (%s:%d)",
2143 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002144 return -1;
2145 }
2146}
2147
2148/*
2149 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002150 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002151 */
2152static void
2153SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002154 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2155 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002156 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2157 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2158 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
2159 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002160 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2161 td->elements = asn1_DEF_PER_Visible.elements;
2162 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2163 td->specifics = asn1_DEF_PER_Visible.specifics;
2164}
2165
Lev Walkina9cc46e2004-09-22 16:06:28 +00002166void
2167SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td,
2168 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002169 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002170 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002171}
2172
2173int
2174SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2175 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2176 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
2177 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2178}
2179
Lev Walkina9cc46e2004-09-22 16:06:28 +00002180ber_dec_rval_t
2181SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2182 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002183 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002184 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2185}
2186
2187asn_enc_rval_t
2188SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2189 void *structure, int tag_mode, ber_tlv_tag_t tag,
2190 asn_app_consume_bytes_f *cb, void *app_key) {
2191 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
2192 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2193}
2194
2195asn_enc_rval_t
2196SIZE_but_not_FROM_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2197 int ilevel, enum xer_encoder_flags_e flags,
2198 asn_app_consume_bytes_f *cb, void *app_key) {
2199 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
2200 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002201}
2202
2203
2204/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
2205
2206static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002207 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002208};
2209asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = {
2210 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002211 SIZE_but_not_FROM_free,
2212 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002213 SIZE_but_not_FROM_constraint,
2214 SIZE_but_not_FROM_decode_ber,
2215 SIZE_but_not_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002216 0, /* Not implemented yet */
2217 SIZE_but_not_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002218 0, /* Use generic outmost tag fetcher */
2219 asn1_DEF_SIZE_but_not_FROM_tags,
2220 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
2221 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002222 asn1_DEF_SIZE_but_not_FROM_tags, /* Same as above */
2223 sizeof(asn1_DEF_SIZE_but_not_FROM_tags)
2224 /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002225 -0, /* Unknown yet */
2226 0, 0, /* No members */
2227 0 /* No specifics */
2228};
2229
2230
2231/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2232
2233#include <PER-Visible.h>
2234
2235/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2236
2237
2238typedef PER_Visible_t SIZE_and_FROM_t;
2239
Lev Walkin006de1c2004-08-20 13:37:45 +00002240/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2241
2242extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002243asn_struct_free_f SIZE_and_FROM_free;
2244asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002245asn_constr_check_f SIZE_and_FROM_constraint;
2246ber_type_decoder_f SIZE_and_FROM_decode_ber;
2247der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002248xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002249
2250/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2251
Lev Walkin8a99bf72004-09-10 06:07:39 +00002252static int check_permitted_alphabet_10(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002253 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002254 const IA5String_t *st = sptr;
2255 const uint8_t *ch = st->buf;
2256 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002257
2258 for(; ch < end; ch++) {
2259 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002260 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002261 }
Lev Walkin775885e2004-08-22 12:47:03 +00002262 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002263}
2264
2265
2266/*** <<< CODE [SIZE-and-FROM] >>> ***/
2267
2268int
2269SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2270 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2271
Lev Walkin634a3b82004-08-22 03:30:05 +00002272 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002273 size_t size;
2274
2275 if(!sptr) {
2276 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002277 "%s: value not given (%s:%d)",
2278 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002279 return -1;
2280 }
2281
2282 size = st->size;
2283
2284 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002285 && !check_permitted_alphabet_10(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002286 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002287 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002288 } else {
2289 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002290 "%s: constraint failed (%s:%d)",
2291 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002292 return -1;
2293 }
2294}
2295
2296/*
2297 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002298 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002299 */
2300static void
2301SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002302 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2303 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002304 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2305 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2306 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
2307 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002308 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2309 td->elements = asn1_DEF_PER_Visible.elements;
2310 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2311 td->specifics = asn1_DEF_PER_Visible.specifics;
2312}
2313
Lev Walkina9cc46e2004-09-22 16:06:28 +00002314void
2315SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td,
2316 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002317 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002318 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002319}
2320
2321int
2322SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2323 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2324 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2325 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2326}
2327
Lev Walkina9cc46e2004-09-22 16:06:28 +00002328ber_dec_rval_t
2329SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2330 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002331 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002332 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2333}
2334
2335asn_enc_rval_t
2336SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2337 void *structure, int tag_mode, ber_tlv_tag_t tag,
2338 asn_app_consume_bytes_f *cb, void *app_key) {
2339 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2340 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2341}
2342
2343asn_enc_rval_t
2344SIZE_and_FROM_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2345 int ilevel, enum xer_encoder_flags_e flags,
2346 asn_app_consume_bytes_f *cb, void *app_key) {
2347 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2348 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002349}
2350
2351
2352/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2353
2354static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002355 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002356};
2357asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = {
2358 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002359 SIZE_and_FROM_free,
2360 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002361 SIZE_and_FROM_constraint,
2362 SIZE_and_FROM_decode_ber,
2363 SIZE_and_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002364 0, /* Not implemented yet */
2365 SIZE_and_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002366 0, /* Use generic outmost tag fetcher */
2367 asn1_DEF_SIZE_and_FROM_tags,
2368 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2369 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002370 asn1_DEF_SIZE_and_FROM_tags, /* Same as above */
2371 sizeof(asn1_DEF_SIZE_and_FROM_tags)
2372 /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002373 -0, /* Unknown yet */
2374 0, 0, /* No members */
2375 0 /* No specifics */
2376};
2377
2378
2379/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2380
2381#include <PER-Visible.h>
2382
2383/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2384
2385
2386typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2387
Lev Walkin006de1c2004-08-20 13:37:45 +00002388/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2389
2390extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002391asn_struct_free_f Neither_SIZE_nor_FROM_free;
2392asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002393asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2394ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2395der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002396xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002397
2398/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2399
Lev Walkin8a99bf72004-09-10 06:07:39 +00002400static int check_permitted_alphabet_11(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002401 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002402 const IA5String_t *st = sptr;
2403 const uint8_t *ch = st->buf;
2404 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002405
2406 for(; ch < end; ch++) {
2407 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002408 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002409 }
Lev Walkin775885e2004-08-22 12:47:03 +00002410 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002411}
2412
2413
2414/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2415
2416int
2417Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2418 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2419
Lev Walkin634a3b82004-08-22 03:30:05 +00002420 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002421
2422 if(!sptr) {
2423 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002424 "%s: value not given (%s:%d)",
2425 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002426 return -1;
2427 }
2428
2429
Lev Walkin8a99bf72004-09-10 06:07:39 +00002430 if(!check_permitted_alphabet_11(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002431 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002432 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002433 } else {
2434 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002435 "%s: constraint failed (%s:%d)",
2436 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002437 return -1;
2438 }
2439}
2440
2441/*
2442 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002443 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002444 */
2445static void
2446Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002447 td->free_struct = asn1_DEF_PER_Visible.free_struct;
2448 td->print_struct = asn1_DEF_PER_Visible.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002449 td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder;
2450 td->der_encoder = asn1_DEF_PER_Visible.der_encoder;
2451 td->xer_decoder = asn1_DEF_PER_Visible.xer_decoder;
2452 td->xer_encoder = asn1_DEF_PER_Visible.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002453 td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form;
2454 td->elements = asn1_DEF_PER_Visible.elements;
2455 td->elements_count = asn1_DEF_PER_Visible.elements_count;
2456 td->specifics = asn1_DEF_PER_Visible.specifics;
2457}
2458
Lev Walkina9cc46e2004-09-22 16:06:28 +00002459void
2460Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td,
2461 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002462 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002463 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002464}
2465
2466int
2467Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2468 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2469 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2470 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2471}
2472
Lev Walkina9cc46e2004-09-22 16:06:28 +00002473ber_dec_rval_t
2474Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td,
2475 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002476 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002477 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2478}
2479
2480asn_enc_rval_t
2481Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td,
2482 void *structure, int tag_mode, ber_tlv_tag_t tag,
2483 asn_app_consume_bytes_f *cb, void *app_key) {
2484 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2485 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2486}
2487
2488asn_enc_rval_t
2489Neither_SIZE_nor_FROM_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2490 int ilevel, enum xer_encoder_flags_e flags,
2491 asn_app_consume_bytes_f *cb, void *app_key) {
2492 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2493 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002494}
2495
2496
2497/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2498
2499static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002500 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002501};
2502asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = {
2503 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002504 Neither_SIZE_nor_FROM_free,
2505 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002506 Neither_SIZE_nor_FROM_constraint,
2507 Neither_SIZE_nor_FROM_decode_ber,
2508 Neither_SIZE_nor_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002509 0, /* Not implemented yet */
2510 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002511 0, /* Use generic outmost tag fetcher */
2512 asn1_DEF_Neither_SIZE_nor_FROM_tags,
2513 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2514 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002515 asn1_DEF_Neither_SIZE_nor_FROM_tags, /* Same as above */
2516 sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags)
2517 /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002518 -0, /* Unknown yet */
2519 0, 0, /* No members */
2520 0 /* No specifics */
2521};
2522
2523
2524/*** <<< INCLUDES [Utf8-3] >>> ***/
2525
2526#include <Utf8-2.h>
2527
2528/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2529
2530
2531typedef Utf8_2_t Utf8_3_t;
2532
Lev Walkin006de1c2004-08-20 13:37:45 +00002533/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2534
2535extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002536asn_struct_free_f Utf8_3_free;
2537asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002538asn_constr_check_f Utf8_3_constraint;
2539ber_type_decoder_f Utf8_3_decode_ber;
2540der_type_encoder_f Utf8_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002541xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002542
2543/*** <<< CTABLES [Utf8-3] >>> ***/
2544
Lev Walkin8a99bf72004-09-10 06:07:39 +00002545static int permitted_alphabet_table_12[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000025460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25500,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
25511,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
25520,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
25531,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2554};
2555
Lev Walkin8a99bf72004-09-10 06:07:39 +00002556static int check_permitted_alphabet_12(const void *sptr) {
2557 int *table = permitted_alphabet_table_12;
Lev Walkin006de1c2004-08-20 13:37:45 +00002558 /* The underlying type is UTF8String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002559 const UTF8String_t *st = sptr;
2560 const uint8_t *ch = st->buf;
2561 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002562
2563 for(; ch < end; ch++) {
2564 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002565 if(cv >= 0x80) return -1;
2566 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002567 }
Lev Walkin775885e2004-08-22 12:47:03 +00002568 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002569}
2570
2571
2572/*** <<< CODE [Utf8-3] >>> ***/
2573
2574int
2575Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2576 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2577
Lev Walkin634a3b82004-08-22 03:30:05 +00002578 const Utf8_2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002579 size_t size;
2580
2581 if(!sptr) {
2582 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002583 "%s: value not given (%s:%d)",
2584 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002585 return -1;
2586 }
2587
2588 size = UTF8String_length(st, td->name, app_errlog, app_key);
2589 if(size == (size_t)-1) return -1;
2590
2591 if((size >= 1 && size <= 2)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002592 && !check_permitted_alphabet_12(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002593 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002594 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002595 } else {
2596 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002597 "%s: constraint failed (%s:%d)",
2598 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002599 return -1;
2600 }
2601}
2602
2603/*
2604 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002605 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002606 */
2607static void
2608Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002609 td->free_struct = asn1_DEF_Utf8_2.free_struct;
2610 td->print_struct = asn1_DEF_Utf8_2.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002611 td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder;
2612 td->der_encoder = asn1_DEF_Utf8_2.der_encoder;
2613 td->xer_decoder = asn1_DEF_Utf8_2.xer_decoder;
2614 td->xer_encoder = asn1_DEF_Utf8_2.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002615 td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form;
2616 td->elements = asn1_DEF_Utf8_2.elements;
2617 td->elements_count = asn1_DEF_Utf8_2.elements_count;
2618 td->specifics = asn1_DEF_Utf8_2.specifics;
2619}
2620
Lev Walkina9cc46e2004-09-22 16:06:28 +00002621void
2622Utf8_3_free(asn1_TYPE_descriptor_t *td,
2623 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002624 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002625 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002626}
2627
2628int
2629Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2630 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2631 Utf8_3_inherit_TYPE_descriptor(td);
2632 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2633}
2634
Lev Walkina9cc46e2004-09-22 16:06:28 +00002635ber_dec_rval_t
2636Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td,
2637 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002638 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002639 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2640}
2641
2642asn_enc_rval_t
2643Utf8_3_encode_der(asn1_TYPE_descriptor_t *td,
2644 void *structure, int tag_mode, ber_tlv_tag_t tag,
2645 asn_app_consume_bytes_f *cb, void *app_key) {
2646 Utf8_3_inherit_TYPE_descriptor(td);
2647 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2648}
2649
2650asn_enc_rval_t
2651Utf8_3_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2652 int ilevel, enum xer_encoder_flags_e flags,
2653 asn_app_consume_bytes_f *cb, void *app_key) {
2654 Utf8_3_inherit_TYPE_descriptor(td);
2655 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002656}
2657
2658
2659/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2660
2661static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002662 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002663};
2664asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = {
2665 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002666 Utf8_3_free,
2667 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002668 Utf8_3_constraint,
2669 Utf8_3_decode_ber,
2670 Utf8_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002671 0, /* Not implemented yet */
2672 Utf8_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002673 0, /* Use generic outmost tag fetcher */
2674 asn1_DEF_Utf8_3_tags,
2675 sizeof(asn1_DEF_Utf8_3_tags)
2676 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002677 asn1_DEF_Utf8_3_tags, /* Same as above */
2678 sizeof(asn1_DEF_Utf8_3_tags)
2679 /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002680 -0, /* Unknown yet */
2681 0, 0, /* No members */
2682 0 /* No specifics */
2683};
2684
2685
2686/*** <<< INCLUDES [Utf8-2] >>> ***/
2687
2688#include <Utf8-1.h>
2689
2690/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2691
2692
2693typedef Utf8_1_t Utf8_2_t;
2694
Lev Walkin006de1c2004-08-20 13:37:45 +00002695/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2696
2697extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002698asn_struct_free_f Utf8_2_free;
2699asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002700asn_constr_check_f Utf8_2_constraint;
2701ber_type_decoder_f Utf8_2_decode_ber;
2702der_type_encoder_f Utf8_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002703xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002704
2705/*** <<< CODE [Utf8-2] >>> ***/
2706
2707int
2708Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2709 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2710
Lev Walkin634a3b82004-08-22 03:30:05 +00002711 const Utf8_1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002712 size_t size;
2713
2714 if(!sptr) {
2715 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002716 "%s: value not given (%s:%d)",
2717 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002718 return -1;
2719 }
2720
2721 size = UTF8String_length(st, td->name, app_errlog, app_key);
2722 if(size == (size_t)-1) return -1;
2723
2724 if((size >= 1 && size <= 2)) {
2725 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002726 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002727 } else {
2728 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002729 "%s: constraint failed (%s:%d)",
2730 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002731 return -1;
2732 }
2733}
2734
2735/*
2736 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00002737 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002738 */
2739static void
2740Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002741 td->free_struct = asn1_DEF_Utf8_1.free_struct;
2742 td->print_struct = asn1_DEF_Utf8_1.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002743 td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder;
2744 td->der_encoder = asn1_DEF_Utf8_1.der_encoder;
2745 td->xer_decoder = asn1_DEF_Utf8_1.xer_decoder;
2746 td->xer_encoder = asn1_DEF_Utf8_1.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002747 td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form;
2748 td->elements = asn1_DEF_Utf8_1.elements;
2749 td->elements_count = asn1_DEF_Utf8_1.elements_count;
2750 td->specifics = asn1_DEF_Utf8_1.specifics;
2751}
2752
Lev Walkina9cc46e2004-09-22 16:06:28 +00002753void
2754Utf8_2_free(asn1_TYPE_descriptor_t *td,
2755 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002756 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002757 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002758}
2759
2760int
2761Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2762 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2763 Utf8_2_inherit_TYPE_descriptor(td);
2764 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2765}
2766
Lev Walkina9cc46e2004-09-22 16:06:28 +00002767ber_dec_rval_t
2768Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td,
2769 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002770 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002771 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2772}
2773
2774asn_enc_rval_t
2775Utf8_2_encode_der(asn1_TYPE_descriptor_t *td,
2776 void *structure, int tag_mode, ber_tlv_tag_t tag,
2777 asn_app_consume_bytes_f *cb, void *app_key) {
2778 Utf8_2_inherit_TYPE_descriptor(td);
2779 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2780}
2781
2782asn_enc_rval_t
2783Utf8_2_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2784 int ilevel, enum xer_encoder_flags_e flags,
2785 asn_app_consume_bytes_f *cb, void *app_key) {
2786 Utf8_2_inherit_TYPE_descriptor(td);
2787 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002788}
2789
2790
2791/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2792
2793static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002794 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002795};
2796asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = {
2797 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002798 Utf8_2_free,
2799 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002800 Utf8_2_constraint,
2801 Utf8_2_decode_ber,
2802 Utf8_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002803 0, /* Not implemented yet */
2804 Utf8_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002805 0, /* Use generic outmost tag fetcher */
2806 asn1_DEF_Utf8_2_tags,
2807 sizeof(asn1_DEF_Utf8_2_tags)
2808 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002809 asn1_DEF_Utf8_2_tags, /* Same as above */
2810 sizeof(asn1_DEF_Utf8_2_tags)
2811 /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002812 -0, /* Unknown yet */
2813 0, 0, /* No members */
2814 0 /* No specifics */
2815};
2816
2817
2818/*** <<< INCLUDES [Utf8-1] >>> ***/
2819
2820#include <UTF8String.h>
2821
2822/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2823
2824
2825typedef UTF8String_t Utf8_1_t;
2826
Lev Walkin006de1c2004-08-20 13:37:45 +00002827/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2828
2829extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002830asn_struct_free_f Utf8_1_free;
2831asn_struct_print_f Utf8_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002832asn_constr_check_f Utf8_1_constraint;
2833ber_type_decoder_f Utf8_1_decode_ber;
2834der_type_encoder_f Utf8_1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002835xer_type_encoder_f Utf8_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002836
2837/*** <<< CODE [Utf8-1] >>> ***/
2838
2839int
2840Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2841 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2842
2843 /* Make the underlying type checker permanent */
2844 td->check_constraints = asn1_DEF_UTF8String.check_constraints;
2845 return td->check_constraints
2846 (td, sptr, app_errlog, app_key);
2847}
2848
2849/*
2850 * This type is implemented using UTF8String,
Lev Walkinc3808c12004-09-23 22:14:58 +00002851 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002852 */
2853static void
2854Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002855 td->free_struct = asn1_DEF_UTF8String.free_struct;
2856 td->print_struct = asn1_DEF_UTF8String.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002857 td->ber_decoder = asn1_DEF_UTF8String.ber_decoder;
2858 td->der_encoder = asn1_DEF_UTF8String.der_encoder;
2859 td->xer_decoder = asn1_DEF_UTF8String.xer_decoder;
2860 td->xer_encoder = asn1_DEF_UTF8String.xer_encoder;
Lev Walkin006de1c2004-08-20 13:37:45 +00002861 td->last_tag_form = asn1_DEF_UTF8String.last_tag_form;
2862 td->elements = asn1_DEF_UTF8String.elements;
2863 td->elements_count = asn1_DEF_UTF8String.elements_count;
2864 td->specifics = asn1_DEF_UTF8String.specifics;
2865}
2866
Lev Walkina9cc46e2004-09-22 16:06:28 +00002867void
2868Utf8_1_free(asn1_TYPE_descriptor_t *td,
2869 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002870 Utf8_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002871 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002872}
2873
2874int
2875Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
2876 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2877 Utf8_1_inherit_TYPE_descriptor(td);
2878 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2879}
2880
Lev Walkina9cc46e2004-09-22 16:06:28 +00002881ber_dec_rval_t
2882Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td,
2883 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002884 Utf8_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002885 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
2886}
2887
2888asn_enc_rval_t
2889Utf8_1_encode_der(asn1_TYPE_descriptor_t *td,
2890 void *structure, int tag_mode, ber_tlv_tag_t tag,
2891 asn_app_consume_bytes_f *cb, void *app_key) {
2892 Utf8_1_inherit_TYPE_descriptor(td);
2893 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2894}
2895
2896asn_enc_rval_t
2897Utf8_1_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
2898 int ilevel, enum xer_encoder_flags_e flags,
2899 asn_app_consume_bytes_f *cb, void *app_key) {
2900 Utf8_1_inherit_TYPE_descriptor(td);
2901 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002902}
2903
2904
2905/*** <<< STAT-DEFS [Utf8-1] >>> ***/
2906
2907static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = {
2908 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2909};
2910asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = {
2911 "Utf8-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002912 Utf8_1_free,
2913 Utf8_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002914 Utf8_1_constraint,
2915 Utf8_1_decode_ber,
2916 Utf8_1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002917 0, /* Not implemented yet */
2918 Utf8_1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002919 0, /* Use generic outmost tag fetcher */
2920 asn1_DEF_Utf8_1_tags,
2921 sizeof(asn1_DEF_Utf8_1_tags)
2922 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
Lev Walkin188ed2c2004-09-13 08:31:01 +00002923 asn1_DEF_Utf8_1_tags, /* Same as above */
2924 sizeof(asn1_DEF_Utf8_1_tags)
2925 /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002926 -0, /* Unknown yet */
2927 0, 0, /* No members */
2928 0 /* No specifics */
2929};
2930
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002931
2932/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
2933
2934#include <Identifier.h>
2935
2936/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
2937
2938
2939typedef Identifier_t VisibleIdentifier_t;
2940
2941/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
2942
2943extern asn1_TYPE_descriptor_t asn1_DEF_VisibleIdentifier;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002944asn_struct_free_f VisibleIdentifier_free;
2945asn_struct_print_f VisibleIdentifier_print;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002946asn_constr_check_f VisibleIdentifier_constraint;
2947ber_type_decoder_f VisibleIdentifier_decode_ber;
2948der_type_encoder_f VisibleIdentifier_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002949xer_type_encoder_f VisibleIdentifier_encode_xer;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002950
2951/*** <<< CTABLES [VisibleIdentifier] >>> ***/
2952
2953static int permitted_alphabet_table_14[256] = {
29540,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
29550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
29560,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
29571,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
29580,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
29591,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
29600,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
29611,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2962};
2963
2964static int check_permitted_alphabet_14(const void *sptr) {
2965 int *table = permitted_alphabet_table_14;
2966 /* The underlying type is VisibleString */
2967 const VisibleString_t *st = sptr;
2968 const uint8_t *ch = st->buf;
2969 const uint8_t *end = ch + st->size;
2970
2971 for(; ch < end; ch++) {
2972 uint8_t cv = *ch;
2973 if(!table[cv]) return -1;
2974 }
2975 return 0;
2976}
2977
2978
2979/*** <<< CODE [VisibleIdentifier] >>> ***/
2980
2981int
2982VisibleIdentifier_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
2983 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2984
2985 const Identifier_t *st = sptr;
2986 size_t size;
2987
2988 if(!sptr) {
2989 _ASN_ERRLOG(app_errlog, app_key,
2990 "%s: value not given (%s:%d)",
2991 td->name, __FILE__, __LINE__);
2992 return -1;
2993 }
2994
2995 size = st->size;
2996
2997 if((size >= 1 && size <= 32)
2998 && !check_permitted_alphabet_14(sptr)) {
2999 /* Constraint check succeeded */
3000 return 0;
3001 } else {
3002 _ASN_ERRLOG(app_errlog, app_key,
3003 "%s: constraint failed (%s:%d)",
3004 td->name, __FILE__, __LINE__);
3005 return -1;
3006 }
3007}
3008
3009/*
3010 * This type is implemented using Identifier,
Lev Walkinc3808c12004-09-23 22:14:58 +00003011 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003012 */
3013static void
3014VisibleIdentifier_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003015 td->free_struct = asn1_DEF_Identifier.free_struct;
3016 td->print_struct = asn1_DEF_Identifier.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003017 td->ber_decoder = asn1_DEF_Identifier.ber_decoder;
3018 td->der_encoder = asn1_DEF_Identifier.der_encoder;
3019 td->xer_decoder = asn1_DEF_Identifier.xer_decoder;
3020 td->xer_encoder = asn1_DEF_Identifier.xer_encoder;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003021 td->last_tag_form = asn1_DEF_Identifier.last_tag_form;
3022 td->elements = asn1_DEF_Identifier.elements;
3023 td->elements_count = asn1_DEF_Identifier.elements_count;
3024 td->specifics = asn1_DEF_Identifier.specifics;
3025}
3026
Lev Walkina9cc46e2004-09-22 16:06:28 +00003027void
3028VisibleIdentifier_free(asn1_TYPE_descriptor_t *td,
3029 void *struct_ptr, int contents_only) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003030 VisibleIdentifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003031 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003032}
3033
3034int
3035VisibleIdentifier_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
3036 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
3037 VisibleIdentifier_inherit_TYPE_descriptor(td);
3038 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3039}
3040
Lev Walkina9cc46e2004-09-22 16:06:28 +00003041ber_dec_rval_t
3042VisibleIdentifier_decode_ber(asn1_TYPE_descriptor_t *td,
3043 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003044 VisibleIdentifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003045 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
3046}
3047
3048asn_enc_rval_t
3049VisibleIdentifier_encode_der(asn1_TYPE_descriptor_t *td,
3050 void *structure, int tag_mode, ber_tlv_tag_t tag,
3051 asn_app_consume_bytes_f *cb, void *app_key) {
3052 VisibleIdentifier_inherit_TYPE_descriptor(td);
3053 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3054}
3055
3056asn_enc_rval_t
3057VisibleIdentifier_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
3058 int ilevel, enum xer_encoder_flags_e flags,
3059 asn_app_consume_bytes_f *cb, void *app_key) {
3060 VisibleIdentifier_inherit_TYPE_descriptor(td);
3061 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003062}
3063
3064
3065/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
3066
3067static ber_tlv_tag_t asn1_DEF_VisibleIdentifier_tags[] = {
3068 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3069};
3070asn1_TYPE_descriptor_t asn1_DEF_VisibleIdentifier = {
3071 "VisibleIdentifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003072 VisibleIdentifier_free,
3073 VisibleIdentifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003074 VisibleIdentifier_constraint,
3075 VisibleIdentifier_decode_ber,
3076 VisibleIdentifier_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003077 0, /* Not implemented yet */
3078 VisibleIdentifier_encode_xer,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003079 0, /* Use generic outmost tag fetcher */
3080 asn1_DEF_VisibleIdentifier_tags,
3081 sizeof(asn1_DEF_VisibleIdentifier_tags)
3082 /sizeof(asn1_DEF_VisibleIdentifier_tags[0]), /* 1 */
3083 asn1_DEF_VisibleIdentifier_tags, /* Same as above */
3084 sizeof(asn1_DEF_VisibleIdentifier_tags)
3085 /sizeof(asn1_DEF_VisibleIdentifier_tags[0]), /* 1 */
3086 -0, /* Unknown yet */
3087 0, 0, /* No members */
3088 0 /* No specifics */
3089};
3090
3091
3092/*** <<< INCLUDES [Identifier] >>> ***/
3093
3094#include <VisibleString.h>
3095
3096/*** <<< TYPE-DECLS [Identifier] >>> ***/
3097
3098
3099typedef VisibleString_t Identifier_t;
3100
3101/*** <<< FUNC-DECLS [Identifier] >>> ***/
3102
3103extern asn1_TYPE_descriptor_t asn1_DEF_Identifier;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003104asn_struct_free_f Identifier_free;
3105asn_struct_print_f Identifier_print;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003106asn_constr_check_f Identifier_constraint;
3107ber_type_decoder_f Identifier_decode_ber;
3108der_type_encoder_f Identifier_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003109xer_type_encoder_f Identifier_encode_xer;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003110
3111/*** <<< CTABLES [Identifier] >>> ***/
3112
3113static int permitted_alphabet_table_15[256] = {
31140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
31150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
31160,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
31171,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
31180,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
31191,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
31200,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
31211,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
3122};
3123
3124static int check_permitted_alphabet_15(const void *sptr) {
3125 int *table = permitted_alphabet_table_15;
3126 /* The underlying type is VisibleString */
3127 const VisibleString_t *st = sptr;
3128 const uint8_t *ch = st->buf;
3129 const uint8_t *end = ch + st->size;
3130
3131 for(; ch < end; ch++) {
3132 uint8_t cv = *ch;
3133 if(!table[cv]) return -1;
3134 }
3135 return 0;
3136}
3137
3138
3139/*** <<< CODE [Identifier] >>> ***/
3140
3141int
3142Identifier_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
3143 asn_app_consume_bytes_f *app_errlog, void *app_key) {
3144
3145 const VisibleString_t *st = sptr;
3146 size_t size;
3147
3148 if(!sptr) {
3149 _ASN_ERRLOG(app_errlog, app_key,
3150 "%s: value not given (%s:%d)",
3151 td->name, __FILE__, __LINE__);
3152 return -1;
3153 }
3154
3155 size = st->size;
3156
3157 if((size >= 1 && size <= 32)
3158 && !check_permitted_alphabet_15(sptr)) {
3159 /* Constraint check succeeded */
3160 return 0;
3161 } else {
3162 _ASN_ERRLOG(app_errlog, app_key,
3163 "%s: constraint failed (%s:%d)",
3164 td->name, __FILE__, __LINE__);
3165 return -1;
3166 }
3167}
3168
3169/*
3170 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00003171 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003172 */
3173static void
3174Identifier_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003175 td->free_struct = asn1_DEF_VisibleString.free_struct;
3176 td->print_struct = asn1_DEF_VisibleString.print_struct;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003177 td->ber_decoder = asn1_DEF_VisibleString.ber_decoder;
3178 td->der_encoder = asn1_DEF_VisibleString.der_encoder;
3179 td->xer_decoder = asn1_DEF_VisibleString.xer_decoder;
3180 td->xer_encoder = asn1_DEF_VisibleString.xer_encoder;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003181 td->last_tag_form = asn1_DEF_VisibleString.last_tag_form;
3182 td->elements = asn1_DEF_VisibleString.elements;
3183 td->elements_count = asn1_DEF_VisibleString.elements_count;
3184 td->specifics = asn1_DEF_VisibleString.specifics;
3185}
3186
Lev Walkina9cc46e2004-09-22 16:06:28 +00003187void
3188Identifier_free(asn1_TYPE_descriptor_t *td,
3189 void *struct_ptr, int contents_only) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003190 Identifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003191 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003192}
3193
3194int
3195Identifier_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr,
3196 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
3197 Identifier_inherit_TYPE_descriptor(td);
3198 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3199}
3200
Lev Walkina9cc46e2004-09-22 16:06:28 +00003201ber_dec_rval_t
3202Identifier_decode_ber(asn1_TYPE_descriptor_t *td,
3203 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003204 Identifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003205 return td->ber_decoder(td, structure, bufptr, size, tag_mode);
3206}
3207
3208asn_enc_rval_t
3209Identifier_encode_der(asn1_TYPE_descriptor_t *td,
3210 void *structure, int tag_mode, ber_tlv_tag_t tag,
3211 asn_app_consume_bytes_f *cb, void *app_key) {
3212 Identifier_inherit_TYPE_descriptor(td);
3213 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3214}
3215
3216asn_enc_rval_t
3217Identifier_encode_xer(asn1_TYPE_descriptor_t *td, void *structure,
3218 int ilevel, enum xer_encoder_flags_e flags,
3219 asn_app_consume_bytes_f *cb, void *app_key) {
3220 Identifier_inherit_TYPE_descriptor(td);
3221 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003222}
3223
3224
3225/*** <<< STAT-DEFS [Identifier] >>> ***/
3226
3227static ber_tlv_tag_t asn1_DEF_Identifier_tags[] = {
3228 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3229};
3230asn1_TYPE_descriptor_t asn1_DEF_Identifier = {
3231 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003232 Identifier_free,
3233 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003234 Identifier_constraint,
3235 Identifier_decode_ber,
3236 Identifier_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003237 0, /* Not implemented yet */
3238 Identifier_encode_xer,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003239 0, /* Use generic outmost tag fetcher */
3240 asn1_DEF_Identifier_tags,
3241 sizeof(asn1_DEF_Identifier_tags)
3242 /sizeof(asn1_DEF_Identifier_tags[0]), /* 1 */
3243 asn1_DEF_Identifier_tags, /* Same as above */
3244 sizeof(asn1_DEF_Identifier_tags)
3245 /sizeof(asn1_DEF_Identifier_tags[0]), /* 1 */
3246 -0, /* Unknown yet */
3247 0, 0, /* No members */
3248 0 /* No specifics */
3249};
3250