blob: 47d84e6e190264cdf0883e6573514e2d35465b79 [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 Walkin154aa182004-09-26 13:12:56 +000012/* This type is equivalent to INTEGER */
Lev Walkindfae9752004-09-29 13:19:37 +000013#define asn_DEF_Int1 asn_DEF_INTEGER
Lev Walkin006de1c2004-08-20 13:37:45 +000014
15/*** <<< CODE [Int1] >>> ***/
16
Lev Walkin154aa182004-09-26 13:12:56 +000017/* This type is equivalent to INTEGER */
Lev Walkin006de1c2004-08-20 13:37:45 +000018
19
20/*** <<< INCLUDES [Int2] >>> ***/
21
22#include <Int1.h>
23
24/*** <<< TYPE-DECLS [Int2] >>> ***/
25
Lev Walkin006de1c2004-08-20 13:37:45 +000026typedef Int1_t Int2_t;
27
Lev Walkin006de1c2004-08-20 13:37:45 +000028/*** <<< FUNC-DECLS [Int2] >>> ***/
29
Lev Walkindfae9752004-09-29 13:19:37 +000030extern asn_TYPE_descriptor_t asn_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +000031asn_struct_free_f Int2_free;
32asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +000033asn_constr_check_f Int2_constraint;
34ber_type_decoder_f Int2_decode_ber;
35der_type_encoder_f Int2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +000036xer_type_decoder_f Int2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +000037xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +000038
39/*** <<< CODE [Int2] >>> ***/
40
41int
Lev Walkindfae9752004-09-29 13:19:37 +000042Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +000043 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +000044 const Int1_t *st = (const Int1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +000045 long value;
46
47 if(!sptr) {
48 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +000049 "%s: value not given (%s:%d)",
50 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +000051 return -1;
52 }
53
Lev Walkin44467432004-09-07 06:43:57 +000054 /* Check if the sign bit is present */
55 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +000056
57 if((value >= 0)) {
58 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +000059 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +000060 } else {
61 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +000062 "%s: constraint failed (%s:%d)",
63 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +000064 return -1;
65 }
66}
67
68/*
69 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +000070 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +000071 */
72static void
Lev Walkine0272aa2005-03-04 11:26:08 +000073Int2_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +000074 td->free_struct = asn_DEF_Int1.free_struct;
75 td->print_struct = asn_DEF_Int1.print_struct;
76 td->ber_decoder = asn_DEF_Int1.ber_decoder;
77 td->der_encoder = asn_DEF_Int1.der_encoder;
78 td->xer_decoder = asn_DEF_Int1.xer_decoder;
79 td->xer_encoder = asn_DEF_Int1.xer_encoder;
80 td->elements = asn_DEF_Int1.elements;
81 td->elements_count = asn_DEF_Int1.elements_count;
82 td->specifics = asn_DEF_Int1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +000083}
84
Lev Walkina9cc46e2004-09-22 16:06:28 +000085void
Lev Walkindfae9752004-09-29 13:19:37 +000086Int2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +000087 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +000088 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +000089 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +000090}
91
92int
Lev Walkindfae9752004-09-29 13:19:37 +000093Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +000094 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +000095 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +000096 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
97}
98
Lev Walkindc06f6b2004-10-20 15:50:55 +000099asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000100Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000101 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000102 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000103 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000104}
105
106asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000107Int2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000108 void *structure, int tag_mode, ber_tlv_tag_t tag,
109 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000110 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000111 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
112}
113
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000114asn_dec_rval_t
115Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
116 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000117 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000118 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
119}
120
Lev Walkina9cc46e2004-09-22 16:06:28 +0000121asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000122Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000123 int ilevel, enum xer_encoder_flags_e flags,
124 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000125 Int2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000126 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000127}
128
129
130/*** <<< STAT-DEFS [Int2] >>> ***/
131
Lev Walkine0272aa2005-03-04 11:26:08 +0000132static ber_tlv_tag_t asn_DEF_Int2_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000133 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000134};
Lev Walkindfae9752004-09-29 13:19:37 +0000135asn_TYPE_descriptor_t asn_DEF_Int2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000136 "Int2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000137 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000138 Int2_free,
139 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000140 Int2_constraint,
141 Int2_decode_ber,
142 Int2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000143 Int2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000144 Int2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000145 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000146 asn_DEF_Int2_0_tags,
147 sizeof(asn_DEF_Int2_0_tags)
148 /sizeof(asn_DEF_Int2_0_tags[0]), /* 1 */
149 asn_DEF_Int2_0_tags, /* Same as above */
150 sizeof(asn_DEF_Int2_0_tags)
151 /sizeof(asn_DEF_Int2_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000152 0, 0, /* No members */
153 0 /* No specifics */
154};
155
156
157/*** <<< INCLUDES [Int3] >>> ***/
158
159#include <Int2.h>
160
161/*** <<< TYPE-DECLS [Int3] >>> ***/
162
Lev Walkin006de1c2004-08-20 13:37:45 +0000163typedef Int2_t Int3_t;
164
Lev Walkin006de1c2004-08-20 13:37:45 +0000165/*** <<< FUNC-DECLS [Int3] >>> ***/
166
Lev Walkindfae9752004-09-29 13:19:37 +0000167extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000168asn_struct_free_f Int3_free;
169asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000170asn_constr_check_f Int3_constraint;
171ber_type_decoder_f Int3_decode_ber;
172der_type_encoder_f Int3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000173xer_type_decoder_f Int3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000174xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000175
176/*** <<< CODE [Int3] >>> ***/
177
178int
Lev Walkindfae9752004-09-29 13:19:37 +0000179Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000180 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000181 const Int2_t *st = (const Int2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000182 long value;
183
184 if(!sptr) {
185 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000186 "%s: value not given (%s:%d)",
187 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000188 return -1;
189 }
190
Lev Walkindfae9752004-09-29 13:19:37 +0000191 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000192 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000193 "%s: value too large (%s:%d)",
194 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000195 return -1;
196 }
197
198 if((value >= 0 && value <= 10)) {
199 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000200 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000201 } else {
202 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000203 "%s: constraint failed (%s:%d)",
204 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000205 return -1;
206 }
207}
208
209/*
210 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000211 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000212 */
213static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000214Int3_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000215 td->free_struct = asn_DEF_Int2.free_struct;
216 td->print_struct = asn_DEF_Int2.print_struct;
217 td->ber_decoder = asn_DEF_Int2.ber_decoder;
218 td->der_encoder = asn_DEF_Int2.der_encoder;
219 td->xer_decoder = asn_DEF_Int2.xer_decoder;
220 td->xer_encoder = asn_DEF_Int2.xer_encoder;
221 td->elements = asn_DEF_Int2.elements;
222 td->elements_count = asn_DEF_Int2.elements_count;
223 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000224}
225
Lev Walkina9cc46e2004-09-22 16:06:28 +0000226void
Lev Walkindfae9752004-09-29 13:19:37 +0000227Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000228 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000229 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000230 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000231}
232
233int
Lev Walkindfae9752004-09-29 13:19:37 +0000234Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000235 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000236 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000237 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
238}
239
Lev Walkindc06f6b2004-10-20 15:50:55 +0000240asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000241Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000242 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000243 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000244 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000245}
246
247asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000248Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000249 void *structure, int tag_mode, ber_tlv_tag_t tag,
250 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000251 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000252 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
253}
254
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000255asn_dec_rval_t
256Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
257 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000258 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000259 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
260}
261
Lev Walkina9cc46e2004-09-22 16:06:28 +0000262asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000263Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000264 int ilevel, enum xer_encoder_flags_e flags,
265 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000266 Int3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000267 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000268}
269
270
271/*** <<< STAT-DEFS [Int3] >>> ***/
272
Lev Walkine0272aa2005-03-04 11:26:08 +0000273static ber_tlv_tag_t asn_DEF_Int3_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000274 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000275};
Lev Walkindfae9752004-09-29 13:19:37 +0000276asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000277 "Int3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000278 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000279 Int3_free,
280 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000281 Int3_constraint,
282 Int3_decode_ber,
283 Int3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000284 Int3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000285 Int3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000286 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000287 asn_DEF_Int3_0_tags,
288 sizeof(asn_DEF_Int3_0_tags)
289 /sizeof(asn_DEF_Int3_0_tags[0]), /* 1 */
290 asn_DEF_Int3_0_tags, /* Same as above */
291 sizeof(asn_DEF_Int3_0_tags)
292 /sizeof(asn_DEF_Int3_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000293 0, 0, /* No members */
294 0 /* No specifics */
295};
296
297
298/*** <<< INCLUDES [Int4] >>> ***/
299
300#include <Int3.h>
301
302/*** <<< TYPE-DECLS [Int4] >>> ***/
303
Lev Walkin006de1c2004-08-20 13:37:45 +0000304typedef Int3_t Int4_t;
305
Lev Walkin006de1c2004-08-20 13:37:45 +0000306/*** <<< FUNC-DECLS [Int4] >>> ***/
307
Lev Walkindfae9752004-09-29 13:19:37 +0000308extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000309asn_struct_free_f Int4_free;
310asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000311asn_constr_check_f Int4_constraint;
312ber_type_decoder_f Int4_decode_ber;
313der_type_encoder_f Int4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000314xer_type_decoder_f Int4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000315xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000316
317/*** <<< CODE [Int4] >>> ***/
318
319int
Lev Walkindfae9752004-09-29 13:19:37 +0000320Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000321 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000322 const Int3_t *st = (const Int3_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000323 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000324
325 if(!sptr) {
326 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000327 "%s: value not given (%s:%d)",
328 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000329 return -1;
330 }
331
Lev Walkindfae9752004-09-29 13:19:37 +0000332 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000333 _ASN_ERRLOG(app_errlog, app_key,
334 "%s: value too large (%s:%d)",
335 td->name, __FILE__, __LINE__);
336 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000337 }
338
Lev Walkind35c8b52004-08-25 02:08:08 +0000339 if((value >= 1 && value <= 10)) {
340 /* Constraint check succeeded */
341 return 0;
342 } else {
343 _ASN_ERRLOG(app_errlog, app_key,
344 "%s: constraint failed (%s:%d)",
345 td->name, __FILE__, __LINE__);
346 return -1;
347 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000348}
349
350/*
351 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000352 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000353 */
354static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000355Int4_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000356 td->free_struct = asn_DEF_Int3.free_struct;
357 td->print_struct = asn_DEF_Int3.print_struct;
358 td->ber_decoder = asn_DEF_Int3.ber_decoder;
359 td->der_encoder = asn_DEF_Int3.der_encoder;
360 td->xer_decoder = asn_DEF_Int3.xer_decoder;
361 td->xer_encoder = asn_DEF_Int3.xer_encoder;
362 td->elements = asn_DEF_Int3.elements;
363 td->elements_count = asn_DEF_Int3.elements_count;
364 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000365}
366
Lev Walkina9cc46e2004-09-22 16:06:28 +0000367void
Lev Walkindfae9752004-09-29 13:19:37 +0000368Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000369 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000370 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000371 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000372}
373
374int
Lev Walkindfae9752004-09-29 13:19:37 +0000375Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000376 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000377 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000378 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
379}
380
Lev Walkindc06f6b2004-10-20 15:50:55 +0000381asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000382Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000383 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000384 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000385 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000386}
387
388asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000389Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000390 void *structure, int tag_mode, ber_tlv_tag_t tag,
391 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000392 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000393 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
394}
395
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000396asn_dec_rval_t
397Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
398 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000399 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000400 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
401}
402
Lev Walkina9cc46e2004-09-22 16:06:28 +0000403asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000404Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000405 int ilevel, enum xer_encoder_flags_e flags,
406 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000407 Int4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000408 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000409}
410
411
412/*** <<< STAT-DEFS [Int4] >>> ***/
413
Lev Walkine0272aa2005-03-04 11:26:08 +0000414static ber_tlv_tag_t asn_DEF_Int4_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000415 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000416};
Lev Walkindfae9752004-09-29 13:19:37 +0000417asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000418 "Int4",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000419 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000420 Int4_free,
421 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000422 Int4_constraint,
423 Int4_decode_ber,
424 Int4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000425 Int4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000426 Int4_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000427 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000428 asn_DEF_Int4_0_tags,
429 sizeof(asn_DEF_Int4_0_tags)
430 /sizeof(asn_DEF_Int4_0_tags[0]), /* 1 */
431 asn_DEF_Int4_0_tags, /* Same as above */
432 sizeof(asn_DEF_Int4_0_tags)
433 /sizeof(asn_DEF_Int4_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000434 0, 0, /* No members */
435 0 /* No specifics */
436};
437
438
439/*** <<< INCLUDES [Int5] >>> ***/
440
441#include <Int4.h>
442
443/*** <<< TYPE-DECLS [Int5] >>> ***/
444
Lev Walkin006de1c2004-08-20 13:37:45 +0000445typedef Int4_t Int5_t;
446
Lev Walkin006de1c2004-08-20 13:37:45 +0000447/*** <<< FUNC-DECLS [Int5] >>> ***/
448
Lev Walkindfae9752004-09-29 13:19:37 +0000449extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000450asn_struct_free_f Int5_free;
451asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000452asn_constr_check_f Int5_constraint;
453ber_type_decoder_f Int5_decode_ber;
454der_type_encoder_f Int5_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000455xer_type_decoder_f Int5_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000456xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000457
458/*** <<< CODE [Int5] >>> ***/
459
460int
Lev Walkindfae9752004-09-29 13:19:37 +0000461Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000462 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000463 const Int4_t *st = (const Int4_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000464 long value;
465
466 if(!sptr) {
467 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000468 "%s: value not given (%s:%d)",
469 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000470 return -1;
471 }
472
Lev Walkindfae9752004-09-29 13:19:37 +0000473 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000474 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000475 "%s: value too large (%s:%d)",
476 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000477 return -1;
478 }
479
480 if((value == 5)) {
481 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000482 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000483 } else {
484 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000485 "%s: constraint failed (%s:%d)",
486 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000487 return -1;
488 }
489}
490
491/*
492 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000493 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000494 */
495static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000496Int5_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000497 td->free_struct = asn_DEF_Int4.free_struct;
498 td->print_struct = asn_DEF_Int4.print_struct;
499 td->ber_decoder = asn_DEF_Int4.ber_decoder;
500 td->der_encoder = asn_DEF_Int4.der_encoder;
501 td->xer_decoder = asn_DEF_Int4.xer_decoder;
502 td->xer_encoder = asn_DEF_Int4.xer_encoder;
503 td->elements = asn_DEF_Int4.elements;
504 td->elements_count = asn_DEF_Int4.elements_count;
505 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000506}
507
Lev Walkina9cc46e2004-09-22 16:06:28 +0000508void
Lev Walkindfae9752004-09-29 13:19:37 +0000509Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000510 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000511 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000512 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000513}
514
515int
Lev Walkindfae9752004-09-29 13:19:37 +0000516Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000517 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000518 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000519 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
520}
521
Lev Walkindc06f6b2004-10-20 15:50:55 +0000522asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000523Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000524 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000525 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000526 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000527}
528
529asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000530Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000531 void *structure, int tag_mode, ber_tlv_tag_t tag,
532 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000533 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000534 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
535}
536
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000537asn_dec_rval_t
538Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
539 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000540 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000541 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
542}
543
Lev Walkina9cc46e2004-09-22 16:06:28 +0000544asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000545Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000546 int ilevel, enum xer_encoder_flags_e flags,
547 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000548 Int5_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000549 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000550}
551
552
553/*** <<< STAT-DEFS [Int5] >>> ***/
554
Lev Walkine0272aa2005-03-04 11:26:08 +0000555static ber_tlv_tag_t asn_DEF_Int5_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000556 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000557};
Lev Walkindfae9752004-09-29 13:19:37 +0000558asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000559 "Int5",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000560 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000561 Int5_free,
562 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000563 Int5_constraint,
564 Int5_decode_ber,
565 Int5_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000566 Int5_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000567 Int5_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000568 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000569 asn_DEF_Int5_0_tags,
570 sizeof(asn_DEF_Int5_0_tags)
571 /sizeof(asn_DEF_Int5_0_tags[0]), /* 1 */
572 asn_DEF_Int5_0_tags, /* Same as above */
573 sizeof(asn_DEF_Int5_0_tags)
574 /sizeof(asn_DEF_Int5_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000575 0, 0, /* No members */
576 0 /* No specifics */
577};
578
579
580/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
581
582#include <INTEGER.h>
583
584/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
585
Lev Walkin006de1c2004-08-20 13:37:45 +0000586typedef INTEGER_t ExtensibleExtensions_t;
587
Lev Walkin006de1c2004-08-20 13:37:45 +0000588/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
589
Lev Walkindfae9752004-09-29 13:19:37 +0000590extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000591asn_struct_free_f ExtensibleExtensions_free;
592asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000593asn_constr_check_f ExtensibleExtensions_constraint;
594ber_type_decoder_f ExtensibleExtensions_decode_ber;
595der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000596xer_type_decoder_f ExtensibleExtensions_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000597xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000598
599/*** <<< CODE [ExtensibleExtensions] >>> ***/
600
601int
Lev Walkindfae9752004-09-29 13:19:37 +0000602ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000603 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000604 const INTEGER_t *st = (const INTEGER_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000605 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000606
607 if(!sptr) {
608 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000609 "%s: value not given (%s:%d)",
610 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000611 return -1;
612 }
613
Lev Walkindfae9752004-09-29 13:19:37 +0000614 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000615 _ASN_ERRLOG(app_errlog, app_key,
616 "%s: value too large (%s:%d)",
617 td->name, __FILE__, __LINE__);
618 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000619 }
620
Lev Walkind35c8b52004-08-25 02:08:08 +0000621 if((value >= 1 && value <= 256)) {
622 /* Constraint check succeeded */
623 return 0;
624 } else {
625 _ASN_ERRLOG(app_errlog, app_key,
626 "%s: constraint failed (%s:%d)",
627 td->name, __FILE__, __LINE__);
628 return -1;
629 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000630}
631
632/*
633 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000634 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000635 */
636static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000637ExtensibleExtensions_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000638 td->free_struct = asn_DEF_INTEGER.free_struct;
639 td->print_struct = asn_DEF_INTEGER.print_struct;
640 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
641 td->der_encoder = asn_DEF_INTEGER.der_encoder;
642 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
643 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
644 td->elements = asn_DEF_INTEGER.elements;
645 td->elements_count = asn_DEF_INTEGER.elements_count;
646 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000647}
648
Lev Walkina9cc46e2004-09-22 16:06:28 +0000649void
Lev Walkindfae9752004-09-29 13:19:37 +0000650ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000651 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000652 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000653 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000654}
655
656int
Lev Walkindfae9752004-09-29 13:19:37 +0000657ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000658 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000659 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000660 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
661}
662
Lev Walkindc06f6b2004-10-20 15:50:55 +0000663asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000664ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000665 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000666 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000667 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000668}
669
670asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000671ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000672 void *structure, int tag_mode, ber_tlv_tag_t tag,
673 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000674 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000675 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
676}
677
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000678asn_dec_rval_t
679ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
680 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000681 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000682 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
683}
684
Lev Walkina9cc46e2004-09-22 16:06:28 +0000685asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000686ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000687 int ilevel, enum xer_encoder_flags_e flags,
688 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000689 ExtensibleExtensions_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000690 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000691}
692
693
694/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
695
Lev Walkine0272aa2005-03-04 11:26:08 +0000696static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_0_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000697 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
698};
Lev Walkindfae9752004-09-29 13:19:37 +0000699asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000700 "ExtensibleExtensions",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000701 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000702 ExtensibleExtensions_free,
703 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000704 ExtensibleExtensions_constraint,
705 ExtensibleExtensions_decode_ber,
706 ExtensibleExtensions_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000707 ExtensibleExtensions_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000708 ExtensibleExtensions_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000709 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000710 asn_DEF_ExtensibleExtensions_0_tags,
711 sizeof(asn_DEF_ExtensibleExtensions_0_tags)
712 /sizeof(asn_DEF_ExtensibleExtensions_0_tags[0]), /* 1 */
713 asn_DEF_ExtensibleExtensions_0_tags, /* Same as above */
714 sizeof(asn_DEF_ExtensibleExtensions_0_tags)
715 /sizeof(asn_DEF_ExtensibleExtensions_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000716 0, 0, /* No members */
717 0 /* No specifics */
718};
719
720
721/*** <<< INCLUDES [Str1] >>> ***/
722
723#include <IA5String.h>
724
725/*** <<< TYPE-DECLS [Str1] >>> ***/
726
Lev Walkin006de1c2004-08-20 13:37:45 +0000727typedef IA5String_t Str1_t;
728
Lev Walkin006de1c2004-08-20 13:37:45 +0000729/*** <<< FUNC-DECLS [Str1] >>> ***/
730
Lev Walkin154aa182004-09-26 13:12:56 +0000731/* This type is equivalent to IA5String */
Lev Walkindfae9752004-09-29 13:19:37 +0000732#define asn_DEF_Str1 asn_DEF_IA5String
Lev Walkin006de1c2004-08-20 13:37:45 +0000733
734/*** <<< CODE [Str1] >>> ***/
735
Lev Walkin154aa182004-09-26 13:12:56 +0000736/* This type is equivalent to IA5String */
Lev Walkin006de1c2004-08-20 13:37:45 +0000737
738
739/*** <<< INCLUDES [Str2] >>> ***/
740
741#include <Str1.h>
742
743/*** <<< TYPE-DECLS [Str2] >>> ***/
744
Lev Walkin006de1c2004-08-20 13:37:45 +0000745typedef Str1_t Str2_t;
746
Lev Walkin006de1c2004-08-20 13:37:45 +0000747/*** <<< FUNC-DECLS [Str2] >>> ***/
748
Lev Walkindfae9752004-09-29 13:19:37 +0000749extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000750asn_struct_free_f Str2_free;
751asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000752asn_constr_check_f Str2_constraint;
753ber_type_decoder_f Str2_decode_ber;
754der_type_encoder_f Str2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000755xer_type_decoder_f Str2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000756xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000757
758/*** <<< CTABLES [Str2] >>> ***/
759
760static int check_permitted_alphabet_1(const void *sptr) {
761 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000762 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +0000763 const uint8_t *ch = st->buf;
764 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000765
766 for(; ch < end; ch++) {
767 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000768 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000769 }
Lev Walkin775885e2004-08-22 12:47:03 +0000770 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000771}
772
773
774/*** <<< CODE [Str2] >>> ***/
775
776int
Lev Walkindfae9752004-09-29 13:19:37 +0000777Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000778 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000779 const Str1_t *st = (const Str1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000780 size_t size;
781
782 if(!sptr) {
783 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000784 "%s: value not given (%s:%d)",
785 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000786 return -1;
787 }
788
789 size = st->size;
790
791 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000792 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000793 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000794 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000795 } else {
796 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000797 "%s: constraint failed (%s:%d)",
798 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000799 return -1;
800 }
801}
802
803/*
804 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000805 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000806 */
807static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000808Str2_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000809 td->free_struct = asn_DEF_Str1.free_struct;
810 td->print_struct = asn_DEF_Str1.print_struct;
811 td->ber_decoder = asn_DEF_Str1.ber_decoder;
812 td->der_encoder = asn_DEF_Str1.der_encoder;
813 td->xer_decoder = asn_DEF_Str1.xer_decoder;
814 td->xer_encoder = asn_DEF_Str1.xer_encoder;
815 td->elements = asn_DEF_Str1.elements;
816 td->elements_count = asn_DEF_Str1.elements_count;
817 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000818}
819
Lev Walkina9cc46e2004-09-22 16:06:28 +0000820void
Lev Walkindfae9752004-09-29 13:19:37 +0000821Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000822 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000823 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000824 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000825}
826
827int
Lev Walkindfae9752004-09-29 13:19:37 +0000828Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000829 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000830 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000831 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
832}
833
Lev Walkindc06f6b2004-10-20 15:50:55 +0000834asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000835Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000836 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000837 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000838 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000839}
840
841asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000842Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000843 void *structure, int tag_mode, ber_tlv_tag_t tag,
844 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000845 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000846 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
847}
848
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000849asn_dec_rval_t
850Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
851 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000852 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000853 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
854}
855
Lev Walkina9cc46e2004-09-22 16:06:28 +0000856asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000857Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000858 int ilevel, enum xer_encoder_flags_e flags,
859 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000860 Str2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000861 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000862}
863
864
865/*** <<< STAT-DEFS [Str2] >>> ***/
866
Lev Walkine0272aa2005-03-04 11:26:08 +0000867static ber_tlv_tag_t asn_DEF_Str2_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000868 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000869};
Lev Walkindfae9752004-09-29 13:19:37 +0000870asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000871 "Str2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000872 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000873 Str2_free,
874 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000875 Str2_constraint,
876 Str2_decode_ber,
877 Str2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000878 Str2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000879 Str2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000880 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +0000881 asn_DEF_Str2_0_tags,
882 sizeof(asn_DEF_Str2_0_tags)
883 /sizeof(asn_DEF_Str2_0_tags[0]), /* 1 */
884 asn_DEF_Str2_0_tags, /* Same as above */
885 sizeof(asn_DEF_Str2_0_tags)
886 /sizeof(asn_DEF_Str2_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000887 0, 0, /* No members */
888 0 /* No specifics */
889};
890
891
892/*** <<< INCLUDES [Str3] >>> ***/
893
894#include <Str2.h>
895
896/*** <<< TYPE-DECLS [Str3] >>> ***/
897
Lev Walkin006de1c2004-08-20 13:37:45 +0000898typedef Str2_t Str3_t;
899
Lev Walkin006de1c2004-08-20 13:37:45 +0000900/*** <<< FUNC-DECLS [Str3] >>> ***/
901
Lev Walkindfae9752004-09-29 13:19:37 +0000902extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000903asn_struct_free_f Str3_free;
904asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000905asn_constr_check_f Str3_constraint;
906ber_type_decoder_f Str3_decode_ber;
907der_type_encoder_f Str3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000908xer_type_decoder_f Str3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000909xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000910
911/*** <<< CTABLES [Str3] >>> ***/
912
913static int permitted_alphabet_table_2[256] = {
9140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9180,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
9190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
9200,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
921};
922
923static int check_permitted_alphabet_2(const void *sptr) {
924 int *table = permitted_alphabet_table_2;
925 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000926 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +0000927 const uint8_t *ch = st->buf;
928 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000929
930 for(; ch < end; ch++) {
931 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000932 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000933 }
Lev Walkin775885e2004-08-22 12:47:03 +0000934 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000935}
936
937
938/*** <<< CODE [Str3] >>> ***/
939
940int
Lev Walkindfae9752004-09-29 13:19:37 +0000941Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000942 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000943 const Str2_t *st = (const Str2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000944 size_t size;
945
946 if(!sptr) {
947 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000948 "%s: value not given (%s:%d)",
949 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000950 return -1;
951 }
952
953 size = st->size;
954
955 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +0000956 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000957 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000958 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000959 } else {
960 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000961 "%s: constraint failed (%s:%d)",
962 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000963 return -1;
964 }
965}
966
967/*
968 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000969 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000970 */
971static void
Lev Walkine0272aa2005-03-04 11:26:08 +0000972Str3_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000973 td->free_struct = asn_DEF_Str2.free_struct;
974 td->print_struct = asn_DEF_Str2.print_struct;
975 td->ber_decoder = asn_DEF_Str2.ber_decoder;
976 td->der_encoder = asn_DEF_Str2.der_encoder;
977 td->xer_decoder = asn_DEF_Str2.xer_decoder;
978 td->xer_encoder = asn_DEF_Str2.xer_encoder;
979 td->elements = asn_DEF_Str2.elements;
980 td->elements_count = asn_DEF_Str2.elements_count;
981 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000982}
983
Lev Walkina9cc46e2004-09-22 16:06:28 +0000984void
Lev Walkindfae9752004-09-29 13:19:37 +0000985Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000986 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000987 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000988 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000989}
990
991int
Lev Walkindfae9752004-09-29 13:19:37 +0000992Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000993 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +0000994 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000995 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
996}
997
Lev Walkindc06f6b2004-10-20 15:50:55 +0000998asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000999Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001000 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001001 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001002 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001003}
1004
1005asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001006Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001007 void *structure, int tag_mode, ber_tlv_tag_t tag,
1008 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001009 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001010 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1011}
1012
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001013asn_dec_rval_t
1014Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1015 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001016 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001017 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1018}
1019
Lev Walkina9cc46e2004-09-22 16:06:28 +00001020asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001021Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001022 int ilevel, enum xer_encoder_flags_e flags,
1023 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001024 Str3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001025 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001026}
1027
1028
1029/*** <<< STAT-DEFS [Str3] >>> ***/
1030
Lev Walkine0272aa2005-03-04 11:26:08 +00001031static ber_tlv_tag_t asn_DEF_Str3_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001032 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001033};
Lev Walkindfae9752004-09-29 13:19:37 +00001034asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001035 "Str3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001036 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001037 Str3_free,
1038 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001039 Str3_constraint,
1040 Str3_decode_ber,
1041 Str3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001042 Str3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001043 Str3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001044 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001045 asn_DEF_Str3_0_tags,
1046 sizeof(asn_DEF_Str3_0_tags)
1047 /sizeof(asn_DEF_Str3_0_tags[0]), /* 1 */
1048 asn_DEF_Str3_0_tags, /* Same as above */
1049 sizeof(asn_DEF_Str3_0_tags)
1050 /sizeof(asn_DEF_Str3_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001051 0, 0, /* No members */
1052 0 /* No specifics */
1053};
1054
1055
Lev Walkin8a99bf72004-09-10 06:07:39 +00001056/*** <<< INCLUDES [Str4] >>> ***/
1057
1058#include <IA5String.h>
1059
1060/*** <<< TYPE-DECLS [Str4] >>> ***/
1061
Lev Walkin8a99bf72004-09-10 06:07:39 +00001062typedef IA5String_t Str4_t;
1063
1064/*** <<< FUNC-DECLS [Str4] >>> ***/
1065
Lev Walkindfae9752004-09-29 13:19:37 +00001066extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001067asn_struct_free_f Str4_free;
1068asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001069asn_constr_check_f Str4_constraint;
1070ber_type_decoder_f Str4_decode_ber;
1071der_type_encoder_f Str4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001072xer_type_decoder_f Str4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001073xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001074
1075/*** <<< CTABLES [Str4] >>> ***/
1076
1077static int check_permitted_alphabet_3(const void *sptr) {
1078 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001079 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001080 const uint8_t *ch = st->buf;
1081 const uint8_t *end = ch + st->size;
1082
1083 for(; ch < end; ch++) {
1084 uint8_t cv = *ch;
1085 if(!(cv <= 127)) return -1;
1086 }
1087 return 0;
1088}
1089
1090
1091/*** <<< CODE [Str4] >>> ***/
1092
1093int
Lev Walkindfae9752004-09-29 13:19:37 +00001094Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001095 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001096 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001097
1098 if(!sptr) {
1099 _ASN_ERRLOG(app_errlog, app_key,
1100 "%s: value not given (%s:%d)",
1101 td->name, __FILE__, __LINE__);
1102 return -1;
1103 }
1104
1105
1106 if(!check_permitted_alphabet_3(sptr)) {
1107 /* Constraint check succeeded */
1108 return 0;
1109 } else {
1110 _ASN_ERRLOG(app_errlog, app_key,
1111 "%s: constraint failed (%s:%d)",
1112 td->name, __FILE__, __LINE__);
1113 return -1;
1114 }
1115}
1116
1117/*
1118 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001119 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001120 */
1121static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001122Str4_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001123 td->free_struct = asn_DEF_IA5String.free_struct;
1124 td->print_struct = asn_DEF_IA5String.print_struct;
1125 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1126 td->der_encoder = asn_DEF_IA5String.der_encoder;
1127 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1128 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1129 td->elements = asn_DEF_IA5String.elements;
1130 td->elements_count = asn_DEF_IA5String.elements_count;
1131 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001132}
1133
Lev Walkina9cc46e2004-09-22 16:06:28 +00001134void
Lev Walkindfae9752004-09-29 13:19:37 +00001135Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001136 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001137 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001138 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001139}
1140
1141int
Lev Walkindfae9752004-09-29 13:19:37 +00001142Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001143 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001144 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001145 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1146}
1147
Lev Walkindc06f6b2004-10-20 15:50:55 +00001148asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001149Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001150 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001151 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001152 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001153}
1154
1155asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001156Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001157 void *structure, int tag_mode, ber_tlv_tag_t tag,
1158 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001159 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001160 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1161}
1162
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001163asn_dec_rval_t
1164Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1165 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001166 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001167 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1168}
1169
Lev Walkina9cc46e2004-09-22 16:06:28 +00001170asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001171Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001172 int ilevel, enum xer_encoder_flags_e flags,
1173 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001174 Str4_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001175 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001176}
1177
1178
1179/*** <<< STAT-DEFS [Str4] >>> ***/
1180
Lev Walkine0272aa2005-03-04 11:26:08 +00001181static ber_tlv_tag_t asn_DEF_Str4_0_tags[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001182 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1183};
Lev Walkindfae9752004-09-29 13:19:37 +00001184asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001185 "Str4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001186 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001187 Str4_free,
1188 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001189 Str4_constraint,
1190 Str4_decode_ber,
1191 Str4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001192 Str4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001193 Str4_encode_xer,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001194 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001195 asn_DEF_Str4_0_tags,
1196 sizeof(asn_DEF_Str4_0_tags)
1197 /sizeof(asn_DEF_Str4_0_tags[0]), /* 1 */
1198 asn_DEF_Str4_0_tags, /* Same as above */
1199 sizeof(asn_DEF_Str4_0_tags)
1200 /sizeof(asn_DEF_Str4_0_tags[0]), /* 1 */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001201 0, 0, /* No members */
1202 0 /* No specifics */
1203};
1204
1205
Lev Walkin006de1c2004-08-20 13:37:45 +00001206/*** <<< INCLUDES [PER-Visible] >>> ***/
1207
1208#include <IA5String.h>
1209
1210/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1211
Lev Walkin006de1c2004-08-20 13:37:45 +00001212typedef IA5String_t PER_Visible_t;
1213
Lev Walkin006de1c2004-08-20 13:37:45 +00001214/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1215
Lev Walkindfae9752004-09-29 13:19:37 +00001216extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001217asn_struct_free_f PER_Visible_free;
1218asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001219asn_constr_check_f PER_Visible_constraint;
1220ber_type_decoder_f PER_Visible_decode_ber;
1221der_type_encoder_f PER_Visible_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001222xer_type_decoder_f PER_Visible_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001223xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001224
1225/*** <<< CTABLES [PER-Visible] >>> ***/
1226
Lev Walkin8a99bf72004-09-10 06:07:39 +00001227static int check_permitted_alphabet_4(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001228 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001229 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001230 const uint8_t *ch = st->buf;
1231 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001232
1233 for(; ch < end; ch++) {
1234 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001235 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001236 }
Lev Walkin775885e2004-08-22 12:47:03 +00001237 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001238}
1239
1240
1241/*** <<< CODE [PER-Visible] >>> ***/
1242
1243int
Lev Walkindfae9752004-09-29 13:19:37 +00001244PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001245 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001246 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001247
1248 if(!sptr) {
1249 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001250 "%s: value not given (%s:%d)",
1251 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001252 return -1;
1253 }
1254
1255
Lev Walkin8a99bf72004-09-10 06:07:39 +00001256 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001257 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001258 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001259 } else {
1260 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001261 "%s: constraint failed (%s:%d)",
1262 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001263 return -1;
1264 }
1265}
1266
1267/*
1268 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001269 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001270 */
1271static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001272PER_Visible_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001273 td->free_struct = asn_DEF_IA5String.free_struct;
1274 td->print_struct = asn_DEF_IA5String.print_struct;
1275 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1276 td->der_encoder = asn_DEF_IA5String.der_encoder;
1277 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1278 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1279 td->elements = asn_DEF_IA5String.elements;
1280 td->elements_count = asn_DEF_IA5String.elements_count;
1281 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001282}
1283
Lev Walkina9cc46e2004-09-22 16:06:28 +00001284void
Lev Walkindfae9752004-09-29 13:19:37 +00001285PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001286 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001287 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001288 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001289}
1290
1291int
Lev Walkindfae9752004-09-29 13:19:37 +00001292PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001293 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001294 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001295 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1296}
1297
Lev Walkindc06f6b2004-10-20 15:50:55 +00001298asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001299PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001300 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001301 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001302 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001303}
1304
1305asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001306PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001307 void *structure, int tag_mode, ber_tlv_tag_t tag,
1308 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001309 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001310 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1311}
1312
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001313asn_dec_rval_t
1314PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1315 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001316 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001317 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1318}
1319
Lev Walkina9cc46e2004-09-22 16:06:28 +00001320asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001321PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001322 int ilevel, enum xer_encoder_flags_e flags,
1323 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001324 PER_Visible_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001325 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001326}
1327
1328
1329/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1330
Lev Walkine0272aa2005-03-04 11:26:08 +00001331static ber_tlv_tag_t asn_DEF_PER_Visible_0_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001332 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1333};
Lev Walkindfae9752004-09-29 13:19:37 +00001334asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001335 "PER-Visible",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001336 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001337 PER_Visible_free,
1338 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001339 PER_Visible_constraint,
1340 PER_Visible_decode_ber,
1341 PER_Visible_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001342 PER_Visible_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001343 PER_Visible_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001344 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001345 asn_DEF_PER_Visible_0_tags,
1346 sizeof(asn_DEF_PER_Visible_0_tags)
1347 /sizeof(asn_DEF_PER_Visible_0_tags[0]), /* 1 */
1348 asn_DEF_PER_Visible_0_tags, /* Same as above */
1349 sizeof(asn_DEF_PER_Visible_0_tags)
1350 /sizeof(asn_DEF_PER_Visible_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001351 0, 0, /* No members */
1352 0 /* No specifics */
1353};
1354
1355
1356/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1357
1358#include <PER-Visible.h>
1359
1360/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1361
Lev Walkin006de1c2004-08-20 13:37:45 +00001362typedef PER_Visible_t PER_Visible_2_t;
1363
Lev Walkin006de1c2004-08-20 13:37:45 +00001364/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1365
Lev Walkindfae9752004-09-29 13:19:37 +00001366extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001367asn_struct_free_f PER_Visible_2_free;
1368asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001369asn_constr_check_f PER_Visible_2_constraint;
1370ber_type_decoder_f PER_Visible_2_decode_ber;
1371der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001372xer_type_decoder_f PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001373xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001374
1375/*** <<< CTABLES [PER-Visible-2] >>> ***/
1376
Lev Walkin8a99bf72004-09-10 06:07:39 +00001377static int check_permitted_alphabet_5(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001378 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001379 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001380 const uint8_t *ch = st->buf;
1381 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001382
1383 for(; ch < end; ch++) {
1384 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001385 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001386 }
Lev Walkin775885e2004-08-22 12:47:03 +00001387 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001388}
1389
1390
1391/*** <<< CODE [PER-Visible-2] >>> ***/
1392
1393int
Lev Walkindfae9752004-09-29 13:19:37 +00001394PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001395 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001396 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001397
1398 if(!sptr) {
1399 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001400 "%s: value not given (%s:%d)",
1401 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001402 return -1;
1403 }
1404
1405
Lev Walkin8a99bf72004-09-10 06:07:39 +00001406 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001407 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001408 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001409 } else {
1410 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001411 "%s: constraint failed (%s:%d)",
1412 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001413 return -1;
1414 }
1415}
1416
1417/*
1418 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001419 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001420 */
1421static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001422PER_Visible_2_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001423 td->free_struct = asn_DEF_PER_Visible.free_struct;
1424 td->print_struct = asn_DEF_PER_Visible.print_struct;
1425 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1426 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1427 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1428 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1429 td->elements = asn_DEF_PER_Visible.elements;
1430 td->elements_count = asn_DEF_PER_Visible.elements_count;
1431 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001432}
1433
Lev Walkina9cc46e2004-09-22 16:06:28 +00001434void
Lev Walkindfae9752004-09-29 13:19:37 +00001435PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001436 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001437 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001438 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001439}
1440
1441int
Lev Walkindfae9752004-09-29 13:19:37 +00001442PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001443 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001444 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001445 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1446}
1447
Lev Walkindc06f6b2004-10-20 15:50:55 +00001448asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001449PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001450 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001451 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001452 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001453}
1454
1455asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001456PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001457 void *structure, int tag_mode, ber_tlv_tag_t tag,
1458 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001459 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001460 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1461}
1462
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001463asn_dec_rval_t
1464PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1465 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001466 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001467 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1468}
1469
Lev Walkina9cc46e2004-09-22 16:06:28 +00001470asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001471PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001472 int ilevel, enum xer_encoder_flags_e flags,
1473 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001474 PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001475 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001476}
1477
1478
1479/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1480
Lev Walkine0272aa2005-03-04 11:26:08 +00001481static ber_tlv_tag_t asn_DEF_PER_Visible_2_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001482 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001483};
Lev Walkindfae9752004-09-29 13:19:37 +00001484asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001485 "PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001486 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001487 PER_Visible_2_free,
1488 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001489 PER_Visible_2_constraint,
1490 PER_Visible_2_decode_ber,
1491 PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001492 PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001493 PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001494 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001495 asn_DEF_PER_Visible_2_0_tags,
1496 sizeof(asn_DEF_PER_Visible_2_0_tags)
1497 /sizeof(asn_DEF_PER_Visible_2_0_tags[0]), /* 1 */
1498 asn_DEF_PER_Visible_2_0_tags, /* Same as above */
1499 sizeof(asn_DEF_PER_Visible_2_0_tags)
1500 /sizeof(asn_DEF_PER_Visible_2_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001501 0, 0, /* No members */
1502 0 /* No specifics */
1503};
1504
1505
1506/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1507
1508#include <PER-Visible.h>
1509
1510/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1511
Lev Walkin006de1c2004-08-20 13:37:45 +00001512typedef PER_Visible_t Not_PER_Visible_1_t;
1513
Lev Walkin006de1c2004-08-20 13:37:45 +00001514/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1515
Lev Walkindfae9752004-09-29 13:19:37 +00001516extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001517asn_struct_free_f Not_PER_Visible_1_free;
1518asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001519asn_constr_check_f Not_PER_Visible_1_constraint;
1520ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1521der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001522xer_type_decoder_f Not_PER_Visible_1_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001523xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001524
1525/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1526
Lev Walkin8a99bf72004-09-10 06:07:39 +00001527static int check_permitted_alphabet_6(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001528 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001529 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001530 const uint8_t *ch = st->buf;
1531 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001532
1533 for(; ch < end; ch++) {
1534 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001535 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001536 }
Lev Walkin775885e2004-08-22 12:47:03 +00001537 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001538}
1539
1540
1541/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1542
1543int
Lev Walkindfae9752004-09-29 13:19:37 +00001544Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001545 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001546 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001547
1548 if(!sptr) {
1549 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001550 "%s: value not given (%s:%d)",
1551 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001552 return -1;
1553 }
1554
1555
Lev Walkin8a99bf72004-09-10 06:07:39 +00001556 if(!check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001557 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001558 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001559 } else {
1560 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001561 "%s: constraint failed (%s:%d)",
1562 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001563 return -1;
1564 }
1565}
1566
1567/*
1568 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001569 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001570 */
1571static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001572Not_PER_Visible_1_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001573 td->free_struct = asn_DEF_PER_Visible.free_struct;
1574 td->print_struct = asn_DEF_PER_Visible.print_struct;
1575 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1576 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1577 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1578 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1579 td->elements = asn_DEF_PER_Visible.elements;
1580 td->elements_count = asn_DEF_PER_Visible.elements_count;
1581 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001582}
1583
Lev Walkina9cc46e2004-09-22 16:06:28 +00001584void
Lev Walkindfae9752004-09-29 13:19:37 +00001585Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001586 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001587 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001588 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001589}
1590
1591int
Lev Walkindfae9752004-09-29 13:19:37 +00001592Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001593 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001594 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001595 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1596}
1597
Lev Walkindc06f6b2004-10-20 15:50:55 +00001598asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001599Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001600 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001601 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001602 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001603}
1604
1605asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001606Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001607 void *structure, int tag_mode, ber_tlv_tag_t tag,
1608 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001609 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001610 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1611}
1612
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001613asn_dec_rval_t
1614Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1615 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001616 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001617 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1618}
1619
Lev Walkina9cc46e2004-09-22 16:06:28 +00001620asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001621Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001622 int ilevel, enum xer_encoder_flags_e flags,
1623 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001624 Not_PER_Visible_1_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001625 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001626}
1627
1628
1629/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1630
Lev Walkine0272aa2005-03-04 11:26:08 +00001631static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001632 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001633};
Lev Walkindfae9752004-09-29 13:19:37 +00001634asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001635 "Not-PER-Visible-1",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001636 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001637 Not_PER_Visible_1_free,
1638 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001639 Not_PER_Visible_1_constraint,
1640 Not_PER_Visible_1_decode_ber,
1641 Not_PER_Visible_1_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001642 Not_PER_Visible_1_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001643 Not_PER_Visible_1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001644 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001645 asn_DEF_Not_PER_Visible_1_0_tags,
1646 sizeof(asn_DEF_Not_PER_Visible_1_0_tags)
1647 /sizeof(asn_DEF_Not_PER_Visible_1_0_tags[0]), /* 1 */
1648 asn_DEF_Not_PER_Visible_1_0_tags, /* Same as above */
1649 sizeof(asn_DEF_Not_PER_Visible_1_0_tags)
1650 /sizeof(asn_DEF_Not_PER_Visible_1_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001651 0, 0, /* No members */
1652 0 /* No specifics */
1653};
1654
1655
1656/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1657
1658#include <PER-Visible.h>
1659
1660/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1661
Lev Walkin006de1c2004-08-20 13:37:45 +00001662typedef PER_Visible_t Not_PER_Visible_2_t;
1663
Lev Walkin006de1c2004-08-20 13:37:45 +00001664/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1665
Lev Walkindfae9752004-09-29 13:19:37 +00001666extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001667asn_struct_free_f Not_PER_Visible_2_free;
1668asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001669asn_constr_check_f Not_PER_Visible_2_constraint;
1670ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1671der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001672xer_type_decoder_f Not_PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001673xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001674
Lev Walkind35c8b52004-08-25 02:08:08 +00001675/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1676
Lev Walkin8a99bf72004-09-10 06:07:39 +00001677static int check_permitted_alphabet_7(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001678 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001679 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00001680 const uint8_t *ch = st->buf;
1681 const uint8_t *end = ch + st->size;
1682
1683 for(; ch < end; ch++) {
1684 uint8_t cv = *ch;
1685 if(!(cv >= 65 && cv <= 66)) return -1;
1686 }
1687 return 0;
1688}
1689
1690
Lev Walkin006de1c2004-08-20 13:37:45 +00001691/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1692
1693int
Lev Walkindfae9752004-09-29 13:19:37 +00001694Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001695 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001696 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001697
1698 if(!sptr) {
1699 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001700 "%s: value not given (%s:%d)",
1701 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001702 return -1;
1703 }
1704
1705
Lev Walkin8a99bf72004-09-10 06:07:39 +00001706 if(!check_permitted_alphabet_7(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001707 /* Constraint check succeeded */
1708 return 0;
1709 } else {
1710 _ASN_ERRLOG(app_errlog, app_key,
1711 "%s: constraint failed (%s:%d)",
1712 td->name, __FILE__, __LINE__);
1713 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001714 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001715}
1716
1717/*
1718 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001719 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001720 */
1721static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001722Not_PER_Visible_2_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001723 td->free_struct = asn_DEF_PER_Visible.free_struct;
1724 td->print_struct = asn_DEF_PER_Visible.print_struct;
1725 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1726 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1727 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1728 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1729 td->elements = asn_DEF_PER_Visible.elements;
1730 td->elements_count = asn_DEF_PER_Visible.elements_count;
1731 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001732}
1733
Lev Walkina9cc46e2004-09-22 16:06:28 +00001734void
Lev Walkindfae9752004-09-29 13:19:37 +00001735Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001736 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001737 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001738 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001739}
1740
1741int
Lev Walkindfae9752004-09-29 13:19:37 +00001742Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001743 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001744 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001745 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1746}
1747
Lev Walkindc06f6b2004-10-20 15:50:55 +00001748asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001749Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001750 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001751 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001752 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001753}
1754
1755asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001756Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001757 void *structure, int tag_mode, ber_tlv_tag_t tag,
1758 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001759 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001760 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1761}
1762
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001763asn_dec_rval_t
1764Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1765 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001766 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001767 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1768}
1769
Lev Walkina9cc46e2004-09-22 16:06:28 +00001770asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001771Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001772 int ilevel, enum xer_encoder_flags_e flags,
1773 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001774 Not_PER_Visible_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001775 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001776}
1777
1778
1779/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1780
Lev Walkine0272aa2005-03-04 11:26:08 +00001781static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001782 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001783};
Lev Walkindfae9752004-09-29 13:19:37 +00001784asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001785 "Not-PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001786 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001787 Not_PER_Visible_2_free,
1788 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001789 Not_PER_Visible_2_constraint,
1790 Not_PER_Visible_2_decode_ber,
1791 Not_PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001792 Not_PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001793 Not_PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001794 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001795 asn_DEF_Not_PER_Visible_2_0_tags,
1796 sizeof(asn_DEF_Not_PER_Visible_2_0_tags)
1797 /sizeof(asn_DEF_Not_PER_Visible_2_0_tags[0]), /* 1 */
1798 asn_DEF_Not_PER_Visible_2_0_tags, /* Same as above */
1799 sizeof(asn_DEF_Not_PER_Visible_2_0_tags)
1800 /sizeof(asn_DEF_Not_PER_Visible_2_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001801 0, 0, /* No members */
1802 0 /* No specifics */
1803};
1804
1805
1806/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1807
1808#include <PER-Visible.h>
1809
1810/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1811
Lev Walkin006de1c2004-08-20 13:37:45 +00001812typedef PER_Visible_t Not_PER_Visible_3_t;
1813
Lev Walkin006de1c2004-08-20 13:37:45 +00001814/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1815
Lev Walkindfae9752004-09-29 13:19:37 +00001816extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001817asn_struct_free_f Not_PER_Visible_3_free;
1818asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001819asn_constr_check_f Not_PER_Visible_3_constraint;
1820ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1821der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001822xer_type_decoder_f Not_PER_Visible_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001823xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001824
Lev Walkind35c8b52004-08-25 02:08:08 +00001825/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1826
Lev Walkin8a99bf72004-09-10 06:07:39 +00001827static int check_permitted_alphabet_8(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001828 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001829 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00001830 const uint8_t *ch = st->buf;
1831 const uint8_t *end = ch + st->size;
1832
1833 for(; ch < end; ch++) {
1834 uint8_t cv = *ch;
1835 if(!(cv >= 65 && cv <= 66)) return -1;
1836 }
1837 return 0;
1838}
1839
1840
Lev Walkin006de1c2004-08-20 13:37:45 +00001841/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1842
1843int
Lev Walkindfae9752004-09-29 13:19:37 +00001844Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001845 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001846 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001847
1848 if(!sptr) {
1849 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001850 "%s: value not given (%s:%d)",
1851 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001852 return -1;
1853 }
1854
1855
Lev Walkin8a99bf72004-09-10 06:07:39 +00001856 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001857 /* Constraint check succeeded */
1858 return 0;
1859 } else {
1860 _ASN_ERRLOG(app_errlog, app_key,
1861 "%s: constraint failed (%s:%d)",
1862 td->name, __FILE__, __LINE__);
1863 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001864 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001865}
1866
1867/*
1868 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001869 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001870 */
1871static void
Lev Walkine0272aa2005-03-04 11:26:08 +00001872Not_PER_Visible_3_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001873 td->free_struct = asn_DEF_PER_Visible.free_struct;
1874 td->print_struct = asn_DEF_PER_Visible.print_struct;
1875 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1876 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1877 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1878 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1879 td->elements = asn_DEF_PER_Visible.elements;
1880 td->elements_count = asn_DEF_PER_Visible.elements_count;
1881 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001882}
1883
Lev Walkina9cc46e2004-09-22 16:06:28 +00001884void
Lev Walkindfae9752004-09-29 13:19:37 +00001885Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001886 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001887 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001888 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001889}
1890
1891int
Lev Walkindfae9752004-09-29 13:19:37 +00001892Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001893 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001894 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001895 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1896}
1897
Lev Walkindc06f6b2004-10-20 15:50:55 +00001898asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001899Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001900 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001901 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001902 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001903}
1904
1905asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001906Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001907 void *structure, int tag_mode, ber_tlv_tag_t tag,
1908 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001909 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001910 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1911}
1912
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001913asn_dec_rval_t
1914Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
1915 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001916 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001917 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1918}
1919
Lev Walkina9cc46e2004-09-22 16:06:28 +00001920asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001921Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001922 int ilevel, enum xer_encoder_flags_e flags,
1923 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00001924 Not_PER_Visible_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001925 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001926}
1927
1928
1929/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1930
Lev Walkine0272aa2005-03-04 11:26:08 +00001931static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001932 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001933};
Lev Walkindfae9752004-09-29 13:19:37 +00001934asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001935 "Not-PER-Visible-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001936 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001937 Not_PER_Visible_3_free,
1938 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001939 Not_PER_Visible_3_constraint,
1940 Not_PER_Visible_3_decode_ber,
1941 Not_PER_Visible_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001942 Not_PER_Visible_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001943 Not_PER_Visible_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001944 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00001945 asn_DEF_Not_PER_Visible_3_0_tags,
1946 sizeof(asn_DEF_Not_PER_Visible_3_0_tags)
1947 /sizeof(asn_DEF_Not_PER_Visible_3_0_tags[0]), /* 1 */
1948 asn_DEF_Not_PER_Visible_3_0_tags, /* Same as above */
1949 sizeof(asn_DEF_Not_PER_Visible_3_0_tags)
1950 /sizeof(asn_DEF_Not_PER_Visible_3_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001951 0, 0, /* No members */
1952 0 /* No specifics */
1953};
1954
1955
1956/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1957
1958#include <PER-Visible.h>
1959
1960/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1961
Lev Walkin006de1c2004-08-20 13:37:45 +00001962typedef PER_Visible_t SIZE_but_not_FROM_t;
1963
Lev Walkin006de1c2004-08-20 13:37:45 +00001964/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1965
Lev Walkindfae9752004-09-29 13:19:37 +00001966extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001967asn_struct_free_f SIZE_but_not_FROM_free;
1968asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001969asn_constr_check_f SIZE_but_not_FROM_constraint;
1970ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1971der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001972xer_type_decoder_f SIZE_but_not_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001973xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001974
1975/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1976
Lev Walkin8a99bf72004-09-10 06:07:39 +00001977static int check_permitted_alphabet_9(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001978 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001979 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001980 const uint8_t *ch = st->buf;
1981 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001982
1983 for(; ch < end; ch++) {
1984 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00001985 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001986 }
Lev Walkin775885e2004-08-22 12:47:03 +00001987 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001988}
1989
1990
1991/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1992
1993int
Lev Walkindfae9752004-09-29 13:19:37 +00001994SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001995 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001996 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001997 size_t size;
1998
1999 if(!sptr) {
2000 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002001 "%s: value not given (%s:%d)",
2002 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002003 return -1;
2004 }
2005
2006 size = st->size;
2007
2008 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002009 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002010 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002011 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002012 } else {
2013 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002014 "%s: constraint failed (%s:%d)",
2015 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002016 return -1;
2017 }
2018}
2019
2020/*
2021 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002022 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002023 */
2024static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002025SIZE_but_not_FROM_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002026 td->free_struct = asn_DEF_PER_Visible.free_struct;
2027 td->print_struct = asn_DEF_PER_Visible.print_struct;
2028 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2029 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2030 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2031 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2032 td->elements = asn_DEF_PER_Visible.elements;
2033 td->elements_count = asn_DEF_PER_Visible.elements_count;
2034 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002035}
2036
Lev Walkina9cc46e2004-09-22 16:06:28 +00002037void
Lev Walkindfae9752004-09-29 13:19:37 +00002038SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002039 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002040 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002041 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002042}
2043
2044int
Lev Walkindfae9752004-09-29 13:19:37 +00002045SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002046 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002047 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002048 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2049}
2050
Lev Walkindc06f6b2004-10-20 15:50:55 +00002051asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002052SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002053 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002054 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002055 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002056}
2057
2058asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002059SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002060 void *structure, int tag_mode, ber_tlv_tag_t tag,
2061 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002062 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002063 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2064}
2065
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002066asn_dec_rval_t
2067SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2068 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002069 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002070 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2071}
2072
Lev Walkina9cc46e2004-09-22 16:06:28 +00002073asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002074SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002075 int ilevel, enum xer_encoder_flags_e flags,
2076 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002077 SIZE_but_not_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002078 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002079}
2080
2081
2082/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
2083
Lev Walkine0272aa2005-03-04 11:26:08 +00002084static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002085 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002086};
Lev Walkindfae9752004-09-29 13:19:37 +00002087asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002088 "SIZE-but-not-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002089 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002090 SIZE_but_not_FROM_free,
2091 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002092 SIZE_but_not_FROM_constraint,
2093 SIZE_but_not_FROM_decode_ber,
2094 SIZE_but_not_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002095 SIZE_but_not_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002096 SIZE_but_not_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002097 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002098 asn_DEF_SIZE_but_not_FROM_0_tags,
2099 sizeof(asn_DEF_SIZE_but_not_FROM_0_tags)
2100 /sizeof(asn_DEF_SIZE_but_not_FROM_0_tags[0]), /* 1 */
2101 asn_DEF_SIZE_but_not_FROM_0_tags, /* Same as above */
2102 sizeof(asn_DEF_SIZE_but_not_FROM_0_tags)
2103 /sizeof(asn_DEF_SIZE_but_not_FROM_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002104 0, 0, /* No members */
2105 0 /* No specifics */
2106};
2107
2108
2109/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2110
2111#include <PER-Visible.h>
2112
2113/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2114
Lev Walkin006de1c2004-08-20 13:37:45 +00002115typedef PER_Visible_t SIZE_and_FROM_t;
2116
Lev Walkin006de1c2004-08-20 13:37:45 +00002117/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2118
Lev Walkindfae9752004-09-29 13:19:37 +00002119extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002120asn_struct_free_f SIZE_and_FROM_free;
2121asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002122asn_constr_check_f SIZE_and_FROM_constraint;
2123ber_type_decoder_f SIZE_and_FROM_decode_ber;
2124der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002125xer_type_decoder_f SIZE_and_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002126xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002127
2128/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2129
Lev Walkin8a99bf72004-09-10 06:07:39 +00002130static int check_permitted_alphabet_10(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002131 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002132 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002133 const uint8_t *ch = st->buf;
2134 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002135
2136 for(; ch < end; ch++) {
2137 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002138 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002139 }
Lev Walkin775885e2004-08-22 12:47:03 +00002140 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002141}
2142
2143
2144/*** <<< CODE [SIZE-and-FROM] >>> ***/
2145
2146int
Lev Walkindfae9752004-09-29 13:19:37 +00002147SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002148 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002149 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002150 size_t size;
2151
2152 if(!sptr) {
2153 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002154 "%s: value not given (%s:%d)",
2155 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002156 return -1;
2157 }
2158
2159 size = st->size;
2160
2161 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002162 && !check_permitted_alphabet_10(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002163 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002164 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002165 } else {
2166 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002167 "%s: constraint failed (%s:%d)",
2168 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002169 return -1;
2170 }
2171}
2172
2173/*
2174 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002175 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002176 */
2177static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002178SIZE_and_FROM_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002179 td->free_struct = asn_DEF_PER_Visible.free_struct;
2180 td->print_struct = asn_DEF_PER_Visible.print_struct;
2181 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2182 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2183 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2184 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2185 td->elements = asn_DEF_PER_Visible.elements;
2186 td->elements_count = asn_DEF_PER_Visible.elements_count;
2187 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002188}
2189
Lev Walkina9cc46e2004-09-22 16:06:28 +00002190void
Lev Walkindfae9752004-09-29 13:19:37 +00002191SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002192 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002193 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002194 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002195}
2196
2197int
Lev Walkindfae9752004-09-29 13:19:37 +00002198SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002199 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002200 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002201 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2202}
2203
Lev Walkindc06f6b2004-10-20 15:50:55 +00002204asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002205SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002206 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002207 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002208 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002209}
2210
2211asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002212SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002213 void *structure, int tag_mode, ber_tlv_tag_t tag,
2214 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002215 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002216 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2217}
2218
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002219asn_dec_rval_t
2220SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2221 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002222 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002223 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2224}
2225
Lev Walkina9cc46e2004-09-22 16:06:28 +00002226asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002227SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002228 int ilevel, enum xer_encoder_flags_e flags,
2229 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002230 SIZE_and_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002231 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002232}
2233
2234
2235/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2236
Lev Walkine0272aa2005-03-04 11:26:08 +00002237static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002238 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002239};
Lev Walkindfae9752004-09-29 13:19:37 +00002240asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002241 "SIZE-and-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002242 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002243 SIZE_and_FROM_free,
2244 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002245 SIZE_and_FROM_constraint,
2246 SIZE_and_FROM_decode_ber,
2247 SIZE_and_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002248 SIZE_and_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002249 SIZE_and_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002250 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002251 asn_DEF_SIZE_and_FROM_0_tags,
2252 sizeof(asn_DEF_SIZE_and_FROM_0_tags)
2253 /sizeof(asn_DEF_SIZE_and_FROM_0_tags[0]), /* 1 */
2254 asn_DEF_SIZE_and_FROM_0_tags, /* Same as above */
2255 sizeof(asn_DEF_SIZE_and_FROM_0_tags)
2256 /sizeof(asn_DEF_SIZE_and_FROM_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002257 0, 0, /* No members */
2258 0 /* No specifics */
2259};
2260
2261
2262/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2263
2264#include <PER-Visible.h>
2265
2266/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2267
Lev Walkin006de1c2004-08-20 13:37:45 +00002268typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2269
Lev Walkin006de1c2004-08-20 13:37:45 +00002270/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2271
Lev Walkindfae9752004-09-29 13:19:37 +00002272extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002273asn_struct_free_f Neither_SIZE_nor_FROM_free;
2274asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002275asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2276ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2277der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002278xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002279xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002280
2281/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2282
Lev Walkin8a99bf72004-09-10 06:07:39 +00002283static int check_permitted_alphabet_11(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002284 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002285 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002286 const uint8_t *ch = st->buf;
2287 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002288
2289 for(; ch < end; ch++) {
2290 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002291 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002292 }
Lev Walkin775885e2004-08-22 12:47:03 +00002293 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002294}
2295
2296
2297/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2298
2299int
Lev Walkindfae9752004-09-29 13:19:37 +00002300Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002301 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002302 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002303
2304 if(!sptr) {
2305 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002306 "%s: value not given (%s:%d)",
2307 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002308 return -1;
2309 }
2310
2311
Lev Walkin8a99bf72004-09-10 06:07:39 +00002312 if(!check_permitted_alphabet_11(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002313 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002314 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002315 } else {
2316 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002317 "%s: constraint failed (%s:%d)",
2318 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002319 return -1;
2320 }
2321}
2322
2323/*
2324 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002325 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002326 */
2327static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002328Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002329 td->free_struct = asn_DEF_PER_Visible.free_struct;
2330 td->print_struct = asn_DEF_PER_Visible.print_struct;
2331 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2332 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2333 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2334 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2335 td->elements = asn_DEF_PER_Visible.elements;
2336 td->elements_count = asn_DEF_PER_Visible.elements_count;
2337 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002338}
2339
Lev Walkina9cc46e2004-09-22 16:06:28 +00002340void
Lev Walkindfae9752004-09-29 13:19:37 +00002341Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002342 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002343 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002344 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002345}
2346
2347int
Lev Walkindfae9752004-09-29 13:19:37 +00002348Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002349 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002350 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002351 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2352}
2353
Lev Walkindc06f6b2004-10-20 15:50:55 +00002354asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002355Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002356 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002357 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002358 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002359}
2360
2361asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002362Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002363 void *structure, int tag_mode, ber_tlv_tag_t tag,
2364 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002365 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002366 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2367}
2368
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002369asn_dec_rval_t
2370Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2371 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002372 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002373 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2374}
2375
Lev Walkina9cc46e2004-09-22 16:06:28 +00002376asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002377Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002378 int ilevel, enum xer_encoder_flags_e flags,
2379 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002380 Neither_SIZE_nor_FROM_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002381 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002382}
2383
2384
2385/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2386
Lev Walkine0272aa2005-03-04 11:26:08 +00002387static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002388 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002389};
Lev Walkindfae9752004-09-29 13:19:37 +00002390asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002391 "Neither-SIZE-nor-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002392 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002393 Neither_SIZE_nor_FROM_free,
2394 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002395 Neither_SIZE_nor_FROM_constraint,
2396 Neither_SIZE_nor_FROM_decode_ber,
2397 Neither_SIZE_nor_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002398 Neither_SIZE_nor_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002399 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002400 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002401 asn_DEF_Neither_SIZE_nor_FROM_0_tags,
2402 sizeof(asn_DEF_Neither_SIZE_nor_FROM_0_tags)
2403 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_0_tags[0]), /* 1 */
2404 asn_DEF_Neither_SIZE_nor_FROM_0_tags, /* Same as above */
2405 sizeof(asn_DEF_Neither_SIZE_nor_FROM_0_tags)
2406 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002407 0, 0, /* No members */
2408 0 /* No specifics */
2409};
2410
2411
Lev Walkin55cc44a2004-10-03 09:14:32 +00002412/*** <<< INCLUDES [Utf8-4] >>> ***/
2413
2414#include <UTF8String.h>
2415
2416/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2417
Lev Walkin55cc44a2004-10-03 09:14:32 +00002418typedef UTF8String_t Utf8_4_t;
2419
2420/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2421
2422extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2423asn_struct_free_f Utf8_4_free;
2424asn_struct_print_f Utf8_4_print;
2425asn_constr_check_f Utf8_4_constraint;
2426ber_type_decoder_f Utf8_4_decode_ber;
2427der_type_encoder_f Utf8_4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002428xer_type_decoder_f Utf8_4_decode_xer;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002429xer_type_encoder_f Utf8_4_encode_xer;
2430
2431/*** <<< CTABLES [Utf8-4] >>> ***/
2432
2433static int check_permitted_alphabet_12(const void *sptr) {
2434 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2435 return -1; /* Alphabet (sic!) test failed. */
2436
2437 return 0;
2438}
2439
2440
2441/*** <<< CODE [Utf8-4] >>> ***/
2442
2443int
2444Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
2445 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002446 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002447
2448 if(!sptr) {
2449 _ASN_ERRLOG(app_errlog, app_key,
2450 "%s: value not given (%s:%d)",
2451 td->name, __FILE__, __LINE__);
2452 return -1;
2453 }
2454
2455
2456 if(!check_permitted_alphabet_12(sptr)) {
2457 /* Constraint check succeeded */
2458 return 0;
2459 } else {
2460 _ASN_ERRLOG(app_errlog, app_key,
2461 "%s: constraint failed (%s:%d)",
2462 td->name, __FILE__, __LINE__);
2463 return -1;
2464 }
2465}
2466
2467/*
2468 * This type is implemented using UTF8String,
2469 * so here we adjust the DEF accordingly.
2470 */
2471static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002472Utf8_4_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002473 td->free_struct = asn_DEF_UTF8String.free_struct;
2474 td->print_struct = asn_DEF_UTF8String.print_struct;
2475 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2476 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2477 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2478 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
2479 td->elements = asn_DEF_UTF8String.elements;
2480 td->elements_count = asn_DEF_UTF8String.elements_count;
2481 td->specifics = asn_DEF_UTF8String.specifics;
2482}
2483
2484void
2485Utf8_4_free(asn_TYPE_descriptor_t *td,
2486 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002487 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002488 td->free_struct(td, struct_ptr, contents_only);
2489}
2490
2491int
2492Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2493 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002494 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002495 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2496}
2497
Lev Walkindc06f6b2004-10-20 15:50:55 +00002498asn_dec_rval_t
Lev Walkin55cc44a2004-10-03 09:14:32 +00002499Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2500 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002501 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002502 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2503}
2504
2505asn_enc_rval_t
2506Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2507 void *structure, int tag_mode, ber_tlv_tag_t tag,
2508 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002509 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002510 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2511}
2512
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002513asn_dec_rval_t
2514Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2515 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002516 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002517 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2518}
2519
Lev Walkin55cc44a2004-10-03 09:14:32 +00002520asn_enc_rval_t
2521Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2522 int ilevel, enum xer_encoder_flags_e flags,
2523 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002524 Utf8_4_0_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002525 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2526}
2527
2528
2529/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2530
Lev Walkine0272aa2005-03-04 11:26:08 +00002531static ber_tlv_tag_t asn_DEF_Utf8_4_0_tags[] = {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002532 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2533};
2534asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2535 "Utf8-4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002536 "Utf8-4",
Lev Walkin55cc44a2004-10-03 09:14:32 +00002537 Utf8_4_free,
2538 Utf8_4_print,
2539 Utf8_4_constraint,
2540 Utf8_4_decode_ber,
2541 Utf8_4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002542 Utf8_4_decode_xer,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002543 Utf8_4_encode_xer,
2544 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002545 asn_DEF_Utf8_4_0_tags,
2546 sizeof(asn_DEF_Utf8_4_0_tags)
2547 /sizeof(asn_DEF_Utf8_4_0_tags[0]), /* 1 */
2548 asn_DEF_Utf8_4_0_tags, /* Same as above */
2549 sizeof(asn_DEF_Utf8_4_0_tags)
2550 /sizeof(asn_DEF_Utf8_4_0_tags[0]), /* 1 */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002551 0, 0, /* No members */
2552 0 /* No specifics */
2553};
2554
2555
Lev Walkin006de1c2004-08-20 13:37:45 +00002556/*** <<< INCLUDES [Utf8-3] >>> ***/
2557
2558#include <Utf8-2.h>
2559
2560/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2561
Lev Walkin006de1c2004-08-20 13:37:45 +00002562typedef Utf8_2_t Utf8_3_t;
2563
Lev Walkin006de1c2004-08-20 13:37:45 +00002564/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2565
Lev Walkindfae9752004-09-29 13:19:37 +00002566extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002567asn_struct_free_f Utf8_3_free;
2568asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002569asn_constr_check_f Utf8_3_constraint;
2570ber_type_decoder_f Utf8_3_decode_ber;
2571der_type_encoder_f Utf8_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002572xer_type_decoder_f Utf8_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002573xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002574
2575/*** <<< CTABLES [Utf8-3] >>> ***/
2576
Lev Walkin55cc44a2004-10-03 09:14:32 +00002577static int permitted_alphabet_table_13[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000025780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
25820,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
25831,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
25840,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
25851,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2586};
2587
Lev Walkin55cc44a2004-10-03 09:14:32 +00002588static int check_permitted_alphabet_13(const void *sptr) {
2589 int *table = permitted_alphabet_table_13;
Lev Walkin006de1c2004-08-20 13:37:45 +00002590 /* The underlying type is UTF8String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002591 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002592 const uint8_t *ch = st->buf;
2593 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002594
2595 for(; ch < end; ch++) {
2596 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002597 if(cv >= 0x80) return -1;
2598 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002599 }
Lev Walkin775885e2004-08-22 12:47:03 +00002600 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002601}
2602
2603
2604/*** <<< CODE [Utf8-3] >>> ***/
2605
2606int
Lev Walkindfae9752004-09-29 13:19:37 +00002607Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002608 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002609 const Utf8_2_t *st = (const Utf8_2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002610 size_t size;
2611
2612 if(!sptr) {
2613 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002614 "%s: value not given (%s:%d)",
2615 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002616 return -1;
2617 }
2618
Lev Walkinfac2e942004-10-02 16:33:46 +00002619 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002620 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002621 _ASN_ERRLOG(app_errlog, app_key,
2622 "%s: UTF-8: broken encoding (%s:%d)",
2623 td->name, __FILE__, __LINE__);
2624 return -1;
2625 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002626
2627 if((size >= 1 && size <= 2)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002628 && !check_permitted_alphabet_13(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002629 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002630 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002631 } else {
2632 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002633 "%s: constraint failed (%s:%d)",
2634 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002635 return -1;
2636 }
2637}
2638
2639/*
2640 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002641 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002642 */
2643static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002644Utf8_3_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002645 td->free_struct = asn_DEF_Utf8_2.free_struct;
2646 td->print_struct = asn_DEF_Utf8_2.print_struct;
2647 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
2648 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
2649 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
2650 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
2651 td->elements = asn_DEF_Utf8_2.elements;
2652 td->elements_count = asn_DEF_Utf8_2.elements_count;
2653 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002654}
2655
Lev Walkina9cc46e2004-09-22 16:06:28 +00002656void
Lev Walkindfae9752004-09-29 13:19:37 +00002657Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002658 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002659 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002660 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002661}
2662
2663int
Lev Walkindfae9752004-09-29 13:19:37 +00002664Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002665 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002666 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002667 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2668}
2669
Lev Walkindc06f6b2004-10-20 15:50:55 +00002670asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002671Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002672 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002673 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002674 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002675}
2676
2677asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002678Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002679 void *structure, int tag_mode, ber_tlv_tag_t tag,
2680 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002681 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002682 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2683}
2684
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002685asn_dec_rval_t
2686Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2687 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002688 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002689 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2690}
2691
Lev Walkina9cc46e2004-09-22 16:06:28 +00002692asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002693Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002694 int ilevel, enum xer_encoder_flags_e flags,
2695 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002696 Utf8_3_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002697 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002698}
2699
2700
2701/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2702
Lev Walkine0272aa2005-03-04 11:26:08 +00002703static ber_tlv_tag_t asn_DEF_Utf8_3_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002704 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002705};
Lev Walkindfae9752004-09-29 13:19:37 +00002706asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002707 "Utf8-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002708 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002709 Utf8_3_free,
2710 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002711 Utf8_3_constraint,
2712 Utf8_3_decode_ber,
2713 Utf8_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002714 Utf8_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002715 Utf8_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002716 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002717 asn_DEF_Utf8_3_0_tags,
2718 sizeof(asn_DEF_Utf8_3_0_tags)
2719 /sizeof(asn_DEF_Utf8_3_0_tags[0]), /* 1 */
2720 asn_DEF_Utf8_3_0_tags, /* Same as above */
2721 sizeof(asn_DEF_Utf8_3_0_tags)
2722 /sizeof(asn_DEF_Utf8_3_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002723 0, 0, /* No members */
2724 0 /* No specifics */
2725};
2726
2727
2728/*** <<< INCLUDES [Utf8-2] >>> ***/
2729
2730#include <Utf8-1.h>
2731
2732/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2733
Lev Walkin006de1c2004-08-20 13:37:45 +00002734typedef Utf8_1_t Utf8_2_t;
2735
Lev Walkin006de1c2004-08-20 13:37:45 +00002736/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2737
Lev Walkindfae9752004-09-29 13:19:37 +00002738extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002739asn_struct_free_f Utf8_2_free;
2740asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002741asn_constr_check_f Utf8_2_constraint;
2742ber_type_decoder_f Utf8_2_decode_ber;
2743der_type_encoder_f Utf8_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002744xer_type_decoder_f Utf8_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002745xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002746
2747/*** <<< CODE [Utf8-2] >>> ***/
2748
2749int
Lev Walkindfae9752004-09-29 13:19:37 +00002750Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002751 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002752 const Utf8_1_t *st = (const Utf8_1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002753 size_t size;
2754
2755 if(!sptr) {
2756 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002757 "%s: value not given (%s:%d)",
2758 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002759 return -1;
2760 }
2761
Lev Walkinfac2e942004-10-02 16:33:46 +00002762 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002763 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002764 _ASN_ERRLOG(app_errlog, app_key,
2765 "%s: UTF-8: broken encoding (%s:%d)",
2766 td->name, __FILE__, __LINE__);
2767 return -1;
2768 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002769
2770 if((size >= 1 && size <= 2)) {
2771 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002772 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002773 } else {
2774 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002775 "%s: constraint failed (%s:%d)",
2776 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002777 return -1;
2778 }
2779}
2780
2781/*
2782 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00002783 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002784 */
2785static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002786Utf8_2_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002787 td->free_struct = asn_DEF_Utf8_1.free_struct;
2788 td->print_struct = asn_DEF_Utf8_1.print_struct;
2789 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
2790 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
2791 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
2792 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
2793 td->elements = asn_DEF_Utf8_1.elements;
2794 td->elements_count = asn_DEF_Utf8_1.elements_count;
2795 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002796}
2797
Lev Walkina9cc46e2004-09-22 16:06:28 +00002798void
Lev Walkindfae9752004-09-29 13:19:37 +00002799Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002800 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002801 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002802 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002803}
2804
2805int
Lev Walkindfae9752004-09-29 13:19:37 +00002806Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002807 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002808 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002809 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2810}
2811
Lev Walkindc06f6b2004-10-20 15:50:55 +00002812asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002813Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002814 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002815 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002816 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002817}
2818
2819asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002820Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002821 void *structure, int tag_mode, ber_tlv_tag_t tag,
2822 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002823 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002824 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2825}
2826
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002827asn_dec_rval_t
2828Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2829 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002830 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002831 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2832}
2833
Lev Walkina9cc46e2004-09-22 16:06:28 +00002834asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002835Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002836 int ilevel, enum xer_encoder_flags_e flags,
2837 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00002838 Utf8_2_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002839 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002840}
2841
2842
2843/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2844
Lev Walkine0272aa2005-03-04 11:26:08 +00002845static ber_tlv_tag_t asn_DEF_Utf8_2_0_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002846 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002847};
Lev Walkindfae9752004-09-29 13:19:37 +00002848asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002849 "Utf8-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002850 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002851 Utf8_2_free,
2852 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002853 Utf8_2_constraint,
2854 Utf8_2_decode_ber,
2855 Utf8_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002856 Utf8_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002857 Utf8_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002858 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00002859 asn_DEF_Utf8_2_0_tags,
2860 sizeof(asn_DEF_Utf8_2_0_tags)
2861 /sizeof(asn_DEF_Utf8_2_0_tags[0]), /* 1 */
2862 asn_DEF_Utf8_2_0_tags, /* Same as above */
2863 sizeof(asn_DEF_Utf8_2_0_tags)
2864 /sizeof(asn_DEF_Utf8_2_0_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002865 0, 0, /* No members */
2866 0 /* No specifics */
2867};
2868
2869
2870/*** <<< INCLUDES [Utf8-1] >>> ***/
2871
2872#include <UTF8String.h>
2873
2874/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2875
Lev Walkin006de1c2004-08-20 13:37:45 +00002876typedef UTF8String_t Utf8_1_t;
2877
Lev Walkin006de1c2004-08-20 13:37:45 +00002878/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2879
Lev Walkin154aa182004-09-26 13:12:56 +00002880/* This type is equivalent to UTF8String */
Lev Walkindfae9752004-09-29 13:19:37 +00002881#define asn_DEF_Utf8_1 asn_DEF_UTF8String
Lev Walkin006de1c2004-08-20 13:37:45 +00002882
2883/*** <<< CODE [Utf8-1] >>> ***/
2884
Lev Walkin154aa182004-09-26 13:12:56 +00002885/* This type is equivalent to UTF8String */
Lev Walkin006de1c2004-08-20 13:37:45 +00002886
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002887
2888/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
2889
2890#include <Identifier.h>
2891
2892/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
2893
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002894typedef Identifier_t VisibleIdentifier_t;
2895
2896/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
2897
Lev Walkin154aa182004-09-26 13:12:56 +00002898/* This type is equivalent to Identifier */
Lev Walkindfae9752004-09-29 13:19:37 +00002899#define asn_DEF_VisibleIdentifier asn_DEF_Identifier
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002900
Lev Walkin154aa182004-09-26 13:12:56 +00002901/*** <<< CODE [VisibleIdentifier] >>> ***/
2902
2903/* This type is equivalent to Identifier */
2904
2905
2906/*** <<< INCLUDES [Identifier] >>> ***/
2907
2908#include <VisibleString.h>
2909
2910/*** <<< TYPE-DECLS [Identifier] >>> ***/
2911
Lev Walkin154aa182004-09-26 13:12:56 +00002912typedef VisibleString_t Identifier_t;
2913
2914/*** <<< FUNC-DECLS [Identifier] >>> ***/
2915
Lev Walkindfae9752004-09-29 13:19:37 +00002916extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00002917asn_struct_free_f Identifier_free;
2918asn_struct_print_f Identifier_print;
2919asn_constr_check_f Identifier_constraint;
2920ber_type_decoder_f Identifier_decode_ber;
2921der_type_encoder_f Identifier_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002922xer_type_decoder_f Identifier_decode_xer;
Lev Walkin154aa182004-09-26 13:12:56 +00002923xer_type_encoder_f Identifier_encode_xer;
2924
2925/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002926
Lev Walkin55cc44a2004-10-03 09:14:32 +00002927static int permitted_alphabet_table_15[256] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +000029280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
29290,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
29300,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
29311,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
29320,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
29331,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
29340,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
29351,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2936};
2937
Lev Walkin55cc44a2004-10-03 09:14:32 +00002938static int check_permitted_alphabet_15(const void *sptr) {
2939 int *table = permitted_alphabet_table_15;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002940 /* The underlying type is VisibleString */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002941 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002942 const uint8_t *ch = st->buf;
2943 const uint8_t *end = ch + st->size;
2944
2945 for(; ch < end; ch++) {
2946 uint8_t cv = *ch;
2947 if(!table[cv]) return -1;
2948 }
2949 return 0;
2950}
2951
2952
Lev Walkin154aa182004-09-26 13:12:56 +00002953/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002954
2955int
Lev Walkindfae9752004-09-29 13:19:37 +00002956Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002957 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002958 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002959 size_t size;
2960
2961 if(!sptr) {
2962 _ASN_ERRLOG(app_errlog, app_key,
2963 "%s: value not given (%s:%d)",
2964 td->name, __FILE__, __LINE__);
2965 return -1;
2966 }
2967
2968 size = st->size;
2969
2970 if((size >= 1 && size <= 32)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002971 && !check_permitted_alphabet_15(sptr)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002972 /* Constraint check succeeded */
2973 return 0;
2974 } else {
2975 _ASN_ERRLOG(app_errlog, app_key,
2976 "%s: constraint failed (%s:%d)",
2977 td->name, __FILE__, __LINE__);
2978 return -1;
2979 }
2980}
2981
2982/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002983 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00002984 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002985 */
2986static void
Lev Walkine0272aa2005-03-04 11:26:08 +00002987Identifier_0_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002988 td->free_struct = asn_DEF_VisibleString.free_struct;
2989 td->print_struct = asn_DEF_VisibleString.print_struct;
2990 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
2991 td->der_encoder = asn_DEF_VisibleString.der_encoder;
2992 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
2993 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
2994 td->elements = asn_DEF_VisibleString.elements;
2995 td->elements_count = asn_DEF_VisibleString.elements_count;
2996 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002997}
2998
Lev Walkina9cc46e2004-09-22 16:06:28 +00002999void
Lev Walkindfae9752004-09-29 13:19:37 +00003000Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003001 void *struct_ptr, int contents_only) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003002 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003003 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003004}
3005
3006int
Lev Walkindfae9752004-09-29 13:19:37 +00003007Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003008 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003009 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003010 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3011}
3012
Lev Walkindc06f6b2004-10-20 15:50:55 +00003013asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003014Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003015 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003016 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003017 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003018}
3019
3020asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003021Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003022 void *structure, int tag_mode, ber_tlv_tag_t tag,
3023 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003024 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003025 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3026}
3027
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003028asn_dec_rval_t
3029Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3030 void **structure, const char *opt_mname, void *bufptr, size_t size) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003031 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003032 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3033}
3034
Lev Walkina9cc46e2004-09-22 16:06:28 +00003035asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003036Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003037 int ilevel, enum xer_encoder_flags_e flags,
3038 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0272aa2005-03-04 11:26:08 +00003039 Identifier_0_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003040 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003041}
3042
3043
3044/*** <<< STAT-DEFS [Identifier] >>> ***/
3045
Lev Walkine0272aa2005-03-04 11:26:08 +00003046static ber_tlv_tag_t asn_DEF_Identifier_0_tags[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003047 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3048};
Lev Walkindfae9752004-09-29 13:19:37 +00003049asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003050 "Identifier",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003051 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003052 Identifier_free,
3053 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003054 Identifier_constraint,
3055 Identifier_decode_ber,
3056 Identifier_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003057 Identifier_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003058 Identifier_encode_xer,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003059 0, /* Use generic outmost tag fetcher */
Lev Walkine0272aa2005-03-04 11:26:08 +00003060 asn_DEF_Identifier_0_tags,
3061 sizeof(asn_DEF_Identifier_0_tags)
3062 /sizeof(asn_DEF_Identifier_0_tags[0]), /* 1 */
3063 asn_DEF_Identifier_0_tags, /* Same as above */
3064 sizeof(asn_DEF_Identifier_0_tags)
3065 /sizeof(asn_DEF_Identifier_0_tags[0]), /* 1 */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003066 0, 0, /* No members */
3067 0 /* No specifics */
3068};
3069