blob: 80c6fc823a0932b3b1a2a5cfabe3edd56d529000 [file] [log] [blame]
Lev Walkin006de1c2004-08-20 13:37:45 +00001
2/*** <<< INCLUDES [Int1] >>> ***/
3
4#include <INTEGER.h>
5
6/*** <<< TYPE-DECLS [Int1] >>> ***/
7
Lev Walkin006de1c2004-08-20 13:37:45 +00008typedef INTEGER_t Int1_t;
9
Lev Walkin006de1c2004-08-20 13:37:45 +000010/*** <<< FUNC-DECLS [Int1] >>> ***/
11
Lev Walkincaf0d5a2005-03-04 23:48:19 +000012extern asn_TYPE_descriptor_t asn_DEF_Int1;
13asn_struct_free_f Int1_free;
14asn_struct_print_f Int1_print;
15asn_constr_check_f Int1_constraint;
16ber_type_decoder_f Int1_decode_ber;
17der_type_encoder_f Int1_encode_der;
18xer_type_decoder_f Int1_decode_xer;
19xer_type_encoder_f Int1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +000020
21/*** <<< CODE [Int1] >>> ***/
22
Lev Walkincaf0d5a2005-03-04 23:48:19 +000023int
24Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000025 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +000026 /* Replace with underlying type checker */
27 td->check_constraints = asn_DEF_INTEGER.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +000028 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000029}
30
31/*
32 * This type is implemented using INTEGER,
33 * so here we adjust the DEF accordingly.
34 */
35static void
Lev Walkine8318b82005-03-06 09:29:03 +000036Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +000037 td->free_struct = asn_DEF_INTEGER.free_struct;
38 td->print_struct = asn_DEF_INTEGER.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -080039 td->check_constraints = asn_DEF_INTEGER.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +000040 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
41 td->der_encoder = asn_DEF_INTEGER.der_encoder;
42 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
43 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +000044 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +000045 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +000046 if(!td->per_constraints)
47 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +000048 td->elements = asn_DEF_INTEGER.elements;
49 td->elements_count = asn_DEF_INTEGER.elements_count;
50 td->specifics = asn_DEF_INTEGER.specifics;
51}
52
53void
54Int1_free(asn_TYPE_descriptor_t *td,
55 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +000056 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000057 td->free_struct(td, struct_ptr, contents_only);
58}
59
60int
61Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
62 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000063 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000064 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
65}
66
67asn_dec_rval_t
68Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000069 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +000070 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000071 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
72}
73
74asn_enc_rval_t
75Int1_encode_der(asn_TYPE_descriptor_t *td,
76 void *structure, int tag_mode, ber_tlv_tag_t tag,
77 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000078 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000079 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
80}
81
82asn_dec_rval_t
83Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000084 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +000085 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000086 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
87}
88
89asn_enc_rval_t
90Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
91 int ilevel, enum xer_encoder_flags_e flags,
92 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000093 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000094 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
95}
96
97
98/*** <<< STAT-DEFS [Int1] >>> ***/
99
Lev Walkina7591b52014-10-12 18:37:35 -0700100static const ber_tlv_tag_t asn_DEF_Int1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000101 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
102};
103asn_TYPE_descriptor_t asn_DEF_Int1 = {
104 "Int1",
105 "Int1",
106 Int1_free,
107 Int1_print,
108 Int1_constraint,
109 Int1_decode_ber,
110 Int1_encode_der,
111 Int1_decode_xer,
112 Int1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000113 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000114 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000115 asn_DEF_Int1_tags_1,
116 sizeof(asn_DEF_Int1_tags_1)
117 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
118 asn_DEF_Int1_tags_1, /* Same as above */
119 sizeof(asn_DEF_Int1_tags_1)
120 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
121 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000122 0, 0, /* No members */
123 0 /* No specifics */
124};
Lev Walkin006de1c2004-08-20 13:37:45 +0000125
126
127/*** <<< INCLUDES [Int2] >>> ***/
128
Lev Walkin22b5ed42006-09-13 02:51:20 +0000129#include "Int1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000130
131/*** <<< TYPE-DECLS [Int2] >>> ***/
132
Lev Walkin006de1c2004-08-20 13:37:45 +0000133typedef Int1_t Int2_t;
134
Lev Walkin006de1c2004-08-20 13:37:45 +0000135/*** <<< FUNC-DECLS [Int2] >>> ***/
136
Lev Walkindfae9752004-09-29 13:19:37 +0000137extern asn_TYPE_descriptor_t asn_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000138asn_struct_free_f Int2_free;
139asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000140asn_constr_check_f Int2_constraint;
141ber_type_decoder_f Int2_decode_ber;
142der_type_encoder_f Int2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000143xer_type_decoder_f Int2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000144xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000145
146/*** <<< CODE [Int2] >>> ***/
147
148int
Lev Walkindfae9752004-09-29 13:19:37 +0000149Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000150 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000151 const Int1_t *st = (const Int1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000152 long value;
153
154 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000155 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000156 "%s: value not given (%s:%d)",
157 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000158 return -1;
159 }
160
Lev Walkin44467432004-09-07 06:43:57 +0000161 /* Check if the sign bit is present */
162 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000163
164 if((value >= 0)) {
165 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000166 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000167 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000168 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000169 "%s: constraint failed (%s:%d)",
170 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000171 return -1;
172 }
173}
174
175/*
176 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000177 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000178 */
179static void
Lev Walkine8318b82005-03-06 09:29:03 +0000180Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000181 td->free_struct = asn_DEF_Int1.free_struct;
182 td->print_struct = asn_DEF_Int1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800183 td->check_constraints = asn_DEF_Int1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000184 td->ber_decoder = asn_DEF_Int1.ber_decoder;
185 td->der_encoder = asn_DEF_Int1.der_encoder;
186 td->xer_decoder = asn_DEF_Int1.xer_decoder;
187 td->xer_encoder = asn_DEF_Int1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000188 td->uper_decoder = asn_DEF_Int1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000189 td->uper_encoder = asn_DEF_Int1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000190 if(!td->per_constraints)
191 td->per_constraints = asn_DEF_Int1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000192 td->elements = asn_DEF_Int1.elements;
193 td->elements_count = asn_DEF_Int1.elements_count;
194 td->specifics = asn_DEF_Int1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000195}
196
Lev Walkina9cc46e2004-09-22 16:06:28 +0000197void
Lev Walkindfae9752004-09-29 13:19:37 +0000198Int2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000199 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000200 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000201 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000202}
203
204int
Lev Walkindfae9752004-09-29 13:19:37 +0000205Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000206 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000207 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000208 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
209}
210
Lev Walkindc06f6b2004-10-20 15:50:55 +0000211asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000212Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000213 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000214 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000215 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000216}
217
218asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000219Int2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000220 void *structure, int tag_mode, ber_tlv_tag_t tag,
221 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000222 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000223 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
224}
225
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000226asn_dec_rval_t
227Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000228 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000229 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000230 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
231}
232
Lev Walkina9cc46e2004-09-22 16:06:28 +0000233asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000234Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000235 int ilevel, enum xer_encoder_flags_e flags,
236 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000237 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000238 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000239}
240
241
242/*** <<< STAT-DEFS [Int2] >>> ***/
243
Lev Walkina7591b52014-10-12 18:37:35 -0700244static const ber_tlv_tag_t asn_DEF_Int2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000245 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000246};
Lev Walkindfae9752004-09-29 13:19:37 +0000247asn_TYPE_descriptor_t asn_DEF_Int2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000248 "Int2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000249 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000250 Int2_free,
251 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000252 Int2_constraint,
253 Int2_decode_ber,
254 Int2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000255 Int2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000256 Int2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000257 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000258 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000259 asn_DEF_Int2_tags_1,
260 sizeof(asn_DEF_Int2_tags_1)
261 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
262 asn_DEF_Int2_tags_1, /* Same as above */
263 sizeof(asn_DEF_Int2_tags_1)
264 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
265 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000266 0, 0, /* No members */
267 0 /* No specifics */
268};
269
270
271/*** <<< INCLUDES [Int3] >>> ***/
272
Lev Walkin22b5ed42006-09-13 02:51:20 +0000273#include "Int2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000274
275/*** <<< TYPE-DECLS [Int3] >>> ***/
276
Lev Walkin006de1c2004-08-20 13:37:45 +0000277typedef Int2_t Int3_t;
278
Lev Walkin006de1c2004-08-20 13:37:45 +0000279/*** <<< FUNC-DECLS [Int3] >>> ***/
280
Lev Walkindfae9752004-09-29 13:19:37 +0000281extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000282asn_struct_free_f Int3_free;
283asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000284asn_constr_check_f Int3_constraint;
285ber_type_decoder_f Int3_decode_ber;
286der_type_encoder_f Int3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000287xer_type_decoder_f Int3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000288xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000289
290/*** <<< CODE [Int3] >>> ***/
291
292int
Lev Walkindfae9752004-09-29 13:19:37 +0000293Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000294 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000295 const Int2_t *st = (const Int2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000296 long value;
297
298 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000299 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000300 "%s: value not given (%s:%d)",
301 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000302 return -1;
303 }
304
Lev Walkindfae9752004-09-29 13:19:37 +0000305 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000306 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000307 "%s: value too large (%s:%d)",
308 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000309 return -1;
310 }
311
312 if((value >= 0 && value <= 10)) {
313 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000314 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000315 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000316 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000317 "%s: constraint failed (%s:%d)",
318 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000319 return -1;
320 }
321}
322
323/*
324 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000325 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000326 */
327static void
Lev Walkine8318b82005-03-06 09:29:03 +0000328Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000329 td->free_struct = asn_DEF_Int2.free_struct;
330 td->print_struct = asn_DEF_Int2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800331 td->check_constraints = asn_DEF_Int2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000332 td->ber_decoder = asn_DEF_Int2.ber_decoder;
333 td->der_encoder = asn_DEF_Int2.der_encoder;
334 td->xer_decoder = asn_DEF_Int2.xer_decoder;
335 td->xer_encoder = asn_DEF_Int2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000336 td->uper_decoder = asn_DEF_Int2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000337 td->uper_encoder = asn_DEF_Int2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000338 if(!td->per_constraints)
339 td->per_constraints = asn_DEF_Int2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000340 td->elements = asn_DEF_Int2.elements;
341 td->elements_count = asn_DEF_Int2.elements_count;
342 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000343}
344
Lev Walkina9cc46e2004-09-22 16:06:28 +0000345void
Lev Walkindfae9752004-09-29 13:19:37 +0000346Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000347 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000348 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000349 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000350}
351
352int
Lev Walkindfae9752004-09-29 13:19:37 +0000353Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000354 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000355 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000356 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
357}
358
Lev Walkindc06f6b2004-10-20 15:50:55 +0000359asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000360Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000361 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000362 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000363 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000364}
365
366asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000367Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000368 void *structure, int tag_mode, ber_tlv_tag_t tag,
369 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000370 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000371 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
372}
373
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000374asn_dec_rval_t
375Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000376 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000377 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000378 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
379}
380
Lev Walkina9cc46e2004-09-22 16:06:28 +0000381asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000382Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000383 int ilevel, enum xer_encoder_flags_e flags,
384 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000385 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000386 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000387}
388
389
390/*** <<< STAT-DEFS [Int3] >>> ***/
391
Lev Walkina7591b52014-10-12 18:37:35 -0700392static const ber_tlv_tag_t asn_DEF_Int3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000393 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000394};
Lev Walkindfae9752004-09-29 13:19:37 +0000395asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000396 "Int3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000397 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000398 Int3_free,
399 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000400 Int3_constraint,
401 Int3_decode_ber,
402 Int3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000403 Int3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000404 Int3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000405 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000406 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000407 asn_DEF_Int3_tags_1,
408 sizeof(asn_DEF_Int3_tags_1)
409 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
410 asn_DEF_Int3_tags_1, /* Same as above */
411 sizeof(asn_DEF_Int3_tags_1)
412 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
413 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000414 0, 0, /* No members */
415 0 /* No specifics */
416};
417
418
419/*** <<< INCLUDES [Int4] >>> ***/
420
Lev Walkin22b5ed42006-09-13 02:51:20 +0000421#include "Int3.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000422
423/*** <<< TYPE-DECLS [Int4] >>> ***/
424
Lev Walkin006de1c2004-08-20 13:37:45 +0000425typedef Int3_t Int4_t;
426
Lev Walkin006de1c2004-08-20 13:37:45 +0000427/*** <<< FUNC-DECLS [Int4] >>> ***/
428
Lev Walkindfae9752004-09-29 13:19:37 +0000429extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000430asn_struct_free_f Int4_free;
431asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000432asn_constr_check_f Int4_constraint;
433ber_type_decoder_f Int4_decode_ber;
434der_type_encoder_f Int4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000435xer_type_decoder_f Int4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000436xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000437
438/*** <<< CODE [Int4] >>> ***/
439
440int
Lev Walkindfae9752004-09-29 13:19:37 +0000441Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000442 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000443 const Int3_t *st = (const Int3_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000444 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000445
446 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000447 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000448 "%s: value not given (%s:%d)",
449 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000450 return -1;
451 }
452
Lev Walkindfae9752004-09-29 13:19:37 +0000453 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000454 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000455 "%s: value too large (%s:%d)",
456 td->name, __FILE__, __LINE__);
457 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000458 }
459
Lev Walkind35c8b52004-08-25 02:08:08 +0000460 if((value >= 1 && value <= 10)) {
461 /* Constraint check succeeded */
462 return 0;
463 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000464 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000465 "%s: constraint failed (%s:%d)",
466 td->name, __FILE__, __LINE__);
467 return -1;
468 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000469}
470
471/*
472 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000473 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000474 */
475static void
Lev Walkine8318b82005-03-06 09:29:03 +0000476Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000477 td->free_struct = asn_DEF_Int3.free_struct;
478 td->print_struct = asn_DEF_Int3.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800479 td->check_constraints = asn_DEF_Int3.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000480 td->ber_decoder = asn_DEF_Int3.ber_decoder;
481 td->der_encoder = asn_DEF_Int3.der_encoder;
482 td->xer_decoder = asn_DEF_Int3.xer_decoder;
483 td->xer_encoder = asn_DEF_Int3.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000484 td->uper_decoder = asn_DEF_Int3.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000485 td->uper_encoder = asn_DEF_Int3.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000486 if(!td->per_constraints)
487 td->per_constraints = asn_DEF_Int3.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000488 td->elements = asn_DEF_Int3.elements;
489 td->elements_count = asn_DEF_Int3.elements_count;
490 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000491}
492
Lev Walkina9cc46e2004-09-22 16:06:28 +0000493void
Lev Walkindfae9752004-09-29 13:19:37 +0000494Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000495 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000496 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000497 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000498}
499
500int
Lev Walkindfae9752004-09-29 13:19:37 +0000501Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000502 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000503 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000504 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
505}
506
Lev Walkindc06f6b2004-10-20 15:50:55 +0000507asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000508Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000509 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000510 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000511 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000512}
513
514asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000515Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000516 void *structure, int tag_mode, ber_tlv_tag_t tag,
517 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000518 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000519 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
520}
521
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000522asn_dec_rval_t
523Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000524 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000525 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000526 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
527}
528
Lev Walkina9cc46e2004-09-22 16:06:28 +0000529asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000530Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000531 int ilevel, enum xer_encoder_flags_e flags,
532 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000533 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000534 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000535}
536
537
538/*** <<< STAT-DEFS [Int4] >>> ***/
539
Lev Walkina7591b52014-10-12 18:37:35 -0700540static const ber_tlv_tag_t asn_DEF_Int4_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000541 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000542};
Lev Walkindfae9752004-09-29 13:19:37 +0000543asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000544 "Int4",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000545 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000546 Int4_free,
547 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000548 Int4_constraint,
549 Int4_decode_ber,
550 Int4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000551 Int4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000552 Int4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000553 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000554 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000555 asn_DEF_Int4_tags_1,
556 sizeof(asn_DEF_Int4_tags_1)
557 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
558 asn_DEF_Int4_tags_1, /* Same as above */
559 sizeof(asn_DEF_Int4_tags_1)
560 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
561 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000562 0, 0, /* No members */
563 0 /* No specifics */
564};
565
566
567/*** <<< INCLUDES [Int5] >>> ***/
568
Lev Walkin22b5ed42006-09-13 02:51:20 +0000569#include "Int4.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000570
571/*** <<< TYPE-DECLS [Int5] >>> ***/
572
Lev Walkin006de1c2004-08-20 13:37:45 +0000573typedef Int4_t Int5_t;
574
Lev Walkin006de1c2004-08-20 13:37:45 +0000575/*** <<< FUNC-DECLS [Int5] >>> ***/
576
Lev Walkindfae9752004-09-29 13:19:37 +0000577extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000578asn_struct_free_f Int5_free;
579asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000580asn_constr_check_f Int5_constraint;
581ber_type_decoder_f Int5_decode_ber;
582der_type_encoder_f Int5_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000583xer_type_decoder_f Int5_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000584xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000585
586/*** <<< CODE [Int5] >>> ***/
587
588int
Lev Walkindfae9752004-09-29 13:19:37 +0000589Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000590 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000591 const Int4_t *st = (const Int4_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000592 long value;
593
594 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000595 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000596 "%s: value not given (%s:%d)",
597 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000598 return -1;
599 }
600
Lev Walkindfae9752004-09-29 13:19:37 +0000601 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000602 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000603 "%s: value too large (%s:%d)",
604 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000605 return -1;
606 }
607
608 if((value == 5)) {
609 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000610 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000611 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000612 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000613 "%s: constraint failed (%s:%d)",
614 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000615 return -1;
616 }
617}
618
619/*
620 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000621 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000622 */
623static void
Lev Walkine8318b82005-03-06 09:29:03 +0000624Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000625 td->free_struct = asn_DEF_Int4.free_struct;
626 td->print_struct = asn_DEF_Int4.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800627 td->check_constraints = asn_DEF_Int4.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000628 td->ber_decoder = asn_DEF_Int4.ber_decoder;
629 td->der_encoder = asn_DEF_Int4.der_encoder;
630 td->xer_decoder = asn_DEF_Int4.xer_decoder;
631 td->xer_encoder = asn_DEF_Int4.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000632 td->uper_decoder = asn_DEF_Int4.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000633 td->uper_encoder = asn_DEF_Int4.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000634 if(!td->per_constraints)
635 td->per_constraints = asn_DEF_Int4.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000636 td->elements = asn_DEF_Int4.elements;
637 td->elements_count = asn_DEF_Int4.elements_count;
638 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000639}
640
Lev Walkina9cc46e2004-09-22 16:06:28 +0000641void
Lev Walkindfae9752004-09-29 13:19:37 +0000642Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000643 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000644 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000645 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000646}
647
648int
Lev Walkindfae9752004-09-29 13:19:37 +0000649Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000650 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000651 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000652 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
653}
654
Lev Walkindc06f6b2004-10-20 15:50:55 +0000655asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000656Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000657 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000658 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000659 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000660}
661
662asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000663Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000664 void *structure, int tag_mode, ber_tlv_tag_t tag,
665 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000666 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000667 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
668}
669
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000670asn_dec_rval_t
671Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000672 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000673 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000674 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
675}
676
Lev Walkina9cc46e2004-09-22 16:06:28 +0000677asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000678Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000679 int ilevel, enum xer_encoder_flags_e flags,
680 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000681 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000682 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000683}
684
685
686/*** <<< STAT-DEFS [Int5] >>> ***/
687
Lev Walkina7591b52014-10-12 18:37:35 -0700688static const ber_tlv_tag_t asn_DEF_Int5_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000689 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000690};
Lev Walkindfae9752004-09-29 13:19:37 +0000691asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000692 "Int5",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000693 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000694 Int5_free,
695 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000696 Int5_constraint,
697 Int5_decode_ber,
698 Int5_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000699 Int5_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000700 Int5_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000701 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000702 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000703 asn_DEF_Int5_tags_1,
704 sizeof(asn_DEF_Int5_tags_1)
705 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
706 asn_DEF_Int5_tags_1, /* Same as above */
707 sizeof(asn_DEF_Int5_tags_1)
708 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
709 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000710 0, 0, /* No members */
711 0 /* No specifics */
712};
713
714
715/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
716
717#include <INTEGER.h>
718
719/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
720
Lev Walkin006de1c2004-08-20 13:37:45 +0000721typedef INTEGER_t ExtensibleExtensions_t;
722
Lev Walkin006de1c2004-08-20 13:37:45 +0000723/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
724
Lev Walkindfae9752004-09-29 13:19:37 +0000725extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000726asn_struct_free_f ExtensibleExtensions_free;
727asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000728asn_constr_check_f ExtensibleExtensions_constraint;
729ber_type_decoder_f ExtensibleExtensions_decode_ber;
730der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000731xer_type_decoder_f ExtensibleExtensions_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000732xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000733
734/*** <<< CODE [ExtensibleExtensions] >>> ***/
735
736int
Lev Walkindfae9752004-09-29 13:19:37 +0000737ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000738 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000739 const INTEGER_t *st = (const INTEGER_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000740 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000741
742 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000743 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000744 "%s: value not given (%s:%d)",
745 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000746 return -1;
747 }
748
Lev Walkindfae9752004-09-29 13:19:37 +0000749 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000750 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000751 "%s: value too large (%s:%d)",
752 td->name, __FILE__, __LINE__);
753 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000754 }
755
Lev Walkind35c8b52004-08-25 02:08:08 +0000756 if((value >= 1 && value <= 256)) {
757 /* Constraint check succeeded */
758 return 0;
759 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000760 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000761 "%s: constraint failed (%s:%d)",
762 td->name, __FILE__, __LINE__);
763 return -1;
764 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000765}
766
767/*
768 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000769 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000770 */
771static void
Lev Walkine8318b82005-03-06 09:29:03 +0000772ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000773 td->free_struct = asn_DEF_INTEGER.free_struct;
774 td->print_struct = asn_DEF_INTEGER.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800775 td->check_constraints = asn_DEF_INTEGER.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000776 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
777 td->der_encoder = asn_DEF_INTEGER.der_encoder;
778 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
779 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000780 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000781 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000782 if(!td->per_constraints)
783 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000784 td->elements = asn_DEF_INTEGER.elements;
785 td->elements_count = asn_DEF_INTEGER.elements_count;
786 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000787}
788
Lev Walkina9cc46e2004-09-22 16:06:28 +0000789void
Lev Walkindfae9752004-09-29 13:19:37 +0000790ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000791 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000792 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000793 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000794}
795
796int
Lev Walkindfae9752004-09-29 13:19:37 +0000797ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000798 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000799 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000800 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
801}
802
Lev Walkindc06f6b2004-10-20 15:50:55 +0000803asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000804ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000805 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000806 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000807 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000808}
809
810asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000811ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000812 void *structure, int tag_mode, ber_tlv_tag_t tag,
813 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000814 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000815 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
816}
817
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000818asn_dec_rval_t
819ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000820 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000821 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000822 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
823}
824
Lev Walkina9cc46e2004-09-22 16:06:28 +0000825asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000826ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000827 int ilevel, enum xer_encoder_flags_e flags,
828 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000829 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000830 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000831}
832
833
834/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
835
Lev Walkina7591b52014-10-12 18:37:35 -0700836static const ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000837 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
838};
Lev Walkindfae9752004-09-29 13:19:37 +0000839asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000840 "ExtensibleExtensions",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000841 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000842 ExtensibleExtensions_free,
843 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000844 ExtensibleExtensions_constraint,
845 ExtensibleExtensions_decode_ber,
846 ExtensibleExtensions_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000847 ExtensibleExtensions_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000848 ExtensibleExtensions_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000849 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000850 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000851 asn_DEF_ExtensibleExtensions_tags_1,
852 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
853 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
854 asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */
855 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
856 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
857 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000858 0, 0, /* No members */
859 0 /* No specifics */
860};
861
862
863/*** <<< INCLUDES [Str1] >>> ***/
864
865#include <IA5String.h>
866
867/*** <<< TYPE-DECLS [Str1] >>> ***/
868
Lev Walkin006de1c2004-08-20 13:37:45 +0000869typedef IA5String_t Str1_t;
870
Lev Walkin006de1c2004-08-20 13:37:45 +0000871/*** <<< FUNC-DECLS [Str1] >>> ***/
872
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000873extern asn_TYPE_descriptor_t asn_DEF_Str1;
874asn_struct_free_f Str1_free;
875asn_struct_print_f Str1_print;
876asn_constr_check_f Str1_constraint;
877ber_type_decoder_f Str1_decode_ber;
878der_type_encoder_f Str1_encode_der;
879xer_type_decoder_f Str1_decode_xer;
880xer_type_encoder_f Str1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000881
882/*** <<< CODE [Str1] >>> ***/
883
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000884int
885Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000886 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000887 /* Replace with underlying type checker */
888 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +0000889 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000890}
891
892/*
893 * This type is implemented using IA5String,
894 * so here we adjust the DEF accordingly.
895 */
896static void
Lev Walkine8318b82005-03-06 09:29:03 +0000897Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000898 td->free_struct = asn_DEF_IA5String.free_struct;
899 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800900 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000901 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
902 td->der_encoder = asn_DEF_IA5String.der_encoder;
903 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
904 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000905 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000906 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000907 if(!td->per_constraints)
908 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000909 td->elements = asn_DEF_IA5String.elements;
910 td->elements_count = asn_DEF_IA5String.elements_count;
911 td->specifics = asn_DEF_IA5String.specifics;
912}
913
914void
915Str1_free(asn_TYPE_descriptor_t *td,
916 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000917 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000918 td->free_struct(td, struct_ptr, contents_only);
919}
920
921int
922Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
923 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000924 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000925 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
926}
927
928asn_dec_rval_t
929Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000930 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000931 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000932 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
933}
934
935asn_enc_rval_t
936Str1_encode_der(asn_TYPE_descriptor_t *td,
937 void *structure, int tag_mode, ber_tlv_tag_t tag,
938 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000939 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000940 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
941}
942
943asn_dec_rval_t
944Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000945 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000946 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000947 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
948}
949
950asn_enc_rval_t
951Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
952 int ilevel, enum xer_encoder_flags_e flags,
953 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000954 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000955 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
956}
957
958
959/*** <<< STAT-DEFS [Str1] >>> ***/
960
Lev Walkina7591b52014-10-12 18:37:35 -0700961static const ber_tlv_tag_t asn_DEF_Str1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000962 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
963};
964asn_TYPE_descriptor_t asn_DEF_Str1 = {
965 "Str1",
966 "Str1",
967 Str1_free,
968 Str1_print,
969 Str1_constraint,
970 Str1_decode_ber,
971 Str1_encode_der,
972 Str1_decode_xer,
973 Str1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000974 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000975 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000976 asn_DEF_Str1_tags_1,
977 sizeof(asn_DEF_Str1_tags_1)
978 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
979 asn_DEF_Str1_tags_1, /* Same as above */
980 sizeof(asn_DEF_Str1_tags_1)
981 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
982 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000983 0, 0, /* No members */
984 0 /* No specifics */
985};
Lev Walkin006de1c2004-08-20 13:37:45 +0000986
987
988/*** <<< INCLUDES [Str2] >>> ***/
989
Lev Walkin22b5ed42006-09-13 02:51:20 +0000990#include "Str1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000991
992/*** <<< TYPE-DECLS [Str2] >>> ***/
993
Lev Walkin006de1c2004-08-20 13:37:45 +0000994typedef Str1_t Str2_t;
995
Lev Walkin006de1c2004-08-20 13:37:45 +0000996/*** <<< FUNC-DECLS [Str2] >>> ***/
997
Lev Walkindfae9752004-09-29 13:19:37 +0000998extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000999asn_struct_free_f Str2_free;
1000asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001001asn_constr_check_f Str2_constraint;
1002ber_type_decoder_f Str2_decode_ber;
1003der_type_encoder_f Str2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001004xer_type_decoder_f Str2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001005xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001006
1007/*** <<< CTABLES [Str2] >>> ***/
1008
Lev Walkine8318b82005-03-06 09:29:03 +00001009static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001010 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001011 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001012 const uint8_t *ch = st->buf;
1013 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001014
1015 for(; ch < end; ch++) {
1016 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001017 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001018 }
Lev Walkin775885e2004-08-22 12:47:03 +00001019 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001020}
1021
1022
1023/*** <<< CODE [Str2] >>> ***/
1024
1025int
Lev Walkindfae9752004-09-29 13:19:37 +00001026Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001027 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001028 const Str1_t *st = (const Str1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001029 size_t size;
1030
1031 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001032 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001033 "%s: value not given (%s:%d)",
1034 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001035 return -1;
1036 }
1037
1038 size = st->size;
1039
1040 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkine8318b82005-03-06 09:29:03 +00001041 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001042 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001043 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001044 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001045 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001046 "%s: constraint failed (%s:%d)",
1047 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001048 return -1;
1049 }
1050}
1051
1052/*
1053 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +00001054 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001055 */
1056static void
Lev Walkine8318b82005-03-06 09:29:03 +00001057Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001058 td->free_struct = asn_DEF_Str1.free_struct;
1059 td->print_struct = asn_DEF_Str1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001060 td->check_constraints = asn_DEF_Str1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001061 td->ber_decoder = asn_DEF_Str1.ber_decoder;
1062 td->der_encoder = asn_DEF_Str1.der_encoder;
1063 td->xer_decoder = asn_DEF_Str1.xer_decoder;
1064 td->xer_encoder = asn_DEF_Str1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001065 td->uper_decoder = asn_DEF_Str1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001066 td->uper_encoder = asn_DEF_Str1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001067 if(!td->per_constraints)
1068 td->per_constraints = asn_DEF_Str1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001069 td->elements = asn_DEF_Str1.elements;
1070 td->elements_count = asn_DEF_Str1.elements_count;
1071 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001072}
1073
Lev Walkina9cc46e2004-09-22 16:06:28 +00001074void
Lev Walkindfae9752004-09-29 13:19:37 +00001075Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001076 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001077 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001078 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001079}
1080
1081int
Lev Walkindfae9752004-09-29 13:19:37 +00001082Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001083 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001084 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001085 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1086}
1087
Lev Walkindc06f6b2004-10-20 15:50:55 +00001088asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001089Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001090 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001091 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001092 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001093}
1094
1095asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001096Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001097 void *structure, int tag_mode, ber_tlv_tag_t tag,
1098 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001099 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001100 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1101}
1102
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001103asn_dec_rval_t
1104Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001105 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001106 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001107 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1108}
1109
Lev Walkina9cc46e2004-09-22 16:06:28 +00001110asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001111Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001112 int ilevel, enum xer_encoder_flags_e flags,
1113 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001114 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001115 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001116}
1117
1118
1119/*** <<< STAT-DEFS [Str2] >>> ***/
1120
Lev Walkina7591b52014-10-12 18:37:35 -07001121static const ber_tlv_tag_t asn_DEF_Str2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001122 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001123};
Lev Walkindfae9752004-09-29 13:19:37 +00001124asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001125 "Str2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001126 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001127 Str2_free,
1128 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001129 Str2_constraint,
1130 Str2_decode_ber,
1131 Str2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001132 Str2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001133 Str2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001134 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001135 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001136 asn_DEF_Str2_tags_1,
1137 sizeof(asn_DEF_Str2_tags_1)
1138 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1139 asn_DEF_Str2_tags_1, /* Same as above */
1140 sizeof(asn_DEF_Str2_tags_1)
1141 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1142 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001143 0, 0, /* No members */
1144 0 /* No specifics */
1145};
1146
1147
1148/*** <<< INCLUDES [Str3] >>> ***/
1149
Lev Walkin22b5ed42006-09-13 02:51:20 +00001150#include "Str2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001151
1152/*** <<< TYPE-DECLS [Str3] >>> ***/
1153
Lev Walkin006de1c2004-08-20 13:37:45 +00001154typedef Str2_t Str3_t;
1155
Lev Walkin006de1c2004-08-20 13:37:45 +00001156/*** <<< FUNC-DECLS [Str3] >>> ***/
1157
Lev Walkindfae9752004-09-29 13:19:37 +00001158extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001159asn_struct_free_f Str3_free;
1160asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001161asn_constr_check_f Str3_constraint;
1162ber_type_decoder_f Str3_decode_ber;
1163der_type_encoder_f Str3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001164xer_type_decoder_f Str3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001165xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001166
1167/*** <<< CTABLES [Str3] >>> ***/
1168
Lev Walkina7591b52014-10-12 18:37:35 -07001169static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00001170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1171 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1172 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1174 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ABC */
1175 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1176 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */
Lev Walkin006de1c2004-08-20 13:37:45 +00001177};
1178
Lev Walkine8318b82005-03-06 09:29:03 +00001179static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07001180 const int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001181 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001182 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001183 const uint8_t *ch = st->buf;
1184 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001185
1186 for(; ch < end; ch++) {
1187 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001188 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001189 }
Lev Walkin775885e2004-08-22 12:47:03 +00001190 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001191}
1192
1193
1194/*** <<< CODE [Str3] >>> ***/
1195
1196int
Lev Walkindfae9752004-09-29 13:19:37 +00001197Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001198 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001199 const Str2_t *st = (const Str2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001200 size_t size;
1201
1202 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001203 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001204 "%s: value not given (%s:%d)",
1205 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001206 return -1;
1207 }
1208
1209 size = st->size;
1210
1211 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkine8318b82005-03-06 09:29:03 +00001212 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001213 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001214 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001215 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001216 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001217 "%s: constraint failed (%s:%d)",
1218 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001219 return -1;
1220 }
1221}
1222
1223/*
1224 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +00001225 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001226 */
1227static void
Lev Walkine8318b82005-03-06 09:29:03 +00001228Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001229 td->free_struct = asn_DEF_Str2.free_struct;
1230 td->print_struct = asn_DEF_Str2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001231 td->check_constraints = asn_DEF_Str2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001232 td->ber_decoder = asn_DEF_Str2.ber_decoder;
1233 td->der_encoder = asn_DEF_Str2.der_encoder;
1234 td->xer_decoder = asn_DEF_Str2.xer_decoder;
1235 td->xer_encoder = asn_DEF_Str2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001236 td->uper_decoder = asn_DEF_Str2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001237 td->uper_encoder = asn_DEF_Str2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001238 if(!td->per_constraints)
1239 td->per_constraints = asn_DEF_Str2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001240 td->elements = asn_DEF_Str2.elements;
1241 td->elements_count = asn_DEF_Str2.elements_count;
1242 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001243}
1244
Lev Walkina9cc46e2004-09-22 16:06:28 +00001245void
Lev Walkindfae9752004-09-29 13:19:37 +00001246Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001247 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001248 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001249 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001250}
1251
1252int
Lev Walkindfae9752004-09-29 13:19:37 +00001253Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001254 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001255 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001256 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1257}
1258
Lev Walkindc06f6b2004-10-20 15:50:55 +00001259asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001260Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001261 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001262 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001263 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001264}
1265
1266asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001267Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001268 void *structure, int tag_mode, ber_tlv_tag_t tag,
1269 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001270 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001271 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1272}
1273
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001274asn_dec_rval_t
1275Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001276 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001277 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001278 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1279}
1280
Lev Walkina9cc46e2004-09-22 16:06:28 +00001281asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001282Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001283 int ilevel, enum xer_encoder_flags_e flags,
1284 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001285 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001286 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001287}
1288
1289
1290/*** <<< STAT-DEFS [Str3] >>> ***/
1291
Lev Walkina7591b52014-10-12 18:37:35 -07001292static const ber_tlv_tag_t asn_DEF_Str3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001293 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001294};
Lev Walkindfae9752004-09-29 13:19:37 +00001295asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001296 "Str3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001297 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001298 Str3_free,
1299 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001300 Str3_constraint,
1301 Str3_decode_ber,
1302 Str3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001303 Str3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001304 Str3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001305 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001306 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001307 asn_DEF_Str3_tags_1,
1308 sizeof(asn_DEF_Str3_tags_1)
1309 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1310 asn_DEF_Str3_tags_1, /* Same as above */
1311 sizeof(asn_DEF_Str3_tags_1)
1312 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1313 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001314 0, 0, /* No members */
1315 0 /* No specifics */
1316};
1317
1318
Lev Walkin8a99bf72004-09-10 06:07:39 +00001319/*** <<< INCLUDES [Str4] >>> ***/
1320
1321#include <IA5String.h>
1322
1323/*** <<< TYPE-DECLS [Str4] >>> ***/
1324
Lev Walkin8a99bf72004-09-10 06:07:39 +00001325typedef IA5String_t Str4_t;
1326
1327/*** <<< FUNC-DECLS [Str4] >>> ***/
1328
Lev Walkindfae9752004-09-29 13:19:37 +00001329extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001330asn_struct_free_f Str4_free;
1331asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001332asn_constr_check_f Str4_constraint;
1333ber_type_decoder_f Str4_decode_ber;
1334der_type_encoder_f Str4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001335xer_type_decoder_f Str4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001336xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001337
1338/*** <<< CTABLES [Str4] >>> ***/
1339
Lev Walkine8318b82005-03-06 09:29:03 +00001340static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001341 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001342 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001343 const uint8_t *ch = st->buf;
1344 const uint8_t *end = ch + st->size;
1345
1346 for(; ch < end; ch++) {
1347 uint8_t cv = *ch;
1348 if(!(cv <= 127)) return -1;
1349 }
1350 return 0;
1351}
1352
1353
1354/*** <<< CODE [Str4] >>> ***/
1355
1356int
Lev Walkindfae9752004-09-29 13:19:37 +00001357Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001358 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001359 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001360
1361 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001362 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001363 "%s: value not given (%s:%d)",
1364 td->name, __FILE__, __LINE__);
1365 return -1;
1366 }
1367
1368
Lev Walkine8318b82005-03-06 09:29:03 +00001369 if(!check_permitted_alphabet_1(st)) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001370 /* Constraint check succeeded */
1371 return 0;
1372 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001373 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001374 "%s: constraint failed (%s:%d)",
1375 td->name, __FILE__, __LINE__);
1376 return -1;
1377 }
1378}
1379
1380/*
1381 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001382 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001383 */
1384static void
Lev Walkine8318b82005-03-06 09:29:03 +00001385Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001386 td->free_struct = asn_DEF_IA5String.free_struct;
1387 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001388 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001389 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1390 td->der_encoder = asn_DEF_IA5String.der_encoder;
1391 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1392 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001393 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001394 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001395 if(!td->per_constraints)
1396 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001397 td->elements = asn_DEF_IA5String.elements;
1398 td->elements_count = asn_DEF_IA5String.elements_count;
1399 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001400}
1401
Lev Walkina9cc46e2004-09-22 16:06:28 +00001402void
Lev Walkindfae9752004-09-29 13:19:37 +00001403Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001404 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001405 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001406 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001407}
1408
1409int
Lev Walkindfae9752004-09-29 13:19:37 +00001410Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001411 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001412 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001413 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1414}
1415
Lev Walkindc06f6b2004-10-20 15:50:55 +00001416asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001417Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001418 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001419 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001420 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001421}
1422
1423asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001424Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001425 void *structure, int tag_mode, ber_tlv_tag_t tag,
1426 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001427 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001428 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1429}
1430
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001431asn_dec_rval_t
1432Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001433 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001434 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001435 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1436}
1437
Lev Walkina9cc46e2004-09-22 16:06:28 +00001438asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001439Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001440 int ilevel, enum xer_encoder_flags_e flags,
1441 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001442 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001443 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001444}
1445
1446
1447/*** <<< STAT-DEFS [Str4] >>> ***/
1448
Lev Walkina7591b52014-10-12 18:37:35 -07001449static const ber_tlv_tag_t asn_DEF_Str4_tags_1[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001450 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1451};
Lev Walkindfae9752004-09-29 13:19:37 +00001452asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001453 "Str4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001454 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001455 Str4_free,
1456 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001457 Str4_constraint,
1458 Str4_decode_ber,
1459 Str4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001460 Str4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001461 Str4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001462 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001463 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001464 asn_DEF_Str4_tags_1,
1465 sizeof(asn_DEF_Str4_tags_1)
1466 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1467 asn_DEF_Str4_tags_1, /* Same as above */
1468 sizeof(asn_DEF_Str4_tags_1)
1469 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1470 0, /* No PER visible constraints */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001471 0, 0, /* No members */
1472 0 /* No specifics */
1473};
1474
1475
Lev Walkin006de1c2004-08-20 13:37:45 +00001476/*** <<< INCLUDES [PER-Visible] >>> ***/
1477
1478#include <IA5String.h>
1479
1480/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1481
Lev Walkin006de1c2004-08-20 13:37:45 +00001482typedef IA5String_t PER_Visible_t;
1483
Lev Walkin006de1c2004-08-20 13:37:45 +00001484/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1485
Lev Walkindfae9752004-09-29 13:19:37 +00001486extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001487asn_struct_free_f PER_Visible_free;
1488asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001489asn_constr_check_f PER_Visible_constraint;
1490ber_type_decoder_f PER_Visible_decode_ber;
1491der_type_encoder_f PER_Visible_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001492xer_type_decoder_f PER_Visible_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001493xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001494
1495/*** <<< CTABLES [PER-Visible] >>> ***/
1496
Lev Walkine8318b82005-03-06 09:29:03 +00001497static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001498 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001499 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001500 const uint8_t *ch = st->buf;
1501 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001502
1503 for(; ch < end; ch++) {
1504 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001505 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001506 }
Lev Walkin775885e2004-08-22 12:47:03 +00001507 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001508}
1509
1510
1511/*** <<< CODE [PER-Visible] >>> ***/
1512
1513int
Lev Walkindfae9752004-09-29 13:19:37 +00001514PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001515 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001516 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001517
1518 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001519 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001520 "%s: value not given (%s:%d)",
1521 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001522 return -1;
1523 }
1524
1525
Lev Walkine8318b82005-03-06 09:29:03 +00001526 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001527 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001528 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001529 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001530 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001531 "%s: constraint failed (%s:%d)",
1532 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001533 return -1;
1534 }
1535}
1536
1537/*
1538 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001539 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001540 */
1541static void
Lev Walkine8318b82005-03-06 09:29:03 +00001542PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001543 td->free_struct = asn_DEF_IA5String.free_struct;
1544 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001545 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001546 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1547 td->der_encoder = asn_DEF_IA5String.der_encoder;
1548 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1549 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001550 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001551 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001552 if(!td->per_constraints)
1553 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001554 td->elements = asn_DEF_IA5String.elements;
1555 td->elements_count = asn_DEF_IA5String.elements_count;
1556 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001557}
1558
Lev Walkina9cc46e2004-09-22 16:06:28 +00001559void
Lev Walkindfae9752004-09-29 13:19:37 +00001560PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001561 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001562 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001563 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001564}
1565
1566int
Lev Walkindfae9752004-09-29 13:19:37 +00001567PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001568 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001569 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001570 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1571}
1572
Lev Walkindc06f6b2004-10-20 15:50:55 +00001573asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001574PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001575 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001576 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001577 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001578}
1579
1580asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001581PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001582 void *structure, int tag_mode, ber_tlv_tag_t tag,
1583 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001584 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001585 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1586}
1587
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001588asn_dec_rval_t
1589PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001590 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001591 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001592 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1593}
1594
Lev Walkina9cc46e2004-09-22 16:06:28 +00001595asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001596PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001597 int ilevel, enum xer_encoder_flags_e flags,
1598 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001599 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001600 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001601}
1602
1603
1604/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1605
Lev Walkina7591b52014-10-12 18:37:35 -07001606static const ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001607 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1608};
Lev Walkindfae9752004-09-29 13:19:37 +00001609asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001610 "PER-Visible",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001611 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001612 PER_Visible_free,
1613 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001614 PER_Visible_constraint,
1615 PER_Visible_decode_ber,
1616 PER_Visible_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001617 PER_Visible_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001618 PER_Visible_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001619 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001620 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001621 asn_DEF_PER_Visible_tags_1,
1622 sizeof(asn_DEF_PER_Visible_tags_1)
1623 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1624 asn_DEF_PER_Visible_tags_1, /* Same as above */
1625 sizeof(asn_DEF_PER_Visible_tags_1)
1626 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1627 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001628 0, 0, /* No members */
1629 0 /* No specifics */
1630};
1631
1632
1633/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1634
Lev Walkin22b5ed42006-09-13 02:51:20 +00001635#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001636
1637/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1638
Lev Walkin006de1c2004-08-20 13:37:45 +00001639typedef PER_Visible_t PER_Visible_2_t;
1640
Lev Walkin006de1c2004-08-20 13:37:45 +00001641/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1642
Lev Walkindfae9752004-09-29 13:19:37 +00001643extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001644asn_struct_free_f PER_Visible_2_free;
1645asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001646asn_constr_check_f PER_Visible_2_constraint;
1647ber_type_decoder_f PER_Visible_2_decode_ber;
1648der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001649xer_type_decoder_f PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001650xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001651
1652/*** <<< CTABLES [PER-Visible-2] >>> ***/
1653
Lev Walkine8318b82005-03-06 09:29:03 +00001654static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001655 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001656 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001657 const uint8_t *ch = st->buf;
1658 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001659
1660 for(; ch < end; ch++) {
1661 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001662 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001663 }
Lev Walkin775885e2004-08-22 12:47:03 +00001664 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001665}
1666
1667
1668/*** <<< CODE [PER-Visible-2] >>> ***/
1669
1670int
Lev Walkindfae9752004-09-29 13:19:37 +00001671PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001672 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001673 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001674
1675 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001676 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001677 "%s: value not given (%s:%d)",
1678 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001679 return -1;
1680 }
1681
1682
Lev Walkine8318b82005-03-06 09:29:03 +00001683 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001684 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001685 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001686 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001687 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001688 "%s: constraint failed (%s:%d)",
1689 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001690 return -1;
1691 }
1692}
1693
1694/*
1695 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001696 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001697 */
1698static void
Lev Walkine8318b82005-03-06 09:29:03 +00001699PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001700 td->free_struct = asn_DEF_PER_Visible.free_struct;
1701 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001702 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001703 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1704 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1705 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1706 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001707 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001708 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001709 if(!td->per_constraints)
1710 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001711 td->elements = asn_DEF_PER_Visible.elements;
1712 td->elements_count = asn_DEF_PER_Visible.elements_count;
1713 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001714}
1715
Lev Walkina9cc46e2004-09-22 16:06:28 +00001716void
Lev Walkindfae9752004-09-29 13:19:37 +00001717PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001718 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001719 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001720 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001721}
1722
1723int
Lev Walkindfae9752004-09-29 13:19:37 +00001724PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001725 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001726 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001727 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1728}
1729
Lev Walkindc06f6b2004-10-20 15:50:55 +00001730asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001731PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001732 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001733 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001734 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001735}
1736
1737asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001738PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001739 void *structure, int tag_mode, ber_tlv_tag_t tag,
1740 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001741 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001742 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1743}
1744
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001745asn_dec_rval_t
1746PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001747 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001748 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001749 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1750}
1751
Lev Walkina9cc46e2004-09-22 16:06:28 +00001752asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001753PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001754 int ilevel, enum xer_encoder_flags_e flags,
1755 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001756 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001757 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001758}
1759
1760
1761/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1762
Lev Walkina7591b52014-10-12 18:37:35 -07001763static const ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001764 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001765};
Lev Walkindfae9752004-09-29 13:19:37 +00001766asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001767 "PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001768 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001769 PER_Visible_2_free,
1770 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001771 PER_Visible_2_constraint,
1772 PER_Visible_2_decode_ber,
1773 PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001774 PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001775 PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001776 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001777 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001778 asn_DEF_PER_Visible_2_tags_1,
1779 sizeof(asn_DEF_PER_Visible_2_tags_1)
1780 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1781 asn_DEF_PER_Visible_2_tags_1, /* Same as above */
1782 sizeof(asn_DEF_PER_Visible_2_tags_1)
1783 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1784 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001785 0, 0, /* No members */
1786 0 /* No specifics */
1787};
1788
1789
1790/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1791
Lev Walkin22b5ed42006-09-13 02:51:20 +00001792#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001793
1794/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1795
Lev Walkin006de1c2004-08-20 13:37:45 +00001796typedef PER_Visible_t Not_PER_Visible_1_t;
1797
Lev Walkin006de1c2004-08-20 13:37:45 +00001798/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1799
Lev Walkindfae9752004-09-29 13:19:37 +00001800extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001801asn_struct_free_f Not_PER_Visible_1_free;
1802asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001803asn_constr_check_f Not_PER_Visible_1_constraint;
1804ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1805der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001806xer_type_decoder_f Not_PER_Visible_1_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001807xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001808
1809/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1810
Lev Walkine8318b82005-03-06 09:29:03 +00001811static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001812 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001813 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001814 const uint8_t *ch = st->buf;
1815 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001816
1817 for(; ch < end; ch++) {
1818 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001819 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001820 }
Lev Walkin775885e2004-08-22 12:47:03 +00001821 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001822}
1823
1824
1825/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1826
1827int
Lev Walkindfae9752004-09-29 13:19:37 +00001828Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001829 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001830 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001831
1832 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001833 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001834 "%s: value not given (%s:%d)",
1835 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001836 return -1;
1837 }
1838
1839
Lev Walkine8318b82005-03-06 09:29:03 +00001840 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001841 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001842 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001843 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001844 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001845 "%s: constraint failed (%s:%d)",
1846 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001847 return -1;
1848 }
1849}
1850
1851/*
1852 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001853 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001854 */
1855static void
Lev Walkine8318b82005-03-06 09:29:03 +00001856Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001857 td->free_struct = asn_DEF_PER_Visible.free_struct;
1858 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001859 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001860 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1861 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1862 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1863 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001864 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001865 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001866 if(!td->per_constraints)
1867 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001868 td->elements = asn_DEF_PER_Visible.elements;
1869 td->elements_count = asn_DEF_PER_Visible.elements_count;
1870 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001871}
1872
Lev Walkina9cc46e2004-09-22 16:06:28 +00001873void
Lev Walkindfae9752004-09-29 13:19:37 +00001874Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001875 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001876 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001877 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001878}
1879
1880int
Lev Walkindfae9752004-09-29 13:19:37 +00001881Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001882 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001883 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001884 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1885}
1886
Lev Walkindc06f6b2004-10-20 15:50:55 +00001887asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001888Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001889 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001890 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001891 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001892}
1893
1894asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001895Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001896 void *structure, int tag_mode, ber_tlv_tag_t tag,
1897 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001898 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001899 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1900}
1901
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001902asn_dec_rval_t
1903Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001904 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001905 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001906 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1907}
1908
Lev Walkina9cc46e2004-09-22 16:06:28 +00001909asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001910Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001911 int ilevel, enum xer_encoder_flags_e flags,
1912 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001913 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001914 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001915}
1916
1917
1918/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1919
Lev Walkina7591b52014-10-12 18:37:35 -07001920static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001921 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001922};
Lev Walkindfae9752004-09-29 13:19:37 +00001923asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001924 "Not-PER-Visible-1",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001925 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001926 Not_PER_Visible_1_free,
1927 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001928 Not_PER_Visible_1_constraint,
1929 Not_PER_Visible_1_decode_ber,
1930 Not_PER_Visible_1_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001931 Not_PER_Visible_1_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001932 Not_PER_Visible_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001933 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001934 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001935 asn_DEF_Not_PER_Visible_1_tags_1,
1936 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1937 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1938 asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */
1939 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1940 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1941 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001942 0, 0, /* No members */
1943 0 /* No specifics */
1944};
1945
1946
1947/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1948
Lev Walkin22b5ed42006-09-13 02:51:20 +00001949#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001950
1951/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1952
Lev Walkin006de1c2004-08-20 13:37:45 +00001953typedef PER_Visible_t Not_PER_Visible_2_t;
1954
Lev Walkin006de1c2004-08-20 13:37:45 +00001955/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1956
Lev Walkindfae9752004-09-29 13:19:37 +00001957extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001958asn_struct_free_f Not_PER_Visible_2_free;
1959asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001960asn_constr_check_f Not_PER_Visible_2_constraint;
1961ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1962der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001963xer_type_decoder_f Not_PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001964xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001965
Lev Walkind35c8b52004-08-25 02:08:08 +00001966/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1967
Lev Walkine8318b82005-03-06 09:29:03 +00001968static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001969 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001970 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00001971 const uint8_t *ch = st->buf;
1972 const uint8_t *end = ch + st->size;
1973
1974 for(; ch < end; ch++) {
1975 uint8_t cv = *ch;
1976 if(!(cv >= 65 && cv <= 66)) return -1;
1977 }
1978 return 0;
1979}
1980
1981
Lev Walkin006de1c2004-08-20 13:37:45 +00001982/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1983
1984int
Lev Walkindfae9752004-09-29 13:19:37 +00001985Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001986 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001987 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001988
1989 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00001990 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001991 "%s: value not given (%s:%d)",
1992 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001993 return -1;
1994 }
1995
1996
Lev Walkine8318b82005-03-06 09:29:03 +00001997 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001998 /* Constraint check succeeded */
1999 return 0;
2000 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002001 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00002002 "%s: constraint failed (%s:%d)",
2003 td->name, __FILE__, __LINE__);
2004 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002005 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002006}
2007
2008/*
2009 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002010 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002011 */
2012static void
Lev Walkine8318b82005-03-06 09:29:03 +00002013Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002014 td->free_struct = asn_DEF_PER_Visible.free_struct;
2015 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002016 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002017 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2018 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2019 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2020 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002021 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002022 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002023 if(!td->per_constraints)
2024 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002025 td->elements = asn_DEF_PER_Visible.elements;
2026 td->elements_count = asn_DEF_PER_Visible.elements_count;
2027 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002028}
2029
Lev Walkina9cc46e2004-09-22 16:06:28 +00002030void
Lev Walkindfae9752004-09-29 13:19:37 +00002031Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002032 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002033 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002034 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002035}
2036
2037int
Lev Walkindfae9752004-09-29 13:19:37 +00002038Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002039 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002040 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002041 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2042}
2043
Lev Walkindc06f6b2004-10-20 15:50:55 +00002044asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002045Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002046 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002047 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002048 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002049}
2050
2051asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002052Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002053 void *structure, int tag_mode, ber_tlv_tag_t tag,
2054 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002055 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002056 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2057}
2058
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002059asn_dec_rval_t
2060Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002061 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002062 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002063 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2064}
2065
Lev Walkina9cc46e2004-09-22 16:06:28 +00002066asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002067Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002068 int ilevel, enum xer_encoder_flags_e flags,
2069 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002070 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002071 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002072}
2073
2074
2075/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
2076
Lev Walkina7591b52014-10-12 18:37:35 -07002077static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002078 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002079};
Lev Walkindfae9752004-09-29 13:19:37 +00002080asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002081 "Not-PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002082 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002083 Not_PER_Visible_2_free,
2084 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002085 Not_PER_Visible_2_constraint,
2086 Not_PER_Visible_2_decode_ber,
2087 Not_PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002088 Not_PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002089 Not_PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002090 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002091 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002092 asn_DEF_Not_PER_Visible_2_tags_1,
2093 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2094 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2095 asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */
2096 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2097 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2098 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002099 0, 0, /* No members */
2100 0 /* No specifics */
2101};
2102
2103
2104/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
2105
Lev Walkin22b5ed42006-09-13 02:51:20 +00002106#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002107
2108/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
2109
Lev Walkin006de1c2004-08-20 13:37:45 +00002110typedef PER_Visible_t Not_PER_Visible_3_t;
2111
Lev Walkin006de1c2004-08-20 13:37:45 +00002112/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
2113
Lev Walkindfae9752004-09-29 13:19:37 +00002114extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002115asn_struct_free_f Not_PER_Visible_3_free;
2116asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002117asn_constr_check_f Not_PER_Visible_3_constraint;
2118ber_type_decoder_f Not_PER_Visible_3_decode_ber;
2119der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002120xer_type_decoder_f Not_PER_Visible_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002121xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002122
Lev Walkind35c8b52004-08-25 02:08:08 +00002123/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
2124
Lev Walkine8318b82005-03-06 09:29:03 +00002125static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002126 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002127 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00002128 const uint8_t *ch = st->buf;
2129 const uint8_t *end = ch + st->size;
2130
2131 for(; ch < end; ch++) {
2132 uint8_t cv = *ch;
2133 if(!(cv >= 65 && cv <= 66)) return -1;
2134 }
2135 return 0;
2136}
2137
2138
Lev Walkin006de1c2004-08-20 13:37:45 +00002139/*** <<< CODE [Not-PER-Visible-3] >>> ***/
2140
2141int
Lev Walkindfae9752004-09-29 13:19:37 +00002142Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002143 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002144 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002145
2146 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002147 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002148 "%s: value not given (%s:%d)",
2149 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002150 return -1;
2151 }
2152
2153
Lev Walkine8318b82005-03-06 09:29:03 +00002154 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002155 /* Constraint check succeeded */
2156 return 0;
2157 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002158 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00002159 "%s: constraint failed (%s:%d)",
2160 td->name, __FILE__, __LINE__);
2161 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002162 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002163}
2164
2165/*
2166 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002167 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002168 */
2169static void
Lev Walkine8318b82005-03-06 09:29:03 +00002170Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002171 td->free_struct = asn_DEF_PER_Visible.free_struct;
2172 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002173 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002174 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2175 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2176 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2177 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002178 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002179 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002180 if(!td->per_constraints)
2181 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002182 td->elements = asn_DEF_PER_Visible.elements;
2183 td->elements_count = asn_DEF_PER_Visible.elements_count;
2184 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002185}
2186
Lev Walkina9cc46e2004-09-22 16:06:28 +00002187void
Lev Walkindfae9752004-09-29 13:19:37 +00002188Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002189 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002190 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002191 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002192}
2193
2194int
Lev Walkindfae9752004-09-29 13:19:37 +00002195Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002196 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002197 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002198 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2199}
2200
Lev Walkindc06f6b2004-10-20 15:50:55 +00002201asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002202Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002203 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002204 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002205 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002206}
2207
2208asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002209Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002210 void *structure, int tag_mode, ber_tlv_tag_t tag,
2211 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002212 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002213 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2214}
2215
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002216asn_dec_rval_t
2217Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002218 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002219 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002220 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2221}
2222
Lev Walkina9cc46e2004-09-22 16:06:28 +00002223asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002224Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002225 int ilevel, enum xer_encoder_flags_e flags,
2226 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002227 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002228 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002229}
2230
2231
2232/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
2233
Lev Walkina7591b52014-10-12 18:37:35 -07002234static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002235 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002236};
Lev Walkindfae9752004-09-29 13:19:37 +00002237asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002238 "Not-PER-Visible-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002239 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002240 Not_PER_Visible_3_free,
2241 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002242 Not_PER_Visible_3_constraint,
2243 Not_PER_Visible_3_decode_ber,
2244 Not_PER_Visible_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002245 Not_PER_Visible_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002246 Not_PER_Visible_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002247 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002248 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002249 asn_DEF_Not_PER_Visible_3_tags_1,
2250 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2251 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2252 asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */
2253 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2254 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2255 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002256 0, 0, /* No members */
2257 0 /* No specifics */
2258};
2259
2260
2261/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
2262
Lev Walkin22b5ed42006-09-13 02:51:20 +00002263#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002264
2265/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
2266
Lev Walkin006de1c2004-08-20 13:37:45 +00002267typedef PER_Visible_t SIZE_but_not_FROM_t;
2268
Lev Walkin006de1c2004-08-20 13:37:45 +00002269/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
2270
Lev Walkindfae9752004-09-29 13:19:37 +00002271extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002272asn_struct_free_f SIZE_but_not_FROM_free;
2273asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002274asn_constr_check_f SIZE_but_not_FROM_constraint;
2275ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
2276der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002277xer_type_decoder_f SIZE_but_not_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002278xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002279
2280/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
2281
Lev Walkine8318b82005-03-06 09:29:03 +00002282static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002283 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002284 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002285 const uint8_t *ch = st->buf;
2286 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002287
2288 for(; ch < end; ch++) {
2289 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00002290 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002291 }
Lev Walkin775885e2004-08-22 12:47:03 +00002292 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002293}
2294
2295
2296/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
2297
2298int
Lev Walkindfae9752004-09-29 13:19:37 +00002299SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002300 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002301 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002302 size_t size;
2303
2304 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002305 _ASN_CTFAIL(app_key, td, sptr,
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 size = st->size;
2312
2313 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002314 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002315 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002316 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002317 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002318 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002319 "%s: constraint failed (%s:%d)",
2320 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002321 return -1;
2322 }
2323}
2324
2325/*
2326 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002327 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002328 */
2329static void
Lev Walkine8318b82005-03-06 09:29:03 +00002330SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002331 td->free_struct = asn_DEF_PER_Visible.free_struct;
2332 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002333 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002334 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2335 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2336 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2337 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002338 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002339 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002340 if(!td->per_constraints)
2341 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002342 td->elements = asn_DEF_PER_Visible.elements;
2343 td->elements_count = asn_DEF_PER_Visible.elements_count;
2344 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002345}
2346
Lev Walkina9cc46e2004-09-22 16:06:28 +00002347void
Lev Walkindfae9752004-09-29 13:19:37 +00002348SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002349 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002350 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002351 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002352}
2353
2354int
Lev Walkindfae9752004-09-29 13:19:37 +00002355SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002356 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002357 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002358 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2359}
2360
Lev Walkindc06f6b2004-10-20 15:50:55 +00002361asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002362SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002363 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002364 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002365 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002366}
2367
2368asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002369SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002370 void *structure, int tag_mode, ber_tlv_tag_t tag,
2371 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002372 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002373 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2374}
2375
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002376asn_dec_rval_t
2377SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002378 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002379 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002380 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2381}
2382
Lev Walkina9cc46e2004-09-22 16:06:28 +00002383asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002384SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002385 int ilevel, enum xer_encoder_flags_e flags,
2386 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002387 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002388 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002389}
2390
2391
2392/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
2393
Lev Walkina7591b52014-10-12 18:37:35 -07002394static const ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002395 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002396};
Lev Walkindfae9752004-09-29 13:19:37 +00002397asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002398 "SIZE-but-not-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002399 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002400 SIZE_but_not_FROM_free,
2401 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002402 SIZE_but_not_FROM_constraint,
2403 SIZE_but_not_FROM_decode_ber,
2404 SIZE_but_not_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002405 SIZE_but_not_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002406 SIZE_but_not_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002407 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002408 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002409 asn_DEF_SIZE_but_not_FROM_tags_1,
2410 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2411 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2412 asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */
2413 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2414 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2415 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002416 0, 0, /* No members */
2417 0 /* No specifics */
2418};
2419
2420
2421/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2422
Lev Walkin22b5ed42006-09-13 02:51:20 +00002423#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002424
2425/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2426
Lev Walkin006de1c2004-08-20 13:37:45 +00002427typedef PER_Visible_t SIZE_and_FROM_t;
2428
Lev Walkin006de1c2004-08-20 13:37:45 +00002429/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2430
Lev Walkindfae9752004-09-29 13:19:37 +00002431extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002432asn_struct_free_f SIZE_and_FROM_free;
2433asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002434asn_constr_check_f SIZE_and_FROM_constraint;
2435ber_type_decoder_f SIZE_and_FROM_decode_ber;
2436der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002437xer_type_decoder_f SIZE_and_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002438xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002439
2440/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2441
Lev Walkine8318b82005-03-06 09:29:03 +00002442static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002443 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002444 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002445 const uint8_t *ch = st->buf;
2446 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002447
2448 for(; ch < end; ch++) {
2449 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002450 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002451 }
Lev Walkin775885e2004-08-22 12:47:03 +00002452 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002453}
2454
2455
2456/*** <<< CODE [SIZE-and-FROM] >>> ***/
2457
2458int
Lev Walkindfae9752004-09-29 13:19:37 +00002459SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002460 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002461 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002462 size_t size;
2463
2464 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002465 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002466 "%s: value not given (%s:%d)",
2467 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002468 return -1;
2469 }
2470
2471 size = st->size;
2472
2473 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002474 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002475 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002476 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002477 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002478 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002479 "%s: constraint failed (%s:%d)",
2480 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002481 return -1;
2482 }
2483}
2484
2485/*
2486 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002487 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002488 */
2489static void
Lev Walkine8318b82005-03-06 09:29:03 +00002490SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002491 td->free_struct = asn_DEF_PER_Visible.free_struct;
2492 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002493 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002494 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2495 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2496 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2497 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002498 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002499 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002500 if(!td->per_constraints)
2501 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002502 td->elements = asn_DEF_PER_Visible.elements;
2503 td->elements_count = asn_DEF_PER_Visible.elements_count;
2504 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002505}
2506
Lev Walkina9cc46e2004-09-22 16:06:28 +00002507void
Lev Walkindfae9752004-09-29 13:19:37 +00002508SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002509 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002510 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002511 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002512}
2513
2514int
Lev Walkindfae9752004-09-29 13:19:37 +00002515SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002516 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002517 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002518 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2519}
2520
Lev Walkindc06f6b2004-10-20 15:50:55 +00002521asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002522SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002523 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002524 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002525 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002526}
2527
2528asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002529SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002530 void *structure, int tag_mode, ber_tlv_tag_t tag,
2531 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002532 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002533 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2534}
2535
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002536asn_dec_rval_t
2537SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002538 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002539 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002540 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2541}
2542
Lev Walkina9cc46e2004-09-22 16:06:28 +00002543asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002544SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002545 int ilevel, enum xer_encoder_flags_e flags,
2546 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002547 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002548 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002549}
2550
2551
2552/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2553
Lev Walkina7591b52014-10-12 18:37:35 -07002554static const ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002555 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002556};
Lev Walkindfae9752004-09-29 13:19:37 +00002557asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002558 "SIZE-and-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002559 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002560 SIZE_and_FROM_free,
2561 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002562 SIZE_and_FROM_constraint,
2563 SIZE_and_FROM_decode_ber,
2564 SIZE_and_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002565 SIZE_and_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002566 SIZE_and_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002567 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002568 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002569 asn_DEF_SIZE_and_FROM_tags_1,
2570 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2571 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2572 asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */
2573 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2574 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2575 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002576 0, 0, /* No members */
2577 0 /* No specifics */
2578};
2579
2580
2581/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2582
Lev Walkin22b5ed42006-09-13 02:51:20 +00002583#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002584
2585/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2586
Lev Walkin006de1c2004-08-20 13:37:45 +00002587typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2588
Lev Walkin006de1c2004-08-20 13:37:45 +00002589/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2590
Lev Walkindfae9752004-09-29 13:19:37 +00002591extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002592asn_struct_free_f Neither_SIZE_nor_FROM_free;
2593asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002594asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2595ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2596der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002597xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002598xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002599
2600/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2601
Lev Walkine8318b82005-03-06 09:29:03 +00002602static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002603 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002604 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002605 const uint8_t *ch = st->buf;
2606 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002607
2608 for(; ch < end; ch++) {
2609 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002610 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002611 }
Lev Walkin775885e2004-08-22 12:47:03 +00002612 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002613}
2614
2615
2616/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2617
2618int
Lev Walkindfae9752004-09-29 13:19:37 +00002619Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002620 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002621 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002622
2623 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002624 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002625 "%s: value not given (%s:%d)",
2626 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002627 return -1;
2628 }
2629
2630
Lev Walkine8318b82005-03-06 09:29:03 +00002631 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002632 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002633 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002634 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002635 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002636 "%s: constraint failed (%s:%d)",
2637 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002638 return -1;
2639 }
2640}
2641
2642/*
2643 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002644 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002645 */
2646static void
Lev Walkine8318b82005-03-06 09:29:03 +00002647Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002648 td->free_struct = asn_DEF_PER_Visible.free_struct;
2649 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002650 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002651 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2652 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2653 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2654 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002655 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002656 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002657 if(!td->per_constraints)
2658 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002659 td->elements = asn_DEF_PER_Visible.elements;
2660 td->elements_count = asn_DEF_PER_Visible.elements_count;
2661 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002662}
2663
Lev Walkina9cc46e2004-09-22 16:06:28 +00002664void
Lev Walkindfae9752004-09-29 13:19:37 +00002665Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002666 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002667 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002668 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002669}
2670
2671int
Lev Walkindfae9752004-09-29 13:19:37 +00002672Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002673 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002674 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002675 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2676}
2677
Lev Walkindc06f6b2004-10-20 15:50:55 +00002678asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002679Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002680 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002681 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002682 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002683}
2684
2685asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002686Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002687 void *structure, int tag_mode, ber_tlv_tag_t tag,
2688 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002689 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002690 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2691}
2692
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002693asn_dec_rval_t
2694Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002695 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002696 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002697 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2698}
2699
Lev Walkina9cc46e2004-09-22 16:06:28 +00002700asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002701Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002702 int ilevel, enum xer_encoder_flags_e flags,
2703 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002704 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002705 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002706}
2707
2708
2709/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2710
Lev Walkina7591b52014-10-12 18:37:35 -07002711static const ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002712 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002713};
Lev Walkindfae9752004-09-29 13:19:37 +00002714asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002715 "Neither-SIZE-nor-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002716 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002717 Neither_SIZE_nor_FROM_free,
2718 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002719 Neither_SIZE_nor_FROM_constraint,
2720 Neither_SIZE_nor_FROM_decode_ber,
2721 Neither_SIZE_nor_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002722 Neither_SIZE_nor_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002723 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002724 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002725 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002726 asn_DEF_Neither_SIZE_nor_FROM_tags_1,
2727 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2728 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2729 asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */
2730 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2731 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2732 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002733 0, 0, /* No members */
2734 0 /* No specifics */
2735};
2736
2737
Lev Walkin55cc44a2004-10-03 09:14:32 +00002738/*** <<< INCLUDES [Utf8-4] >>> ***/
2739
2740#include <UTF8String.h>
2741
2742/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2743
Lev Walkin55cc44a2004-10-03 09:14:32 +00002744typedef UTF8String_t Utf8_4_t;
2745
2746/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2747
2748extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2749asn_struct_free_f Utf8_4_free;
2750asn_struct_print_f Utf8_4_print;
2751asn_constr_check_f Utf8_4_constraint;
2752ber_type_decoder_f Utf8_4_decode_ber;
2753der_type_encoder_f Utf8_4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002754xer_type_decoder_f Utf8_4_decode_xer;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002755xer_type_encoder_f Utf8_4_encode_xer;
2756
2757/*** <<< CTABLES [Utf8-4] >>> ***/
2758
Lev Walkine8318b82005-03-06 09:29:03 +00002759static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002760 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2761 return -1; /* Alphabet (sic!) test failed. */
2762
2763 return 0;
2764}
2765
2766
2767/*** <<< CODE [Utf8-4] >>> ***/
2768
2769int
2770Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002771 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002772 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002773
2774 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002775 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002776 "%s: value not given (%s:%d)",
2777 td->name, __FILE__, __LINE__);
2778 return -1;
2779 }
2780
2781
Lev Walkine8318b82005-03-06 09:29:03 +00002782 if(!check_permitted_alphabet_1(st)) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002783 /* Constraint check succeeded */
2784 return 0;
2785 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002786 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002787 "%s: constraint failed (%s:%d)",
2788 td->name, __FILE__, __LINE__);
2789 return -1;
2790 }
2791}
2792
2793/*
2794 * This type is implemented using UTF8String,
2795 * so here we adjust the DEF accordingly.
2796 */
2797static void
Lev Walkine8318b82005-03-06 09:29:03 +00002798Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002799 td->free_struct = asn_DEF_UTF8String.free_struct;
2800 td->print_struct = asn_DEF_UTF8String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002801 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002802 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2803 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2804 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2805 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002806 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002807 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002808 if(!td->per_constraints)
2809 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002810 td->elements = asn_DEF_UTF8String.elements;
2811 td->elements_count = asn_DEF_UTF8String.elements_count;
2812 td->specifics = asn_DEF_UTF8String.specifics;
2813}
2814
2815void
2816Utf8_4_free(asn_TYPE_descriptor_t *td,
2817 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002818 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002819 td->free_struct(td, struct_ptr, contents_only);
2820}
2821
2822int
2823Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2824 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002825 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002826 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2827}
2828
Lev Walkindc06f6b2004-10-20 15:50:55 +00002829asn_dec_rval_t
Lev Walkin55cc44a2004-10-03 09:14:32 +00002830Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002831 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002832 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002833 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2834}
2835
2836asn_enc_rval_t
2837Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2838 void *structure, int tag_mode, ber_tlv_tag_t tag,
2839 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002840 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002841 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2842}
2843
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002844asn_dec_rval_t
2845Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002846 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002847 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002848 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2849}
2850
Lev Walkin55cc44a2004-10-03 09:14:32 +00002851asn_enc_rval_t
2852Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2853 int ilevel, enum xer_encoder_flags_e flags,
2854 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002855 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002856 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2857}
2858
2859
2860/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2861
Lev Walkina7591b52014-10-12 18:37:35 -07002862static const ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002863 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2864};
2865asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2866 "Utf8-4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002867 "Utf8-4",
Lev Walkin55cc44a2004-10-03 09:14:32 +00002868 Utf8_4_free,
2869 Utf8_4_print,
2870 Utf8_4_constraint,
2871 Utf8_4_decode_ber,
2872 Utf8_4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002873 Utf8_4_decode_xer,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002874 Utf8_4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002875 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002876 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002877 asn_DEF_Utf8_4_tags_1,
2878 sizeof(asn_DEF_Utf8_4_tags_1)
2879 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2880 asn_DEF_Utf8_4_tags_1, /* Same as above */
2881 sizeof(asn_DEF_Utf8_4_tags_1)
2882 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2883 0, /* No PER visible constraints */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002884 0, 0, /* No members */
2885 0 /* No specifics */
2886};
2887
2888
Lev Walkin006de1c2004-08-20 13:37:45 +00002889/*** <<< INCLUDES [Utf8-3] >>> ***/
2890
Lev Walkin22b5ed42006-09-13 02:51:20 +00002891#include "Utf8-2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002892
2893/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2894
Lev Walkin006de1c2004-08-20 13:37:45 +00002895typedef Utf8_2_t Utf8_3_t;
2896
Lev Walkin006de1c2004-08-20 13:37:45 +00002897/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2898
Lev Walkindfae9752004-09-29 13:19:37 +00002899extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002900asn_struct_free_f Utf8_3_free;
2901asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002902asn_constr_check_f Utf8_3_constraint;
2903ber_type_decoder_f Utf8_3_decode_ber;
2904der_type_encoder_f Utf8_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002905xer_type_decoder_f Utf8_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002906xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002907
2908/*** <<< CTABLES [Utf8-3] >>> ***/
2909
Lev Walkina7591b52014-10-12 18:37:35 -07002910static const int permitted_alphabet_table_1[128] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00002911 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2912 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2913 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2914 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2915 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */
291616,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
2917 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */
291842,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkin006de1c2004-08-20 13:37:45 +00002919};
2920
Lev Walkine8318b82005-03-06 09:29:03 +00002921static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07002922 const int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002923 /* The underlying type is UTF8String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002924 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002925 const uint8_t *ch = st->buf;
2926 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002927
2928 for(; ch < end; ch++) {
2929 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002930 if(cv >= 0x80) return -1;
2931 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002932 }
Lev Walkin775885e2004-08-22 12:47:03 +00002933 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002934}
2935
2936
2937/*** <<< CODE [Utf8-3] >>> ***/
2938
2939int
Lev Walkindfae9752004-09-29 13:19:37 +00002940Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002941 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002942 const Utf8_2_t *st = (const Utf8_2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002943 size_t size;
2944
2945 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002946 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002947 "%s: value not given (%s:%d)",
2948 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002949 return -1;
2950 }
2951
Lev Walkinfac2e942004-10-02 16:33:46 +00002952 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002953 if((ssize_t)size < 0) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002954 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00002955 "%s: UTF-8: broken encoding (%s:%d)",
2956 td->name, __FILE__, __LINE__);
2957 return -1;
2958 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002959
2960 if((size >= 1 && size <= 2)
Lev Walkine8318b82005-03-06 09:29:03 +00002961 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002962 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002963 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002964 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00002965 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002966 "%s: constraint failed (%s:%d)",
2967 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002968 return -1;
2969 }
2970}
2971
2972/*
2973 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002974 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002975 */
2976static void
Lev Walkine8318b82005-03-06 09:29:03 +00002977Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002978 td->free_struct = asn_DEF_Utf8_2.free_struct;
2979 td->print_struct = asn_DEF_Utf8_2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002980 td->check_constraints = asn_DEF_Utf8_2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002981 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
2982 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
2983 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
2984 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002985 td->uper_decoder = asn_DEF_Utf8_2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002986 td->uper_encoder = asn_DEF_Utf8_2.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002987 if(!td->per_constraints)
2988 td->per_constraints = asn_DEF_Utf8_2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002989 td->elements = asn_DEF_Utf8_2.elements;
2990 td->elements_count = asn_DEF_Utf8_2.elements_count;
2991 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002992}
2993
Lev Walkina9cc46e2004-09-22 16:06:28 +00002994void
Lev Walkindfae9752004-09-29 13:19:37 +00002995Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002996 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002997 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002998 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002999}
3000
3001int
Lev Walkindfae9752004-09-29 13:19:37 +00003002Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00003003 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003004 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00003005 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3006}
3007
Lev Walkindc06f6b2004-10-20 15:50:55 +00003008asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003009Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003010 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003011 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003012 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003013}
3014
3015asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003016Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003017 void *structure, int tag_mode, ber_tlv_tag_t tag,
3018 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003019 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003020 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3021}
3022
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003023asn_dec_rval_t
3024Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003025 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003026 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003027 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3028}
3029
Lev Walkina9cc46e2004-09-22 16:06:28 +00003030asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003031Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003032 int ilevel, enum xer_encoder_flags_e flags,
3033 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003034 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003035 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003036}
3037
3038
3039/*** <<< STAT-DEFS [Utf8-3] >>> ***/
3040
Lev Walkina7591b52014-10-12 18:37:35 -07003041static const ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003042 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003043};
Lev Walkindfae9752004-09-29 13:19:37 +00003044asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003045 "Utf8-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003046 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003047 Utf8_3_free,
3048 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003049 Utf8_3_constraint,
3050 Utf8_3_decode_ber,
3051 Utf8_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003052 Utf8_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003053 Utf8_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003054 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003055 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003056 asn_DEF_Utf8_3_tags_1,
3057 sizeof(asn_DEF_Utf8_3_tags_1)
3058 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3059 asn_DEF_Utf8_3_tags_1, /* Same as above */
3060 sizeof(asn_DEF_Utf8_3_tags_1)
3061 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3062 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003063 0, 0, /* No members */
3064 0 /* No specifics */
3065};
3066
3067
3068/*** <<< INCLUDES [Utf8-2] >>> ***/
3069
Lev Walkin22b5ed42006-09-13 02:51:20 +00003070#include "Utf8-1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00003071
3072/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
3073
Lev Walkin006de1c2004-08-20 13:37:45 +00003074typedef Utf8_1_t Utf8_2_t;
3075
Lev Walkin006de1c2004-08-20 13:37:45 +00003076/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
3077
Lev Walkindfae9752004-09-29 13:19:37 +00003078extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003079asn_struct_free_f Utf8_2_free;
3080asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00003081asn_constr_check_f Utf8_2_constraint;
3082ber_type_decoder_f Utf8_2_decode_ber;
3083der_type_encoder_f Utf8_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003084xer_type_decoder_f Utf8_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003085xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003086
3087/*** <<< CODE [Utf8-2] >>> ***/
3088
3089int
Lev Walkindfae9752004-09-29 13:19:37 +00003090Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003091 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00003092 const Utf8_1_t *st = (const Utf8_1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00003093 size_t size;
3094
3095 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003096 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003097 "%s: value not given (%s:%d)",
3098 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003099 return -1;
3100 }
3101
Lev Walkinfac2e942004-10-02 16:33:46 +00003102 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00003103 if((ssize_t)size < 0) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003104 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00003105 "%s: UTF-8: broken encoding (%s:%d)",
3106 td->name, __FILE__, __LINE__);
3107 return -1;
3108 }
Lev Walkin006de1c2004-08-20 13:37:45 +00003109
3110 if((size >= 1 && size <= 2)) {
3111 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00003112 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00003113 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003114 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003115 "%s: constraint failed (%s:%d)",
3116 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003117 return -1;
3118 }
3119}
3120
3121/*
3122 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00003123 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00003124 */
3125static void
Lev Walkine8318b82005-03-06 09:29:03 +00003126Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00003127 td->free_struct = asn_DEF_Utf8_1.free_struct;
3128 td->print_struct = asn_DEF_Utf8_1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003129 td->check_constraints = asn_DEF_Utf8_1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003130 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
3131 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
3132 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
3133 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003134 td->uper_decoder = asn_DEF_Utf8_1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003135 td->uper_encoder = asn_DEF_Utf8_1.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003136 if(!td->per_constraints)
3137 td->per_constraints = asn_DEF_Utf8_1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003138 td->elements = asn_DEF_Utf8_1.elements;
3139 td->elements_count = asn_DEF_Utf8_1.elements_count;
3140 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00003141}
3142
Lev Walkina9cc46e2004-09-22 16:06:28 +00003143void
Lev Walkindfae9752004-09-29 13:19:37 +00003144Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003145 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003146 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003147 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00003148}
3149
3150int
Lev Walkindfae9752004-09-29 13:19:37 +00003151Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00003152 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003153 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00003154 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3155}
3156
Lev Walkindc06f6b2004-10-20 15:50:55 +00003157asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003158Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003159 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003160 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003161 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003162}
3163
3164asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003165Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003166 void *structure, int tag_mode, ber_tlv_tag_t tag,
3167 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003168 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003169 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3170}
3171
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003172asn_dec_rval_t
3173Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003174 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003175 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003176 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3177}
3178
Lev Walkina9cc46e2004-09-22 16:06:28 +00003179asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003180Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003181 int ilevel, enum xer_encoder_flags_e flags,
3182 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003183 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003184 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003185}
3186
3187
3188/*** <<< STAT-DEFS [Utf8-2] >>> ***/
3189
Lev Walkina7591b52014-10-12 18:37:35 -07003190static const ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003191 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003192};
Lev Walkindfae9752004-09-29 13:19:37 +00003193asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003194 "Utf8-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003195 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003196 Utf8_2_free,
3197 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003198 Utf8_2_constraint,
3199 Utf8_2_decode_ber,
3200 Utf8_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003201 Utf8_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003202 Utf8_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003203 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003204 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003205 asn_DEF_Utf8_2_tags_1,
3206 sizeof(asn_DEF_Utf8_2_tags_1)
3207 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3208 asn_DEF_Utf8_2_tags_1, /* Same as above */
3209 sizeof(asn_DEF_Utf8_2_tags_1)
3210 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3211 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003212 0, 0, /* No members */
3213 0 /* No specifics */
3214};
3215
3216
3217/*** <<< INCLUDES [Utf8-1] >>> ***/
3218
3219#include <UTF8String.h>
3220
3221/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
3222
Lev Walkin006de1c2004-08-20 13:37:45 +00003223typedef UTF8String_t Utf8_1_t;
3224
Lev Walkin006de1c2004-08-20 13:37:45 +00003225/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
3226
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003227extern asn_TYPE_descriptor_t asn_DEF_Utf8_1;
3228asn_struct_free_f Utf8_1_free;
3229asn_struct_print_f Utf8_1_print;
3230asn_constr_check_f Utf8_1_constraint;
3231ber_type_decoder_f Utf8_1_decode_ber;
3232der_type_encoder_f Utf8_1_encode_der;
3233xer_type_decoder_f Utf8_1_decode_xer;
3234xer_type_encoder_f Utf8_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003235
3236/*** <<< CODE [Utf8-1] >>> ***/
3237
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003238int
3239Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003240 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003241 /* Replace with underlying type checker */
3242 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003243 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003244}
3245
3246/*
3247 * This type is implemented using UTF8String,
3248 * so here we adjust the DEF accordingly.
3249 */
3250static void
Lev Walkine8318b82005-03-06 09:29:03 +00003251Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003252 td->free_struct = asn_DEF_UTF8String.free_struct;
3253 td->print_struct = asn_DEF_UTF8String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003254 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003255 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
3256 td->der_encoder = asn_DEF_UTF8String.der_encoder;
3257 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
3258 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003259 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003260 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003261 if(!td->per_constraints)
3262 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003263 td->elements = asn_DEF_UTF8String.elements;
3264 td->elements_count = asn_DEF_UTF8String.elements_count;
3265 td->specifics = asn_DEF_UTF8String.specifics;
3266}
3267
3268void
3269Utf8_1_free(asn_TYPE_descriptor_t *td,
3270 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003271 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003272 td->free_struct(td, struct_ptr, contents_only);
3273}
3274
3275int
3276Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3277 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003278 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003279 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3280}
3281
3282asn_dec_rval_t
3283Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003284 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003285 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003286 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3287}
3288
3289asn_enc_rval_t
3290Utf8_1_encode_der(asn_TYPE_descriptor_t *td,
3291 void *structure, int tag_mode, ber_tlv_tag_t tag,
3292 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003293 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003294 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3295}
3296
3297asn_dec_rval_t
3298Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003299 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003300 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003301 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3302}
3303
3304asn_enc_rval_t
3305Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3306 int ilevel, enum xer_encoder_flags_e flags,
3307 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003308 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003309 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3310}
3311
3312
3313/*** <<< STAT-DEFS [Utf8-1] >>> ***/
3314
Lev Walkina7591b52014-10-12 18:37:35 -07003315static const ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003316 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
3317};
3318asn_TYPE_descriptor_t asn_DEF_Utf8_1 = {
3319 "Utf8-1",
3320 "Utf8-1",
3321 Utf8_1_free,
3322 Utf8_1_print,
3323 Utf8_1_constraint,
3324 Utf8_1_decode_ber,
3325 Utf8_1_encode_der,
3326 Utf8_1_decode_xer,
3327 Utf8_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003328 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003329 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003330 asn_DEF_Utf8_1_tags_1,
3331 sizeof(asn_DEF_Utf8_1_tags_1)
3332 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3333 asn_DEF_Utf8_1_tags_1, /* Same as above */
3334 sizeof(asn_DEF_Utf8_1_tags_1)
3335 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3336 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003337 0, 0, /* No members */
3338 0 /* No specifics */
3339};
Lev Walkin006de1c2004-08-20 13:37:45 +00003340
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003341
3342/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
3343
Lev Walkin22b5ed42006-09-13 02:51:20 +00003344#include "Identifier.h"
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003345
3346/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
3347
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003348typedef Identifier_t VisibleIdentifier_t;
3349
3350/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
3351
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003352extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier;
3353asn_struct_free_f VisibleIdentifier_free;
3354asn_struct_print_f VisibleIdentifier_print;
3355asn_constr_check_f VisibleIdentifier_constraint;
3356ber_type_decoder_f VisibleIdentifier_decode_ber;
3357der_type_encoder_f VisibleIdentifier_encode_der;
3358xer_type_decoder_f VisibleIdentifier_decode_xer;
3359xer_type_encoder_f VisibleIdentifier_encode_xer;
3360
3361/*** <<< CTABLES [VisibleIdentifier] >>> ***/
3362
Lev Walkina7591b52014-10-12 18:37:35 -07003363static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00003364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
3365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
3366 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */
3367 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */
3368 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */
336927,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */
3370 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */
337154,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003372};
3373
Lev Walkine8318b82005-03-06 09:29:03 +00003374static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07003375 const int *table = permitted_alphabet_table_1;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003376 /* The underlying type is VisibleString */
3377 const VisibleString_t *st = (const VisibleString_t *)sptr;
3378 const uint8_t *ch = st->buf;
3379 const uint8_t *end = ch + st->size;
3380
3381 for(; ch < end; ch++) {
3382 uint8_t cv = *ch;
3383 if(!table[cv]) return -1;
3384 }
3385 return 0;
3386}
3387
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003388
Lev Walkin154aa182004-09-26 13:12:56 +00003389/*** <<< CODE [VisibleIdentifier] >>> ***/
3390
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003391int
3392VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003393 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003394 const Identifier_t *st = (const Identifier_t *)sptr;
3395 size_t size;
3396
3397 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003398 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003399 "%s: value not given (%s:%d)",
3400 td->name, __FILE__, __LINE__);
3401 return -1;
3402 }
3403
3404 size = st->size;
3405
3406 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00003407 && !check_permitted_alphabet_1(st)) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003408 /* Constraint check succeeded */
3409 return 0;
3410 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003411 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003412 "%s: constraint failed (%s:%d)",
3413 td->name, __FILE__, __LINE__);
3414 return -1;
3415 }
3416}
3417
3418/*
3419 * This type is implemented using Identifier,
3420 * so here we adjust the DEF accordingly.
3421 */
3422static void
Lev Walkine8318b82005-03-06 09:29:03 +00003423VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003424 td->free_struct = asn_DEF_Identifier.free_struct;
3425 td->print_struct = asn_DEF_Identifier.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003426 td->check_constraints = asn_DEF_Identifier.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003427 td->ber_decoder = asn_DEF_Identifier.ber_decoder;
3428 td->der_encoder = asn_DEF_Identifier.der_encoder;
3429 td->xer_decoder = asn_DEF_Identifier.xer_decoder;
3430 td->xer_encoder = asn_DEF_Identifier.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003431 td->uper_decoder = asn_DEF_Identifier.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003432 td->uper_encoder = asn_DEF_Identifier.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003433 if(!td->per_constraints)
3434 td->per_constraints = asn_DEF_Identifier.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003435 td->elements = asn_DEF_Identifier.elements;
3436 td->elements_count = asn_DEF_Identifier.elements_count;
3437 td->specifics = asn_DEF_Identifier.specifics;
3438}
3439
3440void
3441VisibleIdentifier_free(asn_TYPE_descriptor_t *td,
3442 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003443 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003444 td->free_struct(td, struct_ptr, contents_only);
3445}
3446
3447int
3448VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3449 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003450 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003451 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3452}
3453
3454asn_dec_rval_t
3455VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003456 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003457 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003458 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3459}
3460
3461asn_enc_rval_t
3462VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td,
3463 void *structure, int tag_mode, ber_tlv_tag_t tag,
3464 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003465 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003466 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3467}
3468
3469asn_dec_rval_t
3470VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003471 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003472 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003473 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3474}
3475
3476asn_enc_rval_t
3477VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3478 int ilevel, enum xer_encoder_flags_e flags,
3479 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003480 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003481 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3482}
3483
3484
3485/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
3486
Lev Walkina7591b52014-10-12 18:37:35 -07003487static const ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003488 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3489};
3490asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = {
3491 "VisibleIdentifier",
3492 "VisibleIdentifier",
3493 VisibleIdentifier_free,
3494 VisibleIdentifier_print,
3495 VisibleIdentifier_constraint,
3496 VisibleIdentifier_decode_ber,
3497 VisibleIdentifier_encode_der,
3498 VisibleIdentifier_decode_xer,
3499 VisibleIdentifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003500 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003501 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003502 asn_DEF_VisibleIdentifier_tags_1,
3503 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3504 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3505 asn_DEF_VisibleIdentifier_tags_1, /* Same as above */
3506 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3507 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3508 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003509 0, 0, /* No members */
3510 0 /* No specifics */
3511};
Lev Walkin154aa182004-09-26 13:12:56 +00003512
3513
Lev Walkin59b176e2005-11-26 11:25:14 +00003514/*** <<< INCLUDES [Sequence] >>> ***/
3515
Lev Walkin22b5ed42006-09-13 02:51:20 +00003516#include "Int1.h"
3517#include "Int4.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003518#include <BOOLEAN.h>
3519#include <ENUMERATED.h>
3520#include <NULL.h>
Lev Walkin22b5ed42006-09-13 02:51:20 +00003521#include "Int5.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003522#include <constr_SEQUENCE.h>
3523
3524/*** <<< DEPS [Sequence] >>> ***/
3525
3526typedef enum enum_c {
3527 enum_c_one = 1,
3528 enum_c_two = 2,
3529 /*
3530 * Enumeration is extensible
3531 */
3532 enum_c_three = 3
Lev Walkin171487e2006-03-21 07:25:18 +00003533} e_enum_c;
Lev Walkin59b176e2005-11-26 11:25:14 +00003534
3535/*** <<< TYPE-DECLS [Sequence] >>> ***/
3536
3537typedef struct Sequence {
3538 Int1_t *int1_c /* DEFAULT 3 */;
3539 Int4_t int4;
3540 Int4_t int4_c;
Lev Walkin2a744a72013-03-27 01:56:23 -07003541 BOOLEAN_t *Bool /* DEFAULT 1 */;
Lev Walkin59b176e2005-11-26 11:25:14 +00003542 ENUMERATED_t enum_c;
3543 NULL_t *null /* OPTIONAL */;
3544 /*
3545 * This type is extensible,
3546 * possible extensions are below.
3547 */
3548 Int5_t *int5_c /* OPTIONAL */;
3549
3550 /* Context for parsing across buffer boundaries */
3551 asn_struct_ctx_t _asn_ctx;
3552} Sequence_t;
3553
3554/*** <<< FUNC-DECLS [Sequence] >>> ***/
3555
3556/* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */
3557extern asn_TYPE_descriptor_t asn_DEF_Sequence;
3558
3559/*** <<< CODE [Sequence] >>> ***/
3560
3561static int
3562enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003563 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003564 /* Replace with underlying type checker */
3565 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003566 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00003567}
3568
3569/*
3570 * This type is implemented using ENUMERATED,
3571 * so here we adjust the DEF accordingly.
3572 */
3573static void
3574enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
3575 td->free_struct = asn_DEF_ENUMERATED.free_struct;
3576 td->print_struct = asn_DEF_ENUMERATED.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003577 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00003578 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
3579 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
3580 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
3581 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
3582 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003583 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003584 if(!td->per_constraints)
3585 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
3586 td->elements = asn_DEF_ENUMERATED.elements;
3587 td->elements_count = asn_DEF_ENUMERATED.elements_count;
3588 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
3589}
3590
3591static void
3592enum_c_6_free(asn_TYPE_descriptor_t *td,
3593 void *struct_ptr, int contents_only) {
3594 enum_c_6_inherit_TYPE_descriptor(td);
3595 td->free_struct(td, struct_ptr, contents_only);
3596}
3597
3598static int
3599enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3600 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
3601 enum_c_6_inherit_TYPE_descriptor(td);
3602 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3603}
3604
3605static asn_dec_rval_t
3606enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3607 void **structure, const void *bufptr, size_t size, int tag_mode) {
3608 enum_c_6_inherit_TYPE_descriptor(td);
3609 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3610}
3611
3612static asn_enc_rval_t
3613enum_c_6_encode_der(asn_TYPE_descriptor_t *td,
3614 void *structure, int tag_mode, ber_tlv_tag_t tag,
3615 asn_app_consume_bytes_f *cb, void *app_key) {
3616 enum_c_6_inherit_TYPE_descriptor(td);
3617 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3618}
3619
3620static asn_dec_rval_t
3621enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3622 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
3623 enum_c_6_inherit_TYPE_descriptor(td);
3624 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3625}
3626
3627static asn_enc_rval_t
3628enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3629 int ilevel, enum xer_encoder_flags_e flags,
3630 asn_app_consume_bytes_f *cb, void *app_key) {
3631 enum_c_6_inherit_TYPE_descriptor(td);
3632 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3633}
3634
3635static int
3636memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003637 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003638 const Int1_t *st = (const Int1_t *)sptr;
3639 long value;
3640
3641 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003642 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003643 "%s: value not given (%s:%d)",
3644 td->name, __FILE__, __LINE__);
3645 return -1;
3646 }
3647
3648 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003649 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003650 "%s: value too large (%s:%d)",
3651 td->name, __FILE__, __LINE__);
3652 return -1;
3653 }
3654
3655 if((value >= -2)) {
3656 /* Constraint check succeeded */
3657 return 0;
3658 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003659 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003660 "%s: constraint failed (%s:%d)",
3661 td->name, __FILE__, __LINE__);
3662 return -1;
3663 }
3664}
3665
3666static int
3667memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003668 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003669 const Int4_t *st = (const Int4_t *)sptr;
3670 long value;
3671
3672 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003673 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003674 "%s: value not given (%s:%d)",
3675 td->name, __FILE__, __LINE__);
3676 return -1;
3677 }
3678
3679 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003680 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003681 "%s: value too large (%s:%d)",
3682 td->name, __FILE__, __LINE__);
3683 return -1;
3684 }
3685
3686 if((value >= 5 && value <= 7)) {
3687 /* Constraint check succeeded */
3688 return 0;
3689 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003690 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003691 "%s: constraint failed (%s:%d)",
3692 td->name, __FILE__, __LINE__);
3693 return -1;
3694 }
3695}
3696
3697static int
3698memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003699 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003700 const Int5_t *st = (const Int5_t *)sptr;
3701 long value;
3702
3703 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003704 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003705 "%s: value not given (%s:%d)",
3706 td->name, __FILE__, __LINE__);
3707 return -1;
3708 }
3709
3710 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003711 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003712 "%s: value too large (%s:%d)",
3713 td->name, __FILE__, __LINE__);
3714 return -1;
3715 }
3716
3717 if((value == 5)) {
3718 /* Constraint check succeeded */
3719 return 0;
3720 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00003721 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003722 "%s: constraint failed (%s:%d)",
3723 td->name, __FILE__, __LINE__);
3724 return -1;
3725 }
3726}
3727
3728
3729/*** <<< STAT-DEFS [Sequence] >>> ***/
3730
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003731static int asn_DFL_2_set_3(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003732 Int1_t *st = *sptr;
3733
3734 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003735 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003736 st = (*sptr = CALLOC(1, sizeof(*st)));
3737 if(!st) return -1;
3738 }
3739
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003740 if(set_value) {
3741 /* Install default value 3 */
3742 return asn_long2INTEGER(st, 3);
3743 } else {
3744 /* Test default value 3 */
3745 long value;
3746 if(asn_INTEGER2long(st, &value))
3747 return -1;
3748 return (value == 3);
3749 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003750}
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003751static int asn_DFL_5_set_1(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003752 BOOLEAN_t *st = *sptr;
3753
3754 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003755 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003756 st = (*sptr = CALLOC(1, sizeof(*st)));
3757 if(!st) return -1;
3758 }
3759
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003760 if(set_value) {
3761 /* Install default value 1 */
3762 *st = 1;
3763 return 0;
3764 } else {
3765 /* Test default value 1 */
3766 return (*st == 1);
3767 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003768}
Lev Walkina7591b52014-10-12 18:37:35 -07003769static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003770 { 1, 3, "one" },
3771 { 2, 3, "two" },
3772 { 3, 5, "three" }
3773 /* This list is extensible */
3774};
Lev Walkina7591b52014-10-12 18:37:35 -07003775static const unsigned int asn_MAP_enum_c_enum2value_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003776 0, /* one(1) */
3777 2, /* three(3) */
3778 1 /* two(2) */
3779 /* This list is extensible */
3780};
Lev Walkina7591b52014-10-12 18:37:35 -07003781static const asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003782 asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */
3783 asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */
3784 3, /* Number of elements in the maps */
3785 3, /* Extensions before this member */
Lev Walkin8bb57a22007-12-03 13:41:36 +00003786 1, /* Strict enumeration */
3787 0, /* Native long size */
3788 0
Lev Walkin59b176e2005-11-26 11:25:14 +00003789};
Lev Walkina7591b52014-10-12 18:37:35 -07003790static const ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003791 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
3792};
3793static /* Use -fall-defs-global to expose */
3794asn_TYPE_descriptor_t asn_DEF_enum_c_6 = {
3795 "enum-c",
3796 "enum-c",
3797 enum_c_6_free,
3798 enum_c_6_print,
3799 enum_c_6_constraint,
3800 enum_c_6_decode_ber,
3801 enum_c_6_encode_der,
3802 enum_c_6_decode_xer,
3803 enum_c_6_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003804 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003805 0, /* Use generic outmost tag fetcher */
3806 asn_DEF_enum_c_tags_6,
3807 sizeof(asn_DEF_enum_c_tags_6)
3808 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3809 asn_DEF_enum_c_tags_6, /* Same as above */
3810 sizeof(asn_DEF_enum_c_tags_6)
3811 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3812 0, /* No PER visible constraints */
3813 0, 0, /* Defined elsewhere */
3814 &asn_SPC_enum_c_specs_6 /* Additional specs */
3815};
3816
3817static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
3818 { ATF_POINTER, 1, offsetof(struct Sequence, int1_c),
3819 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3820 .tag_mode = 0,
3821 .type = &asn_DEF_Int1,
3822 .memb_constraints = memb_int1_c_constraint_1,
3823 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3824 .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */
3825 .name = "int1-c"
3826 },
3827 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4),
3828 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
3829 .tag_mode = +1, /* EXPLICIT tag at current level */
3830 .type = &asn_DEF_Int4,
3831 .memb_constraints = 0, /* Defer constraints checking to the member type */
3832 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3833 .default_value = 0,
3834 .name = "int4"
3835 },
3836 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c),
3837 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3838 .tag_mode = 0,
3839 .type = &asn_DEF_Int4,
3840 .memb_constraints = memb_int4_c_constraint_1,
3841 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3842 .default_value = 0,
3843 .name = "int4-c"
3844 },
Lev Walkin2a744a72013-03-27 01:56:23 -07003845 { ATF_POINTER, 1, offsetof(struct Sequence, Bool),
Lev Walkin59b176e2005-11-26 11:25:14 +00003846 .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
3847 .tag_mode = 0,
3848 .type = &asn_DEF_BOOLEAN,
3849 .memb_constraints = 0, /* Defer constraints checking to the member type */
3850 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3851 .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */
3852 .name = "bool"
3853 },
3854 { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c),
3855 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
3856 .tag_mode = 0,
3857 .type = &asn_DEF_enum_c_6,
3858 .memb_constraints = 0, /* Defer constraints checking to the member type */
3859 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3860 .default_value = 0,
3861 .name = "enum-c"
3862 },
3863 { ATF_POINTER, 2, offsetof(struct Sequence, null),
3864 .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)),
3865 .tag_mode = 0,
3866 .type = &asn_DEF_NULL,
3867 .memb_constraints = 0, /* Defer constraints checking to the member type */
3868 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3869 .default_value = 0,
3870 .name = "null"
3871 },
3872 { ATF_POINTER, 1, offsetof(struct Sequence, int5_c),
3873 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3874 .tag_mode = 0,
3875 .type = &asn_DEF_Int5,
3876 .memb_constraints = memb_int5_c_constraint_1,
3877 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3878 .default_value = 0,
3879 .name = "int5-c"
3880 },
3881};
Lev Walkina7591b52014-10-12 18:37:35 -07003882static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003883 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
3884};
Lev Walkina7591b52014-10-12 18:37:35 -07003885static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -07003886 { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */
3887 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c */
3888 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c */
3889 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c */
3890 { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null */
3891 { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c */
3892 { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 */
Lev Walkin59b176e2005-11-26 11:25:14 +00003893};
3894static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
3895 sizeof(struct Sequence),
3896 offsetof(struct Sequence, _asn_ctx),
3897 asn_MAP_Sequence_tag2el_1,
3898 7, /* Count of tags in the map */
3899 0, 0, 0, /* Optional elements (not needed) */
3900 5, /* Start extensions */
3901 8 /* Stop extensions */
3902};
3903asn_TYPE_descriptor_t asn_DEF_Sequence = {
3904 "Sequence",
3905 "Sequence",
3906 SEQUENCE_free,
3907 SEQUENCE_print,
3908 SEQUENCE_constraint,
3909 SEQUENCE_decode_ber,
3910 SEQUENCE_encode_der,
3911 SEQUENCE_decode_xer,
3912 SEQUENCE_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003913 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003914 0, /* Use generic outmost tag fetcher */
3915 asn_DEF_Sequence_tags_1,
3916 sizeof(asn_DEF_Sequence_tags_1)
3917 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3918 asn_DEF_Sequence_tags_1, /* Same as above */
3919 sizeof(asn_DEF_Sequence_tags_1)
3920 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3921 0, /* No PER visible constraints */
3922 asn_MBR_Sequence_1,
3923 7, /* Elements count */
3924 &asn_SPC_Sequence_specs_1 /* Additional specs */
3925};
3926
3927
3928/*** <<< INCLUDES [SequenceOf] >>> ***/
3929
3930#include <asn_SEQUENCE_OF.h>
3931#include <constr_SEQUENCE_OF.h>
3932
3933/*** <<< FWD-DECLS [SequenceOf] >>> ***/
3934
3935struct Sequence;
3936
3937/*** <<< TYPE-DECLS [SequenceOf] >>> ***/
3938
3939typedef struct SequenceOf {
3940 A_SEQUENCE_OF(struct Sequence) list;
3941
3942 /* Context for parsing across buffer boundaries */
3943 asn_struct_ctx_t _asn_ctx;
3944} SequenceOf_t;
3945
3946/*** <<< FUNC-DECLS [SequenceOf] >>> ***/
3947
3948extern asn_TYPE_descriptor_t asn_DEF_SequenceOf;
3949
3950/*** <<< POST-INCLUDE [SequenceOf] >>> ***/
3951
Lev Walkin22b5ed42006-09-13 02:51:20 +00003952#include "Sequence.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003953
3954/*** <<< STAT-DEFS [SequenceOf] >>> ***/
3955
3956static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = {
3957 { ATF_POINTER, 0, 0,
3958 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
3959 .tag_mode = 0,
3960 .type = &asn_DEF_Sequence,
3961 .memb_constraints = 0, /* Defer constraints checking to the member type */
3962 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3963 .default_value = 0,
3964 .name = ""
3965 },
3966};
Lev Walkina7591b52014-10-12 18:37:35 -07003967static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003968 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
3969};
3970static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = {
3971 sizeof(struct SequenceOf),
3972 offsetof(struct SequenceOf, _asn_ctx),
3973 0, /* XER encoding is XMLDelimitedItemList */
3974};
3975asn_TYPE_descriptor_t asn_DEF_SequenceOf = {
3976 "SequenceOf",
3977 "SequenceOf",
3978 SEQUENCE_OF_free,
3979 SEQUENCE_OF_print,
3980 SEQUENCE_OF_constraint,
3981 SEQUENCE_OF_decode_ber,
3982 SEQUENCE_OF_encode_der,
3983 SEQUENCE_OF_decode_xer,
3984 SEQUENCE_OF_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003985 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003986 0, /* Use generic outmost tag fetcher */
3987 asn_DEF_SequenceOf_tags_1,
3988 sizeof(asn_DEF_SequenceOf_tags_1)
3989 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
3990 asn_DEF_SequenceOf_tags_1, /* Same as above */
3991 sizeof(asn_DEF_SequenceOf_tags_1)
3992 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
3993 0, /* No PER visible constraints */
3994 asn_MBR_SequenceOf_1,
3995 1, /* Single element */
3996 &asn_SPC_SequenceOf_specs_1 /* Additional specs */
3997};
3998
3999
4000/*** <<< INCLUDES [Enum0] >>> ***/
4001
4002#include <ENUMERATED.h>
4003
4004/*** <<< DEPS [Enum0] >>> ***/
4005
4006typedef enum Enum0 {
4007 Enum0_one = 0,
4008 Enum0_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00004009} e_Enum0;
Lev Walkin59b176e2005-11-26 11:25:14 +00004010
4011/*** <<< TYPE-DECLS [Enum0] >>> ***/
4012
4013typedef ENUMERATED_t Enum0_t;
4014
4015/*** <<< FUNC-DECLS [Enum0] >>> ***/
4016
4017extern asn_TYPE_descriptor_t asn_DEF_Enum0;
4018asn_struct_free_f Enum0_free;
4019asn_struct_print_f Enum0_print;
4020asn_constr_check_f Enum0_constraint;
4021ber_type_decoder_f Enum0_decode_ber;
4022der_type_encoder_f Enum0_encode_der;
4023xer_type_decoder_f Enum0_decode_xer;
4024xer_type_encoder_f Enum0_encode_xer;
4025
4026/*** <<< CODE [Enum0] >>> ***/
4027
4028int
4029Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004030 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004031 /* Replace with underlying type checker */
4032 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00004033 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00004034}
4035
4036/*
4037 * This type is implemented using ENUMERATED,
4038 * so here we adjust the DEF accordingly.
4039 */
4040static void
4041Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4042 td->free_struct = asn_DEF_ENUMERATED.free_struct;
4043 td->print_struct = asn_DEF_ENUMERATED.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004044 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00004045 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
4046 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
4047 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
4048 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
4049 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004050 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004051 if(!td->per_constraints)
4052 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
4053 td->elements = asn_DEF_ENUMERATED.elements;
4054 td->elements_count = asn_DEF_ENUMERATED.elements_count;
4055 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
4056}
4057
4058void
4059Enum0_free(asn_TYPE_descriptor_t *td,
4060 void *struct_ptr, int contents_only) {
4061 Enum0_1_inherit_TYPE_descriptor(td);
4062 td->free_struct(td, struct_ptr, contents_only);
4063}
4064
4065int
4066Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4067 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4068 Enum0_1_inherit_TYPE_descriptor(td);
4069 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4070}
4071
4072asn_dec_rval_t
4073Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4074 void **structure, const void *bufptr, size_t size, int tag_mode) {
4075 Enum0_1_inherit_TYPE_descriptor(td);
4076 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4077}
4078
4079asn_enc_rval_t
4080Enum0_encode_der(asn_TYPE_descriptor_t *td,
4081 void *structure, int tag_mode, ber_tlv_tag_t tag,
4082 asn_app_consume_bytes_f *cb, void *app_key) {
4083 Enum0_1_inherit_TYPE_descriptor(td);
4084 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4085}
4086
4087asn_dec_rval_t
4088Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4089 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4090 Enum0_1_inherit_TYPE_descriptor(td);
4091 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4092}
4093
4094asn_enc_rval_t
4095Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4096 int ilevel, enum xer_encoder_flags_e flags,
4097 asn_app_consume_bytes_f *cb, void *app_key) {
4098 Enum0_1_inherit_TYPE_descriptor(td);
4099 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4100}
4101
4102
4103/*** <<< STAT-DEFS [Enum0] >>> ***/
4104
Lev Walkina7591b52014-10-12 18:37:35 -07004105static const asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004106 { 0, 3, "one" },
4107 { 1, 3, "two" }
4108};
Lev Walkina7591b52014-10-12 18:37:35 -07004109static const unsigned int asn_MAP_Enum0_enum2value_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004110 0, /* one(0) */
4111 1 /* two(1) */
4112};
Lev Walkina7591b52014-10-12 18:37:35 -07004113static const asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004114 asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */
4115 asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */
4116 2, /* Number of elements in the maps */
4117 0, /* Enumeration is not extensible */
Lev Walkin8bb57a22007-12-03 13:41:36 +00004118 1, /* Strict enumeration */
4119 0, /* Native long size */
4120 0
Lev Walkin59b176e2005-11-26 11:25:14 +00004121};
Lev Walkina7591b52014-10-12 18:37:35 -07004122static const ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004123 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4124};
4125asn_TYPE_descriptor_t asn_DEF_Enum0 = {
4126 "Enum0",
4127 "Enum0",
4128 Enum0_free,
4129 Enum0_print,
4130 Enum0_constraint,
4131 Enum0_decode_ber,
4132 Enum0_encode_der,
4133 Enum0_decode_xer,
4134 Enum0_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004135 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004136 0, /* Use generic outmost tag fetcher */
4137 asn_DEF_Enum0_tags_1,
4138 sizeof(asn_DEF_Enum0_tags_1)
4139 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4140 asn_DEF_Enum0_tags_1, /* Same as above */
4141 sizeof(asn_DEF_Enum0_tags_1)
4142 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4143 0, /* No PER visible constraints */
4144 0, 0, /* Defined elsewhere */
4145 &asn_SPC_Enum0_specs_1 /* Additional specs */
4146};
4147
4148
4149/*** <<< INCLUDES [Enum1] >>> ***/
4150
4151#include <NativeEnumerated.h>
4152
4153/*** <<< DEPS [Enum1] >>> ***/
4154
4155typedef enum Enum1 {
4156 Enum1_one = 0,
4157 Enum1_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00004158} e_Enum1;
Lev Walkin59b176e2005-11-26 11:25:14 +00004159
4160/*** <<< TYPE-DECLS [Enum1] >>> ***/
4161
4162typedef long Enum1_t;
4163
4164/*** <<< FUNC-DECLS [Enum1] >>> ***/
4165
4166extern asn_TYPE_descriptor_t asn_DEF_Enum1;
4167asn_struct_free_f Enum1_free;
4168asn_struct_print_f Enum1_print;
4169asn_constr_check_f Enum1_constraint;
4170ber_type_decoder_f Enum1_decode_ber;
4171der_type_encoder_f Enum1_encode_der;
4172xer_type_decoder_f Enum1_decode_xer;
4173xer_type_encoder_f Enum1_encode_xer;
4174
4175/*** <<< CODE [Enum1] >>> ***/
4176
4177int
4178Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004179 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004180 long value;
4181
4182 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004183 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004184 "%s: value not given (%s:%d)",
4185 td->name, __FILE__, __LINE__);
4186 return -1;
4187 }
4188
4189 value = *(const long *)sptr;
4190
4191 if((value == 0)) {
4192 /* Constraint check succeeded */
4193 return 0;
4194 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004195 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004196 "%s: constraint failed (%s:%d)",
4197 td->name, __FILE__, __LINE__);
4198 return -1;
4199 }
4200}
4201
4202/*
4203 * This type is implemented using NativeEnumerated,
4204 * so here we adjust the DEF accordingly.
4205 */
4206static void
4207Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4208 td->free_struct = asn_DEF_NativeEnumerated.free_struct;
4209 td->print_struct = asn_DEF_NativeEnumerated.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004210 td->check_constraints = asn_DEF_NativeEnumerated.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00004211 td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder;
4212 td->der_encoder = asn_DEF_NativeEnumerated.der_encoder;
4213 td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder;
4214 td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder;
4215 td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004216 td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004217 if(!td->per_constraints)
4218 td->per_constraints = asn_DEF_NativeEnumerated.per_constraints;
4219 td->elements = asn_DEF_NativeEnumerated.elements;
4220 td->elements_count = asn_DEF_NativeEnumerated.elements_count;
4221 /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */
4222}
4223
4224void
4225Enum1_free(asn_TYPE_descriptor_t *td,
4226 void *struct_ptr, int contents_only) {
4227 Enum1_1_inherit_TYPE_descriptor(td);
4228 td->free_struct(td, struct_ptr, contents_only);
4229}
4230
4231int
4232Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4233 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4234 Enum1_1_inherit_TYPE_descriptor(td);
4235 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4236}
4237
4238asn_dec_rval_t
4239Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4240 void **structure, const void *bufptr, size_t size, int tag_mode) {
4241 Enum1_1_inherit_TYPE_descriptor(td);
4242 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4243}
4244
4245asn_enc_rval_t
4246Enum1_encode_der(asn_TYPE_descriptor_t *td,
4247 void *structure, int tag_mode, ber_tlv_tag_t tag,
4248 asn_app_consume_bytes_f *cb, void *app_key) {
4249 Enum1_1_inherit_TYPE_descriptor(td);
4250 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4251}
4252
4253asn_dec_rval_t
4254Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4255 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4256 Enum1_1_inherit_TYPE_descriptor(td);
4257 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4258}
4259
4260asn_enc_rval_t
4261Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4262 int ilevel, enum xer_encoder_flags_e flags,
4263 asn_app_consume_bytes_f *cb, void *app_key) {
4264 Enum1_1_inherit_TYPE_descriptor(td);
4265 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4266}
4267
4268
4269/*** <<< STAT-DEFS [Enum1] >>> ***/
4270
Lev Walkina7591b52014-10-12 18:37:35 -07004271static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004272 { 0, 3, "one" },
4273 { 1, 3, "two" }
4274};
Lev Walkina7591b52014-10-12 18:37:35 -07004275static const unsigned int asn_MAP_Enum1_enum2value_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004276 0, /* one(0) */
4277 1 /* two(1) */
4278};
Lev Walkina7591b52014-10-12 18:37:35 -07004279static const asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004280 asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */
4281 asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */
4282 2, /* Number of elements in the maps */
4283 0, /* Enumeration is not extensible */
Lev Walkin8bb57a22007-12-03 13:41:36 +00004284 1, /* Strict enumeration */
4285 0, /* Native long size */
4286 0
Lev Walkin59b176e2005-11-26 11:25:14 +00004287};
Lev Walkina7591b52014-10-12 18:37:35 -07004288static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004289 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4290};
4291asn_TYPE_descriptor_t asn_DEF_Enum1 = {
4292 "Enum1",
4293 "Enum1",
4294 Enum1_free,
4295 Enum1_print,
4296 Enum1_constraint,
4297 Enum1_decode_ber,
4298 Enum1_encode_der,
4299 Enum1_decode_xer,
4300 Enum1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004301 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004302 0, /* Use generic outmost tag fetcher */
4303 asn_DEF_Enum1_tags_1,
4304 sizeof(asn_DEF_Enum1_tags_1)
4305 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4306 asn_DEF_Enum1_tags_1, /* Same as above */
4307 sizeof(asn_DEF_Enum1_tags_1)
4308 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4309 0, /* No PER visible constraints */
4310 0, 0, /* Defined elsewhere */
4311 &asn_SPC_Enum1_specs_1 /* Additional specs */
4312};
4313
4314
Lev Walkin154aa182004-09-26 13:12:56 +00004315/*** <<< INCLUDES [Identifier] >>> ***/
4316
4317#include <VisibleString.h>
4318
4319/*** <<< TYPE-DECLS [Identifier] >>> ***/
4320
Lev Walkin154aa182004-09-26 13:12:56 +00004321typedef VisibleString_t Identifier_t;
4322
4323/*** <<< FUNC-DECLS [Identifier] >>> ***/
4324
Lev Walkindfae9752004-09-29 13:19:37 +00004325extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00004326asn_struct_free_f Identifier_free;
4327asn_struct_print_f Identifier_print;
4328asn_constr_check_f Identifier_constraint;
4329ber_type_decoder_f Identifier_decode_ber;
4330der_type_encoder_f Identifier_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004331xer_type_decoder_f Identifier_decode_xer;
Lev Walkin154aa182004-09-26 13:12:56 +00004332xer_type_encoder_f Identifier_encode_xer;
4333
4334/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004335
Lev Walkina7591b52014-10-12 18:37:35 -07004336static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00004337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
4338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
4339 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */
4340 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */
4341 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */
434227,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */
4343 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */
434454,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004345};
4346
Lev Walkine8318b82005-03-06 09:29:03 +00004347static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07004348 const int *table = permitted_alphabet_table_1;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004349 /* The underlying type is VisibleString */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004350 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004351 const uint8_t *ch = st->buf;
4352 const uint8_t *end = ch + st->size;
4353
4354 for(; ch < end; ch++) {
4355 uint8_t cv = *ch;
4356 if(!table[cv]) return -1;
4357 }
4358 return 0;
4359}
4360
4361
Lev Walkin154aa182004-09-26 13:12:56 +00004362/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004363
4364int
Lev Walkindfae9752004-09-29 13:19:37 +00004365Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004366 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004367 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004368 size_t size;
4369
4370 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004371 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004372 "%s: value not given (%s:%d)",
4373 td->name, __FILE__, __LINE__);
4374 return -1;
4375 }
4376
4377 size = st->size;
4378
4379 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00004380 && !check_permitted_alphabet_1(st)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004381 /* Constraint check succeeded */
4382 return 0;
4383 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +00004384 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004385 "%s: constraint failed (%s:%d)",
4386 td->name, __FILE__, __LINE__);
4387 return -1;
4388 }
4389}
4390
4391/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004392 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00004393 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004394 */
4395static void
Lev Walkine8318b82005-03-06 09:29:03 +00004396Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00004397 td->free_struct = asn_DEF_VisibleString.free_struct;
4398 td->print_struct = asn_DEF_VisibleString.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004399 td->check_constraints = asn_DEF_VisibleString.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00004400 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
4401 td->der_encoder = asn_DEF_VisibleString.der_encoder;
4402 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
4403 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004404 td->uper_decoder = asn_DEF_VisibleString.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004405 td->uper_encoder = asn_DEF_VisibleString.uper_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004406 if(!td->per_constraints)
4407 td->per_constraints = asn_DEF_VisibleString.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00004408 td->elements = asn_DEF_VisibleString.elements;
4409 td->elements_count = asn_DEF_VisibleString.elements_count;
4410 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004411}
4412
Lev Walkina9cc46e2004-09-22 16:06:28 +00004413void
Lev Walkindfae9752004-09-29 13:19:37 +00004414Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004415 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00004416 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004417 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004418}
4419
4420int
Lev Walkindfae9752004-09-29 13:19:37 +00004421Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004422 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004423 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004424 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4425}
4426
Lev Walkindc06f6b2004-10-20 15:50:55 +00004427asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004428Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004429 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00004430 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00004431 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004432}
4433
4434asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004435Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004436 void *structure, int tag_mode, ber_tlv_tag_t tag,
4437 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004438 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004439 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4440}
4441
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004442asn_dec_rval_t
4443Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004444 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00004445 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004446 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4447}
4448
Lev Walkina9cc46e2004-09-22 16:06:28 +00004449asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004450Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004451 int ilevel, enum xer_encoder_flags_e flags,
4452 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004453 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004454 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004455}
4456
4457
4458/*** <<< STAT-DEFS [Identifier] >>> ***/
4459
Lev Walkina7591b52014-10-12 18:37:35 -07004460static const ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004461 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
4462};
Lev Walkindfae9752004-09-29 13:19:37 +00004463asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004464 "Identifier",
Lev Walkindc06f6b2004-10-20 15:50:55 +00004465 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00004466 Identifier_free,
4467 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004468 Identifier_constraint,
4469 Identifier_decode_ber,
4470 Identifier_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004471 Identifier_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004472 Identifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004473 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004474 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00004475 asn_DEF_Identifier_tags_1,
4476 sizeof(asn_DEF_Identifier_tags_1)
4477 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4478 asn_DEF_Identifier_tags_1, /* Same as above */
4479 sizeof(asn_DEF_Identifier_tags_1)
4480 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4481 0, /* No PER visible constraints */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004482 0, 0, /* No members */
4483 0 /* No specifics */
4484};
4485