blob: 3cdcb3b78e772f460e42cee05a7763a1f0a213fb [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
Lev Walkin006de1c2004-08-20 13:37:45 +00008typedef INTEGER_t Int1_t;
9
Lev Walkin006de1c2004-08-20 13:37:45 +000010/*** <<< FUNC-DECLS [Int1] >>> ***/
11
Lev Walkincaf0d5a2005-03-04 23:48:19 +000012extern asn_TYPE_descriptor_t asn_DEF_Int1;
13asn_struct_free_f Int1_free;
14asn_struct_print_f Int1_print;
15asn_constr_check_f Int1_constraint;
16ber_type_decoder_f Int1_decode_ber;
17der_type_encoder_f Int1_encode_der;
18xer_type_decoder_f Int1_decode_xer;
19xer_type_encoder_f Int1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +000020
21/*** <<< CODE [Int1] >>> ***/
22
Lev Walkincaf0d5a2005-03-04 23:48:19 +000023int
24Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000025 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +000026 /* Replace with underlying type checker */
27 td->check_constraints = asn_DEF_INTEGER.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +000028 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000029}
30
31/*
32 * This type is implemented using INTEGER,
33 * so here we adjust the DEF accordingly.
34 */
35static void
Lev Walkine8318b82005-03-06 09:29:03 +000036Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +000037 td->free_struct = asn_DEF_INTEGER.free_struct;
38 td->print_struct = asn_DEF_INTEGER.print_struct;
39 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
40 td->der_encoder = asn_DEF_INTEGER.der_encoder;
41 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
42 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +000043 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +000044 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +000045 if(!td->per_constraints)
46 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +000047 td->elements = asn_DEF_INTEGER.elements;
48 td->elements_count = asn_DEF_INTEGER.elements_count;
49 td->specifics = asn_DEF_INTEGER.specifics;
50}
51
52void
53Int1_free(asn_TYPE_descriptor_t *td,
54 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +000055 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000056 td->free_struct(td, struct_ptr, contents_only);
57}
58
59int
60Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
61 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000062 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000063 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
64}
65
66asn_dec_rval_t
67Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000068 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +000069 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000070 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
71}
72
73asn_enc_rval_t
74Int1_encode_der(asn_TYPE_descriptor_t *td,
75 void *structure, int tag_mode, ber_tlv_tag_t tag,
76 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000077 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000078 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
79}
80
81asn_dec_rval_t
82Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000083 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +000084 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000085 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
86}
87
88asn_enc_rval_t
89Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
90 int ilevel, enum xer_encoder_flags_e flags,
91 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000092 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000093 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
94}
95
96
97/*** <<< STAT-DEFS [Int1] >>> ***/
98
Lev Walkin59b176e2005-11-26 11:25:14 +000099static ber_tlv_tag_t asn_DEF_Int1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000100 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
101};
102asn_TYPE_descriptor_t asn_DEF_Int1 = {
103 "Int1",
104 "Int1",
105 Int1_free,
106 Int1_print,
107 Int1_constraint,
108 Int1_decode_ber,
109 Int1_encode_der,
110 Int1_decode_xer,
111 Int1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000112 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000113 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000114 asn_DEF_Int1_tags_1,
115 sizeof(asn_DEF_Int1_tags_1)
116 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
117 asn_DEF_Int1_tags_1, /* Same as above */
118 sizeof(asn_DEF_Int1_tags_1)
119 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
120 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000121 0, 0, /* No members */
122 0 /* No specifics */
123};
Lev Walkin006de1c2004-08-20 13:37:45 +0000124
125
126/*** <<< INCLUDES [Int2] >>> ***/
127
Lev Walkin22b5ed42006-09-13 02:51:20 +0000128#include "Int1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000129
130/*** <<< TYPE-DECLS [Int2] >>> ***/
131
Lev Walkin006de1c2004-08-20 13:37:45 +0000132typedef Int1_t Int2_t;
133
Lev Walkin006de1c2004-08-20 13:37:45 +0000134/*** <<< FUNC-DECLS [Int2] >>> ***/
135
Lev Walkindfae9752004-09-29 13:19:37 +0000136extern asn_TYPE_descriptor_t asn_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000137asn_struct_free_f Int2_free;
138asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000139asn_constr_check_f Int2_constraint;
140ber_type_decoder_f Int2_decode_ber;
141der_type_encoder_f Int2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000142xer_type_decoder_f Int2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000143xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000144
145/*** <<< CODE [Int2] >>> ***/
146
147int
Lev Walkindfae9752004-09-29 13:19:37 +0000148Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000149 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000150 const Int1_t *st = (const Int1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000151 long value;
152
153 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000154 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000155 "%s: value not given (%s:%d)",
156 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000157 return -1;
158 }
159
Lev Walkin44467432004-09-07 06:43:57 +0000160 /* Check if the sign bit is present */
161 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000162
163 if((value >= 0)) {
164 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000165 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000166 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000167 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000168 "%s: constraint failed (%s:%d)",
169 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000170 return -1;
171 }
172}
173
174/*
175 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000176 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000177 */
178static void
Lev Walkine8318b82005-03-06 09:29:03 +0000179Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000180 td->free_struct = asn_DEF_Int1.free_struct;
181 td->print_struct = asn_DEF_Int1.print_struct;
182 td->ber_decoder = asn_DEF_Int1.ber_decoder;
183 td->der_encoder = asn_DEF_Int1.der_encoder;
184 td->xer_decoder = asn_DEF_Int1.xer_decoder;
185 td->xer_encoder = asn_DEF_Int1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000186 td->uper_decoder = asn_DEF_Int1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000187 td->uper_encoder = asn_DEF_Int1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000188 if(!td->per_constraints)
189 td->per_constraints = asn_DEF_Int1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000190 td->elements = asn_DEF_Int1.elements;
191 td->elements_count = asn_DEF_Int1.elements_count;
192 td->specifics = asn_DEF_Int1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000193}
194
Lev Walkina9cc46e2004-09-22 16:06:28 +0000195void
Lev Walkindfae9752004-09-29 13:19:37 +0000196Int2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000197 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000198 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000199 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000200}
201
202int
Lev Walkindfae9752004-09-29 13:19:37 +0000203Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000204 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000205 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000206 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
207}
208
Lev Walkindc06f6b2004-10-20 15:50:55 +0000209asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000210Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000211 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000212 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000213 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000214}
215
216asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000217Int2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000218 void *structure, int tag_mode, ber_tlv_tag_t tag,
219 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000220 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000221 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
222}
223
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000224asn_dec_rval_t
225Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000226 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000227 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000228 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
229}
230
Lev Walkina9cc46e2004-09-22 16:06:28 +0000231asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000232Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000233 int ilevel, enum xer_encoder_flags_e flags,
234 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000235 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000236 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000237}
238
239
240/*** <<< STAT-DEFS [Int2] >>> ***/
241
Lev Walkin59b176e2005-11-26 11:25:14 +0000242static ber_tlv_tag_t asn_DEF_Int2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000243 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000244};
Lev Walkindfae9752004-09-29 13:19:37 +0000245asn_TYPE_descriptor_t asn_DEF_Int2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000246 "Int2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000247 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000248 Int2_free,
249 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000250 Int2_constraint,
251 Int2_decode_ber,
252 Int2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000253 Int2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000254 Int2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000255 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000256 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000257 asn_DEF_Int2_tags_1,
258 sizeof(asn_DEF_Int2_tags_1)
259 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
260 asn_DEF_Int2_tags_1, /* Same as above */
261 sizeof(asn_DEF_Int2_tags_1)
262 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
263 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000264 0, 0, /* No members */
265 0 /* No specifics */
266};
267
268
269/*** <<< INCLUDES [Int3] >>> ***/
270
Lev Walkin22b5ed42006-09-13 02:51:20 +0000271#include "Int2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000272
273/*** <<< TYPE-DECLS [Int3] >>> ***/
274
Lev Walkin006de1c2004-08-20 13:37:45 +0000275typedef Int2_t Int3_t;
276
Lev Walkin006de1c2004-08-20 13:37:45 +0000277/*** <<< FUNC-DECLS [Int3] >>> ***/
278
Lev Walkindfae9752004-09-29 13:19:37 +0000279extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000280asn_struct_free_f Int3_free;
281asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000282asn_constr_check_f Int3_constraint;
283ber_type_decoder_f Int3_decode_ber;
284der_type_encoder_f Int3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000285xer_type_decoder_f Int3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000286xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000287
288/*** <<< CODE [Int3] >>> ***/
289
290int
Lev Walkindfae9752004-09-29 13:19:37 +0000291Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000292 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000293 const Int2_t *st = (const Int2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000294 long value;
295
296 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000297 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000298 "%s: value not given (%s:%d)",
299 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000300 return -1;
301 }
302
Lev Walkindfae9752004-09-29 13:19:37 +0000303 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000304 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000305 "%s: value too large (%s:%d)",
306 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000307 return -1;
308 }
309
310 if((value >= 0 && value <= 10)) {
311 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000312 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000313 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000314 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000315 "%s: constraint failed (%s:%d)",
316 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000317 return -1;
318 }
319}
320
321/*
322 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000323 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000324 */
325static void
Lev Walkine8318b82005-03-06 09:29:03 +0000326Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000327 td->free_struct = asn_DEF_Int2.free_struct;
328 td->print_struct = asn_DEF_Int2.print_struct;
329 td->ber_decoder = asn_DEF_Int2.ber_decoder;
330 td->der_encoder = asn_DEF_Int2.der_encoder;
331 td->xer_decoder = asn_DEF_Int2.xer_decoder;
332 td->xer_encoder = asn_DEF_Int2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000333 td->uper_decoder = asn_DEF_Int2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000334 td->uper_encoder = asn_DEF_Int2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000335 if(!td->per_constraints)
336 td->per_constraints = asn_DEF_Int2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000337 td->elements = asn_DEF_Int2.elements;
338 td->elements_count = asn_DEF_Int2.elements_count;
339 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000340}
341
Lev Walkina9cc46e2004-09-22 16:06:28 +0000342void
Lev Walkindfae9752004-09-29 13:19:37 +0000343Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000344 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000345 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000346 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000347}
348
349int
Lev Walkindfae9752004-09-29 13:19:37 +0000350Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000351 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000352 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000353 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
354}
355
Lev Walkindc06f6b2004-10-20 15:50:55 +0000356asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000357Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000358 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000359 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000360 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000361}
362
363asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000364Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000365 void *structure, int tag_mode, ber_tlv_tag_t tag,
366 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000367 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000368 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
369}
370
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000371asn_dec_rval_t
372Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000373 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000374 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000375 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
376}
377
Lev Walkina9cc46e2004-09-22 16:06:28 +0000378asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000379Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000380 int ilevel, enum xer_encoder_flags_e flags,
381 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000382 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000383 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000384}
385
386
387/*** <<< STAT-DEFS [Int3] >>> ***/
388
Lev Walkin59b176e2005-11-26 11:25:14 +0000389static ber_tlv_tag_t asn_DEF_Int3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000390 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000391};
Lev Walkindfae9752004-09-29 13:19:37 +0000392asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000393 "Int3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000394 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000395 Int3_free,
396 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000397 Int3_constraint,
398 Int3_decode_ber,
399 Int3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000400 Int3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000401 Int3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000402 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000403 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000404 asn_DEF_Int3_tags_1,
405 sizeof(asn_DEF_Int3_tags_1)
406 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
407 asn_DEF_Int3_tags_1, /* Same as above */
408 sizeof(asn_DEF_Int3_tags_1)
409 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
410 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000411 0, 0, /* No members */
412 0 /* No specifics */
413};
414
415
416/*** <<< INCLUDES [Int4] >>> ***/
417
Lev Walkin22b5ed42006-09-13 02:51:20 +0000418#include "Int3.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000419
420/*** <<< TYPE-DECLS [Int4] >>> ***/
421
Lev Walkin006de1c2004-08-20 13:37:45 +0000422typedef Int3_t Int4_t;
423
Lev Walkin006de1c2004-08-20 13:37:45 +0000424/*** <<< FUNC-DECLS [Int4] >>> ***/
425
Lev Walkindfae9752004-09-29 13:19:37 +0000426extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000427asn_struct_free_f Int4_free;
428asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000429asn_constr_check_f Int4_constraint;
430ber_type_decoder_f Int4_decode_ber;
431der_type_encoder_f Int4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000432xer_type_decoder_f Int4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000433xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000434
435/*** <<< CODE [Int4] >>> ***/
436
437int
Lev Walkindfae9752004-09-29 13:19:37 +0000438Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000439 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000440 const Int3_t *st = (const Int3_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000441 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000442
443 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000444 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000445 "%s: value not given (%s:%d)",
446 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000447 return -1;
448 }
449
Lev Walkindfae9752004-09-29 13:19:37 +0000450 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000451 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000452 "%s: value too large (%s:%d)",
453 td->name, __FILE__, __LINE__);
454 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000455 }
456
Lev Walkind35c8b52004-08-25 02:08:08 +0000457 if((value >= 1 && value <= 10)) {
458 /* Constraint check succeeded */
459 return 0;
460 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000461 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000462 "%s: constraint failed (%s:%d)",
463 td->name, __FILE__, __LINE__);
464 return -1;
465 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000466}
467
468/*
469 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000470 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000471 */
472static void
Lev Walkine8318b82005-03-06 09:29:03 +0000473Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000474 td->free_struct = asn_DEF_Int3.free_struct;
475 td->print_struct = asn_DEF_Int3.print_struct;
476 td->ber_decoder = asn_DEF_Int3.ber_decoder;
477 td->der_encoder = asn_DEF_Int3.der_encoder;
478 td->xer_decoder = asn_DEF_Int3.xer_decoder;
479 td->xer_encoder = asn_DEF_Int3.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000480 td->uper_decoder = asn_DEF_Int3.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000481 td->uper_encoder = asn_DEF_Int3.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000482 if(!td->per_constraints)
483 td->per_constraints = asn_DEF_Int3.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000484 td->elements = asn_DEF_Int3.elements;
485 td->elements_count = asn_DEF_Int3.elements_count;
486 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000487}
488
Lev Walkina9cc46e2004-09-22 16:06:28 +0000489void
Lev Walkindfae9752004-09-29 13:19:37 +0000490Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000491 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000492 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000493 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000494}
495
496int
Lev Walkindfae9752004-09-29 13:19:37 +0000497Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000498 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000499 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000500 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
501}
502
Lev Walkindc06f6b2004-10-20 15:50:55 +0000503asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000504Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000505 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000506 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000507 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000508}
509
510asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000511Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000512 void *structure, int tag_mode, ber_tlv_tag_t tag,
513 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000514 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000515 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
516}
517
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000518asn_dec_rval_t
519Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000520 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000521 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000522 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
523}
524
Lev Walkina9cc46e2004-09-22 16:06:28 +0000525asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000526Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000527 int ilevel, enum xer_encoder_flags_e flags,
528 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000529 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000530 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000531}
532
533
534/*** <<< STAT-DEFS [Int4] >>> ***/
535
Lev Walkin59b176e2005-11-26 11:25:14 +0000536static ber_tlv_tag_t asn_DEF_Int4_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000537 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000538};
Lev Walkindfae9752004-09-29 13:19:37 +0000539asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000540 "Int4",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000541 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000542 Int4_free,
543 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000544 Int4_constraint,
545 Int4_decode_ber,
546 Int4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000547 Int4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000548 Int4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000549 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000550 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000551 asn_DEF_Int4_tags_1,
552 sizeof(asn_DEF_Int4_tags_1)
553 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
554 asn_DEF_Int4_tags_1, /* Same as above */
555 sizeof(asn_DEF_Int4_tags_1)
556 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
557 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000558 0, 0, /* No members */
559 0 /* No specifics */
560};
561
562
563/*** <<< INCLUDES [Int5] >>> ***/
564
Lev Walkin22b5ed42006-09-13 02:51:20 +0000565#include "Int4.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000566
567/*** <<< TYPE-DECLS [Int5] >>> ***/
568
Lev Walkin006de1c2004-08-20 13:37:45 +0000569typedef Int4_t Int5_t;
570
Lev Walkin006de1c2004-08-20 13:37:45 +0000571/*** <<< FUNC-DECLS [Int5] >>> ***/
572
Lev Walkindfae9752004-09-29 13:19:37 +0000573extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000574asn_struct_free_f Int5_free;
575asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000576asn_constr_check_f Int5_constraint;
577ber_type_decoder_f Int5_decode_ber;
578der_type_encoder_f Int5_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000579xer_type_decoder_f Int5_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000580xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000581
582/*** <<< CODE [Int5] >>> ***/
583
584int
Lev Walkindfae9752004-09-29 13:19:37 +0000585Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000586 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000587 const Int4_t *st = (const Int4_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000588 long value;
589
590 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000591 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000592 "%s: value not given (%s:%d)",
593 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000594 return -1;
595 }
596
Lev Walkindfae9752004-09-29 13:19:37 +0000597 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000598 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000599 "%s: value too large (%s:%d)",
600 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000601 return -1;
602 }
603
604 if((value == 5)) {
605 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000606 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000607 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000608 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000609 "%s: constraint failed (%s:%d)",
610 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000611 return -1;
612 }
613}
614
615/*
616 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000617 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000618 */
619static void
Lev Walkine8318b82005-03-06 09:29:03 +0000620Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000621 td->free_struct = asn_DEF_Int4.free_struct;
622 td->print_struct = asn_DEF_Int4.print_struct;
623 td->ber_decoder = asn_DEF_Int4.ber_decoder;
624 td->der_encoder = asn_DEF_Int4.der_encoder;
625 td->xer_decoder = asn_DEF_Int4.xer_decoder;
626 td->xer_encoder = asn_DEF_Int4.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000627 td->uper_decoder = asn_DEF_Int4.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000628 td->uper_encoder = asn_DEF_Int4.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000629 if(!td->per_constraints)
630 td->per_constraints = asn_DEF_Int4.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000631 td->elements = asn_DEF_Int4.elements;
632 td->elements_count = asn_DEF_Int4.elements_count;
633 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000634}
635
Lev Walkina9cc46e2004-09-22 16:06:28 +0000636void
Lev Walkindfae9752004-09-29 13:19:37 +0000637Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000638 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000639 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000640 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000641}
642
643int
Lev Walkindfae9752004-09-29 13:19:37 +0000644Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000645 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000646 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000647 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
648}
649
Lev Walkindc06f6b2004-10-20 15:50:55 +0000650asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000651Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000652 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000653 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000654 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000655}
656
657asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000658Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000659 void *structure, int tag_mode, ber_tlv_tag_t tag,
660 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000661 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000662 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
663}
664
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000665asn_dec_rval_t
666Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000667 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000668 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000669 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
670}
671
Lev Walkina9cc46e2004-09-22 16:06:28 +0000672asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000673Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000674 int ilevel, enum xer_encoder_flags_e flags,
675 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000676 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000677 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000678}
679
680
681/*** <<< STAT-DEFS [Int5] >>> ***/
682
Lev Walkin59b176e2005-11-26 11:25:14 +0000683static ber_tlv_tag_t asn_DEF_Int5_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000684 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000685};
Lev Walkindfae9752004-09-29 13:19:37 +0000686asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000687 "Int5",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000688 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000689 Int5_free,
690 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000691 Int5_constraint,
692 Int5_decode_ber,
693 Int5_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000694 Int5_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000695 Int5_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000696 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000697 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000698 asn_DEF_Int5_tags_1,
699 sizeof(asn_DEF_Int5_tags_1)
700 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
701 asn_DEF_Int5_tags_1, /* Same as above */
702 sizeof(asn_DEF_Int5_tags_1)
703 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
704 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000705 0, 0, /* No members */
706 0 /* No specifics */
707};
708
709
710/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
711
712#include <INTEGER.h>
713
714/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
715
Lev Walkin006de1c2004-08-20 13:37:45 +0000716typedef INTEGER_t ExtensibleExtensions_t;
717
Lev Walkin006de1c2004-08-20 13:37:45 +0000718/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
719
Lev Walkindfae9752004-09-29 13:19:37 +0000720extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000721asn_struct_free_f ExtensibleExtensions_free;
722asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000723asn_constr_check_f ExtensibleExtensions_constraint;
724ber_type_decoder_f ExtensibleExtensions_decode_ber;
725der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000726xer_type_decoder_f ExtensibleExtensions_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000727xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000728
729/*** <<< CODE [ExtensibleExtensions] >>> ***/
730
731int
Lev Walkindfae9752004-09-29 13:19:37 +0000732ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000733 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000734 const INTEGER_t *st = (const INTEGER_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000735 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000736
737 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000738 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000739 "%s: value not given (%s:%d)",
740 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000741 return -1;
742 }
743
Lev Walkindfae9752004-09-29 13:19:37 +0000744 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000745 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000746 "%s: value too large (%s:%d)",
747 td->name, __FILE__, __LINE__);
748 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000749 }
750
Lev Walkind35c8b52004-08-25 02:08:08 +0000751 if((value >= 1 && value <= 256)) {
752 /* Constraint check succeeded */
753 return 0;
754 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000755 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000756 "%s: constraint failed (%s:%d)",
757 td->name, __FILE__, __LINE__);
758 return -1;
759 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000760}
761
762/*
763 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000764 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000765 */
766static void
Lev Walkine8318b82005-03-06 09:29:03 +0000767ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000768 td->free_struct = asn_DEF_INTEGER.free_struct;
769 td->print_struct = asn_DEF_INTEGER.print_struct;
770 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
771 td->der_encoder = asn_DEF_INTEGER.der_encoder;
772 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
773 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000774 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000775 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000776 if(!td->per_constraints)
777 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000778 td->elements = asn_DEF_INTEGER.elements;
779 td->elements_count = asn_DEF_INTEGER.elements_count;
780 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000781}
782
Lev Walkina9cc46e2004-09-22 16:06:28 +0000783void
Lev Walkindfae9752004-09-29 13:19:37 +0000784ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000785 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000786 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000787 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000788}
789
790int
Lev Walkindfae9752004-09-29 13:19:37 +0000791ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000792 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000793 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000794 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
795}
796
Lev Walkindc06f6b2004-10-20 15:50:55 +0000797asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000798ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000799 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000800 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000801 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000802}
803
804asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000805ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000806 void *structure, int tag_mode, ber_tlv_tag_t tag,
807 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000808 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000809 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
810}
811
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000812asn_dec_rval_t
813ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000814 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000815 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000816 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
817}
818
Lev Walkina9cc46e2004-09-22 16:06:28 +0000819asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000820ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000821 int ilevel, enum xer_encoder_flags_e flags,
822 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000823 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000824 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000825}
826
827
828/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
829
Lev Walkin59b176e2005-11-26 11:25:14 +0000830static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000831 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
832};
Lev Walkindfae9752004-09-29 13:19:37 +0000833asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000834 "ExtensibleExtensions",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000835 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000836 ExtensibleExtensions_free,
837 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000838 ExtensibleExtensions_constraint,
839 ExtensibleExtensions_decode_ber,
840 ExtensibleExtensions_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000841 ExtensibleExtensions_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000842 ExtensibleExtensions_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000843 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000844 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000845 asn_DEF_ExtensibleExtensions_tags_1,
846 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
847 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
848 asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */
849 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
850 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
851 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000852 0, 0, /* No members */
853 0 /* No specifics */
854};
855
856
857/*** <<< INCLUDES [Str1] >>> ***/
858
859#include <IA5String.h>
860
861/*** <<< TYPE-DECLS [Str1] >>> ***/
862
Lev Walkin006de1c2004-08-20 13:37:45 +0000863typedef IA5String_t Str1_t;
864
Lev Walkin006de1c2004-08-20 13:37:45 +0000865/*** <<< FUNC-DECLS [Str1] >>> ***/
866
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000867extern asn_TYPE_descriptor_t asn_DEF_Str1;
868asn_struct_free_f Str1_free;
869asn_struct_print_f Str1_print;
870asn_constr_check_f Str1_constraint;
871ber_type_decoder_f Str1_decode_ber;
872der_type_encoder_f Str1_encode_der;
873xer_type_decoder_f Str1_decode_xer;
874xer_type_encoder_f Str1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000875
876/*** <<< CODE [Str1] >>> ***/
877
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000878int
879Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000880 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000881 /* Replace with underlying type checker */
882 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +0000883 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000884}
885
886/*
887 * This type is implemented using IA5String,
888 * so here we adjust the DEF accordingly.
889 */
890static void
Lev Walkine8318b82005-03-06 09:29:03 +0000891Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000892 td->free_struct = asn_DEF_IA5String.free_struct;
893 td->print_struct = asn_DEF_IA5String.print_struct;
894 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
895 td->der_encoder = asn_DEF_IA5String.der_encoder;
896 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
897 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000898 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000899 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000900 if(!td->per_constraints)
901 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000902 td->elements = asn_DEF_IA5String.elements;
903 td->elements_count = asn_DEF_IA5String.elements_count;
904 td->specifics = asn_DEF_IA5String.specifics;
905}
906
907void
908Str1_free(asn_TYPE_descriptor_t *td,
909 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000910 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000911 td->free_struct(td, struct_ptr, contents_only);
912}
913
914int
915Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
916 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000917 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000918 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
919}
920
921asn_dec_rval_t
922Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000923 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000924 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000925 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
926}
927
928asn_enc_rval_t
929Str1_encode_der(asn_TYPE_descriptor_t *td,
930 void *structure, int tag_mode, ber_tlv_tag_t tag,
931 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000932 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000933 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
934}
935
936asn_dec_rval_t
937Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000938 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000939 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000940 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
941}
942
943asn_enc_rval_t
944Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
945 int ilevel, enum xer_encoder_flags_e flags,
946 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000947 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000948 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
949}
950
951
952/*** <<< STAT-DEFS [Str1] >>> ***/
953
Lev Walkin59b176e2005-11-26 11:25:14 +0000954static ber_tlv_tag_t asn_DEF_Str1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000955 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
956};
957asn_TYPE_descriptor_t asn_DEF_Str1 = {
958 "Str1",
959 "Str1",
960 Str1_free,
961 Str1_print,
962 Str1_constraint,
963 Str1_decode_ber,
964 Str1_encode_der,
965 Str1_decode_xer,
966 Str1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000967 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000968 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000969 asn_DEF_Str1_tags_1,
970 sizeof(asn_DEF_Str1_tags_1)
971 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
972 asn_DEF_Str1_tags_1, /* Same as above */
973 sizeof(asn_DEF_Str1_tags_1)
974 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
975 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000976 0, 0, /* No members */
977 0 /* No specifics */
978};
Lev Walkin006de1c2004-08-20 13:37:45 +0000979
980
981/*** <<< INCLUDES [Str2] >>> ***/
982
Lev Walkin22b5ed42006-09-13 02:51:20 +0000983#include "Str1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000984
985/*** <<< TYPE-DECLS [Str2] >>> ***/
986
Lev Walkin006de1c2004-08-20 13:37:45 +0000987typedef Str1_t Str2_t;
988
Lev Walkin006de1c2004-08-20 13:37:45 +0000989/*** <<< FUNC-DECLS [Str2] >>> ***/
990
Lev Walkindfae9752004-09-29 13:19:37 +0000991extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000992asn_struct_free_f Str2_free;
993asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000994asn_constr_check_f Str2_constraint;
995ber_type_decoder_f Str2_decode_ber;
996der_type_encoder_f Str2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000997xer_type_decoder_f Str2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000998xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000999
1000/*** <<< CTABLES [Str2] >>> ***/
1001
Lev Walkine8318b82005-03-06 09:29:03 +00001002static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001003 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001004 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001005 const uint8_t *ch = st->buf;
1006 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001007
1008 for(; ch < end; ch++) {
1009 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001010 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001011 }
Lev Walkin775885e2004-08-22 12:47:03 +00001012 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001013}
1014
1015
1016/*** <<< CODE [Str2] >>> ***/
1017
1018int
Lev Walkindfae9752004-09-29 13:19:37 +00001019Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001020 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001021 const Str1_t *st = (const Str1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001022 size_t size;
1023
1024 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001025 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001026 "%s: value not given (%s:%d)",
1027 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001028 return -1;
1029 }
1030
1031 size = st->size;
1032
1033 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkine8318b82005-03-06 09:29:03 +00001034 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001035 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001036 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001037 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001038 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001039 "%s: constraint failed (%s:%d)",
1040 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001041 return -1;
1042 }
1043}
1044
1045/*
1046 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +00001047 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001048 */
1049static void
Lev Walkine8318b82005-03-06 09:29:03 +00001050Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001051 td->free_struct = asn_DEF_Str1.free_struct;
1052 td->print_struct = asn_DEF_Str1.print_struct;
1053 td->ber_decoder = asn_DEF_Str1.ber_decoder;
1054 td->der_encoder = asn_DEF_Str1.der_encoder;
1055 td->xer_decoder = asn_DEF_Str1.xer_decoder;
1056 td->xer_encoder = asn_DEF_Str1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001057 td->uper_decoder = asn_DEF_Str1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001058 td->uper_encoder = asn_DEF_Str1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001059 if(!td->per_constraints)
1060 td->per_constraints = asn_DEF_Str1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001061 td->elements = asn_DEF_Str1.elements;
1062 td->elements_count = asn_DEF_Str1.elements_count;
1063 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001064}
1065
Lev Walkina9cc46e2004-09-22 16:06:28 +00001066void
Lev Walkindfae9752004-09-29 13:19:37 +00001067Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001068 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001069 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001070 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001071}
1072
1073int
Lev Walkindfae9752004-09-29 13:19:37 +00001074Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001075 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001076 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001077 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1078}
1079
Lev Walkindc06f6b2004-10-20 15:50:55 +00001080asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001081Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001082 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001083 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001084 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001085}
1086
1087asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001088Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001089 void *structure, int tag_mode, ber_tlv_tag_t tag,
1090 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001091 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001092 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1093}
1094
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001095asn_dec_rval_t
1096Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001097 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001098 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001099 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1100}
1101
Lev Walkina9cc46e2004-09-22 16:06:28 +00001102asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001103Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001104 int ilevel, enum xer_encoder_flags_e flags,
1105 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001106 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001107 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001108}
1109
1110
1111/*** <<< STAT-DEFS [Str2] >>> ***/
1112
Lev Walkin59b176e2005-11-26 11:25:14 +00001113static ber_tlv_tag_t asn_DEF_Str2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001114 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001115};
Lev Walkindfae9752004-09-29 13:19:37 +00001116asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001117 "Str2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001118 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001119 Str2_free,
1120 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001121 Str2_constraint,
1122 Str2_decode_ber,
1123 Str2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001124 Str2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001125 Str2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001126 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001127 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001128 asn_DEF_Str2_tags_1,
1129 sizeof(asn_DEF_Str2_tags_1)
1130 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1131 asn_DEF_Str2_tags_1, /* Same as above */
1132 sizeof(asn_DEF_Str2_tags_1)
1133 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1134 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001135 0, 0, /* No members */
1136 0 /* No specifics */
1137};
1138
1139
1140/*** <<< INCLUDES [Str3] >>> ***/
1141
Lev Walkin22b5ed42006-09-13 02:51:20 +00001142#include "Str2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001143
1144/*** <<< TYPE-DECLS [Str3] >>> ***/
1145
Lev Walkin006de1c2004-08-20 13:37:45 +00001146typedef Str2_t Str3_t;
1147
Lev Walkin006de1c2004-08-20 13:37:45 +00001148/*** <<< FUNC-DECLS [Str3] >>> ***/
1149
Lev Walkindfae9752004-09-29 13:19:37 +00001150extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001151asn_struct_free_f Str3_free;
1152asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001153asn_constr_check_f Str3_constraint;
1154ber_type_decoder_f Str3_decode_ber;
1155der_type_encoder_f Str3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001156xer_type_decoder_f Str3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001157xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001158
1159/*** <<< CTABLES [Str3] >>> ***/
1160
Lev Walkine8318b82005-03-06 09:29:03 +00001161static int permitted_alphabet_table_1[256] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000011620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
11630,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
11640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
11650,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
11660,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
11670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
11680,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
1169};
1170
Lev Walkine8318b82005-03-06 09:29:03 +00001171static int check_permitted_alphabet_1(const void *sptr) {
1172 int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001173 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001174 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001175 const uint8_t *ch = st->buf;
1176 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001177
1178 for(; ch < end; ch++) {
1179 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001180 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001181 }
Lev Walkin775885e2004-08-22 12:47:03 +00001182 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001183}
1184
1185
1186/*** <<< CODE [Str3] >>> ***/
1187
1188int
Lev Walkindfae9752004-09-29 13:19:37 +00001189Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001190 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001191 const Str2_t *st = (const Str2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001192 size_t size;
1193
1194 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001195 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001196 "%s: value not given (%s:%d)",
1197 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001198 return -1;
1199 }
1200
1201 size = st->size;
1202
1203 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkine8318b82005-03-06 09:29:03 +00001204 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001205 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001206 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001207 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001208 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001209 "%s: constraint failed (%s:%d)",
1210 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001211 return -1;
1212 }
1213}
1214
1215/*
1216 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +00001217 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001218 */
1219static void
Lev Walkine8318b82005-03-06 09:29:03 +00001220Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001221 td->free_struct = asn_DEF_Str2.free_struct;
1222 td->print_struct = asn_DEF_Str2.print_struct;
1223 td->ber_decoder = asn_DEF_Str2.ber_decoder;
1224 td->der_encoder = asn_DEF_Str2.der_encoder;
1225 td->xer_decoder = asn_DEF_Str2.xer_decoder;
1226 td->xer_encoder = asn_DEF_Str2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001227 td->uper_decoder = asn_DEF_Str2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001228 td->uper_encoder = asn_DEF_Str2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001229 if(!td->per_constraints)
1230 td->per_constraints = asn_DEF_Str2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001231 td->elements = asn_DEF_Str2.elements;
1232 td->elements_count = asn_DEF_Str2.elements_count;
1233 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001234}
1235
Lev Walkina9cc46e2004-09-22 16:06:28 +00001236void
Lev Walkindfae9752004-09-29 13:19:37 +00001237Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001238 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001239 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001240 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001241}
1242
1243int
Lev Walkindfae9752004-09-29 13:19:37 +00001244Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001245 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001246 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001247 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1248}
1249
Lev Walkindc06f6b2004-10-20 15:50:55 +00001250asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001251Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001252 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001253 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001254 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001255}
1256
1257asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001258Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001259 void *structure, int tag_mode, ber_tlv_tag_t tag,
1260 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001261 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001262 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1263}
1264
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001265asn_dec_rval_t
1266Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001267 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001268 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001269 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1270}
1271
Lev Walkina9cc46e2004-09-22 16:06:28 +00001272asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001273Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001274 int ilevel, enum xer_encoder_flags_e flags,
1275 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001276 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001277 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001278}
1279
1280
1281/*** <<< STAT-DEFS [Str3] >>> ***/
1282
Lev Walkin59b176e2005-11-26 11:25:14 +00001283static ber_tlv_tag_t asn_DEF_Str3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001284 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001285};
Lev Walkindfae9752004-09-29 13:19:37 +00001286asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001287 "Str3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001288 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001289 Str3_free,
1290 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001291 Str3_constraint,
1292 Str3_decode_ber,
1293 Str3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001294 Str3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001295 Str3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001296 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001297 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001298 asn_DEF_Str3_tags_1,
1299 sizeof(asn_DEF_Str3_tags_1)
1300 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1301 asn_DEF_Str3_tags_1, /* Same as above */
1302 sizeof(asn_DEF_Str3_tags_1)
1303 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1304 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001305 0, 0, /* No members */
1306 0 /* No specifics */
1307};
1308
1309
Lev Walkin8a99bf72004-09-10 06:07:39 +00001310/*** <<< INCLUDES [Str4] >>> ***/
1311
1312#include <IA5String.h>
1313
1314/*** <<< TYPE-DECLS [Str4] >>> ***/
1315
Lev Walkin8a99bf72004-09-10 06:07:39 +00001316typedef IA5String_t Str4_t;
1317
1318/*** <<< FUNC-DECLS [Str4] >>> ***/
1319
Lev Walkindfae9752004-09-29 13:19:37 +00001320extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001321asn_struct_free_f Str4_free;
1322asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001323asn_constr_check_f Str4_constraint;
1324ber_type_decoder_f Str4_decode_ber;
1325der_type_encoder_f Str4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001326xer_type_decoder_f Str4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001327xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001328
1329/*** <<< CTABLES [Str4] >>> ***/
1330
Lev Walkine8318b82005-03-06 09:29:03 +00001331static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001332 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001333 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001334 const uint8_t *ch = st->buf;
1335 const uint8_t *end = ch + st->size;
1336
1337 for(; ch < end; ch++) {
1338 uint8_t cv = *ch;
1339 if(!(cv <= 127)) return -1;
1340 }
1341 return 0;
1342}
1343
1344
1345/*** <<< CODE [Str4] >>> ***/
1346
1347int
Lev Walkindfae9752004-09-29 13:19:37 +00001348Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001349 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001350 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001351
1352 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001353 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001354 "%s: value not given (%s:%d)",
1355 td->name, __FILE__, __LINE__);
1356 return -1;
1357 }
1358
1359
Lev Walkine8318b82005-03-06 09:29:03 +00001360 if(!check_permitted_alphabet_1(st)) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001361 /* Constraint check succeeded */
1362 return 0;
1363 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001364 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001365 "%s: constraint failed (%s:%d)",
1366 td->name, __FILE__, __LINE__);
1367 return -1;
1368 }
1369}
1370
1371/*
1372 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001373 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001374 */
1375static void
Lev Walkine8318b82005-03-06 09:29:03 +00001376Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001377 td->free_struct = asn_DEF_IA5String.free_struct;
1378 td->print_struct = asn_DEF_IA5String.print_struct;
1379 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1380 td->der_encoder = asn_DEF_IA5String.der_encoder;
1381 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1382 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001383 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001384 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001385 if(!td->per_constraints)
1386 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001387 td->elements = asn_DEF_IA5String.elements;
1388 td->elements_count = asn_DEF_IA5String.elements_count;
1389 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001390}
1391
Lev Walkina9cc46e2004-09-22 16:06:28 +00001392void
Lev Walkindfae9752004-09-29 13:19:37 +00001393Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001394 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001395 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001396 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001397}
1398
1399int
Lev Walkindfae9752004-09-29 13:19:37 +00001400Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001401 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001402 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001403 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1404}
1405
Lev Walkindc06f6b2004-10-20 15:50:55 +00001406asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001407Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001408 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001409 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001410 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001411}
1412
1413asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001414Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001415 void *structure, int tag_mode, ber_tlv_tag_t tag,
1416 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001417 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001418 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1419}
1420
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001421asn_dec_rval_t
1422Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001423 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001424 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001425 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1426}
1427
Lev Walkina9cc46e2004-09-22 16:06:28 +00001428asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001429Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001430 int ilevel, enum xer_encoder_flags_e flags,
1431 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001432 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001433 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001434}
1435
1436
1437/*** <<< STAT-DEFS [Str4] >>> ***/
1438
Lev Walkin59b176e2005-11-26 11:25:14 +00001439static ber_tlv_tag_t asn_DEF_Str4_tags_1[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001440 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1441};
Lev Walkindfae9752004-09-29 13:19:37 +00001442asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001443 "Str4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001444 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001445 Str4_free,
1446 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001447 Str4_constraint,
1448 Str4_decode_ber,
1449 Str4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001450 Str4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001451 Str4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001452 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001453 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001454 asn_DEF_Str4_tags_1,
1455 sizeof(asn_DEF_Str4_tags_1)
1456 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1457 asn_DEF_Str4_tags_1, /* Same as above */
1458 sizeof(asn_DEF_Str4_tags_1)
1459 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1460 0, /* No PER visible constraints */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001461 0, 0, /* No members */
1462 0 /* No specifics */
1463};
1464
1465
Lev Walkin006de1c2004-08-20 13:37:45 +00001466/*** <<< INCLUDES [PER-Visible] >>> ***/
1467
1468#include <IA5String.h>
1469
1470/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1471
Lev Walkin006de1c2004-08-20 13:37:45 +00001472typedef IA5String_t PER_Visible_t;
1473
Lev Walkin006de1c2004-08-20 13:37:45 +00001474/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1475
Lev Walkindfae9752004-09-29 13:19:37 +00001476extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001477asn_struct_free_f PER_Visible_free;
1478asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001479asn_constr_check_f PER_Visible_constraint;
1480ber_type_decoder_f PER_Visible_decode_ber;
1481der_type_encoder_f PER_Visible_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001482xer_type_decoder_f PER_Visible_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001483xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001484
1485/*** <<< CTABLES [PER-Visible] >>> ***/
1486
Lev Walkine8318b82005-03-06 09:29:03 +00001487static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001488 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001489 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001490 const uint8_t *ch = st->buf;
1491 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001492
1493 for(; ch < end; ch++) {
1494 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001495 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001496 }
Lev Walkin775885e2004-08-22 12:47:03 +00001497 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001498}
1499
1500
1501/*** <<< CODE [PER-Visible] >>> ***/
1502
1503int
Lev Walkindfae9752004-09-29 13:19:37 +00001504PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001505 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001506 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001507
1508 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001509 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001510 "%s: value not given (%s:%d)",
1511 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001512 return -1;
1513 }
1514
1515
Lev Walkine8318b82005-03-06 09:29:03 +00001516 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001517 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001518 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001519 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001520 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001521 "%s: constraint failed (%s:%d)",
1522 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001523 return -1;
1524 }
1525}
1526
1527/*
1528 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001529 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001530 */
1531static void
Lev Walkine8318b82005-03-06 09:29:03 +00001532PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001533 td->free_struct = asn_DEF_IA5String.free_struct;
1534 td->print_struct = asn_DEF_IA5String.print_struct;
1535 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1536 td->der_encoder = asn_DEF_IA5String.der_encoder;
1537 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1538 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001539 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001540 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001541 if(!td->per_constraints)
1542 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001543 td->elements = asn_DEF_IA5String.elements;
1544 td->elements_count = asn_DEF_IA5String.elements_count;
1545 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001546}
1547
Lev Walkina9cc46e2004-09-22 16:06:28 +00001548void
Lev Walkindfae9752004-09-29 13:19:37 +00001549PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001550 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001551 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001552 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001553}
1554
1555int
Lev Walkindfae9752004-09-29 13:19:37 +00001556PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001557 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001558 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001559 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1560}
1561
Lev Walkindc06f6b2004-10-20 15:50:55 +00001562asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001563PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001564 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001565 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001566 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001567}
1568
1569asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001570PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001571 void *structure, int tag_mode, ber_tlv_tag_t tag,
1572 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001573 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001574 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1575}
1576
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001577asn_dec_rval_t
1578PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001579 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001580 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001581 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1582}
1583
Lev Walkina9cc46e2004-09-22 16:06:28 +00001584asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001585PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001586 int ilevel, enum xer_encoder_flags_e flags,
1587 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001588 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001589 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001590}
1591
1592
1593/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1594
Lev Walkin59b176e2005-11-26 11:25:14 +00001595static ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001596 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1597};
Lev Walkindfae9752004-09-29 13:19:37 +00001598asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001599 "PER-Visible",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001600 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001601 PER_Visible_free,
1602 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001603 PER_Visible_constraint,
1604 PER_Visible_decode_ber,
1605 PER_Visible_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001606 PER_Visible_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001607 PER_Visible_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001608 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001609 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001610 asn_DEF_PER_Visible_tags_1,
1611 sizeof(asn_DEF_PER_Visible_tags_1)
1612 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1613 asn_DEF_PER_Visible_tags_1, /* Same as above */
1614 sizeof(asn_DEF_PER_Visible_tags_1)
1615 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1616 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001617 0, 0, /* No members */
1618 0 /* No specifics */
1619};
1620
1621
1622/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1623
Lev Walkin22b5ed42006-09-13 02:51:20 +00001624#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001625
1626/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1627
Lev Walkin006de1c2004-08-20 13:37:45 +00001628typedef PER_Visible_t PER_Visible_2_t;
1629
Lev Walkin006de1c2004-08-20 13:37:45 +00001630/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1631
Lev Walkindfae9752004-09-29 13:19:37 +00001632extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001633asn_struct_free_f PER_Visible_2_free;
1634asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001635asn_constr_check_f PER_Visible_2_constraint;
1636ber_type_decoder_f PER_Visible_2_decode_ber;
1637der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001638xer_type_decoder_f PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001639xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001640
1641/*** <<< CTABLES [PER-Visible-2] >>> ***/
1642
Lev Walkine8318b82005-03-06 09:29:03 +00001643static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001644 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001645 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001646 const uint8_t *ch = st->buf;
1647 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001648
1649 for(; ch < end; ch++) {
1650 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001651 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001652 }
Lev Walkin775885e2004-08-22 12:47:03 +00001653 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001654}
1655
1656
1657/*** <<< CODE [PER-Visible-2] >>> ***/
1658
1659int
Lev Walkindfae9752004-09-29 13:19:37 +00001660PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001661 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001662 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001663
1664 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001665 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001666 "%s: value not given (%s:%d)",
1667 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001668 return -1;
1669 }
1670
1671
Lev Walkine8318b82005-03-06 09:29:03 +00001672 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001673 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001674 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001675 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001676 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001677 "%s: constraint failed (%s:%d)",
1678 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001679 return -1;
1680 }
1681}
1682
1683/*
1684 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001685 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001686 */
1687static void
Lev Walkine8318b82005-03-06 09:29:03 +00001688PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001689 td->free_struct = asn_DEF_PER_Visible.free_struct;
1690 td->print_struct = asn_DEF_PER_Visible.print_struct;
1691 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1692 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1693 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1694 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001695 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001696 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001697 if(!td->per_constraints)
1698 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001699 td->elements = asn_DEF_PER_Visible.elements;
1700 td->elements_count = asn_DEF_PER_Visible.elements_count;
1701 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001702}
1703
Lev Walkina9cc46e2004-09-22 16:06:28 +00001704void
Lev Walkindfae9752004-09-29 13:19:37 +00001705PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001706 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001707 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001708 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001709}
1710
1711int
Lev Walkindfae9752004-09-29 13:19:37 +00001712PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001713 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001714 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001715 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1716}
1717
Lev Walkindc06f6b2004-10-20 15:50:55 +00001718asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001719PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001720 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001721 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001722 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001723}
1724
1725asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001726PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001727 void *structure, int tag_mode, ber_tlv_tag_t tag,
1728 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001729 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001730 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1731}
1732
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001733asn_dec_rval_t
1734PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001735 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001736 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001737 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1738}
1739
Lev Walkina9cc46e2004-09-22 16:06:28 +00001740asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001741PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001742 int ilevel, enum xer_encoder_flags_e flags,
1743 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001744 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001745 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001746}
1747
1748
1749/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1750
Lev Walkin59b176e2005-11-26 11:25:14 +00001751static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001752 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001753};
Lev Walkindfae9752004-09-29 13:19:37 +00001754asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001755 "PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001756 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001757 PER_Visible_2_free,
1758 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001759 PER_Visible_2_constraint,
1760 PER_Visible_2_decode_ber,
1761 PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001762 PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001763 PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001764 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001765 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001766 asn_DEF_PER_Visible_2_tags_1,
1767 sizeof(asn_DEF_PER_Visible_2_tags_1)
1768 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1769 asn_DEF_PER_Visible_2_tags_1, /* Same as above */
1770 sizeof(asn_DEF_PER_Visible_2_tags_1)
1771 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1772 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001773 0, 0, /* No members */
1774 0 /* No specifics */
1775};
1776
1777
1778/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1779
Lev Walkin22b5ed42006-09-13 02:51:20 +00001780#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001781
1782/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1783
Lev Walkin006de1c2004-08-20 13:37:45 +00001784typedef PER_Visible_t Not_PER_Visible_1_t;
1785
Lev Walkin006de1c2004-08-20 13:37:45 +00001786/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1787
Lev Walkindfae9752004-09-29 13:19:37 +00001788extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001789asn_struct_free_f Not_PER_Visible_1_free;
1790asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001791asn_constr_check_f Not_PER_Visible_1_constraint;
1792ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1793der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001794xer_type_decoder_f Not_PER_Visible_1_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001795xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001796
1797/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1798
Lev Walkine8318b82005-03-06 09:29:03 +00001799static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001800 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001801 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001802 const uint8_t *ch = st->buf;
1803 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001804
1805 for(; ch < end; ch++) {
1806 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001807 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001808 }
Lev Walkin775885e2004-08-22 12:47:03 +00001809 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001810}
1811
1812
1813/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1814
1815int
Lev Walkindfae9752004-09-29 13:19:37 +00001816Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001817 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001818 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001819
1820 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001821 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001822 "%s: value not given (%s:%d)",
1823 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001824 return -1;
1825 }
1826
1827
Lev Walkine8318b82005-03-06 09:29:03 +00001828 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001829 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001830 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001831 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001832 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001833 "%s: constraint failed (%s:%d)",
1834 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001835 return -1;
1836 }
1837}
1838
1839/*
1840 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001841 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001842 */
1843static void
Lev Walkine8318b82005-03-06 09:29:03 +00001844Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001845 td->free_struct = asn_DEF_PER_Visible.free_struct;
1846 td->print_struct = asn_DEF_PER_Visible.print_struct;
1847 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1848 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1849 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1850 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001851 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001852 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001853 if(!td->per_constraints)
1854 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001855 td->elements = asn_DEF_PER_Visible.elements;
1856 td->elements_count = asn_DEF_PER_Visible.elements_count;
1857 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001858}
1859
Lev Walkina9cc46e2004-09-22 16:06:28 +00001860void
Lev Walkindfae9752004-09-29 13:19:37 +00001861Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001862 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001863 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001864 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001865}
1866
1867int
Lev Walkindfae9752004-09-29 13:19:37 +00001868Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001869 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001870 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001871 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1872}
1873
Lev Walkindc06f6b2004-10-20 15:50:55 +00001874asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001875Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001876 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001877 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001878 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001879}
1880
1881asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001882Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001883 void *structure, int tag_mode, ber_tlv_tag_t tag,
1884 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001885 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001886 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1887}
1888
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001889asn_dec_rval_t
1890Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001891 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001892 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001893 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1894}
1895
Lev Walkina9cc46e2004-09-22 16:06:28 +00001896asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001897Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001898 int ilevel, enum xer_encoder_flags_e flags,
1899 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001900 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001901 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001902}
1903
1904
1905/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1906
Lev Walkin59b176e2005-11-26 11:25:14 +00001907static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001908 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001909};
Lev Walkindfae9752004-09-29 13:19:37 +00001910asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001911 "Not-PER-Visible-1",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001912 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001913 Not_PER_Visible_1_free,
1914 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001915 Not_PER_Visible_1_constraint,
1916 Not_PER_Visible_1_decode_ber,
1917 Not_PER_Visible_1_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001918 Not_PER_Visible_1_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001919 Not_PER_Visible_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001920 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001921 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001922 asn_DEF_Not_PER_Visible_1_tags_1,
1923 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1924 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1925 asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */
1926 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1927 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1928 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001929 0, 0, /* No members */
1930 0 /* No specifics */
1931};
1932
1933
1934/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1935
Lev Walkin22b5ed42006-09-13 02:51:20 +00001936#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001937
1938/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1939
Lev Walkin006de1c2004-08-20 13:37:45 +00001940typedef PER_Visible_t Not_PER_Visible_2_t;
1941
Lev Walkin006de1c2004-08-20 13:37:45 +00001942/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1943
Lev Walkindfae9752004-09-29 13:19:37 +00001944extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001945asn_struct_free_f Not_PER_Visible_2_free;
1946asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001947asn_constr_check_f Not_PER_Visible_2_constraint;
1948ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1949der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001950xer_type_decoder_f Not_PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001951xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001952
Lev Walkind35c8b52004-08-25 02:08:08 +00001953/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1954
Lev Walkine8318b82005-03-06 09:29:03 +00001955static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001956 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001957 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00001958 const uint8_t *ch = st->buf;
1959 const uint8_t *end = ch + st->size;
1960
1961 for(; ch < end; ch++) {
1962 uint8_t cv = *ch;
1963 if(!(cv >= 65 && cv <= 66)) return -1;
1964 }
1965 return 0;
1966}
1967
1968
Lev Walkin006de1c2004-08-20 13:37:45 +00001969/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1970
1971int
Lev Walkindfae9752004-09-29 13:19:37 +00001972Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001973 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001974 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001975
1976 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001977 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001978 "%s: value not given (%s:%d)",
1979 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001980 return -1;
1981 }
1982
1983
Lev Walkine8318b82005-03-06 09:29:03 +00001984 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001985 /* Constraint check succeeded */
1986 return 0;
1987 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001988 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00001989 "%s: constraint failed (%s:%d)",
1990 td->name, __FILE__, __LINE__);
1991 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001992 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001993}
1994
1995/*
1996 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001997 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001998 */
1999static void
Lev Walkine8318b82005-03-06 09:29:03 +00002000Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002001 td->free_struct = asn_DEF_PER_Visible.free_struct;
2002 td->print_struct = asn_DEF_PER_Visible.print_struct;
2003 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2004 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2005 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2006 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002007 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002008 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002009 if(!td->per_constraints)
2010 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002011 td->elements = asn_DEF_PER_Visible.elements;
2012 td->elements_count = asn_DEF_PER_Visible.elements_count;
2013 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002014}
2015
Lev Walkina9cc46e2004-09-22 16:06:28 +00002016void
Lev Walkindfae9752004-09-29 13:19:37 +00002017Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002018 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002019 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002020 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002021}
2022
2023int
Lev Walkindfae9752004-09-29 13:19:37 +00002024Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002025 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002026 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002027 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2028}
2029
Lev Walkindc06f6b2004-10-20 15:50:55 +00002030asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002031Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002032 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002033 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002034 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002035}
2036
2037asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002038Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002039 void *structure, int tag_mode, ber_tlv_tag_t tag,
2040 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002041 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002042 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2043}
2044
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002045asn_dec_rval_t
2046Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002047 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002048 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002049 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2050}
2051
Lev Walkina9cc46e2004-09-22 16:06:28 +00002052asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002053Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002054 int ilevel, enum xer_encoder_flags_e flags,
2055 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002056 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002057 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002058}
2059
2060
2061/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
2062
Lev Walkin59b176e2005-11-26 11:25:14 +00002063static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002064 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002065};
Lev Walkindfae9752004-09-29 13:19:37 +00002066asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002067 "Not-PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002068 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002069 Not_PER_Visible_2_free,
2070 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002071 Not_PER_Visible_2_constraint,
2072 Not_PER_Visible_2_decode_ber,
2073 Not_PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002074 Not_PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002075 Not_PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002076 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002077 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002078 asn_DEF_Not_PER_Visible_2_tags_1,
2079 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2080 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2081 asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */
2082 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2083 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2084 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002085 0, 0, /* No members */
2086 0 /* No specifics */
2087};
2088
2089
2090/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
2091
Lev Walkin22b5ed42006-09-13 02:51:20 +00002092#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002093
2094/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
2095
Lev Walkin006de1c2004-08-20 13:37:45 +00002096typedef PER_Visible_t Not_PER_Visible_3_t;
2097
Lev Walkin006de1c2004-08-20 13:37:45 +00002098/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
2099
Lev Walkindfae9752004-09-29 13:19:37 +00002100extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002101asn_struct_free_f Not_PER_Visible_3_free;
2102asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002103asn_constr_check_f Not_PER_Visible_3_constraint;
2104ber_type_decoder_f Not_PER_Visible_3_decode_ber;
2105der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002106xer_type_decoder_f Not_PER_Visible_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002107xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002108
Lev Walkind35c8b52004-08-25 02:08:08 +00002109/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
2110
Lev Walkine8318b82005-03-06 09:29:03 +00002111static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002112 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002113 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00002114 const uint8_t *ch = st->buf;
2115 const uint8_t *end = ch + st->size;
2116
2117 for(; ch < end; ch++) {
2118 uint8_t cv = *ch;
2119 if(!(cv >= 65 && cv <= 66)) return -1;
2120 }
2121 return 0;
2122}
2123
2124
Lev Walkin006de1c2004-08-20 13:37:45 +00002125/*** <<< CODE [Not-PER-Visible-3] >>> ***/
2126
2127int
Lev Walkindfae9752004-09-29 13:19:37 +00002128Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002129 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002130 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002131
2132 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002133 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002134 "%s: value not given (%s:%d)",
2135 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002136 return -1;
2137 }
2138
2139
Lev Walkine8318b82005-03-06 09:29:03 +00002140 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002141 /* Constraint check succeeded */
2142 return 0;
2143 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002144 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00002145 "%s: constraint failed (%s:%d)",
2146 td->name, __FILE__, __LINE__);
2147 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002148 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002149}
2150
2151/*
2152 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002153 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002154 */
2155static void
Lev Walkine8318b82005-03-06 09:29:03 +00002156Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002157 td->free_struct = asn_DEF_PER_Visible.free_struct;
2158 td->print_struct = asn_DEF_PER_Visible.print_struct;
2159 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2160 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2161 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2162 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002163 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002164 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002165 if(!td->per_constraints)
2166 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002167 td->elements = asn_DEF_PER_Visible.elements;
2168 td->elements_count = asn_DEF_PER_Visible.elements_count;
2169 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002170}
2171
Lev Walkina9cc46e2004-09-22 16:06:28 +00002172void
Lev Walkindfae9752004-09-29 13:19:37 +00002173Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002174 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002175 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002176 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002177}
2178
2179int
Lev Walkindfae9752004-09-29 13:19:37 +00002180Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002181 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002182 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002183 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2184}
2185
Lev Walkindc06f6b2004-10-20 15:50:55 +00002186asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002187Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002188 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002189 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002190 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002191}
2192
2193asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002194Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002195 void *structure, int tag_mode, ber_tlv_tag_t tag,
2196 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002197 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002198 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2199}
2200
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002201asn_dec_rval_t
2202Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002203 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002204 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002205 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2206}
2207
Lev Walkina9cc46e2004-09-22 16:06:28 +00002208asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002209Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002210 int ilevel, enum xer_encoder_flags_e flags,
2211 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002212 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002213 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002214}
2215
2216
2217/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
2218
Lev Walkin59b176e2005-11-26 11:25:14 +00002219static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002220 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002221};
Lev Walkindfae9752004-09-29 13:19:37 +00002222asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002223 "Not-PER-Visible-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002224 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002225 Not_PER_Visible_3_free,
2226 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002227 Not_PER_Visible_3_constraint,
2228 Not_PER_Visible_3_decode_ber,
2229 Not_PER_Visible_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002230 Not_PER_Visible_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002231 Not_PER_Visible_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002232 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002233 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002234 asn_DEF_Not_PER_Visible_3_tags_1,
2235 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2236 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2237 asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */
2238 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2239 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2240 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002241 0, 0, /* No members */
2242 0 /* No specifics */
2243};
2244
2245
2246/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
2247
Lev Walkin22b5ed42006-09-13 02:51:20 +00002248#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002249
2250/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
2251
Lev Walkin006de1c2004-08-20 13:37:45 +00002252typedef PER_Visible_t SIZE_but_not_FROM_t;
2253
Lev Walkin006de1c2004-08-20 13:37:45 +00002254/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
2255
Lev Walkindfae9752004-09-29 13:19:37 +00002256extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002257asn_struct_free_f SIZE_but_not_FROM_free;
2258asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002259asn_constr_check_f SIZE_but_not_FROM_constraint;
2260ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
2261der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002262xer_type_decoder_f SIZE_but_not_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002263xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002264
2265/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
2266
Lev Walkine8318b82005-03-06 09:29:03 +00002267static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002268 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002269 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002270 const uint8_t *ch = st->buf;
2271 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002272
2273 for(; ch < end; ch++) {
2274 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00002275 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002276 }
Lev Walkin775885e2004-08-22 12:47:03 +00002277 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002278}
2279
2280
2281/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
2282
2283int
Lev Walkindfae9752004-09-29 13:19:37 +00002284SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002285 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002286 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002287 size_t size;
2288
2289 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002290 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002291 "%s: value not given (%s:%d)",
2292 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002293 return -1;
2294 }
2295
2296 size = st->size;
2297
2298 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002299 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002300 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002301 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002302 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002303 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002304 "%s: constraint failed (%s:%d)",
2305 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002306 return -1;
2307 }
2308}
2309
2310/*
2311 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002312 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002313 */
2314static void
Lev Walkine8318b82005-03-06 09:29:03 +00002315SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002316 td->free_struct = asn_DEF_PER_Visible.free_struct;
2317 td->print_struct = asn_DEF_PER_Visible.print_struct;
2318 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2319 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2320 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2321 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002322 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002323 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002324 if(!td->per_constraints)
2325 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002326 td->elements = asn_DEF_PER_Visible.elements;
2327 td->elements_count = asn_DEF_PER_Visible.elements_count;
2328 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002329}
2330
Lev Walkina9cc46e2004-09-22 16:06:28 +00002331void
Lev Walkindfae9752004-09-29 13:19:37 +00002332SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002333 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002334 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002335 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002336}
2337
2338int
Lev Walkindfae9752004-09-29 13:19:37 +00002339SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002340 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002341 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002342 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2343}
2344
Lev Walkindc06f6b2004-10-20 15:50:55 +00002345asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002346SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002347 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002348 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002349 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002350}
2351
2352asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002353SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002354 void *structure, int tag_mode, ber_tlv_tag_t tag,
2355 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002356 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002357 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2358}
2359
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002360asn_dec_rval_t
2361SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002362 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002363 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002364 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2365}
2366
Lev Walkina9cc46e2004-09-22 16:06:28 +00002367asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002368SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002369 int ilevel, enum xer_encoder_flags_e flags,
2370 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002371 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002372 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002373}
2374
2375
2376/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
2377
Lev Walkin59b176e2005-11-26 11:25:14 +00002378static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002379 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002380};
Lev Walkindfae9752004-09-29 13:19:37 +00002381asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002382 "SIZE-but-not-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002383 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002384 SIZE_but_not_FROM_free,
2385 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002386 SIZE_but_not_FROM_constraint,
2387 SIZE_but_not_FROM_decode_ber,
2388 SIZE_but_not_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002389 SIZE_but_not_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002390 SIZE_but_not_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002391 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002392 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002393 asn_DEF_SIZE_but_not_FROM_tags_1,
2394 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2395 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2396 asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */
2397 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2398 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2399 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002400 0, 0, /* No members */
2401 0 /* No specifics */
2402};
2403
2404
2405/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2406
Lev Walkin22b5ed42006-09-13 02:51:20 +00002407#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002408
2409/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2410
Lev Walkin006de1c2004-08-20 13:37:45 +00002411typedef PER_Visible_t SIZE_and_FROM_t;
2412
Lev Walkin006de1c2004-08-20 13:37:45 +00002413/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2414
Lev Walkindfae9752004-09-29 13:19:37 +00002415extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002416asn_struct_free_f SIZE_and_FROM_free;
2417asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002418asn_constr_check_f SIZE_and_FROM_constraint;
2419ber_type_decoder_f SIZE_and_FROM_decode_ber;
2420der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002421xer_type_decoder_f SIZE_and_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002422xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002423
2424/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2425
Lev Walkine8318b82005-03-06 09:29:03 +00002426static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002427 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002428 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002429 const uint8_t *ch = st->buf;
2430 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002431
2432 for(; ch < end; ch++) {
2433 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002434 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002435 }
Lev Walkin775885e2004-08-22 12:47:03 +00002436 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002437}
2438
2439
2440/*** <<< CODE [SIZE-and-FROM] >>> ***/
2441
2442int
Lev Walkindfae9752004-09-29 13:19:37 +00002443SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002444 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002445 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002446 size_t size;
2447
2448 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002449 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002450 "%s: value not given (%s:%d)",
2451 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002452 return -1;
2453 }
2454
2455 size = st->size;
2456
2457 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002458 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002459 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002460 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002461 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002462 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002463 "%s: constraint failed (%s:%d)",
2464 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002465 return -1;
2466 }
2467}
2468
2469/*
2470 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002471 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002472 */
2473static void
Lev Walkine8318b82005-03-06 09:29:03 +00002474SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002475 td->free_struct = asn_DEF_PER_Visible.free_struct;
2476 td->print_struct = asn_DEF_PER_Visible.print_struct;
2477 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2478 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2479 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2480 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002481 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002482 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002483 if(!td->per_constraints)
2484 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002485 td->elements = asn_DEF_PER_Visible.elements;
2486 td->elements_count = asn_DEF_PER_Visible.elements_count;
2487 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002488}
2489
Lev Walkina9cc46e2004-09-22 16:06:28 +00002490void
Lev Walkindfae9752004-09-29 13:19:37 +00002491SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002492 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002493 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002494 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002495}
2496
2497int
Lev Walkindfae9752004-09-29 13:19:37 +00002498SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002499 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002500 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002501 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2502}
2503
Lev Walkindc06f6b2004-10-20 15:50:55 +00002504asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002505SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002506 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002507 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002508 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002509}
2510
2511asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002512SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002513 void *structure, int tag_mode, ber_tlv_tag_t tag,
2514 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002515 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002516 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2517}
2518
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002519asn_dec_rval_t
2520SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002521 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002522 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002523 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2524}
2525
Lev Walkina9cc46e2004-09-22 16:06:28 +00002526asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002527SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002528 int ilevel, enum xer_encoder_flags_e flags,
2529 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002530 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002531 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002532}
2533
2534
2535/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2536
Lev Walkin59b176e2005-11-26 11:25:14 +00002537static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002538 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002539};
Lev Walkindfae9752004-09-29 13:19:37 +00002540asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002541 "SIZE-and-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002542 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002543 SIZE_and_FROM_free,
2544 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002545 SIZE_and_FROM_constraint,
2546 SIZE_and_FROM_decode_ber,
2547 SIZE_and_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002548 SIZE_and_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002549 SIZE_and_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002550 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002551 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002552 asn_DEF_SIZE_and_FROM_tags_1,
2553 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2554 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2555 asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */
2556 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2557 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2558 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002559 0, 0, /* No members */
2560 0 /* No specifics */
2561};
2562
2563
2564/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2565
Lev Walkin22b5ed42006-09-13 02:51:20 +00002566#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002567
2568/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2569
Lev Walkin006de1c2004-08-20 13:37:45 +00002570typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2571
Lev Walkin006de1c2004-08-20 13:37:45 +00002572/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2573
Lev Walkindfae9752004-09-29 13:19:37 +00002574extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002575asn_struct_free_f Neither_SIZE_nor_FROM_free;
2576asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002577asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2578ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2579der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002580xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002581xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002582
2583/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2584
Lev Walkine8318b82005-03-06 09:29:03 +00002585static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002586 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002587 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002588 const uint8_t *ch = st->buf;
2589 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002590
2591 for(; ch < end; ch++) {
2592 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002593 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002594 }
Lev Walkin775885e2004-08-22 12:47:03 +00002595 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002596}
2597
2598
2599/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2600
2601int
Lev Walkindfae9752004-09-29 13:19:37 +00002602Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002603 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002604 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002605
2606 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002607 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002608 "%s: value not given (%s:%d)",
2609 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002610 return -1;
2611 }
2612
2613
Lev Walkine8318b82005-03-06 09:29:03 +00002614 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002615 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002616 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002617 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002618 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002619 "%s: constraint failed (%s:%d)",
2620 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002621 return -1;
2622 }
2623}
2624
2625/*
2626 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002627 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002628 */
2629static void
Lev Walkine8318b82005-03-06 09:29:03 +00002630Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002631 td->free_struct = asn_DEF_PER_Visible.free_struct;
2632 td->print_struct = asn_DEF_PER_Visible.print_struct;
2633 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2634 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2635 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2636 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002637 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002638 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002639 if(!td->per_constraints)
2640 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002641 td->elements = asn_DEF_PER_Visible.elements;
2642 td->elements_count = asn_DEF_PER_Visible.elements_count;
2643 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002644}
2645
Lev Walkina9cc46e2004-09-22 16:06:28 +00002646void
Lev Walkindfae9752004-09-29 13:19:37 +00002647Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002648 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002649 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002650 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002651}
2652
2653int
Lev Walkindfae9752004-09-29 13:19:37 +00002654Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002655 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002656 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002657 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2658}
2659
Lev Walkindc06f6b2004-10-20 15:50:55 +00002660asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002661Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002662 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002663 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002664 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002665}
2666
2667asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002668Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002669 void *structure, int tag_mode, ber_tlv_tag_t tag,
2670 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002671 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002672 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2673}
2674
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002675asn_dec_rval_t
2676Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002677 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002678 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002679 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2680}
2681
Lev Walkina9cc46e2004-09-22 16:06:28 +00002682asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002683Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002684 int ilevel, enum xer_encoder_flags_e flags,
2685 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002686 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002687 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002688}
2689
2690
2691/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2692
Lev Walkin59b176e2005-11-26 11:25:14 +00002693static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002694 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002695};
Lev Walkindfae9752004-09-29 13:19:37 +00002696asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002697 "Neither-SIZE-nor-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002698 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002699 Neither_SIZE_nor_FROM_free,
2700 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002701 Neither_SIZE_nor_FROM_constraint,
2702 Neither_SIZE_nor_FROM_decode_ber,
2703 Neither_SIZE_nor_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002704 Neither_SIZE_nor_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002705 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002706 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002707 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002708 asn_DEF_Neither_SIZE_nor_FROM_tags_1,
2709 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2710 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2711 asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */
2712 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2713 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2714 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002715 0, 0, /* No members */
2716 0 /* No specifics */
2717};
2718
2719
Lev Walkin55cc44a2004-10-03 09:14:32 +00002720/*** <<< INCLUDES [Utf8-4] >>> ***/
2721
2722#include <UTF8String.h>
2723
2724/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2725
Lev Walkin55cc44a2004-10-03 09:14:32 +00002726typedef UTF8String_t Utf8_4_t;
2727
2728/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2729
2730extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2731asn_struct_free_f Utf8_4_free;
2732asn_struct_print_f Utf8_4_print;
2733asn_constr_check_f Utf8_4_constraint;
2734ber_type_decoder_f Utf8_4_decode_ber;
2735der_type_encoder_f Utf8_4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002736xer_type_decoder_f Utf8_4_decode_xer;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002737xer_type_encoder_f Utf8_4_encode_xer;
2738
2739/*** <<< CTABLES [Utf8-4] >>> ***/
2740
Lev Walkine8318b82005-03-06 09:29:03 +00002741static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002742 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2743 return -1; /* Alphabet (sic!) test failed. */
2744
2745 return 0;
2746}
2747
2748
2749/*** <<< CODE [Utf8-4] >>> ***/
2750
2751int
2752Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002753 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002754 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002755
2756 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002757 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002758 "%s: value not given (%s:%d)",
2759 td->name, __FILE__, __LINE__);
2760 return -1;
2761 }
2762
2763
Lev Walkine8318b82005-03-06 09:29:03 +00002764 if(!check_permitted_alphabet_1(st)) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002765 /* Constraint check succeeded */
2766 return 0;
2767 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002768 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002769 "%s: constraint failed (%s:%d)",
2770 td->name, __FILE__, __LINE__);
2771 return -1;
2772 }
2773}
2774
2775/*
2776 * This type is implemented using UTF8String,
2777 * so here we adjust the DEF accordingly.
2778 */
2779static void
Lev Walkine8318b82005-03-06 09:29:03 +00002780Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002781 td->free_struct = asn_DEF_UTF8String.free_struct;
2782 td->print_struct = asn_DEF_UTF8String.print_struct;
2783 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2784 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2785 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2786 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002787 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002788 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002789 if(!td->per_constraints)
2790 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002791 td->elements = asn_DEF_UTF8String.elements;
2792 td->elements_count = asn_DEF_UTF8String.elements_count;
2793 td->specifics = asn_DEF_UTF8String.specifics;
2794}
2795
2796void
2797Utf8_4_free(asn_TYPE_descriptor_t *td,
2798 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002799 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002800 td->free_struct(td, struct_ptr, contents_only);
2801}
2802
2803int
2804Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2805 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002806 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002807 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2808}
2809
Lev Walkindc06f6b2004-10-20 15:50:55 +00002810asn_dec_rval_t
Lev Walkin55cc44a2004-10-03 09:14:32 +00002811Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002812 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002813 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002814 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2815}
2816
2817asn_enc_rval_t
2818Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2819 void *structure, int tag_mode, ber_tlv_tag_t tag,
2820 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002821 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002822 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2823}
2824
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002825asn_dec_rval_t
2826Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002827 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002828 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002829 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2830}
2831
Lev Walkin55cc44a2004-10-03 09:14:32 +00002832asn_enc_rval_t
2833Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2834 int ilevel, enum xer_encoder_flags_e flags,
2835 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002836 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002837 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2838}
2839
2840
2841/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2842
Lev Walkin59b176e2005-11-26 11:25:14 +00002843static ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002844 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2845};
2846asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2847 "Utf8-4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002848 "Utf8-4",
Lev Walkin55cc44a2004-10-03 09:14:32 +00002849 Utf8_4_free,
2850 Utf8_4_print,
2851 Utf8_4_constraint,
2852 Utf8_4_decode_ber,
2853 Utf8_4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002854 Utf8_4_decode_xer,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002855 Utf8_4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002856 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002857 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002858 asn_DEF_Utf8_4_tags_1,
2859 sizeof(asn_DEF_Utf8_4_tags_1)
2860 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2861 asn_DEF_Utf8_4_tags_1, /* Same as above */
2862 sizeof(asn_DEF_Utf8_4_tags_1)
2863 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2864 0, /* No PER visible constraints */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002865 0, 0, /* No members */
2866 0 /* No specifics */
2867};
2868
2869
Lev Walkin006de1c2004-08-20 13:37:45 +00002870/*** <<< INCLUDES [Utf8-3] >>> ***/
2871
Lev Walkin22b5ed42006-09-13 02:51:20 +00002872#include "Utf8-2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002873
2874/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2875
Lev Walkin006de1c2004-08-20 13:37:45 +00002876typedef Utf8_2_t Utf8_3_t;
2877
Lev Walkin006de1c2004-08-20 13:37:45 +00002878/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2879
Lev Walkindfae9752004-09-29 13:19:37 +00002880extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002881asn_struct_free_f Utf8_3_free;
2882asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002883asn_constr_check_f Utf8_3_constraint;
2884ber_type_decoder_f Utf8_3_decode_ber;
2885der_type_encoder_f Utf8_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002886xer_type_decoder_f Utf8_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002887xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002888
2889/*** <<< CTABLES [Utf8-3] >>> ***/
2890
Lev Walkine8318b82005-03-06 09:29:03 +00002891static int permitted_alphabet_table_1[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000028920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28930,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28940,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28950,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28960,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
28971,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
28980,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
28991,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2900};
2901
Lev Walkine8318b82005-03-06 09:29:03 +00002902static int check_permitted_alphabet_1(const void *sptr) {
2903 int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002904 /* The underlying type is UTF8String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002905 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002906 const uint8_t *ch = st->buf;
2907 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002908
2909 for(; ch < end; ch++) {
2910 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002911 if(cv >= 0x80) return -1;
2912 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002913 }
Lev Walkin775885e2004-08-22 12:47:03 +00002914 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002915}
2916
2917
2918/*** <<< CODE [Utf8-3] >>> ***/
2919
2920int
Lev Walkindfae9752004-09-29 13:19:37 +00002921Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002922 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002923 const Utf8_2_t *st = (const Utf8_2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002924 size_t size;
2925
2926 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002927 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002928 "%s: value not given (%s:%d)",
2929 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002930 return -1;
2931 }
2932
Lev Walkinfac2e942004-10-02 16:33:46 +00002933 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002934 if((ssize_t)size < 0) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002935 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00002936 "%s: UTF-8: broken encoding (%s:%d)",
2937 td->name, __FILE__, __LINE__);
2938 return -1;
2939 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002940
2941 if((size >= 1 && size <= 2)
Lev Walkine8318b82005-03-06 09:29:03 +00002942 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002943 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002944 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002945 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002946 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002947 "%s: constraint failed (%s:%d)",
2948 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002949 return -1;
2950 }
2951}
2952
2953/*
2954 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002955 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002956 */
2957static void
Lev Walkine8318b82005-03-06 09:29:03 +00002958Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002959 td->free_struct = asn_DEF_Utf8_2.free_struct;
2960 td->print_struct = asn_DEF_Utf8_2.print_struct;
2961 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
2962 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
2963 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
2964 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002965 td->uper_decoder = asn_DEF_Utf8_2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002966 td->uper_encoder = asn_DEF_Utf8_2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002967 if(!td->per_constraints)
2968 td->per_constraints = asn_DEF_Utf8_2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002969 td->elements = asn_DEF_Utf8_2.elements;
2970 td->elements_count = asn_DEF_Utf8_2.elements_count;
2971 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002972}
2973
Lev Walkina9cc46e2004-09-22 16:06:28 +00002974void
Lev Walkindfae9752004-09-29 13:19:37 +00002975Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002976 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002977 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002978 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002979}
2980
2981int
Lev Walkindfae9752004-09-29 13:19:37 +00002982Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002983 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002984 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002985 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2986}
2987
Lev Walkindc06f6b2004-10-20 15:50:55 +00002988asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002989Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002990 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002991 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002992 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002993}
2994
2995asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002996Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002997 void *structure, int tag_mode, ber_tlv_tag_t tag,
2998 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002999 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003000 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3001}
3002
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003003asn_dec_rval_t
3004Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003005 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003006 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003007 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3008}
3009
Lev Walkina9cc46e2004-09-22 16:06:28 +00003010asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003011Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003012 int ilevel, enum xer_encoder_flags_e flags,
3013 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003014 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003015 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003016}
3017
3018
3019/*** <<< STAT-DEFS [Utf8-3] >>> ***/
3020
Lev Walkin59b176e2005-11-26 11:25:14 +00003021static ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003022 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003023};
Lev Walkindfae9752004-09-29 13:19:37 +00003024asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003025 "Utf8-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003026 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003027 Utf8_3_free,
3028 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003029 Utf8_3_constraint,
3030 Utf8_3_decode_ber,
3031 Utf8_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003032 Utf8_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003033 Utf8_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003034 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003035 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003036 asn_DEF_Utf8_3_tags_1,
3037 sizeof(asn_DEF_Utf8_3_tags_1)
3038 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3039 asn_DEF_Utf8_3_tags_1, /* Same as above */
3040 sizeof(asn_DEF_Utf8_3_tags_1)
3041 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3042 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003043 0, 0, /* No members */
3044 0 /* No specifics */
3045};
3046
3047
3048/*** <<< INCLUDES [Utf8-2] >>> ***/
3049
Lev Walkin22b5ed42006-09-13 02:51:20 +00003050#include "Utf8-1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00003051
3052/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
3053
Lev Walkin006de1c2004-08-20 13:37:45 +00003054typedef Utf8_1_t Utf8_2_t;
3055
Lev Walkin006de1c2004-08-20 13:37:45 +00003056/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
3057
Lev Walkindfae9752004-09-29 13:19:37 +00003058extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003059asn_struct_free_f Utf8_2_free;
3060asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00003061asn_constr_check_f Utf8_2_constraint;
3062ber_type_decoder_f Utf8_2_decode_ber;
3063der_type_encoder_f Utf8_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003064xer_type_decoder_f Utf8_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003065xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003066
3067/*** <<< CODE [Utf8-2] >>> ***/
3068
3069int
Lev Walkindfae9752004-09-29 13:19:37 +00003070Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003071 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00003072 const Utf8_1_t *st = (const Utf8_1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00003073 size_t size;
3074
3075 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003076 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003077 "%s: value not given (%s:%d)",
3078 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003079 return -1;
3080 }
3081
Lev Walkinfac2e942004-10-02 16:33:46 +00003082 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00003083 if((ssize_t)size < 0) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003084 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00003085 "%s: UTF-8: broken encoding (%s:%d)",
3086 td->name, __FILE__, __LINE__);
3087 return -1;
3088 }
Lev Walkin006de1c2004-08-20 13:37:45 +00003089
3090 if((size >= 1 && size <= 2)) {
3091 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00003092 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00003093 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003094 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003095 "%s: constraint failed (%s:%d)",
3096 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003097 return -1;
3098 }
3099}
3100
3101/*
3102 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00003103 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00003104 */
3105static void
Lev Walkine8318b82005-03-06 09:29:03 +00003106Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00003107 td->free_struct = asn_DEF_Utf8_1.free_struct;
3108 td->print_struct = asn_DEF_Utf8_1.print_struct;
3109 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
3110 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
3111 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
3112 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003113 td->uper_decoder = asn_DEF_Utf8_1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003114 td->uper_encoder = asn_DEF_Utf8_1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003115 if(!td->per_constraints)
3116 td->per_constraints = asn_DEF_Utf8_1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003117 td->elements = asn_DEF_Utf8_1.elements;
3118 td->elements_count = asn_DEF_Utf8_1.elements_count;
3119 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00003120}
3121
Lev Walkina9cc46e2004-09-22 16:06:28 +00003122void
Lev Walkindfae9752004-09-29 13:19:37 +00003123Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003124 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003125 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003126 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00003127}
3128
3129int
Lev Walkindfae9752004-09-29 13:19:37 +00003130Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00003131 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003132 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00003133 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3134}
3135
Lev Walkindc06f6b2004-10-20 15:50:55 +00003136asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003137Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003138 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003139 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003140 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003141}
3142
3143asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003144Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003145 void *structure, int tag_mode, ber_tlv_tag_t tag,
3146 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003147 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003148 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3149}
3150
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003151asn_dec_rval_t
3152Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003153 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003154 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003155 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3156}
3157
Lev Walkina9cc46e2004-09-22 16:06:28 +00003158asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003159Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003160 int ilevel, enum xer_encoder_flags_e flags,
3161 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003162 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003163 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003164}
3165
3166
3167/*** <<< STAT-DEFS [Utf8-2] >>> ***/
3168
Lev Walkin59b176e2005-11-26 11:25:14 +00003169static ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003170 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003171};
Lev Walkindfae9752004-09-29 13:19:37 +00003172asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003173 "Utf8-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003174 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003175 Utf8_2_free,
3176 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003177 Utf8_2_constraint,
3178 Utf8_2_decode_ber,
3179 Utf8_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003180 Utf8_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003181 Utf8_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003182 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003183 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003184 asn_DEF_Utf8_2_tags_1,
3185 sizeof(asn_DEF_Utf8_2_tags_1)
3186 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3187 asn_DEF_Utf8_2_tags_1, /* Same as above */
3188 sizeof(asn_DEF_Utf8_2_tags_1)
3189 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3190 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003191 0, 0, /* No members */
3192 0 /* No specifics */
3193};
3194
3195
3196/*** <<< INCLUDES [Utf8-1] >>> ***/
3197
3198#include <UTF8String.h>
3199
3200/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
3201
Lev Walkin006de1c2004-08-20 13:37:45 +00003202typedef UTF8String_t Utf8_1_t;
3203
Lev Walkin006de1c2004-08-20 13:37:45 +00003204/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
3205
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003206extern asn_TYPE_descriptor_t asn_DEF_Utf8_1;
3207asn_struct_free_f Utf8_1_free;
3208asn_struct_print_f Utf8_1_print;
3209asn_constr_check_f Utf8_1_constraint;
3210ber_type_decoder_f Utf8_1_decode_ber;
3211der_type_encoder_f Utf8_1_encode_der;
3212xer_type_decoder_f Utf8_1_decode_xer;
3213xer_type_encoder_f Utf8_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003214
3215/*** <<< CODE [Utf8-1] >>> ***/
3216
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003217int
3218Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003219 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003220 /* Replace with underlying type checker */
3221 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003222 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003223}
3224
3225/*
3226 * This type is implemented using UTF8String,
3227 * so here we adjust the DEF accordingly.
3228 */
3229static void
Lev Walkine8318b82005-03-06 09:29:03 +00003230Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003231 td->free_struct = asn_DEF_UTF8String.free_struct;
3232 td->print_struct = asn_DEF_UTF8String.print_struct;
3233 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
3234 td->der_encoder = asn_DEF_UTF8String.der_encoder;
3235 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
3236 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003237 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003238 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003239 if(!td->per_constraints)
3240 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003241 td->elements = asn_DEF_UTF8String.elements;
3242 td->elements_count = asn_DEF_UTF8String.elements_count;
3243 td->specifics = asn_DEF_UTF8String.specifics;
3244}
3245
3246void
3247Utf8_1_free(asn_TYPE_descriptor_t *td,
3248 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003249 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003250 td->free_struct(td, struct_ptr, contents_only);
3251}
3252
3253int
3254Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3255 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003256 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003257 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3258}
3259
3260asn_dec_rval_t
3261Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003262 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003263 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003264 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3265}
3266
3267asn_enc_rval_t
3268Utf8_1_encode_der(asn_TYPE_descriptor_t *td,
3269 void *structure, int tag_mode, ber_tlv_tag_t tag,
3270 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003271 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003272 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3273}
3274
3275asn_dec_rval_t
3276Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003277 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003278 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003279 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3280}
3281
3282asn_enc_rval_t
3283Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3284 int ilevel, enum xer_encoder_flags_e flags,
3285 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003286 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003287 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3288}
3289
3290
3291/*** <<< STAT-DEFS [Utf8-1] >>> ***/
3292
Lev Walkin59b176e2005-11-26 11:25:14 +00003293static ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003294 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
3295};
3296asn_TYPE_descriptor_t asn_DEF_Utf8_1 = {
3297 "Utf8-1",
3298 "Utf8-1",
3299 Utf8_1_free,
3300 Utf8_1_print,
3301 Utf8_1_constraint,
3302 Utf8_1_decode_ber,
3303 Utf8_1_encode_der,
3304 Utf8_1_decode_xer,
3305 Utf8_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003306 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003307 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003308 asn_DEF_Utf8_1_tags_1,
3309 sizeof(asn_DEF_Utf8_1_tags_1)
3310 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3311 asn_DEF_Utf8_1_tags_1, /* Same as above */
3312 sizeof(asn_DEF_Utf8_1_tags_1)
3313 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3314 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003315 0, 0, /* No members */
3316 0 /* No specifics */
3317};
Lev Walkin006de1c2004-08-20 13:37:45 +00003318
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003319
3320/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
3321
Lev Walkin22b5ed42006-09-13 02:51:20 +00003322#include "Identifier.h"
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003323
3324/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
3325
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003326typedef Identifier_t VisibleIdentifier_t;
3327
3328/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
3329
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003330extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier;
3331asn_struct_free_f VisibleIdentifier_free;
3332asn_struct_print_f VisibleIdentifier_print;
3333asn_constr_check_f VisibleIdentifier_constraint;
3334ber_type_decoder_f VisibleIdentifier_decode_ber;
3335der_type_encoder_f VisibleIdentifier_encode_der;
3336xer_type_decoder_f VisibleIdentifier_decode_xer;
3337xer_type_encoder_f VisibleIdentifier_encode_xer;
3338
3339/*** <<< CTABLES [VisibleIdentifier] >>> ***/
3340
Lev Walkine8318b82005-03-06 09:29:03 +00003341static int permitted_alphabet_table_1[256] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +000033420,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
33430,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
33440,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
33451,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
33460,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
33471,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
33480,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
33491,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
3350};
3351
Lev Walkine8318b82005-03-06 09:29:03 +00003352static int check_permitted_alphabet_1(const void *sptr) {
3353 int *table = permitted_alphabet_table_1;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003354 /* The underlying type is VisibleString */
3355 const VisibleString_t *st = (const VisibleString_t *)sptr;
3356 const uint8_t *ch = st->buf;
3357 const uint8_t *end = ch + st->size;
3358
3359 for(; ch < end; ch++) {
3360 uint8_t cv = *ch;
3361 if(!table[cv]) return -1;
3362 }
3363 return 0;
3364}
3365
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003366
Lev Walkin154aa182004-09-26 13:12:56 +00003367/*** <<< CODE [VisibleIdentifier] >>> ***/
3368
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003369int
3370VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003371 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003372 const Identifier_t *st = (const Identifier_t *)sptr;
3373 size_t size;
3374
3375 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003376 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003377 "%s: value not given (%s:%d)",
3378 td->name, __FILE__, __LINE__);
3379 return -1;
3380 }
3381
3382 size = st->size;
3383
3384 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00003385 && !check_permitted_alphabet_1(st)) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003386 /* Constraint check succeeded */
3387 return 0;
3388 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003389 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003390 "%s: constraint failed (%s:%d)",
3391 td->name, __FILE__, __LINE__);
3392 return -1;
3393 }
3394}
3395
3396/*
3397 * This type is implemented using Identifier,
3398 * so here we adjust the DEF accordingly.
3399 */
3400static void
Lev Walkine8318b82005-03-06 09:29:03 +00003401VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003402 td->free_struct = asn_DEF_Identifier.free_struct;
3403 td->print_struct = asn_DEF_Identifier.print_struct;
3404 td->ber_decoder = asn_DEF_Identifier.ber_decoder;
3405 td->der_encoder = asn_DEF_Identifier.der_encoder;
3406 td->xer_decoder = asn_DEF_Identifier.xer_decoder;
3407 td->xer_encoder = asn_DEF_Identifier.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003408 td->uper_decoder = asn_DEF_Identifier.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003409 td->uper_encoder = asn_DEF_Identifier.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003410 if(!td->per_constraints)
3411 td->per_constraints = asn_DEF_Identifier.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003412 td->elements = asn_DEF_Identifier.elements;
3413 td->elements_count = asn_DEF_Identifier.elements_count;
3414 td->specifics = asn_DEF_Identifier.specifics;
3415}
3416
3417void
3418VisibleIdentifier_free(asn_TYPE_descriptor_t *td,
3419 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003420 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003421 td->free_struct(td, struct_ptr, contents_only);
3422}
3423
3424int
3425VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3426 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003427 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003428 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3429}
3430
3431asn_dec_rval_t
3432VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003433 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003434 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003435 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3436}
3437
3438asn_enc_rval_t
3439VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td,
3440 void *structure, int tag_mode, ber_tlv_tag_t tag,
3441 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003442 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003443 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3444}
3445
3446asn_dec_rval_t
3447VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003448 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003449 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003450 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3451}
3452
3453asn_enc_rval_t
3454VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3455 int ilevel, enum xer_encoder_flags_e flags,
3456 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003457 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003458 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3459}
3460
3461
3462/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
3463
Lev Walkin59b176e2005-11-26 11:25:14 +00003464static ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003465 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3466};
3467asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = {
3468 "VisibleIdentifier",
3469 "VisibleIdentifier",
3470 VisibleIdentifier_free,
3471 VisibleIdentifier_print,
3472 VisibleIdentifier_constraint,
3473 VisibleIdentifier_decode_ber,
3474 VisibleIdentifier_encode_der,
3475 VisibleIdentifier_decode_xer,
3476 VisibleIdentifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003477 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003478 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003479 asn_DEF_VisibleIdentifier_tags_1,
3480 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3481 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3482 asn_DEF_VisibleIdentifier_tags_1, /* Same as above */
3483 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3484 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3485 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003486 0, 0, /* No members */
3487 0 /* No specifics */
3488};
Lev Walkin154aa182004-09-26 13:12:56 +00003489
3490
Lev Walkin59b176e2005-11-26 11:25:14 +00003491/*** <<< INCLUDES [Sequence] >>> ***/
3492
Lev Walkin22b5ed42006-09-13 02:51:20 +00003493#include "Int1.h"
3494#include "Int4.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003495#include <BOOLEAN.h>
3496#include <ENUMERATED.h>
3497#include <NULL.h>
Lev Walkin22b5ed42006-09-13 02:51:20 +00003498#include "Int5.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003499#include <constr_SEQUENCE.h>
3500
3501/*** <<< DEPS [Sequence] >>> ***/
3502
3503typedef enum enum_c {
3504 enum_c_one = 1,
3505 enum_c_two = 2,
3506 /*
3507 * Enumeration is extensible
3508 */
3509 enum_c_three = 3
Lev Walkin171487e2006-03-21 07:25:18 +00003510} e_enum_c;
Lev Walkin59b176e2005-11-26 11:25:14 +00003511
3512/*** <<< TYPE-DECLS [Sequence] >>> ***/
3513
3514typedef struct Sequence {
3515 Int1_t *int1_c /* DEFAULT 3 */;
3516 Int4_t int4;
3517 Int4_t int4_c;
3518 BOOLEAN_t *bool /* DEFAULT 1 */;
3519 ENUMERATED_t enum_c;
3520 NULL_t *null /* OPTIONAL */;
3521 /*
3522 * This type is extensible,
3523 * possible extensions are below.
3524 */
3525 Int5_t *int5_c /* OPTIONAL */;
3526
3527 /* Context for parsing across buffer boundaries */
3528 asn_struct_ctx_t _asn_ctx;
3529} Sequence_t;
3530
3531/*** <<< FUNC-DECLS [Sequence] >>> ***/
3532
3533/* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */
3534extern asn_TYPE_descriptor_t asn_DEF_Sequence;
3535
3536/*** <<< CODE [Sequence] >>> ***/
3537
3538static int
3539enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003540 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003541 /* Replace with underlying type checker */
3542 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003543 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00003544}
3545
3546/*
3547 * This type is implemented using ENUMERATED,
3548 * so here we adjust the DEF accordingly.
3549 */
3550static void
3551enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
3552 td->free_struct = asn_DEF_ENUMERATED.free_struct;
3553 td->print_struct = asn_DEF_ENUMERATED.print_struct;
3554 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
3555 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
3556 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
3557 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
3558 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003559 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003560 if(!td->per_constraints)
3561 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
3562 td->elements = asn_DEF_ENUMERATED.elements;
3563 td->elements_count = asn_DEF_ENUMERATED.elements_count;
3564 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
3565}
3566
3567static void
3568enum_c_6_free(asn_TYPE_descriptor_t *td,
3569 void *struct_ptr, int contents_only) {
3570 enum_c_6_inherit_TYPE_descriptor(td);
3571 td->free_struct(td, struct_ptr, contents_only);
3572}
3573
3574static int
3575enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3576 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
3577 enum_c_6_inherit_TYPE_descriptor(td);
3578 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3579}
3580
3581static asn_dec_rval_t
3582enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3583 void **structure, const void *bufptr, size_t size, int tag_mode) {
3584 enum_c_6_inherit_TYPE_descriptor(td);
3585 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3586}
3587
3588static asn_enc_rval_t
3589enum_c_6_encode_der(asn_TYPE_descriptor_t *td,
3590 void *structure, int tag_mode, ber_tlv_tag_t tag,
3591 asn_app_consume_bytes_f *cb, void *app_key) {
3592 enum_c_6_inherit_TYPE_descriptor(td);
3593 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3594}
3595
3596static asn_dec_rval_t
3597enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3598 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
3599 enum_c_6_inherit_TYPE_descriptor(td);
3600 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3601}
3602
3603static asn_enc_rval_t
3604enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3605 int ilevel, enum xer_encoder_flags_e flags,
3606 asn_app_consume_bytes_f *cb, void *app_key) {
3607 enum_c_6_inherit_TYPE_descriptor(td);
3608 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3609}
3610
3611static int
3612memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003613 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003614 const Int1_t *st = (const Int1_t *)sptr;
3615 long value;
3616
3617 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003618 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003619 "%s: value not given (%s:%d)",
3620 td->name, __FILE__, __LINE__);
3621 return -1;
3622 }
3623
3624 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003625 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003626 "%s: value too large (%s:%d)",
3627 td->name, __FILE__, __LINE__);
3628 return -1;
3629 }
3630
3631 if((value >= -2)) {
3632 /* Constraint check succeeded */
3633 return 0;
3634 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003635 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003636 "%s: constraint failed (%s:%d)",
3637 td->name, __FILE__, __LINE__);
3638 return -1;
3639 }
3640}
3641
3642static int
3643memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003644 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003645 const Int4_t *st = (const Int4_t *)sptr;
3646 long value;
3647
3648 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003649 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003650 "%s: value not given (%s:%d)",
3651 td->name, __FILE__, __LINE__);
3652 return -1;
3653 }
3654
3655 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003656 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003657 "%s: value too large (%s:%d)",
3658 td->name, __FILE__, __LINE__);
3659 return -1;
3660 }
3661
3662 if((value >= 5 && value <= 7)) {
3663 /* Constraint check succeeded */
3664 return 0;
3665 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003666 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003667 "%s: constraint failed (%s:%d)",
3668 td->name, __FILE__, __LINE__);
3669 return -1;
3670 }
3671}
3672
3673static int
3674memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003675 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003676 const Int5_t *st = (const Int5_t *)sptr;
3677 long value;
3678
3679 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003680 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003681 "%s: value not given (%s:%d)",
3682 td->name, __FILE__, __LINE__);
3683 return -1;
3684 }
3685
3686 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003687 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003688 "%s: value too large (%s:%d)",
3689 td->name, __FILE__, __LINE__);
3690 return -1;
3691 }
3692
3693 if((value == 5)) {
3694 /* Constraint check succeeded */
3695 return 0;
3696 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003697 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003698 "%s: constraint failed (%s:%d)",
3699 td->name, __FILE__, __LINE__);
3700 return -1;
3701 }
3702}
3703
3704
3705/*** <<< STAT-DEFS [Sequence] >>> ***/
3706
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003707static int asn_DFL_2_set_3(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003708 Int1_t *st = *sptr;
3709
3710 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003711 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003712 st = (*sptr = CALLOC(1, sizeof(*st)));
3713 if(!st) return -1;
3714 }
3715
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003716 if(set_value) {
3717 /* Install default value 3 */
3718 return asn_long2INTEGER(st, 3);
3719 } else {
3720 /* Test default value 3 */
3721 long value;
3722 if(asn_INTEGER2long(st, &value))
3723 return -1;
3724 return (value == 3);
3725 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003726}
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003727static int asn_DFL_5_set_1(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003728 BOOLEAN_t *st = *sptr;
3729
3730 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003731 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003732 st = (*sptr = CALLOC(1, sizeof(*st)));
3733 if(!st) return -1;
3734 }
3735
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003736 if(set_value) {
3737 /* Install default value 1 */
3738 *st = 1;
3739 return 0;
3740 } else {
3741 /* Test default value 1 */
3742 return (*st == 1);
3743 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003744}
3745static asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = {
3746 { 1, 3, "one" },
3747 { 2, 3, "two" },
3748 { 3, 5, "three" }
3749 /* This list is extensible */
3750};
3751static unsigned int asn_MAP_enum_c_enum2value_6[] = {
3752 0, /* one(1) */
3753 2, /* three(3) */
3754 1 /* two(2) */
3755 /* This list is extensible */
3756};
3757static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = {
3758 asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */
3759 asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */
3760 3, /* Number of elements in the maps */
3761 3, /* Extensions before this member */
3762 1 /* Strict enumeration */
3763};
3764static ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = {
3765 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
3766};
3767static /* Use -fall-defs-global to expose */
3768asn_TYPE_descriptor_t asn_DEF_enum_c_6 = {
3769 "enum-c",
3770 "enum-c",
3771 enum_c_6_free,
3772 enum_c_6_print,
3773 enum_c_6_constraint,
3774 enum_c_6_decode_ber,
3775 enum_c_6_encode_der,
3776 enum_c_6_decode_xer,
3777 enum_c_6_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003778 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003779 0, /* Use generic outmost tag fetcher */
3780 asn_DEF_enum_c_tags_6,
3781 sizeof(asn_DEF_enum_c_tags_6)
3782 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3783 asn_DEF_enum_c_tags_6, /* Same as above */
3784 sizeof(asn_DEF_enum_c_tags_6)
3785 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3786 0, /* No PER visible constraints */
3787 0, 0, /* Defined elsewhere */
3788 &asn_SPC_enum_c_specs_6 /* Additional specs */
3789};
3790
3791static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
3792 { ATF_POINTER, 1, offsetof(struct Sequence, int1_c),
3793 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3794 .tag_mode = 0,
3795 .type = &asn_DEF_Int1,
3796 .memb_constraints = memb_int1_c_constraint_1,
3797 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3798 .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */
3799 .name = "int1-c"
3800 },
3801 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4),
3802 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
3803 .tag_mode = +1, /* EXPLICIT tag at current level */
3804 .type = &asn_DEF_Int4,
3805 .memb_constraints = 0, /* Defer constraints checking to the member type */
3806 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3807 .default_value = 0,
3808 .name = "int4"
3809 },
3810 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c),
3811 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3812 .tag_mode = 0,
3813 .type = &asn_DEF_Int4,
3814 .memb_constraints = memb_int4_c_constraint_1,
3815 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3816 .default_value = 0,
3817 .name = "int4-c"
3818 },
3819 { ATF_POINTER, 1, offsetof(struct Sequence, bool),
3820 .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
3821 .tag_mode = 0,
3822 .type = &asn_DEF_BOOLEAN,
3823 .memb_constraints = 0, /* Defer constraints checking to the member type */
3824 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3825 .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */
3826 .name = "bool"
3827 },
3828 { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c),
3829 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
3830 .tag_mode = 0,
3831 .type = &asn_DEF_enum_c_6,
3832 .memb_constraints = 0, /* Defer constraints checking to the member type */
3833 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3834 .default_value = 0,
3835 .name = "enum-c"
3836 },
3837 { ATF_POINTER, 2, offsetof(struct Sequence, null),
3838 .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)),
3839 .tag_mode = 0,
3840 .type = &asn_DEF_NULL,
3841 .memb_constraints = 0, /* Defer constraints checking to the member type */
3842 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3843 .default_value = 0,
3844 .name = "null"
3845 },
3846 { ATF_POINTER, 1, offsetof(struct Sequence, int5_c),
3847 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3848 .tag_mode = 0,
3849 .type = &asn_DEF_Int5,
3850 .memb_constraints = memb_int5_c_constraint_1,
3851 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3852 .default_value = 0,
3853 .name = "int5-c"
3854 },
3855};
3856static ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = {
3857 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
3858};
3859static asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = {
3860 { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool at 59 */
3861 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c at 56 */
3862 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c at 58 */
3863 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c at 62 */
3864 { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null at 64 */
3865 { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c at 60 */
3866 { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 at 57 */
3867};
3868static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
3869 sizeof(struct Sequence),
3870 offsetof(struct Sequence, _asn_ctx),
3871 asn_MAP_Sequence_tag2el_1,
3872 7, /* Count of tags in the map */
3873 0, 0, 0, /* Optional elements (not needed) */
3874 5, /* Start extensions */
3875 8 /* Stop extensions */
3876};
3877asn_TYPE_descriptor_t asn_DEF_Sequence = {
3878 "Sequence",
3879 "Sequence",
3880 SEQUENCE_free,
3881 SEQUENCE_print,
3882 SEQUENCE_constraint,
3883 SEQUENCE_decode_ber,
3884 SEQUENCE_encode_der,
3885 SEQUENCE_decode_xer,
3886 SEQUENCE_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003887 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003888 0, /* Use generic outmost tag fetcher */
3889 asn_DEF_Sequence_tags_1,
3890 sizeof(asn_DEF_Sequence_tags_1)
3891 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3892 asn_DEF_Sequence_tags_1, /* Same as above */
3893 sizeof(asn_DEF_Sequence_tags_1)
3894 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3895 0, /* No PER visible constraints */
3896 asn_MBR_Sequence_1,
3897 7, /* Elements count */
3898 &asn_SPC_Sequence_specs_1 /* Additional specs */
3899};
3900
3901
3902/*** <<< INCLUDES [SequenceOf] >>> ***/
3903
3904#include <asn_SEQUENCE_OF.h>
3905#include <constr_SEQUENCE_OF.h>
3906
3907/*** <<< FWD-DECLS [SequenceOf] >>> ***/
3908
3909struct Sequence;
3910
3911/*** <<< TYPE-DECLS [SequenceOf] >>> ***/
3912
3913typedef struct SequenceOf {
3914 A_SEQUENCE_OF(struct Sequence) list;
3915
3916 /* Context for parsing across buffer boundaries */
3917 asn_struct_ctx_t _asn_ctx;
3918} SequenceOf_t;
3919
3920/*** <<< FUNC-DECLS [SequenceOf] >>> ***/
3921
3922extern asn_TYPE_descriptor_t asn_DEF_SequenceOf;
3923
3924/*** <<< POST-INCLUDE [SequenceOf] >>> ***/
3925
Lev Walkin22b5ed42006-09-13 02:51:20 +00003926#include "Sequence.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003927
3928/*** <<< STAT-DEFS [SequenceOf] >>> ***/
3929
3930static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = {
3931 { ATF_POINTER, 0, 0,
3932 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
3933 .tag_mode = 0,
3934 .type = &asn_DEF_Sequence,
3935 .memb_constraints = 0, /* Defer constraints checking to the member type */
3936 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3937 .default_value = 0,
3938 .name = ""
3939 },
3940};
3941static ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = {
3942 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
3943};
3944static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = {
3945 sizeof(struct SequenceOf),
3946 offsetof(struct SequenceOf, _asn_ctx),
3947 0, /* XER encoding is XMLDelimitedItemList */
3948};
3949asn_TYPE_descriptor_t asn_DEF_SequenceOf = {
3950 "SequenceOf",
3951 "SequenceOf",
3952 SEQUENCE_OF_free,
3953 SEQUENCE_OF_print,
3954 SEQUENCE_OF_constraint,
3955 SEQUENCE_OF_decode_ber,
3956 SEQUENCE_OF_encode_der,
3957 SEQUENCE_OF_decode_xer,
3958 SEQUENCE_OF_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003959 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003960 0, /* Use generic outmost tag fetcher */
3961 asn_DEF_SequenceOf_tags_1,
3962 sizeof(asn_DEF_SequenceOf_tags_1)
3963 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
3964 asn_DEF_SequenceOf_tags_1, /* Same as above */
3965 sizeof(asn_DEF_SequenceOf_tags_1)
3966 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
3967 0, /* No PER visible constraints */
3968 asn_MBR_SequenceOf_1,
3969 1, /* Single element */
3970 &asn_SPC_SequenceOf_specs_1 /* Additional specs */
3971};
3972
3973
3974/*** <<< INCLUDES [Enum0] >>> ***/
3975
3976#include <ENUMERATED.h>
3977
3978/*** <<< DEPS [Enum0] >>> ***/
3979
3980typedef enum Enum0 {
3981 Enum0_one = 0,
3982 Enum0_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00003983} e_Enum0;
Lev Walkin59b176e2005-11-26 11:25:14 +00003984
3985/*** <<< TYPE-DECLS [Enum0] >>> ***/
3986
3987typedef ENUMERATED_t Enum0_t;
3988
3989/*** <<< FUNC-DECLS [Enum0] >>> ***/
3990
3991extern asn_TYPE_descriptor_t asn_DEF_Enum0;
3992asn_struct_free_f Enum0_free;
3993asn_struct_print_f Enum0_print;
3994asn_constr_check_f Enum0_constraint;
3995ber_type_decoder_f Enum0_decode_ber;
3996der_type_encoder_f Enum0_encode_der;
3997xer_type_decoder_f Enum0_decode_xer;
3998xer_type_encoder_f Enum0_encode_xer;
3999
4000/*** <<< CODE [Enum0] >>> ***/
4001
4002int
4003Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004004 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004005 /* Replace with underlying type checker */
4006 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00004007 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00004008}
4009
4010/*
4011 * This type is implemented using ENUMERATED,
4012 * so here we adjust the DEF accordingly.
4013 */
4014static void
4015Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4016 td->free_struct = asn_DEF_ENUMERATED.free_struct;
4017 td->print_struct = asn_DEF_ENUMERATED.print_struct;
4018 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
4019 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
4020 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
4021 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
4022 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004023 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004024 if(!td->per_constraints)
4025 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
4026 td->elements = asn_DEF_ENUMERATED.elements;
4027 td->elements_count = asn_DEF_ENUMERATED.elements_count;
4028 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
4029}
4030
4031void
4032Enum0_free(asn_TYPE_descriptor_t *td,
4033 void *struct_ptr, int contents_only) {
4034 Enum0_1_inherit_TYPE_descriptor(td);
4035 td->free_struct(td, struct_ptr, contents_only);
4036}
4037
4038int
4039Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4040 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4041 Enum0_1_inherit_TYPE_descriptor(td);
4042 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4043}
4044
4045asn_dec_rval_t
4046Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4047 void **structure, const void *bufptr, size_t size, int tag_mode) {
4048 Enum0_1_inherit_TYPE_descriptor(td);
4049 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4050}
4051
4052asn_enc_rval_t
4053Enum0_encode_der(asn_TYPE_descriptor_t *td,
4054 void *structure, int tag_mode, ber_tlv_tag_t tag,
4055 asn_app_consume_bytes_f *cb, void *app_key) {
4056 Enum0_1_inherit_TYPE_descriptor(td);
4057 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4058}
4059
4060asn_dec_rval_t
4061Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4062 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4063 Enum0_1_inherit_TYPE_descriptor(td);
4064 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4065}
4066
4067asn_enc_rval_t
4068Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4069 int ilevel, enum xer_encoder_flags_e flags,
4070 asn_app_consume_bytes_f *cb, void *app_key) {
4071 Enum0_1_inherit_TYPE_descriptor(td);
4072 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4073}
4074
4075
4076/*** <<< STAT-DEFS [Enum0] >>> ***/
4077
4078static asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = {
4079 { 0, 3, "one" },
4080 { 1, 3, "two" }
4081};
4082static unsigned int asn_MAP_Enum0_enum2value_1[] = {
4083 0, /* one(0) */
4084 1 /* two(1) */
4085};
4086static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = {
4087 asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */
4088 asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */
4089 2, /* Number of elements in the maps */
4090 0, /* Enumeration is not extensible */
4091 1 /* Strict enumeration */
4092};
4093static ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = {
4094 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4095};
4096asn_TYPE_descriptor_t asn_DEF_Enum0 = {
4097 "Enum0",
4098 "Enum0",
4099 Enum0_free,
4100 Enum0_print,
4101 Enum0_constraint,
4102 Enum0_decode_ber,
4103 Enum0_encode_der,
4104 Enum0_decode_xer,
4105 Enum0_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004106 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004107 0, /* Use generic outmost tag fetcher */
4108 asn_DEF_Enum0_tags_1,
4109 sizeof(asn_DEF_Enum0_tags_1)
4110 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4111 asn_DEF_Enum0_tags_1, /* Same as above */
4112 sizeof(asn_DEF_Enum0_tags_1)
4113 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4114 0, /* No PER visible constraints */
4115 0, 0, /* Defined elsewhere */
4116 &asn_SPC_Enum0_specs_1 /* Additional specs */
4117};
4118
4119
4120/*** <<< INCLUDES [Enum1] >>> ***/
4121
4122#include <NativeEnumerated.h>
4123
4124/*** <<< DEPS [Enum1] >>> ***/
4125
4126typedef enum Enum1 {
4127 Enum1_one = 0,
4128 Enum1_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00004129} e_Enum1;
Lev Walkin59b176e2005-11-26 11:25:14 +00004130
4131/*** <<< TYPE-DECLS [Enum1] >>> ***/
4132
4133typedef long Enum1_t;
4134
4135/*** <<< FUNC-DECLS [Enum1] >>> ***/
4136
4137extern asn_TYPE_descriptor_t asn_DEF_Enum1;
4138asn_struct_free_f Enum1_free;
4139asn_struct_print_f Enum1_print;
4140asn_constr_check_f Enum1_constraint;
4141ber_type_decoder_f Enum1_decode_ber;
4142der_type_encoder_f Enum1_encode_der;
4143xer_type_decoder_f Enum1_decode_xer;
4144xer_type_encoder_f Enum1_encode_xer;
4145
4146/*** <<< CODE [Enum1] >>> ***/
4147
4148int
4149Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004150 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004151 long value;
4152
4153 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004154 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004155 "%s: value not given (%s:%d)",
4156 td->name, __FILE__, __LINE__);
4157 return -1;
4158 }
4159
4160 value = *(const long *)sptr;
4161
4162 if((value == 0)) {
4163 /* Constraint check succeeded */
4164 return 0;
4165 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004166 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004167 "%s: constraint failed (%s:%d)",
4168 td->name, __FILE__, __LINE__);
4169 return -1;
4170 }
4171}
4172
4173/*
4174 * This type is implemented using NativeEnumerated,
4175 * so here we adjust the DEF accordingly.
4176 */
4177static void
4178Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4179 td->free_struct = asn_DEF_NativeEnumerated.free_struct;
4180 td->print_struct = asn_DEF_NativeEnumerated.print_struct;
4181 td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder;
4182 td->der_encoder = asn_DEF_NativeEnumerated.der_encoder;
4183 td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder;
4184 td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder;
4185 td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004186 td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004187 if(!td->per_constraints)
4188 td->per_constraints = asn_DEF_NativeEnumerated.per_constraints;
4189 td->elements = asn_DEF_NativeEnumerated.elements;
4190 td->elements_count = asn_DEF_NativeEnumerated.elements_count;
4191 /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */
4192}
4193
4194void
4195Enum1_free(asn_TYPE_descriptor_t *td,
4196 void *struct_ptr, int contents_only) {
4197 Enum1_1_inherit_TYPE_descriptor(td);
4198 td->free_struct(td, struct_ptr, contents_only);
4199}
4200
4201int
4202Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4203 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4204 Enum1_1_inherit_TYPE_descriptor(td);
4205 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4206}
4207
4208asn_dec_rval_t
4209Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4210 void **structure, const void *bufptr, size_t size, int tag_mode) {
4211 Enum1_1_inherit_TYPE_descriptor(td);
4212 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4213}
4214
4215asn_enc_rval_t
4216Enum1_encode_der(asn_TYPE_descriptor_t *td,
4217 void *structure, int tag_mode, ber_tlv_tag_t tag,
4218 asn_app_consume_bytes_f *cb, void *app_key) {
4219 Enum1_1_inherit_TYPE_descriptor(td);
4220 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4221}
4222
4223asn_dec_rval_t
4224Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4225 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4226 Enum1_1_inherit_TYPE_descriptor(td);
4227 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4228}
4229
4230asn_enc_rval_t
4231Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4232 int ilevel, enum xer_encoder_flags_e flags,
4233 asn_app_consume_bytes_f *cb, void *app_key) {
4234 Enum1_1_inherit_TYPE_descriptor(td);
4235 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4236}
4237
4238
4239/*** <<< STAT-DEFS [Enum1] >>> ***/
4240
4241static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = {
4242 { 0, 3, "one" },
4243 { 1, 3, "two" }
4244};
4245static unsigned int asn_MAP_Enum1_enum2value_1[] = {
4246 0, /* one(0) */
4247 1 /* two(1) */
4248};
4249static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = {
4250 asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */
4251 asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */
4252 2, /* Number of elements in the maps */
4253 0, /* Enumeration is not extensible */
4254 1 /* Strict enumeration */
4255};
4256static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = {
4257 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4258};
4259asn_TYPE_descriptor_t asn_DEF_Enum1 = {
4260 "Enum1",
4261 "Enum1",
4262 Enum1_free,
4263 Enum1_print,
4264 Enum1_constraint,
4265 Enum1_decode_ber,
4266 Enum1_encode_der,
4267 Enum1_decode_xer,
4268 Enum1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004269 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004270 0, /* Use generic outmost tag fetcher */
4271 asn_DEF_Enum1_tags_1,
4272 sizeof(asn_DEF_Enum1_tags_1)
4273 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4274 asn_DEF_Enum1_tags_1, /* Same as above */
4275 sizeof(asn_DEF_Enum1_tags_1)
4276 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4277 0, /* No PER visible constraints */
4278 0, 0, /* Defined elsewhere */
4279 &asn_SPC_Enum1_specs_1 /* Additional specs */
4280};
4281
4282
Lev Walkin154aa182004-09-26 13:12:56 +00004283/*** <<< INCLUDES [Identifier] >>> ***/
4284
4285#include <VisibleString.h>
4286
4287/*** <<< TYPE-DECLS [Identifier] >>> ***/
4288
Lev Walkin154aa182004-09-26 13:12:56 +00004289typedef VisibleString_t Identifier_t;
4290
4291/*** <<< FUNC-DECLS [Identifier] >>> ***/
4292
Lev Walkindfae9752004-09-29 13:19:37 +00004293extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00004294asn_struct_free_f Identifier_free;
4295asn_struct_print_f Identifier_print;
4296asn_constr_check_f Identifier_constraint;
4297ber_type_decoder_f Identifier_decode_ber;
4298der_type_encoder_f Identifier_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004299xer_type_decoder_f Identifier_decode_xer;
Lev Walkin154aa182004-09-26 13:12:56 +00004300xer_type_encoder_f Identifier_encode_xer;
4301
4302/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004303
Lev Walkine8318b82005-03-06 09:29:03 +00004304static int permitted_alphabet_table_1[256] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +000043050,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
43060,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
43070,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
43081,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
43090,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
43101,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
43110,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
43121,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
4313};
4314
Lev Walkine8318b82005-03-06 09:29:03 +00004315static int check_permitted_alphabet_1(const void *sptr) {
4316 int *table = permitted_alphabet_table_1;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004317 /* The underlying type is VisibleString */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004318 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004319 const uint8_t *ch = st->buf;
4320 const uint8_t *end = ch + st->size;
4321
4322 for(; ch < end; ch++) {
4323 uint8_t cv = *ch;
4324 if(!table[cv]) return -1;
4325 }
4326 return 0;
4327}
4328
4329
Lev Walkin154aa182004-09-26 13:12:56 +00004330/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004331
4332int
Lev Walkindfae9752004-09-29 13:19:37 +00004333Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004334 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004335 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004336 size_t size;
4337
4338 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004339 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004340 "%s: value not given (%s:%d)",
4341 td->name, __FILE__, __LINE__);
4342 return -1;
4343 }
4344
4345 size = st->size;
4346
4347 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00004348 && !check_permitted_alphabet_1(st)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004349 /* Constraint check succeeded */
4350 return 0;
4351 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004352 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004353 "%s: constraint failed (%s:%d)",
4354 td->name, __FILE__, __LINE__);
4355 return -1;
4356 }
4357}
4358
4359/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004360 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00004361 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004362 */
4363static void
Lev Walkine8318b82005-03-06 09:29:03 +00004364Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00004365 td->free_struct = asn_DEF_VisibleString.free_struct;
4366 td->print_struct = asn_DEF_VisibleString.print_struct;
4367 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
4368 td->der_encoder = asn_DEF_VisibleString.der_encoder;
4369 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
4370 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004371 td->uper_decoder = asn_DEF_VisibleString.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004372 td->uper_encoder = asn_DEF_VisibleString.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004373 if(!td->per_constraints)
4374 td->per_constraints = asn_DEF_VisibleString.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00004375 td->elements = asn_DEF_VisibleString.elements;
4376 td->elements_count = asn_DEF_VisibleString.elements_count;
4377 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004378}
4379
Lev Walkina9cc46e2004-09-22 16:06:28 +00004380void
Lev Walkindfae9752004-09-29 13:19:37 +00004381Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004382 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00004383 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004384 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004385}
4386
4387int
Lev Walkindfae9752004-09-29 13:19:37 +00004388Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004389 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004390 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004391 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4392}
4393
Lev Walkindc06f6b2004-10-20 15:50:55 +00004394asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004395Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004396 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00004397 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00004398 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004399}
4400
4401asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004402Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004403 void *structure, int tag_mode, ber_tlv_tag_t tag,
4404 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004405 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004406 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4407}
4408
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004409asn_dec_rval_t
4410Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004411 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00004412 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004413 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4414}
4415
Lev Walkina9cc46e2004-09-22 16:06:28 +00004416asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004417Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004418 int ilevel, enum xer_encoder_flags_e flags,
4419 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004420 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004421 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004422}
4423
4424
4425/*** <<< STAT-DEFS [Identifier] >>> ***/
4426
Lev Walkin59b176e2005-11-26 11:25:14 +00004427static ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004428 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
4429};
Lev Walkindfae9752004-09-29 13:19:37 +00004430asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004431 "Identifier",
Lev Walkindc06f6b2004-10-20 15:50:55 +00004432 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00004433 Identifier_free,
4434 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004435 Identifier_constraint,
4436 Identifier_decode_ber,
4437 Identifier_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004438 Identifier_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004439 Identifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004440 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004441 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00004442 asn_DEF_Identifier_tags_1,
4443 sizeof(asn_DEF_Identifier_tags_1)
4444 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4445 asn_DEF_Identifier_tags_1, /* Same as above */
4446 sizeof(asn_DEF_Identifier_tags_1)
4447 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4448 0, /* No PER visible constraints */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004449 0, 0, /* No members */
4450 0 /* No specifics */
4451};
4452