blob: 75b3698e85abb46a93bdb162a10b9d3ff69994e3 [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 Walkinba68c912017-07-06 07:52:39 -070046 td->oer_decoder = asn_DEF_INTEGER.oer_decoder;
47 td->oer_encoder = asn_DEF_INTEGER.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +000048 if(!td->per_constraints)
49 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +000050 td->elements = asn_DEF_INTEGER.elements;
51 td->elements_count = asn_DEF_INTEGER.elements_count;
52 td->specifics = asn_DEF_INTEGER.specifics;
53}
54
55void
56Int1_free(asn_TYPE_descriptor_t *td,
57 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +000058 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000059 td->free_struct(td, struct_ptr, contents_only);
60}
61
62int
63Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
64 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000065 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000066 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
67}
68
69asn_dec_rval_t
70Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000071 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +000072 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000073 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
74}
75
76asn_enc_rval_t
77Int1_encode_der(asn_TYPE_descriptor_t *td,
78 void *structure, int tag_mode, ber_tlv_tag_t tag,
79 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000080 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000081 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
82}
83
84asn_dec_rval_t
85Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +000086 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +000087 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000088 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
89}
90
91asn_enc_rval_t
92Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
93 int ilevel, enum xer_encoder_flags_e flags,
94 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +000095 Int1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +000096 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
97}
98
99
100/*** <<< STAT-DEFS [Int1] >>> ***/
101
Lev Walkina7591b52014-10-12 18:37:35 -0700102static const ber_tlv_tag_t asn_DEF_Int1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000103 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
104};
105asn_TYPE_descriptor_t asn_DEF_Int1 = {
106 "Int1",
107 "Int1",
108 Int1_free,
109 Int1_print,
110 Int1_constraint,
111 Int1_decode_ber,
112 Int1_encode_der,
113 Int1_decode_xer,
114 Int1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000115 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700116 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000117 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000118 asn_DEF_Int1_tags_1,
119 sizeof(asn_DEF_Int1_tags_1)
120 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
121 asn_DEF_Int1_tags_1, /* Same as above */
122 sizeof(asn_DEF_Int1_tags_1)
123 /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */
124 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000125 0, 0, /* No members */
126 0 /* No specifics */
127};
Lev Walkin006de1c2004-08-20 13:37:45 +0000128
129
130/*** <<< INCLUDES [Int2] >>> ***/
131
Lev Walkin22b5ed42006-09-13 02:51:20 +0000132#include "Int1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000133
134/*** <<< TYPE-DECLS [Int2] >>> ***/
135
Lev Walkin006de1c2004-08-20 13:37:45 +0000136typedef Int1_t Int2_t;
137
Lev Walkin006de1c2004-08-20 13:37:45 +0000138/*** <<< FUNC-DECLS [Int2] >>> ***/
139
Lev Walkindfae9752004-09-29 13:19:37 +0000140extern asn_TYPE_descriptor_t asn_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000141asn_struct_free_f Int2_free;
142asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000143asn_constr_check_f Int2_constraint;
144ber_type_decoder_f Int2_decode_ber;
145der_type_encoder_f Int2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000146xer_type_decoder_f Int2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000147xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000148
149/*** <<< CODE [Int2] >>> ***/
150
151int
Lev Walkindfae9752004-09-29 13:19:37 +0000152Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000153 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000154 const Int1_t *st = (const Int1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000155 long value;
156
157 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700158 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000159 "%s: value not given (%s:%d)",
160 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000161 return -1;
162 }
163
Lev Walkin44467432004-09-07 06:43:57 +0000164 /* Check if the sign bit is present */
165 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000166
167 if((value >= 0)) {
168 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000169 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000170 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700171 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000172 "%s: constraint failed (%s:%d)",
173 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000174 return -1;
175 }
176}
177
178/*
179 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000180 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000181 */
182static void
Lev Walkine8318b82005-03-06 09:29:03 +0000183Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000184 td->free_struct = asn_DEF_Int1.free_struct;
185 td->print_struct = asn_DEF_Int1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800186 td->check_constraints = asn_DEF_Int1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000187 td->ber_decoder = asn_DEF_Int1.ber_decoder;
188 td->der_encoder = asn_DEF_Int1.der_encoder;
189 td->xer_decoder = asn_DEF_Int1.xer_decoder;
190 td->xer_encoder = asn_DEF_Int1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000191 td->uper_decoder = asn_DEF_Int1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000192 td->uper_encoder = asn_DEF_Int1.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700193 td->oer_decoder = asn_DEF_Int1.oer_decoder;
194 td->oer_encoder = asn_DEF_Int1.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000195 if(!td->per_constraints)
196 td->per_constraints = asn_DEF_Int1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000197 td->elements = asn_DEF_Int1.elements;
198 td->elements_count = asn_DEF_Int1.elements_count;
199 td->specifics = asn_DEF_Int1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000200}
201
Lev Walkina9cc46e2004-09-22 16:06:28 +0000202void
Lev Walkindfae9752004-09-29 13:19:37 +0000203Int2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000204 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000205 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000206 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000207}
208
209int
Lev Walkindfae9752004-09-29 13:19:37 +0000210Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000211 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000212 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000213 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
214}
215
Lev Walkindc06f6b2004-10-20 15:50:55 +0000216asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000217Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000218 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000219 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000220 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000221}
222
223asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000224Int2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000225 void *structure, int tag_mode, ber_tlv_tag_t tag,
226 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000227 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000228 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
229}
230
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000231asn_dec_rval_t
232Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000233 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000234 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000235 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
236}
237
Lev Walkina9cc46e2004-09-22 16:06:28 +0000238asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000239Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000240 int ilevel, enum xer_encoder_flags_e flags,
241 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000242 Int2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000243 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000244}
245
246
247/*** <<< STAT-DEFS [Int2] >>> ***/
248
Lev Walkina7591b52014-10-12 18:37:35 -0700249static const ber_tlv_tag_t asn_DEF_Int2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000250 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000251};
Lev Walkindfae9752004-09-29 13:19:37 +0000252asn_TYPE_descriptor_t asn_DEF_Int2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000253 "Int2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000254 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000255 Int2_free,
256 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000257 Int2_constraint,
258 Int2_decode_ber,
259 Int2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000260 Int2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000261 Int2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000262 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700263 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000264 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000265 asn_DEF_Int2_tags_1,
266 sizeof(asn_DEF_Int2_tags_1)
267 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
268 asn_DEF_Int2_tags_1, /* Same as above */
269 sizeof(asn_DEF_Int2_tags_1)
270 /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */
271 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000272 0, 0, /* No members */
273 0 /* No specifics */
274};
275
276
277/*** <<< INCLUDES [Int3] >>> ***/
278
Lev Walkin22b5ed42006-09-13 02:51:20 +0000279#include "Int2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000280
281/*** <<< TYPE-DECLS [Int3] >>> ***/
282
Lev Walkin006de1c2004-08-20 13:37:45 +0000283typedef Int2_t Int3_t;
284
Lev Walkin006de1c2004-08-20 13:37:45 +0000285/*** <<< FUNC-DECLS [Int3] >>> ***/
286
Lev Walkindfae9752004-09-29 13:19:37 +0000287extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000288asn_struct_free_f Int3_free;
289asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000290asn_constr_check_f Int3_constraint;
291ber_type_decoder_f Int3_decode_ber;
292der_type_encoder_f Int3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000293xer_type_decoder_f Int3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000294xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000295
296/*** <<< CODE [Int3] >>> ***/
297
298int
Lev Walkindfae9752004-09-29 13:19:37 +0000299Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000300 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000301 const Int2_t *st = (const Int2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000302 long value;
303
304 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700305 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000306 "%s: value not given (%s:%d)",
307 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000308 return -1;
309 }
310
Lev Walkindfae9752004-09-29 13:19:37 +0000311 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700312 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000313 "%s: value too large (%s:%d)",
314 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000315 return -1;
316 }
317
318 if((value >= 0 && value <= 10)) {
319 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000320 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000321 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700322 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000323 "%s: constraint failed (%s:%d)",
324 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000325 return -1;
326 }
327}
328
329/*
330 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000331 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000332 */
333static void
Lev Walkine8318b82005-03-06 09:29:03 +0000334Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000335 td->free_struct = asn_DEF_Int2.free_struct;
336 td->print_struct = asn_DEF_Int2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800337 td->check_constraints = asn_DEF_Int2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000338 td->ber_decoder = asn_DEF_Int2.ber_decoder;
339 td->der_encoder = asn_DEF_Int2.der_encoder;
340 td->xer_decoder = asn_DEF_Int2.xer_decoder;
341 td->xer_encoder = asn_DEF_Int2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000342 td->uper_decoder = asn_DEF_Int2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000343 td->uper_encoder = asn_DEF_Int2.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700344 td->oer_decoder = asn_DEF_Int2.oer_decoder;
345 td->oer_encoder = asn_DEF_Int2.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000346 if(!td->per_constraints)
347 td->per_constraints = asn_DEF_Int2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000348 td->elements = asn_DEF_Int2.elements;
349 td->elements_count = asn_DEF_Int2.elements_count;
350 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000351}
352
Lev Walkina9cc46e2004-09-22 16:06:28 +0000353void
Lev Walkindfae9752004-09-29 13:19:37 +0000354Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000355 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000356 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000357 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000358}
359
360int
Lev Walkindfae9752004-09-29 13:19:37 +0000361Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000362 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000363 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000364 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
365}
366
Lev Walkindc06f6b2004-10-20 15:50:55 +0000367asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000368Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000369 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000370 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000371 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000372}
373
374asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000375Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000376 void *structure, int tag_mode, ber_tlv_tag_t tag,
377 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000378 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000379 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
380}
381
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000382asn_dec_rval_t
383Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000384 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000385 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000386 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
387}
388
Lev Walkina9cc46e2004-09-22 16:06:28 +0000389asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000390Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000391 int ilevel, enum xer_encoder_flags_e flags,
392 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000393 Int3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000394 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000395}
396
397
398/*** <<< STAT-DEFS [Int3] >>> ***/
399
Lev Walkina7591b52014-10-12 18:37:35 -0700400static const ber_tlv_tag_t asn_DEF_Int3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000401 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000402};
Lev Walkindfae9752004-09-29 13:19:37 +0000403asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000404 "Int3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000405 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000406 Int3_free,
407 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000408 Int3_constraint,
409 Int3_decode_ber,
410 Int3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000411 Int3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000412 Int3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000413 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700414 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000415 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000416 asn_DEF_Int3_tags_1,
417 sizeof(asn_DEF_Int3_tags_1)
418 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
419 asn_DEF_Int3_tags_1, /* Same as above */
420 sizeof(asn_DEF_Int3_tags_1)
421 /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */
422 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000423 0, 0, /* No members */
424 0 /* No specifics */
425};
426
427
428/*** <<< INCLUDES [Int4] >>> ***/
429
Lev Walkin22b5ed42006-09-13 02:51:20 +0000430#include "Int3.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000431
432/*** <<< TYPE-DECLS [Int4] >>> ***/
433
Lev Walkin006de1c2004-08-20 13:37:45 +0000434typedef Int3_t Int4_t;
435
Lev Walkin006de1c2004-08-20 13:37:45 +0000436/*** <<< FUNC-DECLS [Int4] >>> ***/
437
Lev Walkindfae9752004-09-29 13:19:37 +0000438extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000439asn_struct_free_f Int4_free;
440asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000441asn_constr_check_f Int4_constraint;
442ber_type_decoder_f Int4_decode_ber;
443der_type_encoder_f Int4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000444xer_type_decoder_f Int4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000445xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000446
447/*** <<< CODE [Int4] >>> ***/
448
449int
Lev Walkindfae9752004-09-29 13:19:37 +0000450Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000451 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000452 const Int3_t *st = (const Int3_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000453 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000454
455 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700456 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000457 "%s: value not given (%s:%d)",
458 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000459 return -1;
460 }
461
Lev Walkindfae9752004-09-29 13:19:37 +0000462 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700463 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000464 "%s: value too large (%s:%d)",
465 td->name, __FILE__, __LINE__);
466 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000467 }
468
Lev Walkind35c8b52004-08-25 02:08:08 +0000469 if((value >= 1 && value <= 10)) {
470 /* Constraint check succeeded */
471 return 0;
472 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700473 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000474 "%s: constraint failed (%s:%d)",
475 td->name, __FILE__, __LINE__);
476 return -1;
477 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000478}
479
480/*
481 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000482 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000483 */
484static void
Lev Walkine8318b82005-03-06 09:29:03 +0000485Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000486 td->free_struct = asn_DEF_Int3.free_struct;
487 td->print_struct = asn_DEF_Int3.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800488 td->check_constraints = asn_DEF_Int3.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000489 td->ber_decoder = asn_DEF_Int3.ber_decoder;
490 td->der_encoder = asn_DEF_Int3.der_encoder;
491 td->xer_decoder = asn_DEF_Int3.xer_decoder;
492 td->xer_encoder = asn_DEF_Int3.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000493 td->uper_decoder = asn_DEF_Int3.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000494 td->uper_encoder = asn_DEF_Int3.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700495 td->oer_decoder = asn_DEF_Int3.oer_decoder;
496 td->oer_encoder = asn_DEF_Int3.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000497 if(!td->per_constraints)
498 td->per_constraints = asn_DEF_Int3.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000499 td->elements = asn_DEF_Int3.elements;
500 td->elements_count = asn_DEF_Int3.elements_count;
501 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000502}
503
Lev Walkina9cc46e2004-09-22 16:06:28 +0000504void
Lev Walkindfae9752004-09-29 13:19:37 +0000505Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000506 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000507 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000508 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000509}
510
511int
Lev Walkindfae9752004-09-29 13:19:37 +0000512Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000513 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000514 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000515 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
516}
517
Lev Walkindc06f6b2004-10-20 15:50:55 +0000518asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000519Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000520 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000521 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000522 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000523}
524
525asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000526Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000527 void *structure, int tag_mode, ber_tlv_tag_t tag,
528 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000529 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000530 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
531}
532
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000533asn_dec_rval_t
534Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000535 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000536 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000537 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
538}
539
Lev Walkina9cc46e2004-09-22 16:06:28 +0000540asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000541Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000542 int ilevel, enum xer_encoder_flags_e flags,
543 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000544 Int4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000545 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000546}
547
548
549/*** <<< STAT-DEFS [Int4] >>> ***/
550
Lev Walkina7591b52014-10-12 18:37:35 -0700551static const ber_tlv_tag_t asn_DEF_Int4_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000552 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000553};
Lev Walkindfae9752004-09-29 13:19:37 +0000554asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000555 "Int4",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000556 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000557 Int4_free,
558 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000559 Int4_constraint,
560 Int4_decode_ber,
561 Int4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000562 Int4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000563 Int4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000564 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700565 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000566 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000567 asn_DEF_Int4_tags_1,
568 sizeof(asn_DEF_Int4_tags_1)
569 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
570 asn_DEF_Int4_tags_1, /* Same as above */
571 sizeof(asn_DEF_Int4_tags_1)
572 /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */
573 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000574 0, 0, /* No members */
575 0 /* No specifics */
576};
577
578
579/*** <<< INCLUDES [Int5] >>> ***/
580
Lev Walkin22b5ed42006-09-13 02:51:20 +0000581#include "Int4.h"
Lev Walkin006de1c2004-08-20 13:37:45 +0000582
583/*** <<< TYPE-DECLS [Int5] >>> ***/
584
Lev Walkin006de1c2004-08-20 13:37:45 +0000585typedef Int4_t Int5_t;
586
Lev Walkin006de1c2004-08-20 13:37:45 +0000587/*** <<< FUNC-DECLS [Int5] >>> ***/
588
Lev Walkindfae9752004-09-29 13:19:37 +0000589extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000590asn_struct_free_f Int5_free;
591asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000592asn_constr_check_f Int5_constraint;
593ber_type_decoder_f Int5_decode_ber;
594der_type_encoder_f Int5_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000595xer_type_decoder_f Int5_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000596xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000597
598/*** <<< CODE [Int5] >>> ***/
599
600int
Lev Walkindfae9752004-09-29 13:19:37 +0000601Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000602 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000603 const Int4_t *st = (const Int4_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000604 long value;
605
606 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700607 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000608 "%s: value not given (%s:%d)",
609 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000610 return -1;
611 }
612
Lev Walkindfae9752004-09-29 13:19:37 +0000613 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700614 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000615 "%s: value too large (%s:%d)",
616 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000617 return -1;
618 }
619
620 if((value == 5)) {
621 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000622 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000623 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700624 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000625 "%s: constraint failed (%s:%d)",
626 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000627 return -1;
628 }
629}
630
631/*
632 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000633 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000634 */
635static void
Lev Walkine8318b82005-03-06 09:29:03 +0000636Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000637 td->free_struct = asn_DEF_Int4.free_struct;
638 td->print_struct = asn_DEF_Int4.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800639 td->check_constraints = asn_DEF_Int4.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000640 td->ber_decoder = asn_DEF_Int4.ber_decoder;
641 td->der_encoder = asn_DEF_Int4.der_encoder;
642 td->xer_decoder = asn_DEF_Int4.xer_decoder;
643 td->xer_encoder = asn_DEF_Int4.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000644 td->uper_decoder = asn_DEF_Int4.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000645 td->uper_encoder = asn_DEF_Int4.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700646 td->oer_decoder = asn_DEF_Int4.oer_decoder;
647 td->oer_encoder = asn_DEF_Int4.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000648 if(!td->per_constraints)
649 td->per_constraints = asn_DEF_Int4.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000650 td->elements = asn_DEF_Int4.elements;
651 td->elements_count = asn_DEF_Int4.elements_count;
652 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000653}
654
Lev Walkina9cc46e2004-09-22 16:06:28 +0000655void
Lev Walkindfae9752004-09-29 13:19:37 +0000656Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000657 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000658 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000659 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000660}
661
662int
Lev Walkindfae9752004-09-29 13:19:37 +0000663Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000664 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000665 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000666 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
667}
668
Lev Walkindc06f6b2004-10-20 15:50:55 +0000669asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000670Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000671 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000672 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000673 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000674}
675
676asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000677Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000678 void *structure, int tag_mode, ber_tlv_tag_t tag,
679 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000680 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000681 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
682}
683
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000684asn_dec_rval_t
685Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000686 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000687 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000688 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
689}
690
Lev Walkina9cc46e2004-09-22 16:06:28 +0000691asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000692Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000693 int ilevel, enum xer_encoder_flags_e flags,
694 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000695 Int5_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000696 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000697}
698
699
700/*** <<< STAT-DEFS [Int5] >>> ***/
701
Lev Walkina7591b52014-10-12 18:37:35 -0700702static const ber_tlv_tag_t asn_DEF_Int5_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000703 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000704};
Lev Walkindfae9752004-09-29 13:19:37 +0000705asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000706 "Int5",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000707 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000708 Int5_free,
709 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000710 Int5_constraint,
711 Int5_decode_ber,
712 Int5_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000713 Int5_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000714 Int5_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000715 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700716 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000717 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000718 asn_DEF_Int5_tags_1,
719 sizeof(asn_DEF_Int5_tags_1)
720 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
721 asn_DEF_Int5_tags_1, /* Same as above */
722 sizeof(asn_DEF_Int5_tags_1)
723 /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */
724 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000725 0, 0, /* No members */
726 0 /* No specifics */
727};
728
729
730/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
731
732#include <INTEGER.h>
733
734/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
735
Lev Walkin006de1c2004-08-20 13:37:45 +0000736typedef INTEGER_t ExtensibleExtensions_t;
737
Lev Walkin006de1c2004-08-20 13:37:45 +0000738/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
739
Lev Walkindfae9752004-09-29 13:19:37 +0000740extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000741asn_struct_free_f ExtensibleExtensions_free;
742asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000743asn_constr_check_f ExtensibleExtensions_constraint;
744ber_type_decoder_f ExtensibleExtensions_decode_ber;
745der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000746xer_type_decoder_f ExtensibleExtensions_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000747xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000748
749/*** <<< CODE [ExtensibleExtensions] >>> ***/
750
751int
Lev Walkindfae9752004-09-29 13:19:37 +0000752ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000753 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000754 const INTEGER_t *st = (const INTEGER_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000755 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000756
757 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700758 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000759 "%s: value not given (%s:%d)",
760 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000761 return -1;
762 }
763
Lev Walkindfae9752004-09-29 13:19:37 +0000764 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700765 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000766 "%s: value too large (%s:%d)",
767 td->name, __FILE__, __LINE__);
768 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000769 }
770
Lev Walkind35c8b52004-08-25 02:08:08 +0000771 if((value >= 1 && value <= 256)) {
772 /* Constraint check succeeded */
773 return 0;
774 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700775 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +0000776 "%s: constraint failed (%s:%d)",
777 td->name, __FILE__, __LINE__);
778 return -1;
779 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000780}
781
782/*
783 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000784 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000785 */
786static void
Lev Walkine8318b82005-03-06 09:29:03 +0000787ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +0000788 td->free_struct = asn_DEF_INTEGER.free_struct;
789 td->print_struct = asn_DEF_INTEGER.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800790 td->check_constraints = asn_DEF_INTEGER.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000791 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
792 td->der_encoder = asn_DEF_INTEGER.der_encoder;
793 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
794 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000795 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000796 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700797 td->oer_decoder = asn_DEF_INTEGER.oer_decoder;
798 td->oer_encoder = asn_DEF_INTEGER.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000799 if(!td->per_constraints)
800 td->per_constraints = asn_DEF_INTEGER.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +0000801 td->elements = asn_DEF_INTEGER.elements;
802 td->elements_count = asn_DEF_INTEGER.elements_count;
803 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000804}
805
Lev Walkina9cc46e2004-09-22 16:06:28 +0000806void
Lev Walkindfae9752004-09-29 13:19:37 +0000807ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000808 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000809 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000810 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000811}
812
813int
Lev Walkindfae9752004-09-29 13:19:37 +0000814ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000815 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000816 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +0000817 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
818}
819
Lev Walkindc06f6b2004-10-20 15:50:55 +0000820asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000821ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000822 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000823 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000824 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000825}
826
827asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000828ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000829 void *structure, int tag_mode, ber_tlv_tag_t tag,
830 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000831 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000832 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
833}
834
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000835asn_dec_rval_t
836ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000837 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000838 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000839 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
840}
841
Lev Walkina9cc46e2004-09-22 16:06:28 +0000842asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000843ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000844 int ilevel, enum xer_encoder_flags_e flags,
845 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000846 ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000847 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000848}
849
850
851/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
852
Lev Walkina7591b52014-10-12 18:37:35 -0700853static const ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000854 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
855};
Lev Walkindfae9752004-09-29 13:19:37 +0000856asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000857 "ExtensibleExtensions",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000858 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000859 ExtensibleExtensions_free,
860 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000861 ExtensibleExtensions_constraint,
862 ExtensibleExtensions_decode_ber,
863 ExtensibleExtensions_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +0000864 ExtensibleExtensions_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000865 ExtensibleExtensions_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000866 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700867 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000868 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000869 asn_DEF_ExtensibleExtensions_tags_1,
870 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
871 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
872 asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */
873 sizeof(asn_DEF_ExtensibleExtensions_tags_1)
874 /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */
875 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +0000876 0, 0, /* No members */
877 0 /* No specifics */
878};
879
880
881/*** <<< INCLUDES [Str1] >>> ***/
882
883#include <IA5String.h>
884
885/*** <<< TYPE-DECLS [Str1] >>> ***/
886
Lev Walkin006de1c2004-08-20 13:37:45 +0000887typedef IA5String_t Str1_t;
888
Lev Walkin006de1c2004-08-20 13:37:45 +0000889/*** <<< FUNC-DECLS [Str1] >>> ***/
890
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000891extern asn_TYPE_descriptor_t asn_DEF_Str1;
892asn_struct_free_f Str1_free;
893asn_struct_print_f Str1_print;
894asn_constr_check_f Str1_constraint;
895ber_type_decoder_f Str1_decode_ber;
896der_type_encoder_f Str1_encode_der;
897xer_type_decoder_f Str1_decode_xer;
898xer_type_encoder_f Str1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000899
900/*** <<< CODE [Str1] >>> ***/
901
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000902int
903Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000904 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000905 /* Replace with underlying type checker */
906 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +0000907 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000908}
909
910/*
911 * This type is implemented using IA5String,
912 * so here we adjust the DEF accordingly.
913 */
914static void
Lev Walkine8318b82005-03-06 09:29:03 +0000915Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000916 td->free_struct = asn_DEF_IA5String.free_struct;
917 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800918 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000919 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
920 td->der_encoder = asn_DEF_IA5String.der_encoder;
921 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
922 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000923 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000924 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700925 td->oer_decoder = asn_DEF_IA5String.oer_decoder;
926 td->oer_encoder = asn_DEF_IA5String.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +0000927 if(!td->per_constraints)
928 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000929 td->elements = asn_DEF_IA5String.elements;
930 td->elements_count = asn_DEF_IA5String.elements_count;
931 td->specifics = asn_DEF_IA5String.specifics;
932}
933
934void
935Str1_free(asn_TYPE_descriptor_t *td,
936 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +0000937 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000938 td->free_struct(td, struct_ptr, contents_only);
939}
940
941int
942Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
943 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000944 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000945 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
946}
947
948asn_dec_rval_t
949Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000950 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +0000951 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000952 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
953}
954
955asn_enc_rval_t
956Str1_encode_der(asn_TYPE_descriptor_t *td,
957 void *structure, int tag_mode, ber_tlv_tag_t tag,
958 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000959 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000960 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
961}
962
963asn_dec_rval_t
964Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +0000965 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +0000966 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000967 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
968}
969
970asn_enc_rval_t
971Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
972 int ilevel, enum xer_encoder_flags_e flags,
973 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +0000974 Str1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000975 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
976}
977
978
979/*** <<< STAT-DEFS [Str1] >>> ***/
980
Lev Walkina7591b52014-10-12 18:37:35 -0700981static const ber_tlv_tag_t asn_DEF_Str1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000982 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
983};
984asn_TYPE_descriptor_t asn_DEF_Str1 = {
985 "Str1",
986 "Str1",
987 Str1_free,
988 Str1_print,
989 Str1_constraint,
990 Str1_decode_ber,
991 Str1_encode_der,
992 Str1_decode_xer,
993 Str1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000994 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -0700995 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +0000996 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000997 asn_DEF_Str1_tags_1,
998 sizeof(asn_DEF_Str1_tags_1)
999 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
1000 asn_DEF_Str1_tags_1, /* Same as above */
1001 sizeof(asn_DEF_Str1_tags_1)
1002 /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */
1003 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00001004 0, 0, /* No members */
1005 0 /* No specifics */
1006};
Lev Walkin006de1c2004-08-20 13:37:45 +00001007
1008
1009/*** <<< INCLUDES [Str2] >>> ***/
1010
Lev Walkin22b5ed42006-09-13 02:51:20 +00001011#include "Str1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001012
1013/*** <<< TYPE-DECLS [Str2] >>> ***/
1014
Lev Walkin006de1c2004-08-20 13:37:45 +00001015typedef Str1_t Str2_t;
1016
Lev Walkin006de1c2004-08-20 13:37:45 +00001017/*** <<< FUNC-DECLS [Str2] >>> ***/
1018
Lev Walkindfae9752004-09-29 13:19:37 +00001019extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001020asn_struct_free_f Str2_free;
1021asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001022asn_constr_check_f Str2_constraint;
1023ber_type_decoder_f Str2_decode_ber;
1024der_type_encoder_f Str2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001025xer_type_decoder_f Str2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001026xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001027
1028/*** <<< CTABLES [Str2] >>> ***/
1029
Lev Walkine8318b82005-03-06 09:29:03 +00001030static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001031 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001032 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001033 const uint8_t *ch = st->buf;
1034 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001035
1036 for(; ch < end; ch++) {
1037 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001038 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001039 }
Lev Walkin775885e2004-08-22 12:47:03 +00001040 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001041}
1042
1043
1044/*** <<< CODE [Str2] >>> ***/
1045
1046int
Lev Walkindfae9752004-09-29 13:19:37 +00001047Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001048 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001049 const Str1_t *st = (const Str1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001050 size_t size;
1051
1052 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001053 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001054 "%s: value not given (%s:%d)",
1055 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001056 return -1;
1057 }
1058
1059 size = st->size;
1060
1061 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkine8318b82005-03-06 09:29:03 +00001062 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001063 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001064 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001065 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001066 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001067 "%s: constraint failed (%s:%d)",
1068 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001069 return -1;
1070 }
1071}
1072
1073/*
1074 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +00001075 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001076 */
1077static void
Lev Walkine8318b82005-03-06 09:29:03 +00001078Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001079 td->free_struct = asn_DEF_Str1.free_struct;
1080 td->print_struct = asn_DEF_Str1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001081 td->check_constraints = asn_DEF_Str1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001082 td->ber_decoder = asn_DEF_Str1.ber_decoder;
1083 td->der_encoder = asn_DEF_Str1.der_encoder;
1084 td->xer_decoder = asn_DEF_Str1.xer_decoder;
1085 td->xer_encoder = asn_DEF_Str1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001086 td->uper_decoder = asn_DEF_Str1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001087 td->uper_encoder = asn_DEF_Str1.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001088 td->oer_decoder = asn_DEF_Str1.oer_decoder;
1089 td->oer_encoder = asn_DEF_Str1.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001090 if(!td->per_constraints)
1091 td->per_constraints = asn_DEF_Str1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001092 td->elements = asn_DEF_Str1.elements;
1093 td->elements_count = asn_DEF_Str1.elements_count;
1094 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001095}
1096
Lev Walkina9cc46e2004-09-22 16:06:28 +00001097void
Lev Walkindfae9752004-09-29 13:19:37 +00001098Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001099 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001100 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001101 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001102}
1103
1104int
Lev Walkindfae9752004-09-29 13:19:37 +00001105Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001106 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001107 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001108 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1109}
1110
Lev Walkindc06f6b2004-10-20 15:50:55 +00001111asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001112Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001113 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001114 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001115 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001116}
1117
1118asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001119Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001120 void *structure, int tag_mode, ber_tlv_tag_t tag,
1121 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001122 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001123 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1124}
1125
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001126asn_dec_rval_t
1127Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001128 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001129 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001130 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1131}
1132
Lev Walkina9cc46e2004-09-22 16:06:28 +00001133asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001134Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001135 int ilevel, enum xer_encoder_flags_e flags,
1136 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001137 Str2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001138 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001139}
1140
1141
1142/*** <<< STAT-DEFS [Str2] >>> ***/
1143
Lev Walkina7591b52014-10-12 18:37:35 -07001144static const ber_tlv_tag_t asn_DEF_Str2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001145 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001146};
Lev Walkindfae9752004-09-29 13:19:37 +00001147asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001148 "Str2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001149 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001150 Str2_free,
1151 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001152 Str2_constraint,
1153 Str2_decode_ber,
1154 Str2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001155 Str2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001156 Str2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001157 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001158 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001159 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001160 asn_DEF_Str2_tags_1,
1161 sizeof(asn_DEF_Str2_tags_1)
1162 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1163 asn_DEF_Str2_tags_1, /* Same as above */
1164 sizeof(asn_DEF_Str2_tags_1)
1165 /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */
1166 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001167 0, 0, /* No members */
1168 0 /* No specifics */
1169};
1170
1171
1172/*** <<< INCLUDES [Str3] >>> ***/
1173
Lev Walkin22b5ed42006-09-13 02:51:20 +00001174#include "Str2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001175
1176/*** <<< TYPE-DECLS [Str3] >>> ***/
1177
Lev Walkin006de1c2004-08-20 13:37:45 +00001178typedef Str2_t Str3_t;
1179
Lev Walkin006de1c2004-08-20 13:37:45 +00001180/*** <<< FUNC-DECLS [Str3] >>> ***/
1181
Lev Walkindfae9752004-09-29 13:19:37 +00001182extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001183asn_struct_free_f Str3_free;
1184asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001185asn_constr_check_f Str3_constraint;
1186ber_type_decoder_f Str3_decode_ber;
1187der_type_encoder_f Str3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001188xer_type_decoder_f Str3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001189xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001190
1191/*** <<< CTABLES [Str3] >>> ***/
1192
Lev Walkina7591b52014-10-12 18:37:35 -07001193static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00001194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1195 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1198 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ABC */
1199 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1200 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */
Lev Walkin006de1c2004-08-20 13:37:45 +00001201};
1202
Lev Walkine8318b82005-03-06 09:29:03 +00001203static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07001204 const int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001205 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001206 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001207 const uint8_t *ch = st->buf;
1208 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001209
1210 for(; ch < end; ch++) {
1211 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001212 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001213 }
Lev Walkin775885e2004-08-22 12:47:03 +00001214 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001215}
1216
1217
1218/*** <<< CODE [Str3] >>> ***/
1219
1220int
Lev Walkindfae9752004-09-29 13:19:37 +00001221Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001222 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001223 const Str2_t *st = (const Str2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001224 size_t size;
1225
1226 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001227 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001228 "%s: value not given (%s:%d)",
1229 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001230 return -1;
1231 }
1232
1233 size = st->size;
1234
1235 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkine8318b82005-03-06 09:29:03 +00001236 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001237 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001238 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001239 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001240 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001241 "%s: constraint failed (%s:%d)",
1242 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001243 return -1;
1244 }
1245}
1246
1247/*
1248 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +00001249 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001250 */
1251static void
Lev Walkine8318b82005-03-06 09:29:03 +00001252Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001253 td->free_struct = asn_DEF_Str2.free_struct;
1254 td->print_struct = asn_DEF_Str2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001255 td->check_constraints = asn_DEF_Str2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001256 td->ber_decoder = asn_DEF_Str2.ber_decoder;
1257 td->der_encoder = asn_DEF_Str2.der_encoder;
1258 td->xer_decoder = asn_DEF_Str2.xer_decoder;
1259 td->xer_encoder = asn_DEF_Str2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001260 td->uper_decoder = asn_DEF_Str2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001261 td->uper_encoder = asn_DEF_Str2.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001262 td->oer_decoder = asn_DEF_Str2.oer_decoder;
1263 td->oer_encoder = asn_DEF_Str2.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001264 if(!td->per_constraints)
1265 td->per_constraints = asn_DEF_Str2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001266 td->elements = asn_DEF_Str2.elements;
1267 td->elements_count = asn_DEF_Str2.elements_count;
1268 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001269}
1270
Lev Walkina9cc46e2004-09-22 16:06:28 +00001271void
Lev Walkindfae9752004-09-29 13:19:37 +00001272Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001273 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001274 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001275 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001276}
1277
1278int
Lev Walkindfae9752004-09-29 13:19:37 +00001279Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001280 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001281 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001282 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1283}
1284
Lev Walkindc06f6b2004-10-20 15:50:55 +00001285asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001286Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001287 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001288 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001289 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001290}
1291
1292asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001293Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001294 void *structure, int tag_mode, ber_tlv_tag_t tag,
1295 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001296 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001297 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1298}
1299
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001300asn_dec_rval_t
1301Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001302 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001303 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001304 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1305}
1306
Lev Walkina9cc46e2004-09-22 16:06:28 +00001307asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001308Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001309 int ilevel, enum xer_encoder_flags_e flags,
1310 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001311 Str3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001312 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001313}
1314
1315
1316/*** <<< STAT-DEFS [Str3] >>> ***/
1317
Lev Walkina7591b52014-10-12 18:37:35 -07001318static const ber_tlv_tag_t asn_DEF_Str3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001319 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001320};
Lev Walkindfae9752004-09-29 13:19:37 +00001321asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001322 "Str3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001323 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001324 Str3_free,
1325 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001326 Str3_constraint,
1327 Str3_decode_ber,
1328 Str3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001329 Str3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001330 Str3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001331 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001332 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001333 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001334 asn_DEF_Str3_tags_1,
1335 sizeof(asn_DEF_Str3_tags_1)
1336 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1337 asn_DEF_Str3_tags_1, /* Same as above */
1338 sizeof(asn_DEF_Str3_tags_1)
1339 /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */
1340 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001341 0, 0, /* No members */
1342 0 /* No specifics */
1343};
1344
1345
Lev Walkin8a99bf72004-09-10 06:07:39 +00001346/*** <<< INCLUDES [Str4] >>> ***/
1347
1348#include <IA5String.h>
1349
1350/*** <<< TYPE-DECLS [Str4] >>> ***/
1351
Lev Walkin8a99bf72004-09-10 06:07:39 +00001352typedef IA5String_t Str4_t;
1353
1354/*** <<< FUNC-DECLS [Str4] >>> ***/
1355
Lev Walkindfae9752004-09-29 13:19:37 +00001356extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001357asn_struct_free_f Str4_free;
1358asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001359asn_constr_check_f Str4_constraint;
1360ber_type_decoder_f Str4_decode_ber;
1361der_type_encoder_f Str4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001362xer_type_decoder_f Str4_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001363xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001364
1365/*** <<< CTABLES [Str4] >>> ***/
1366
Lev Walkine8318b82005-03-06 09:29:03 +00001367static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001368 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001369 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001370 const uint8_t *ch = st->buf;
1371 const uint8_t *end = ch + st->size;
1372
1373 for(; ch < end; ch++) {
1374 uint8_t cv = *ch;
1375 if(!(cv <= 127)) return -1;
1376 }
1377 return 0;
1378}
1379
1380
1381/*** <<< CODE [Str4] >>> ***/
1382
1383int
Lev Walkindfae9752004-09-29 13:19:37 +00001384Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001385 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001386 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001387
1388 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001389 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001390 "%s: value not given (%s:%d)",
1391 td->name, __FILE__, __LINE__);
1392 return -1;
1393 }
1394
1395
Lev Walkine8318b82005-03-06 09:29:03 +00001396 if(!check_permitted_alphabet_1(st)) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001397 /* Constraint check succeeded */
1398 return 0;
1399 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001400 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001401 "%s: constraint failed (%s:%d)",
1402 td->name, __FILE__, __LINE__);
1403 return -1;
1404 }
1405}
1406
1407/*
1408 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001409 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001410 */
1411static void
Lev Walkine8318b82005-03-06 09:29:03 +00001412Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001413 td->free_struct = asn_DEF_IA5String.free_struct;
1414 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001415 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001416 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1417 td->der_encoder = asn_DEF_IA5String.der_encoder;
1418 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1419 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001420 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001421 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001422 td->oer_decoder = asn_DEF_IA5String.oer_decoder;
1423 td->oer_encoder = asn_DEF_IA5String.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001424 if(!td->per_constraints)
1425 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001426 td->elements = asn_DEF_IA5String.elements;
1427 td->elements_count = asn_DEF_IA5String.elements_count;
1428 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001429}
1430
Lev Walkina9cc46e2004-09-22 16:06:28 +00001431void
Lev Walkindfae9752004-09-29 13:19:37 +00001432Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001433 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001434 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001435 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001436}
1437
1438int
Lev Walkindfae9752004-09-29 13:19:37 +00001439Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001440 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001441 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001442 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1443}
1444
Lev Walkindc06f6b2004-10-20 15:50:55 +00001445asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001446Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001447 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001448 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001449 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001450}
1451
1452asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001453Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001454 void *structure, int tag_mode, ber_tlv_tag_t tag,
1455 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001456 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001457 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1458}
1459
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001460asn_dec_rval_t
1461Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001462 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001463 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001464 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1465}
1466
Lev Walkina9cc46e2004-09-22 16:06:28 +00001467asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001468Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001469 int ilevel, enum xer_encoder_flags_e flags,
1470 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001471 Str4_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001472 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001473}
1474
1475
1476/*** <<< STAT-DEFS [Str4] >>> ***/
1477
Lev Walkina7591b52014-10-12 18:37:35 -07001478static const ber_tlv_tag_t asn_DEF_Str4_tags_1[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001479 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1480};
Lev Walkindfae9752004-09-29 13:19:37 +00001481asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001482 "Str4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001483 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001484 Str4_free,
1485 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001486 Str4_constraint,
1487 Str4_decode_ber,
1488 Str4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001489 Str4_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001490 Str4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001491 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001492 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001493 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001494 asn_DEF_Str4_tags_1,
1495 sizeof(asn_DEF_Str4_tags_1)
1496 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1497 asn_DEF_Str4_tags_1, /* Same as above */
1498 sizeof(asn_DEF_Str4_tags_1)
1499 /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */
1500 0, /* No PER visible constraints */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001501 0, 0, /* No members */
1502 0 /* No specifics */
1503};
1504
1505
Lev Walkin006de1c2004-08-20 13:37:45 +00001506/*** <<< INCLUDES [PER-Visible] >>> ***/
1507
1508#include <IA5String.h>
1509
1510/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1511
Lev Walkin006de1c2004-08-20 13:37:45 +00001512typedef IA5String_t PER_Visible_t;
1513
Lev Walkin006de1c2004-08-20 13:37:45 +00001514/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1515
Lev Walkindfae9752004-09-29 13:19:37 +00001516extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001517asn_struct_free_f PER_Visible_free;
1518asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001519asn_constr_check_f PER_Visible_constraint;
1520ber_type_decoder_f PER_Visible_decode_ber;
1521der_type_encoder_f PER_Visible_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001522xer_type_decoder_f PER_Visible_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001523xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001524
1525/*** <<< CTABLES [PER-Visible] >>> ***/
1526
Lev Walkine8318b82005-03-06 09:29:03 +00001527static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001528 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001529 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001530 const uint8_t *ch = st->buf;
1531 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001532
1533 for(; ch < end; ch++) {
1534 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001535 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001536 }
Lev Walkin775885e2004-08-22 12:47:03 +00001537 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001538}
1539
1540
1541/*** <<< CODE [PER-Visible] >>> ***/
1542
1543int
Lev Walkindfae9752004-09-29 13:19:37 +00001544PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001545 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001546 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001547
1548 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001549 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001550 "%s: value not given (%s:%d)",
1551 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001552 return -1;
1553 }
1554
1555
Lev Walkine8318b82005-03-06 09:29:03 +00001556 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001557 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001558 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001559 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001560 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001561 "%s: constraint failed (%s:%d)",
1562 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001563 return -1;
1564 }
1565}
1566
1567/*
1568 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001569 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001570 */
1571static void
Lev Walkine8318b82005-03-06 09:29:03 +00001572PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001573 td->free_struct = asn_DEF_IA5String.free_struct;
1574 td->print_struct = asn_DEF_IA5String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001575 td->check_constraints = asn_DEF_IA5String.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001576 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1577 td->der_encoder = asn_DEF_IA5String.der_encoder;
1578 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1579 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001580 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001581 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001582 td->oer_decoder = asn_DEF_IA5String.oer_decoder;
1583 td->oer_encoder = asn_DEF_IA5String.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001584 if(!td->per_constraints)
1585 td->per_constraints = asn_DEF_IA5String.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001586 td->elements = asn_DEF_IA5String.elements;
1587 td->elements_count = asn_DEF_IA5String.elements_count;
1588 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001589}
1590
Lev Walkina9cc46e2004-09-22 16:06:28 +00001591void
Lev Walkindfae9752004-09-29 13:19:37 +00001592PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001593 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001594 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001595 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001596}
1597
1598int
Lev Walkindfae9752004-09-29 13:19:37 +00001599PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001600 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001601 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001602 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1603}
1604
Lev Walkindc06f6b2004-10-20 15:50:55 +00001605asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001606PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001607 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001608 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001609 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001610}
1611
1612asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001613PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001614 void *structure, int tag_mode, ber_tlv_tag_t tag,
1615 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001616 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001617 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1618}
1619
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001620asn_dec_rval_t
1621PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001622 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001623 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001624 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1625}
1626
Lev Walkina9cc46e2004-09-22 16:06:28 +00001627asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001628PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001629 int ilevel, enum xer_encoder_flags_e flags,
1630 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001631 PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001632 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001633}
1634
1635
1636/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1637
Lev Walkina7591b52014-10-12 18:37:35 -07001638static const ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001639 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1640};
Lev Walkindfae9752004-09-29 13:19:37 +00001641asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001642 "PER-Visible",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001643 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001644 PER_Visible_free,
1645 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001646 PER_Visible_constraint,
1647 PER_Visible_decode_ber,
1648 PER_Visible_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001649 PER_Visible_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001650 PER_Visible_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001651 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001652 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001653 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001654 asn_DEF_PER_Visible_tags_1,
1655 sizeof(asn_DEF_PER_Visible_tags_1)
1656 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1657 asn_DEF_PER_Visible_tags_1, /* Same as above */
1658 sizeof(asn_DEF_PER_Visible_tags_1)
1659 /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */
1660 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001661 0, 0, /* No members */
1662 0 /* No specifics */
1663};
1664
1665
1666/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1667
Lev Walkin22b5ed42006-09-13 02:51:20 +00001668#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001669
1670/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1671
Lev Walkin006de1c2004-08-20 13:37:45 +00001672typedef PER_Visible_t PER_Visible_2_t;
1673
Lev Walkin006de1c2004-08-20 13:37:45 +00001674/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1675
Lev Walkindfae9752004-09-29 13:19:37 +00001676extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001677asn_struct_free_f PER_Visible_2_free;
1678asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001679asn_constr_check_f PER_Visible_2_constraint;
1680ber_type_decoder_f PER_Visible_2_decode_ber;
1681der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001682xer_type_decoder_f PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001683xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001684
1685/*** <<< CTABLES [PER-Visible-2] >>> ***/
1686
Lev Walkine8318b82005-03-06 09:29:03 +00001687static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001688 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001689 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001690 const uint8_t *ch = st->buf;
1691 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001692
1693 for(; ch < end; ch++) {
1694 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001695 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001696 }
Lev Walkin775885e2004-08-22 12:47:03 +00001697 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001698}
1699
1700
1701/*** <<< CODE [PER-Visible-2] >>> ***/
1702
1703int
Lev Walkindfae9752004-09-29 13:19:37 +00001704PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001705 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001706 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001707
1708 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001709 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001710 "%s: value not given (%s:%d)",
1711 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001712 return -1;
1713 }
1714
1715
Lev Walkine8318b82005-03-06 09:29:03 +00001716 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001717 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001718 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001719 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001720 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001721 "%s: constraint failed (%s:%d)",
1722 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001723 return -1;
1724 }
1725}
1726
1727/*
1728 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001729 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001730 */
1731static void
Lev Walkine8318b82005-03-06 09:29:03 +00001732PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001733 td->free_struct = asn_DEF_PER_Visible.free_struct;
1734 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001735 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001736 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1737 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1738 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1739 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001740 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001741 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001742 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
1743 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001744 if(!td->per_constraints)
1745 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001746 td->elements = asn_DEF_PER_Visible.elements;
1747 td->elements_count = asn_DEF_PER_Visible.elements_count;
1748 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001749}
1750
Lev Walkina9cc46e2004-09-22 16:06:28 +00001751void
Lev Walkindfae9752004-09-29 13:19:37 +00001752PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001753 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001754 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001755 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001756}
1757
1758int
Lev Walkindfae9752004-09-29 13:19:37 +00001759PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001760 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001761 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001762 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1763}
1764
Lev Walkindc06f6b2004-10-20 15:50:55 +00001765asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001766PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001767 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001768 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001769 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001770}
1771
1772asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001773PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001774 void *structure, int tag_mode, ber_tlv_tag_t tag,
1775 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001776 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001777 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1778}
1779
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001780asn_dec_rval_t
1781PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001782 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001783 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001784 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1785}
1786
Lev Walkina9cc46e2004-09-22 16:06:28 +00001787asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001788PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001789 int ilevel, enum xer_encoder_flags_e flags,
1790 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001791 PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001792 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001793}
1794
1795
1796/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1797
Lev Walkina7591b52014-10-12 18:37:35 -07001798static const ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001799 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001800};
Lev Walkindfae9752004-09-29 13:19:37 +00001801asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001802 "PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001803 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001804 PER_Visible_2_free,
1805 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001806 PER_Visible_2_constraint,
1807 PER_Visible_2_decode_ber,
1808 PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001809 PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001810 PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001811 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001812 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001813 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001814 asn_DEF_PER_Visible_2_tags_1,
1815 sizeof(asn_DEF_PER_Visible_2_tags_1)
1816 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1817 asn_DEF_PER_Visible_2_tags_1, /* Same as above */
1818 sizeof(asn_DEF_PER_Visible_2_tags_1)
1819 /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */
1820 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001821 0, 0, /* No members */
1822 0 /* No specifics */
1823};
1824
1825
1826/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1827
Lev Walkin22b5ed42006-09-13 02:51:20 +00001828#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001829
1830/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1831
Lev Walkin006de1c2004-08-20 13:37:45 +00001832typedef PER_Visible_t Not_PER_Visible_1_t;
1833
Lev Walkin006de1c2004-08-20 13:37:45 +00001834/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1835
Lev Walkindfae9752004-09-29 13:19:37 +00001836extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001837asn_struct_free_f Not_PER_Visible_1_free;
1838asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001839asn_constr_check_f Not_PER_Visible_1_constraint;
1840ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1841der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001842xer_type_decoder_f Not_PER_Visible_1_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001843xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001844
1845/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1846
Lev Walkine8318b82005-03-06 09:29:03 +00001847static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001848 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001849 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001850 const uint8_t *ch = st->buf;
1851 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001852
1853 for(; ch < end; ch++) {
1854 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001855 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001856 }
Lev Walkin775885e2004-08-22 12:47:03 +00001857 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001858}
1859
1860
1861/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1862
1863int
Lev Walkindfae9752004-09-29 13:19:37 +00001864Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00001865 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00001866 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001867
1868 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001869 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001870 "%s: value not given (%s:%d)",
1871 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001872 return -1;
1873 }
1874
1875
Lev Walkine8318b82005-03-06 09:29:03 +00001876 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001877 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001878 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001879 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07001880 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00001881 "%s: constraint failed (%s:%d)",
1882 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001883 return -1;
1884 }
1885}
1886
1887/*
1888 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001889 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001890 */
1891static void
Lev Walkine8318b82005-03-06 09:29:03 +00001892Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00001893 td->free_struct = asn_DEF_PER_Visible.free_struct;
1894 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08001895 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001896 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1897 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1898 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1899 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001900 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001901 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07001902 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
1903 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00001904 if(!td->per_constraints)
1905 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00001906 td->elements = asn_DEF_PER_Visible.elements;
1907 td->elements_count = asn_DEF_PER_Visible.elements_count;
1908 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001909}
1910
Lev Walkina9cc46e2004-09-22 16:06:28 +00001911void
Lev Walkindfae9752004-09-29 13:19:37 +00001912Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001913 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00001914 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001915 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001916}
1917
1918int
Lev Walkindfae9752004-09-29 13:19:37 +00001919Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001920 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001921 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00001922 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1923}
1924
Lev Walkindc06f6b2004-10-20 15:50:55 +00001925asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001926Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001927 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00001928 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001929 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001930}
1931
1932asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001933Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001934 void *structure, int tag_mode, ber_tlv_tag_t tag,
1935 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001936 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001937 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1938}
1939
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001940asn_dec_rval_t
1941Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00001942 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00001943 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001944 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
1945}
1946
Lev Walkina9cc46e2004-09-22 16:06:28 +00001947asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001948Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001949 int ilevel, enum xer_encoder_flags_e flags,
1950 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00001951 Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001952 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001953}
1954
1955
1956/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1957
Lev Walkina7591b52014-10-12 18:37:35 -07001958static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001959 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001960};
Lev Walkindfae9752004-09-29 13:19:37 +00001961asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001962 "Not-PER-Visible-1",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001963 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001964 Not_PER_Visible_1_free,
1965 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001966 Not_PER_Visible_1_constraint,
1967 Not_PER_Visible_1_decode_ber,
1968 Not_PER_Visible_1_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00001969 Not_PER_Visible_1_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001970 Not_PER_Visible_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00001971 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07001972 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00001973 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00001974 asn_DEF_Not_PER_Visible_1_tags_1,
1975 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1976 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1977 asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */
1978 sizeof(asn_DEF_Not_PER_Visible_1_tags_1)
1979 /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */
1980 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00001981 0, 0, /* No members */
1982 0 /* No specifics */
1983};
1984
1985
1986/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1987
Lev Walkin22b5ed42006-09-13 02:51:20 +00001988#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00001989
1990/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1991
Lev Walkin006de1c2004-08-20 13:37:45 +00001992typedef PER_Visible_t Not_PER_Visible_2_t;
1993
Lev Walkin006de1c2004-08-20 13:37:45 +00001994/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1995
Lev Walkindfae9752004-09-29 13:19:37 +00001996extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001997asn_struct_free_f Not_PER_Visible_2_free;
1998asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001999asn_constr_check_f Not_PER_Visible_2_constraint;
2000ber_type_decoder_f Not_PER_Visible_2_decode_ber;
2001der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002002xer_type_decoder_f Not_PER_Visible_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002003xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002004
Lev Walkind35c8b52004-08-25 02:08:08 +00002005/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
2006
Lev Walkine8318b82005-03-06 09:29:03 +00002007static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002008 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002009 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00002010 const uint8_t *ch = st->buf;
2011 const uint8_t *end = ch + st->size;
2012
2013 for(; ch < end; ch++) {
2014 uint8_t cv = *ch;
2015 if(!(cv >= 65 && cv <= 66)) return -1;
2016 }
2017 return 0;
2018}
2019
2020
Lev Walkin006de1c2004-08-20 13:37:45 +00002021/*** <<< CODE [Not-PER-Visible-2] >>> ***/
2022
2023int
Lev Walkindfae9752004-09-29 13:19:37 +00002024Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002025 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002026 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002027
2028 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002029 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002030 "%s: value not given (%s:%d)",
2031 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002032 return -1;
2033 }
2034
2035
Lev Walkine8318b82005-03-06 09:29:03 +00002036 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002037 /* Constraint check succeeded */
2038 return 0;
2039 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002040 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00002041 "%s: constraint failed (%s:%d)",
2042 td->name, __FILE__, __LINE__);
2043 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002044 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002045}
2046
2047/*
2048 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002049 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002050 */
2051static void
Lev Walkine8318b82005-03-06 09:29:03 +00002052Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002053 td->free_struct = asn_DEF_PER_Visible.free_struct;
2054 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002055 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002056 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2057 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2058 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2059 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002060 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002061 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002062 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
2063 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002064 if(!td->per_constraints)
2065 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002066 td->elements = asn_DEF_PER_Visible.elements;
2067 td->elements_count = asn_DEF_PER_Visible.elements_count;
2068 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002069}
2070
Lev Walkina9cc46e2004-09-22 16:06:28 +00002071void
Lev Walkindfae9752004-09-29 13:19:37 +00002072Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002073 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002074 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002075 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002076}
2077
2078int
Lev Walkindfae9752004-09-29 13:19:37 +00002079Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002080 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002081 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002082 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2083}
2084
Lev Walkindc06f6b2004-10-20 15:50:55 +00002085asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002086Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002087 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002088 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002089 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002090}
2091
2092asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002093Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002094 void *structure, int tag_mode, ber_tlv_tag_t tag,
2095 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002096 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002097 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2098}
2099
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002100asn_dec_rval_t
2101Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002102 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002103 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002104 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2105}
2106
Lev Walkina9cc46e2004-09-22 16:06:28 +00002107asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002108Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002109 int ilevel, enum xer_encoder_flags_e flags,
2110 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002111 Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002112 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002113}
2114
2115
2116/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
2117
Lev Walkina7591b52014-10-12 18:37:35 -07002118static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002119 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002120};
Lev Walkindfae9752004-09-29 13:19:37 +00002121asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002122 "Not-PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002123 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002124 Not_PER_Visible_2_free,
2125 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002126 Not_PER_Visible_2_constraint,
2127 Not_PER_Visible_2_decode_ber,
2128 Not_PER_Visible_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002129 Not_PER_Visible_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002130 Not_PER_Visible_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002131 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002132 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002133 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002134 asn_DEF_Not_PER_Visible_2_tags_1,
2135 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2136 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2137 asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */
2138 sizeof(asn_DEF_Not_PER_Visible_2_tags_1)
2139 /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */
2140 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002141 0, 0, /* No members */
2142 0 /* No specifics */
2143};
2144
2145
2146/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
2147
Lev Walkin22b5ed42006-09-13 02:51:20 +00002148#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002149
2150/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
2151
Lev Walkin006de1c2004-08-20 13:37:45 +00002152typedef PER_Visible_t Not_PER_Visible_3_t;
2153
Lev Walkin006de1c2004-08-20 13:37:45 +00002154/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
2155
Lev Walkindfae9752004-09-29 13:19:37 +00002156extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002157asn_struct_free_f Not_PER_Visible_3_free;
2158asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002159asn_constr_check_f Not_PER_Visible_3_constraint;
2160ber_type_decoder_f Not_PER_Visible_3_decode_ber;
2161der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002162xer_type_decoder_f Not_PER_Visible_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002163xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002164
Lev Walkind35c8b52004-08-25 02:08:08 +00002165/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
2166
Lev Walkine8318b82005-03-06 09:29:03 +00002167static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002168 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002169 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +00002170 const uint8_t *ch = st->buf;
2171 const uint8_t *end = ch + st->size;
2172
2173 for(; ch < end; ch++) {
2174 uint8_t cv = *ch;
2175 if(!(cv >= 65 && cv <= 66)) return -1;
2176 }
2177 return 0;
2178}
2179
2180
Lev Walkin006de1c2004-08-20 13:37:45 +00002181/*** <<< CODE [Not-PER-Visible-3] >>> ***/
2182
2183int
Lev Walkindfae9752004-09-29 13:19:37 +00002184Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002185 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002186 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002187
2188 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002189 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002190 "%s: value not given (%s:%d)",
2191 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002192 return -1;
2193 }
2194
2195
Lev Walkine8318b82005-03-06 09:29:03 +00002196 if(!check_permitted_alphabet_1(st)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00002197 /* Constraint check succeeded */
2198 return 0;
2199 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002200 ASN__CTFAIL(app_key, td, sptr,
Lev Walkind35c8b52004-08-25 02:08:08 +00002201 "%s: constraint failed (%s:%d)",
2202 td->name, __FILE__, __LINE__);
2203 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002204 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002205}
2206
2207/*
2208 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002209 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002210 */
2211static void
Lev Walkine8318b82005-03-06 09:29:03 +00002212Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002213 td->free_struct = asn_DEF_PER_Visible.free_struct;
2214 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002215 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002216 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2217 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2218 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2219 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002220 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002221 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002222 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
2223 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002224 if(!td->per_constraints)
2225 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002226 td->elements = asn_DEF_PER_Visible.elements;
2227 td->elements_count = asn_DEF_PER_Visible.elements_count;
2228 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002229}
2230
Lev Walkina9cc46e2004-09-22 16:06:28 +00002231void
Lev Walkindfae9752004-09-29 13:19:37 +00002232Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002233 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002234 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002235 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002236}
2237
2238int
Lev Walkindfae9752004-09-29 13:19:37 +00002239Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002240 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002241 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002242 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2243}
2244
Lev Walkindc06f6b2004-10-20 15:50:55 +00002245asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002246Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002247 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002248 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002249 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002250}
2251
2252asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002253Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002254 void *structure, int tag_mode, ber_tlv_tag_t tag,
2255 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002256 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002257 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2258}
2259
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002260asn_dec_rval_t
2261Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002262 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002263 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002264 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2265}
2266
Lev Walkina9cc46e2004-09-22 16:06:28 +00002267asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002268Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002269 int ilevel, enum xer_encoder_flags_e flags,
2270 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002271 Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002272 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002273}
2274
2275
2276/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
2277
Lev Walkina7591b52014-10-12 18:37:35 -07002278static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002279 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002280};
Lev Walkindfae9752004-09-29 13:19:37 +00002281asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002282 "Not-PER-Visible-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002283 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002284 Not_PER_Visible_3_free,
2285 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002286 Not_PER_Visible_3_constraint,
2287 Not_PER_Visible_3_decode_ber,
2288 Not_PER_Visible_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002289 Not_PER_Visible_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002290 Not_PER_Visible_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002291 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002292 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002293 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002294 asn_DEF_Not_PER_Visible_3_tags_1,
2295 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2296 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2297 asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */
2298 sizeof(asn_DEF_Not_PER_Visible_3_tags_1)
2299 /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */
2300 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002301 0, 0, /* No members */
2302 0 /* No specifics */
2303};
2304
2305
2306/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
2307
Lev Walkin22b5ed42006-09-13 02:51:20 +00002308#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002309
2310/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
2311
Lev Walkin006de1c2004-08-20 13:37:45 +00002312typedef PER_Visible_t SIZE_but_not_FROM_t;
2313
Lev Walkin006de1c2004-08-20 13:37:45 +00002314/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
2315
Lev Walkindfae9752004-09-29 13:19:37 +00002316extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002317asn_struct_free_f SIZE_but_not_FROM_free;
2318asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002319asn_constr_check_f SIZE_but_not_FROM_constraint;
2320ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
2321der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002322xer_type_decoder_f SIZE_but_not_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002323xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002324
2325/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
2326
Lev Walkine8318b82005-03-06 09:29:03 +00002327static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002328 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002329 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002330 const uint8_t *ch = st->buf;
2331 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002332
2333 for(; ch < end; ch++) {
2334 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00002335 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002336 }
Lev Walkin775885e2004-08-22 12:47:03 +00002337 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002338}
2339
2340
2341/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
2342
2343int
Lev Walkindfae9752004-09-29 13:19:37 +00002344SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002345 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002346 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002347 size_t size;
2348
2349 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002350 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002351 "%s: value not given (%s:%d)",
2352 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002353 return -1;
2354 }
2355
2356 size = st->size;
2357
2358 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002359 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002360 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002361 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002362 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002363 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002364 "%s: constraint failed (%s:%d)",
2365 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002366 return -1;
2367 }
2368}
2369
2370/*
2371 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002372 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002373 */
2374static void
Lev Walkine8318b82005-03-06 09:29:03 +00002375SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002376 td->free_struct = asn_DEF_PER_Visible.free_struct;
2377 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002378 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002379 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2380 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2381 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2382 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002383 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002384 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002385 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
2386 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002387 if(!td->per_constraints)
2388 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002389 td->elements = asn_DEF_PER_Visible.elements;
2390 td->elements_count = asn_DEF_PER_Visible.elements_count;
2391 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002392}
2393
Lev Walkina9cc46e2004-09-22 16:06:28 +00002394void
Lev Walkindfae9752004-09-29 13:19:37 +00002395SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002396 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002397 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002398 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002399}
2400
2401int
Lev Walkindfae9752004-09-29 13:19:37 +00002402SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002403 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002404 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002405 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2406}
2407
Lev Walkindc06f6b2004-10-20 15:50:55 +00002408asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002409SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002410 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002411 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002412 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002413}
2414
2415asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002416SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002417 void *structure, int tag_mode, ber_tlv_tag_t tag,
2418 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002419 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002420 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2421}
2422
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002423asn_dec_rval_t
2424SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002425 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002426 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002427 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2428}
2429
Lev Walkina9cc46e2004-09-22 16:06:28 +00002430asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002431SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002432 int ilevel, enum xer_encoder_flags_e flags,
2433 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002434 SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002435 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002436}
2437
2438
2439/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
2440
Lev Walkina7591b52014-10-12 18:37:35 -07002441static const ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002442 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002443};
Lev Walkindfae9752004-09-29 13:19:37 +00002444asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002445 "SIZE-but-not-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002446 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002447 SIZE_but_not_FROM_free,
2448 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002449 SIZE_but_not_FROM_constraint,
2450 SIZE_but_not_FROM_decode_ber,
2451 SIZE_but_not_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002452 SIZE_but_not_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002453 SIZE_but_not_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002454 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002455 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002456 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002457 asn_DEF_SIZE_but_not_FROM_tags_1,
2458 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2459 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2460 asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */
2461 sizeof(asn_DEF_SIZE_but_not_FROM_tags_1)
2462 /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */
2463 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002464 0, 0, /* No members */
2465 0 /* No specifics */
2466};
2467
2468
2469/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2470
Lev Walkin22b5ed42006-09-13 02:51:20 +00002471#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002472
2473/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2474
Lev Walkin006de1c2004-08-20 13:37:45 +00002475typedef PER_Visible_t SIZE_and_FROM_t;
2476
Lev Walkin006de1c2004-08-20 13:37:45 +00002477/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2478
Lev Walkindfae9752004-09-29 13:19:37 +00002479extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002480asn_struct_free_f SIZE_and_FROM_free;
2481asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002482asn_constr_check_f SIZE_and_FROM_constraint;
2483ber_type_decoder_f SIZE_and_FROM_decode_ber;
2484der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002485xer_type_decoder_f SIZE_and_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002486xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002487
2488/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2489
Lev Walkine8318b82005-03-06 09:29:03 +00002490static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002491 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002492 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002493 const uint8_t *ch = st->buf;
2494 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002495
2496 for(; ch < end; ch++) {
2497 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002498 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002499 }
Lev Walkin775885e2004-08-22 12:47:03 +00002500 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002501}
2502
2503
2504/*** <<< CODE [SIZE-and-FROM] >>> ***/
2505
2506int
Lev Walkindfae9752004-09-29 13:19:37 +00002507SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002508 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002509 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002510 size_t size;
2511
2512 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002513 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002514 "%s: value not given (%s:%d)",
2515 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002516 return -1;
2517 }
2518
2519 size = st->size;
2520
2521 if((size >= 1 && size <= 4)
Lev Walkine8318b82005-03-06 09:29:03 +00002522 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002523 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002524 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002525 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002526 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002527 "%s: constraint failed (%s:%d)",
2528 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002529 return -1;
2530 }
2531}
2532
2533/*
2534 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002535 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002536 */
2537static void
Lev Walkine8318b82005-03-06 09:29:03 +00002538SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002539 td->free_struct = asn_DEF_PER_Visible.free_struct;
2540 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002541 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002542 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2543 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2544 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2545 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002546 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002547 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002548 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
2549 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002550 if(!td->per_constraints)
2551 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002552 td->elements = asn_DEF_PER_Visible.elements;
2553 td->elements_count = asn_DEF_PER_Visible.elements_count;
2554 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002555}
2556
Lev Walkina9cc46e2004-09-22 16:06:28 +00002557void
Lev Walkindfae9752004-09-29 13:19:37 +00002558SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002559 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002560 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002561 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002562}
2563
2564int
Lev Walkindfae9752004-09-29 13:19:37 +00002565SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002566 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002567 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002568 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2569}
2570
Lev Walkindc06f6b2004-10-20 15:50:55 +00002571asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002572SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002573 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002574 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002575 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002576}
2577
2578asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002579SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002580 void *structure, int tag_mode, ber_tlv_tag_t tag,
2581 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002582 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002583 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2584}
2585
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002586asn_dec_rval_t
2587SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002588 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002589 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002590 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2591}
2592
Lev Walkina9cc46e2004-09-22 16:06:28 +00002593asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002594SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002595 int ilevel, enum xer_encoder_flags_e flags,
2596 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002597 SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002598 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002599}
2600
2601
2602/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2603
Lev Walkina7591b52014-10-12 18:37:35 -07002604static const ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002605 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002606};
Lev Walkindfae9752004-09-29 13:19:37 +00002607asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002608 "SIZE-and-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002609 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002610 SIZE_and_FROM_free,
2611 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002612 SIZE_and_FROM_constraint,
2613 SIZE_and_FROM_decode_ber,
2614 SIZE_and_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002615 SIZE_and_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002616 SIZE_and_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002617 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002618 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002619 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002620 asn_DEF_SIZE_and_FROM_tags_1,
2621 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2622 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2623 asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */
2624 sizeof(asn_DEF_SIZE_and_FROM_tags_1)
2625 /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */
2626 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002627 0, 0, /* No members */
2628 0 /* No specifics */
2629};
2630
2631
2632/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2633
Lev Walkin22b5ed42006-09-13 02:51:20 +00002634#include "PER-Visible.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002635
2636/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2637
Lev Walkin006de1c2004-08-20 13:37:45 +00002638typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2639
Lev Walkin006de1c2004-08-20 13:37:45 +00002640/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2641
Lev Walkindfae9752004-09-29 13:19:37 +00002642extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002643asn_struct_free_f Neither_SIZE_nor_FROM_free;
2644asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002645asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2646ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2647der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002648xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002649xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002650
2651/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2652
Lev Walkine8318b82005-03-06 09:29:03 +00002653static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002654 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002655 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002656 const uint8_t *ch = st->buf;
2657 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002658
2659 for(; ch < end; ch++) {
2660 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002661 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002662 }
Lev Walkin775885e2004-08-22 12:47:03 +00002663 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002664}
2665
2666
2667/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2668
2669int
Lev Walkindfae9752004-09-29 13:19:37 +00002670Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002671 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002672 const PER_Visible_t *st = (const PER_Visible_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002673
2674 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002675 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002676 "%s: value not given (%s:%d)",
2677 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002678 return -1;
2679 }
2680
2681
Lev Walkine8318b82005-03-06 09:29:03 +00002682 if(!check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002683 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002684 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002685 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002686 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00002687 "%s: constraint failed (%s:%d)",
2688 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002689 return -1;
2690 }
2691}
2692
2693/*
2694 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002695 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002696 */
2697static void
Lev Walkine8318b82005-03-06 09:29:03 +00002698Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00002699 td->free_struct = asn_DEF_PER_Visible.free_struct;
2700 td->print_struct = asn_DEF_PER_Visible.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002701 td->check_constraints = asn_DEF_PER_Visible.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002702 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2703 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2704 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2705 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002706 td->uper_decoder = asn_DEF_PER_Visible.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002707 td->uper_encoder = asn_DEF_PER_Visible.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002708 td->oer_decoder = asn_DEF_PER_Visible.oer_decoder;
2709 td->oer_encoder = asn_DEF_PER_Visible.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002710 if(!td->per_constraints)
2711 td->per_constraints = asn_DEF_PER_Visible.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00002712 td->elements = asn_DEF_PER_Visible.elements;
2713 td->elements_count = asn_DEF_PER_Visible.elements_count;
2714 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002715}
2716
Lev Walkina9cc46e2004-09-22 16:06:28 +00002717void
Lev Walkindfae9752004-09-29 13:19:37 +00002718Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002719 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002720 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002721 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002722}
2723
2724int
Lev Walkindfae9752004-09-29 13:19:37 +00002725Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002726 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002727 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00002728 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2729}
2730
Lev Walkindc06f6b2004-10-20 15:50:55 +00002731asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002732Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002733 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002734 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002735 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002736}
2737
2738asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002739Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002740 void *structure, int tag_mode, ber_tlv_tag_t tag,
2741 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002742 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002743 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2744}
2745
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002746asn_dec_rval_t
2747Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002748 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002749 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002750 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2751}
2752
Lev Walkina9cc46e2004-09-22 16:06:28 +00002753asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002754Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002755 int ilevel, enum xer_encoder_flags_e flags,
2756 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002757 Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002758 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002759}
2760
2761
2762/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2763
Lev Walkina7591b52014-10-12 18:37:35 -07002764static const ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002765 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002766};
Lev Walkindfae9752004-09-29 13:19:37 +00002767asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002768 "Neither-SIZE-nor-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002769 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002770 Neither_SIZE_nor_FROM_free,
2771 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002772 Neither_SIZE_nor_FROM_constraint,
2773 Neither_SIZE_nor_FROM_decode_ber,
2774 Neither_SIZE_nor_FROM_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002775 Neither_SIZE_nor_FROM_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002776 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002777 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002778 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00002779 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002780 asn_DEF_Neither_SIZE_nor_FROM_tags_1,
2781 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2782 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2783 asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */
2784 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1)
2785 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */
2786 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00002787 0, 0, /* No members */
2788 0 /* No specifics */
2789};
2790
2791
Lev Walkin55cc44a2004-10-03 09:14:32 +00002792/*** <<< INCLUDES [Utf8-4] >>> ***/
2793
2794#include <UTF8String.h>
2795
2796/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2797
Lev Walkin55cc44a2004-10-03 09:14:32 +00002798typedef UTF8String_t Utf8_4_t;
2799
2800/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2801
2802extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2803asn_struct_free_f Utf8_4_free;
2804asn_struct_print_f Utf8_4_print;
2805asn_constr_check_f Utf8_4_constraint;
2806ber_type_decoder_f Utf8_4_decode_ber;
2807der_type_encoder_f Utf8_4_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002808xer_type_decoder_f Utf8_4_decode_xer;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002809xer_type_encoder_f Utf8_4_encode_xer;
2810
2811/*** <<< CTABLES [Utf8-4] >>> ***/
2812
Lev Walkine8318b82005-03-06 09:29:03 +00002813static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002814 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2815 return -1; /* Alphabet (sic!) test failed. */
2816
2817 return 0;
2818}
2819
2820
2821/*** <<< CODE [Utf8-4] >>> ***/
2822
2823int
2824Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002825 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002826 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002827
2828 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002829 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002830 "%s: value not given (%s:%d)",
2831 td->name, __FILE__, __LINE__);
2832 return -1;
2833 }
2834
2835
Lev Walkine8318b82005-03-06 09:29:03 +00002836 if(!check_permitted_alphabet_1(st)) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002837 /* Constraint check succeeded */
2838 return 0;
2839 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07002840 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002841 "%s: constraint failed (%s:%d)",
2842 td->name, __FILE__, __LINE__);
2843 return -1;
2844 }
2845}
2846
2847/*
2848 * This type is implemented using UTF8String,
2849 * so here we adjust the DEF accordingly.
2850 */
2851static void
Lev Walkine8318b82005-03-06 09:29:03 +00002852Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002853 td->free_struct = asn_DEF_UTF8String.free_struct;
2854 td->print_struct = asn_DEF_UTF8String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08002855 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002856 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2857 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2858 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2859 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002860 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002861 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07002862 td->oer_decoder = asn_DEF_UTF8String.oer_decoder;
2863 td->oer_encoder = asn_DEF_UTF8String.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00002864 if(!td->per_constraints)
2865 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkin55cc44a2004-10-03 09:14:32 +00002866 td->elements = asn_DEF_UTF8String.elements;
2867 td->elements_count = asn_DEF_UTF8String.elements_count;
2868 td->specifics = asn_DEF_UTF8String.specifics;
2869}
2870
2871void
2872Utf8_4_free(asn_TYPE_descriptor_t *td,
2873 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00002874 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002875 td->free_struct(td, struct_ptr, contents_only);
2876}
2877
2878int
2879Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2880 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002881 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002882 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2883}
2884
Lev Walkindc06f6b2004-10-20 15:50:55 +00002885asn_dec_rval_t
Lev Walkin55cc44a2004-10-03 09:14:32 +00002886Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002887 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00002888 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002889 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2890}
2891
2892asn_enc_rval_t
2893Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2894 void *structure, int tag_mode, ber_tlv_tag_t tag,
2895 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002896 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002897 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2898}
2899
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002900asn_dec_rval_t
2901Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00002902 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00002903 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002904 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
2905}
2906
Lev Walkin55cc44a2004-10-03 09:14:32 +00002907asn_enc_rval_t
2908Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2909 int ilevel, enum xer_encoder_flags_e flags,
2910 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00002911 Utf8_4_1_inherit_TYPE_descriptor(td);
Lev Walkin55cc44a2004-10-03 09:14:32 +00002912 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2913}
2914
2915
2916/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2917
Lev Walkina7591b52014-10-12 18:37:35 -07002918static const ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = {
Lev Walkin55cc44a2004-10-03 09:14:32 +00002919 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2920};
2921asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2922 "Utf8-4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002923 "Utf8-4",
Lev Walkin55cc44a2004-10-03 09:14:32 +00002924 Utf8_4_free,
2925 Utf8_4_print,
2926 Utf8_4_constraint,
2927 Utf8_4_decode_ber,
2928 Utf8_4_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002929 Utf8_4_decode_xer,
Lev Walkin55cc44a2004-10-03 09:14:32 +00002930 Utf8_4_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00002931 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07002932 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002933 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00002934 asn_DEF_Utf8_4_tags_1,
2935 sizeof(asn_DEF_Utf8_4_tags_1)
2936 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2937 asn_DEF_Utf8_4_tags_1, /* Same as above */
2938 sizeof(asn_DEF_Utf8_4_tags_1)
2939 /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */
2940 0, /* No PER visible constraints */
Lev Walkin55cc44a2004-10-03 09:14:32 +00002941 0, 0, /* No members */
2942 0 /* No specifics */
2943};
2944
2945
Lev Walkin006de1c2004-08-20 13:37:45 +00002946/*** <<< INCLUDES [Utf8-3] >>> ***/
2947
Lev Walkin22b5ed42006-09-13 02:51:20 +00002948#include "Utf8-2.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00002949
2950/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2951
Lev Walkin006de1c2004-08-20 13:37:45 +00002952typedef Utf8_2_t Utf8_3_t;
2953
Lev Walkin006de1c2004-08-20 13:37:45 +00002954/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2955
Lev Walkindfae9752004-09-29 13:19:37 +00002956extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002957asn_struct_free_f Utf8_3_free;
2958asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002959asn_constr_check_f Utf8_3_constraint;
2960ber_type_decoder_f Utf8_3_decode_ber;
2961der_type_encoder_f Utf8_3_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00002962xer_type_decoder_f Utf8_3_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002963xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002964
2965/*** <<< CTABLES [Utf8-3] >>> ***/
2966
Lev Walkina7591b52014-10-12 18:37:35 -07002967static const int permitted_alphabet_table_1[128] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00002968 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2970 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2971 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
2972 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */
297316,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
2974 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */
297542,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkin006de1c2004-08-20 13:37:45 +00002976};
2977
Lev Walkine8318b82005-03-06 09:29:03 +00002978static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07002979 const int *table = permitted_alphabet_table_1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002980 /* The underlying type is UTF8String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002981 const UTF8String_t *st = (const UTF8String_t *)sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00002982 const uint8_t *ch = st->buf;
2983 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002984
2985 for(; ch < end; ch++) {
2986 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002987 if(cv >= 0x80) return -1;
2988 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002989 }
Lev Walkin775885e2004-08-22 12:47:03 +00002990 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002991}
2992
2993
2994/*** <<< CODE [Utf8-3] >>> ***/
2995
2996int
Lev Walkindfae9752004-09-29 13:19:37 +00002997Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00002998 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00002999 const Utf8_2_t *st = (const Utf8_2_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00003000 size_t size;
3001
3002 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003003 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003004 "%s: value not given (%s:%d)",
3005 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003006 return -1;
3007 }
3008
Lev Walkinfac2e942004-10-02 16:33:46 +00003009 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00003010 if((ssize_t)size < 0) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003011 ASN__CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00003012 "%s: UTF-8: broken encoding (%s:%d)",
3013 td->name, __FILE__, __LINE__);
3014 return -1;
3015 }
Lev Walkin006de1c2004-08-20 13:37:45 +00003016
3017 if((size >= 1 && size <= 2)
Lev Walkine8318b82005-03-06 09:29:03 +00003018 && !check_permitted_alphabet_1(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00003019 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00003020 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00003021 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003022 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003023 "%s: constraint failed (%s:%d)",
3024 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003025 return -1;
3026 }
3027}
3028
3029/*
3030 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00003031 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00003032 */
3033static void
Lev Walkine8318b82005-03-06 09:29:03 +00003034Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00003035 td->free_struct = asn_DEF_Utf8_2.free_struct;
3036 td->print_struct = asn_DEF_Utf8_2.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003037 td->check_constraints = asn_DEF_Utf8_2.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003038 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
3039 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
3040 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
3041 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003042 td->uper_decoder = asn_DEF_Utf8_2.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003043 td->uper_encoder = asn_DEF_Utf8_2.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07003044 td->oer_decoder = asn_DEF_Utf8_2.oer_decoder;
3045 td->oer_encoder = asn_DEF_Utf8_2.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003046 if(!td->per_constraints)
3047 td->per_constraints = asn_DEF_Utf8_2.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003048 td->elements = asn_DEF_Utf8_2.elements;
3049 td->elements_count = asn_DEF_Utf8_2.elements_count;
3050 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00003051}
3052
Lev Walkina9cc46e2004-09-22 16:06:28 +00003053void
Lev Walkindfae9752004-09-29 13:19:37 +00003054Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003055 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003056 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003057 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00003058}
3059
3060int
Lev Walkindfae9752004-09-29 13:19:37 +00003061Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00003062 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003063 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00003064 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3065}
3066
Lev Walkindc06f6b2004-10-20 15:50:55 +00003067asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003068Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003069 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003070 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003071 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003072}
3073
3074asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003075Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003076 void *structure, int tag_mode, ber_tlv_tag_t tag,
3077 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003078 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003079 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3080}
3081
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003082asn_dec_rval_t
3083Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003084 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003085 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003086 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3087}
3088
Lev Walkina9cc46e2004-09-22 16:06:28 +00003089asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003090Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003091 int ilevel, enum xer_encoder_flags_e flags,
3092 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003093 Utf8_3_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003094 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003095}
3096
3097
3098/*** <<< STAT-DEFS [Utf8-3] >>> ***/
3099
Lev Walkina7591b52014-10-12 18:37:35 -07003100static const ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003101 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003102};
Lev Walkindfae9752004-09-29 13:19:37 +00003103asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003104 "Utf8-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003105 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003106 Utf8_3_free,
3107 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003108 Utf8_3_constraint,
3109 Utf8_3_decode_ber,
3110 Utf8_3_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003111 Utf8_3_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003112 Utf8_3_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003113 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003114 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003115 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003116 asn_DEF_Utf8_3_tags_1,
3117 sizeof(asn_DEF_Utf8_3_tags_1)
3118 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3119 asn_DEF_Utf8_3_tags_1, /* Same as above */
3120 sizeof(asn_DEF_Utf8_3_tags_1)
3121 /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */
3122 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003123 0, 0, /* No members */
3124 0 /* No specifics */
3125};
3126
3127
3128/*** <<< INCLUDES [Utf8-2] >>> ***/
3129
Lev Walkin22b5ed42006-09-13 02:51:20 +00003130#include "Utf8-1.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00003131
3132/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
3133
Lev Walkin006de1c2004-08-20 13:37:45 +00003134typedef Utf8_1_t Utf8_2_t;
3135
Lev Walkin006de1c2004-08-20 13:37:45 +00003136/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
3137
Lev Walkindfae9752004-09-29 13:19:37 +00003138extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003139asn_struct_free_f Utf8_2_free;
3140asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00003141asn_constr_check_f Utf8_2_constraint;
3142ber_type_decoder_f Utf8_2_decode_ber;
3143der_type_encoder_f Utf8_2_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003144xer_type_decoder_f Utf8_2_decode_xer;
Lev Walkina9cc46e2004-09-22 16:06:28 +00003145xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003146
3147/*** <<< CODE [Utf8-2] >>> ***/
3148
3149int
Lev Walkindfae9752004-09-29 13:19:37 +00003150Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003151 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00003152 const Utf8_1_t *st = (const Utf8_1_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00003153 size_t size;
3154
3155 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003156 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003157 "%s: value not given (%s:%d)",
3158 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003159 return -1;
3160 }
3161
Lev Walkinfac2e942004-10-02 16:33:46 +00003162 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00003163 if((ssize_t)size < 0) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003164 ASN__CTFAIL(app_key, td, sptr,
Lev Walkinfac2e942004-10-02 16:33:46 +00003165 "%s: UTF-8: broken encoding (%s:%d)",
3166 td->name, __FILE__, __LINE__);
3167 return -1;
3168 }
Lev Walkin006de1c2004-08-20 13:37:45 +00003169
3170 if((size >= 1 && size <= 2)) {
3171 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00003172 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00003173 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003174 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +00003175 "%s: constraint failed (%s:%d)",
3176 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00003177 return -1;
3178 }
3179}
3180
3181/*
3182 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00003183 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00003184 */
3185static void
Lev Walkine8318b82005-03-06 09:29:03 +00003186Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00003187 td->free_struct = asn_DEF_Utf8_1.free_struct;
3188 td->print_struct = asn_DEF_Utf8_1.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003189 td->check_constraints = asn_DEF_Utf8_1.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003190 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
3191 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
3192 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
3193 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003194 td->uper_decoder = asn_DEF_Utf8_1.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003195 td->uper_encoder = asn_DEF_Utf8_1.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07003196 td->oer_decoder = asn_DEF_Utf8_1.oer_decoder;
3197 td->oer_encoder = asn_DEF_Utf8_1.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003198 if(!td->per_constraints)
3199 td->per_constraints = asn_DEF_Utf8_1.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00003200 td->elements = asn_DEF_Utf8_1.elements;
3201 td->elements_count = asn_DEF_Utf8_1.elements_count;
3202 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00003203}
3204
Lev Walkina9cc46e2004-09-22 16:06:28 +00003205void
Lev Walkindfae9752004-09-29 13:19:37 +00003206Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003207 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003208 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003209 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00003210}
3211
3212int
Lev Walkindfae9752004-09-29 13:19:37 +00003213Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00003214 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003215 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin006de1c2004-08-20 13:37:45 +00003216 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3217}
3218
Lev Walkindc06f6b2004-10-20 15:50:55 +00003219asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003220Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003221 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003222 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00003223 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003224}
3225
3226asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003227Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003228 void *structure, int tag_mode, ber_tlv_tag_t tag,
3229 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003230 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003231 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3232}
3233
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003234asn_dec_rval_t
3235Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003236 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003237 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003238 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3239}
3240
Lev Walkina9cc46e2004-09-22 16:06:28 +00003241asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00003242Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003243 int ilevel, enum xer_encoder_flags_e flags,
3244 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003245 Utf8_2_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00003246 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00003247}
3248
3249
3250/*** <<< STAT-DEFS [Utf8-2] >>> ***/
3251
Lev Walkina7591b52014-10-12 18:37:35 -07003252static const ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00003253 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00003254};
Lev Walkindfae9752004-09-29 13:19:37 +00003255asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00003256 "Utf8-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00003257 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00003258 Utf8_2_free,
3259 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00003260 Utf8_2_constraint,
3261 Utf8_2_decode_ber,
3262 Utf8_2_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00003263 Utf8_2_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00003264 Utf8_2_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003265 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003266 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +00003267 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003268 asn_DEF_Utf8_2_tags_1,
3269 sizeof(asn_DEF_Utf8_2_tags_1)
3270 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3271 asn_DEF_Utf8_2_tags_1, /* Same as above */
3272 sizeof(asn_DEF_Utf8_2_tags_1)
3273 /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */
3274 0, /* No PER visible constraints */
Lev Walkin006de1c2004-08-20 13:37:45 +00003275 0, 0, /* No members */
3276 0 /* No specifics */
3277};
3278
3279
3280/*** <<< INCLUDES [Utf8-1] >>> ***/
3281
3282#include <UTF8String.h>
3283
3284/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
3285
Lev Walkin006de1c2004-08-20 13:37:45 +00003286typedef UTF8String_t Utf8_1_t;
3287
Lev Walkin006de1c2004-08-20 13:37:45 +00003288/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
3289
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003290extern asn_TYPE_descriptor_t asn_DEF_Utf8_1;
3291asn_struct_free_f Utf8_1_free;
3292asn_struct_print_f Utf8_1_print;
3293asn_constr_check_f Utf8_1_constraint;
3294ber_type_decoder_f Utf8_1_decode_ber;
3295der_type_encoder_f Utf8_1_encode_der;
3296xer_type_decoder_f Utf8_1_decode_xer;
3297xer_type_encoder_f Utf8_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00003298
3299/*** <<< CODE [Utf8-1] >>> ***/
3300
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003301int
3302Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003303 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003304 /* Replace with underlying type checker */
3305 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003306 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003307}
3308
3309/*
3310 * This type is implemented using UTF8String,
3311 * so here we adjust the DEF accordingly.
3312 */
3313static void
Lev Walkine8318b82005-03-06 09:29:03 +00003314Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003315 td->free_struct = asn_DEF_UTF8String.free_struct;
3316 td->print_struct = asn_DEF_UTF8String.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003317 td->check_constraints = asn_DEF_UTF8String.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003318 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
3319 td->der_encoder = asn_DEF_UTF8String.der_encoder;
3320 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
3321 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003322 td->uper_decoder = asn_DEF_UTF8String.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003323 td->uper_encoder = asn_DEF_UTF8String.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07003324 td->oer_decoder = asn_DEF_UTF8String.oer_decoder;
3325 td->oer_encoder = asn_DEF_UTF8String.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003326 if(!td->per_constraints)
3327 td->per_constraints = asn_DEF_UTF8String.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003328 td->elements = asn_DEF_UTF8String.elements;
3329 td->elements_count = asn_DEF_UTF8String.elements_count;
3330 td->specifics = asn_DEF_UTF8String.specifics;
3331}
3332
3333void
3334Utf8_1_free(asn_TYPE_descriptor_t *td,
3335 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003336 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003337 td->free_struct(td, struct_ptr, contents_only);
3338}
3339
3340int
3341Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3342 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003343 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003344 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3345}
3346
3347asn_dec_rval_t
3348Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003349 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003350 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003351 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3352}
3353
3354asn_enc_rval_t
3355Utf8_1_encode_der(asn_TYPE_descriptor_t *td,
3356 void *structure, int tag_mode, ber_tlv_tag_t tag,
3357 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003358 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003359 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3360}
3361
3362asn_dec_rval_t
3363Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003364 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003365 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003366 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3367}
3368
3369asn_enc_rval_t
3370Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3371 int ilevel, enum xer_encoder_flags_e flags,
3372 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003373 Utf8_1_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003374 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3375}
3376
3377
3378/*** <<< STAT-DEFS [Utf8-1] >>> ***/
3379
Lev Walkina7591b52014-10-12 18:37:35 -07003380static const ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003381 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
3382};
3383asn_TYPE_descriptor_t asn_DEF_Utf8_1 = {
3384 "Utf8-1",
3385 "Utf8-1",
3386 Utf8_1_free,
3387 Utf8_1_print,
3388 Utf8_1_constraint,
3389 Utf8_1_decode_ber,
3390 Utf8_1_encode_der,
3391 Utf8_1_decode_xer,
3392 Utf8_1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003393 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003394 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003395 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003396 asn_DEF_Utf8_1_tags_1,
3397 sizeof(asn_DEF_Utf8_1_tags_1)
3398 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3399 asn_DEF_Utf8_1_tags_1, /* Same as above */
3400 sizeof(asn_DEF_Utf8_1_tags_1)
3401 /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */
3402 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003403 0, 0, /* No members */
3404 0 /* No specifics */
3405};
Lev Walkin006de1c2004-08-20 13:37:45 +00003406
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003407
3408/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
3409
Lev Walkin22b5ed42006-09-13 02:51:20 +00003410#include "Identifier.h"
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003411
3412/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
3413
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003414typedef Identifier_t VisibleIdentifier_t;
3415
3416/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
3417
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003418extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier;
3419asn_struct_free_f VisibleIdentifier_free;
3420asn_struct_print_f VisibleIdentifier_print;
3421asn_constr_check_f VisibleIdentifier_constraint;
3422ber_type_decoder_f VisibleIdentifier_decode_ber;
3423der_type_encoder_f VisibleIdentifier_encode_der;
3424xer_type_decoder_f VisibleIdentifier_decode_xer;
3425xer_type_encoder_f VisibleIdentifier_encode_xer;
3426
3427/*** <<< CTABLES [VisibleIdentifier] >>> ***/
3428
Lev Walkina7591b52014-10-12 18:37:35 -07003429static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00003430 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
3431 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
3432 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */
3433 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */
3434 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */
343527,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */
3436 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */
343754,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003438};
3439
Lev Walkine8318b82005-03-06 09:29:03 +00003440static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07003441 const int *table = permitted_alphabet_table_1;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003442 /* The underlying type is VisibleString */
3443 const VisibleString_t *st = (const VisibleString_t *)sptr;
3444 const uint8_t *ch = st->buf;
3445 const uint8_t *end = ch + st->size;
3446
3447 for(; ch < end; ch++) {
3448 uint8_t cv = *ch;
3449 if(!table[cv]) return -1;
3450 }
3451 return 0;
3452}
3453
Lev Walkine4ca5ce2004-09-15 11:44:13 +00003454
Lev Walkin154aa182004-09-26 13:12:56 +00003455/*** <<< CODE [VisibleIdentifier] >>> ***/
3456
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003457int
3458VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003459 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003460 const Identifier_t *st = (const Identifier_t *)sptr;
3461 size_t size;
3462
3463 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003464 ASN__CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003465 "%s: value not given (%s:%d)",
3466 td->name, __FILE__, __LINE__);
3467 return -1;
3468 }
3469
3470 size = st->size;
3471
3472 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00003473 && !check_permitted_alphabet_1(st)) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003474 /* Constraint check succeeded */
3475 return 0;
3476 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003477 ASN__CTFAIL(app_key, td, sptr,
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003478 "%s: constraint failed (%s:%d)",
3479 td->name, __FILE__, __LINE__);
3480 return -1;
3481 }
3482}
3483
3484/*
3485 * This type is implemented using Identifier,
3486 * so here we adjust the DEF accordingly.
3487 */
3488static void
Lev Walkine8318b82005-03-06 09:29:03 +00003489VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003490 td->free_struct = asn_DEF_Identifier.free_struct;
3491 td->print_struct = asn_DEF_Identifier.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003492 td->check_constraints = asn_DEF_Identifier.check_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003493 td->ber_decoder = asn_DEF_Identifier.ber_decoder;
3494 td->der_encoder = asn_DEF_Identifier.der_encoder;
3495 td->xer_decoder = asn_DEF_Identifier.xer_decoder;
3496 td->xer_encoder = asn_DEF_Identifier.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003497 td->uper_decoder = asn_DEF_Identifier.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003498 td->uper_encoder = asn_DEF_Identifier.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07003499 td->oer_decoder = asn_DEF_Identifier.oer_decoder;
3500 td->oer_encoder = asn_DEF_Identifier.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003501 if(!td->per_constraints)
3502 td->per_constraints = asn_DEF_Identifier.per_constraints;
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003503 td->elements = asn_DEF_Identifier.elements;
3504 td->elements_count = asn_DEF_Identifier.elements_count;
3505 td->specifics = asn_DEF_Identifier.specifics;
3506}
3507
3508void
3509VisibleIdentifier_free(asn_TYPE_descriptor_t *td,
3510 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00003511 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003512 td->free_struct(td, struct_ptr, contents_only);
3513}
3514
3515int
3516VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3517 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003518 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003519 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3520}
3521
3522asn_dec_rval_t
3523VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003524 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00003525 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003526 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3527}
3528
3529asn_enc_rval_t
3530VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td,
3531 void *structure, int tag_mode, ber_tlv_tag_t tag,
3532 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003533 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003534 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3535}
3536
3537asn_dec_rval_t
3538VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00003539 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00003540 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003541 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3542}
3543
3544asn_enc_rval_t
3545VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3546 int ilevel, enum xer_encoder_flags_e flags,
3547 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00003548 VisibleIdentifier_1_inherit_TYPE_descriptor(td);
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003549 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3550}
3551
3552
3553/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
3554
Lev Walkina7591b52014-10-12 18:37:35 -07003555static const ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = {
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003556 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
3557};
3558asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = {
3559 "VisibleIdentifier",
3560 "VisibleIdentifier",
3561 VisibleIdentifier_free,
3562 VisibleIdentifier_print,
3563 VisibleIdentifier_constraint,
3564 VisibleIdentifier_decode_ber,
3565 VisibleIdentifier_encode_der,
3566 VisibleIdentifier_decode_xer,
3567 VisibleIdentifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003568 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003569 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003570 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00003571 asn_DEF_VisibleIdentifier_tags_1,
3572 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3573 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3574 asn_DEF_VisibleIdentifier_tags_1, /* Same as above */
3575 sizeof(asn_DEF_VisibleIdentifier_tags_1)
3576 /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */
3577 0, /* No PER visible constraints */
Lev Walkincaf0d5a2005-03-04 23:48:19 +00003578 0, 0, /* No members */
3579 0 /* No specifics */
3580};
Lev Walkin154aa182004-09-26 13:12:56 +00003581
3582
Lev Walkin59b176e2005-11-26 11:25:14 +00003583/*** <<< INCLUDES [Sequence] >>> ***/
3584
Lev Walkin22b5ed42006-09-13 02:51:20 +00003585#include "Int1.h"
3586#include "Int4.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003587#include <BOOLEAN.h>
3588#include <ENUMERATED.h>
3589#include <NULL.h>
Lev Walkin22b5ed42006-09-13 02:51:20 +00003590#include "Int5.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00003591#include <constr_SEQUENCE.h>
3592
3593/*** <<< DEPS [Sequence] >>> ***/
3594
3595typedef enum enum_c {
3596 enum_c_one = 1,
3597 enum_c_two = 2,
3598 /*
3599 * Enumeration is extensible
3600 */
3601 enum_c_three = 3
Lev Walkin171487e2006-03-21 07:25:18 +00003602} e_enum_c;
Lev Walkin59b176e2005-11-26 11:25:14 +00003603
3604/*** <<< TYPE-DECLS [Sequence] >>> ***/
3605
3606typedef struct Sequence {
3607 Int1_t *int1_c /* DEFAULT 3 */;
3608 Int4_t int4;
3609 Int4_t int4_c;
Lev Walkin2a744a72013-03-27 01:56:23 -07003610 BOOLEAN_t *Bool /* DEFAULT 1 */;
Lev Walkin59b176e2005-11-26 11:25:14 +00003611 ENUMERATED_t enum_c;
3612 NULL_t *null /* OPTIONAL */;
3613 /*
3614 * This type is extensible,
3615 * possible extensions are below.
3616 */
3617 Int5_t *int5_c /* OPTIONAL */;
3618
3619 /* Context for parsing across buffer boundaries */
3620 asn_struct_ctx_t _asn_ctx;
3621} Sequence_t;
3622
3623/*** <<< FUNC-DECLS [Sequence] >>> ***/
3624
3625/* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */
3626extern asn_TYPE_descriptor_t asn_DEF_Sequence;
3627
3628/*** <<< CODE [Sequence] >>> ***/
3629
3630static int
3631enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003632 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003633 /* Replace with underlying type checker */
3634 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00003635 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00003636}
3637
3638/*
3639 * This type is implemented using ENUMERATED,
3640 * so here we adjust the DEF accordingly.
3641 */
3642static void
3643enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
3644 td->free_struct = asn_DEF_ENUMERATED.free_struct;
3645 td->print_struct = asn_DEF_ENUMERATED.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08003646 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00003647 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
3648 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
3649 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
3650 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
3651 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003652 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07003653 td->oer_decoder = asn_DEF_ENUMERATED.oer_decoder;
3654 td->oer_encoder = asn_DEF_ENUMERATED.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00003655 if(!td->per_constraints)
3656 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
3657 td->elements = asn_DEF_ENUMERATED.elements;
3658 td->elements_count = asn_DEF_ENUMERATED.elements_count;
3659 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
3660}
3661
3662static void
3663enum_c_6_free(asn_TYPE_descriptor_t *td,
3664 void *struct_ptr, int contents_only) {
3665 enum_c_6_inherit_TYPE_descriptor(td);
3666 td->free_struct(td, struct_ptr, contents_only);
3667}
3668
3669static int
3670enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
3671 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
3672 enum_c_6_inherit_TYPE_descriptor(td);
3673 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
3674}
3675
3676static asn_dec_rval_t
3677enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3678 void **structure, const void *bufptr, size_t size, int tag_mode) {
3679 enum_c_6_inherit_TYPE_descriptor(td);
3680 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
3681}
3682
3683static asn_enc_rval_t
3684enum_c_6_encode_der(asn_TYPE_descriptor_t *td,
3685 void *structure, int tag_mode, ber_tlv_tag_t tag,
3686 asn_app_consume_bytes_f *cb, void *app_key) {
3687 enum_c_6_inherit_TYPE_descriptor(td);
3688 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
3689}
3690
3691static asn_dec_rval_t
3692enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
3693 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
3694 enum_c_6_inherit_TYPE_descriptor(td);
3695 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
3696}
3697
3698static asn_enc_rval_t
3699enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
3700 int ilevel, enum xer_encoder_flags_e flags,
3701 asn_app_consume_bytes_f *cb, void *app_key) {
3702 enum_c_6_inherit_TYPE_descriptor(td);
3703 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
3704}
3705
3706static int
3707memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003708 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003709 const Int1_t *st = (const Int1_t *)sptr;
3710 long value;
3711
3712 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003713 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003714 "%s: value not given (%s:%d)",
3715 td->name, __FILE__, __LINE__);
3716 return -1;
3717 }
3718
3719 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003720 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003721 "%s: value too large (%s:%d)",
3722 td->name, __FILE__, __LINE__);
3723 return -1;
3724 }
3725
3726 if((value >= -2)) {
3727 /* Constraint check succeeded */
3728 return 0;
3729 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003730 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003731 "%s: constraint failed (%s:%d)",
3732 td->name, __FILE__, __LINE__);
3733 return -1;
3734 }
3735}
3736
3737static int
3738memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003739 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003740 const Int4_t *st = (const Int4_t *)sptr;
3741 long value;
3742
3743 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003744 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003745 "%s: value not given (%s:%d)",
3746 td->name, __FILE__, __LINE__);
3747 return -1;
3748 }
3749
3750 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003751 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003752 "%s: value too large (%s:%d)",
3753 td->name, __FILE__, __LINE__);
3754 return -1;
3755 }
3756
3757 if((value >= 5 && value <= 7)) {
3758 /* Constraint check succeeded */
3759 return 0;
3760 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003761 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003762 "%s: constraint failed (%s:%d)",
3763 td->name, __FILE__, __LINE__);
3764 return -1;
3765 }
3766}
3767
3768static int
3769memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00003770 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003771 const Int5_t *st = (const Int5_t *)sptr;
3772 long value;
3773
3774 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003775 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003776 "%s: value not given (%s:%d)",
3777 td->name, __FILE__, __LINE__);
3778 return -1;
3779 }
3780
3781 if(asn_INTEGER2long(st, &value)) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003782 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003783 "%s: value too large (%s:%d)",
3784 td->name, __FILE__, __LINE__);
3785 return -1;
3786 }
3787
3788 if((value == 5)) {
3789 /* Constraint check succeeded */
3790 return 0;
3791 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07003792 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00003793 "%s: constraint failed (%s:%d)",
3794 td->name, __FILE__, __LINE__);
3795 return -1;
3796 }
3797}
3798
3799
3800/*** <<< STAT-DEFS [Sequence] >>> ***/
3801
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003802static int asn_DFL_2_set_3(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003803 Int1_t *st = *sptr;
3804
3805 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003806 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003807 st = (*sptr = CALLOC(1, sizeof(*st)));
3808 if(!st) return -1;
3809 }
3810
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003811 if(set_value) {
3812 /* Install default value 3 */
3813 return asn_long2INTEGER(st, 3);
3814 } else {
3815 /* Test default value 3 */
3816 long value;
3817 if(asn_INTEGER2long(st, &value))
3818 return -1;
3819 return (value == 3);
3820 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003821}
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003822static int asn_DFL_5_set_1(int set_value, void **sptr) {
Lev Walkin59b176e2005-11-26 11:25:14 +00003823 BOOLEAN_t *st = *sptr;
3824
3825 if(!st) {
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003826 if(!set_value) return -1; /* Not a default value */
Lev Walkin59b176e2005-11-26 11:25:14 +00003827 st = (*sptr = CALLOC(1, sizeof(*st)));
3828 if(!st) return -1;
3829 }
3830
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003831 if(set_value) {
3832 /* Install default value 1 */
3833 *st = 1;
3834 return 0;
3835 } else {
3836 /* Test default value 1 */
3837 return (*st == 1);
3838 }
Lev Walkin59b176e2005-11-26 11:25:14 +00003839}
Lev Walkina7591b52014-10-12 18:37:35 -07003840static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003841 { 1, 3, "one" },
3842 { 2, 3, "two" },
3843 { 3, 5, "three" }
3844 /* This list is extensible */
3845};
Lev Walkina7591b52014-10-12 18:37:35 -07003846static const unsigned int asn_MAP_enum_c_enum2value_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003847 0, /* one(1) */
3848 2, /* three(3) */
3849 1 /* two(2) */
3850 /* This list is extensible */
3851};
johvike70c4072017-05-09 11:06:12 +02003852static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003853 asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */
3854 asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */
3855 3, /* Number of elements in the maps */
3856 3, /* Extensions before this member */
Lev Walkin8bb57a22007-12-03 13:41:36 +00003857 1, /* Strict enumeration */
3858 0, /* Native long size */
3859 0
Lev Walkin59b176e2005-11-26 11:25:14 +00003860};
Lev Walkina7591b52014-10-12 18:37:35 -07003861static const ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003862 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
3863};
3864static /* Use -fall-defs-global to expose */
3865asn_TYPE_descriptor_t asn_DEF_enum_c_6 = {
3866 "enum-c",
3867 "enum-c",
3868 enum_c_6_free,
3869 enum_c_6_print,
3870 enum_c_6_constraint,
3871 enum_c_6_decode_ber,
3872 enum_c_6_encode_der,
3873 enum_c_6_decode_xer,
3874 enum_c_6_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003875 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003876 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003877 0, /* Use generic outmost tag fetcher */
3878 asn_DEF_enum_c_tags_6,
3879 sizeof(asn_DEF_enum_c_tags_6)
3880 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3881 asn_DEF_enum_c_tags_6, /* Same as above */
3882 sizeof(asn_DEF_enum_c_tags_6)
3883 /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */
3884 0, /* No PER visible constraints */
3885 0, 0, /* Defined elsewhere */
3886 &asn_SPC_enum_c_specs_6 /* Additional specs */
3887};
3888
3889static asn_TYPE_member_t asn_MBR_Sequence_1[] = {
3890 { ATF_POINTER, 1, offsetof(struct Sequence, int1_c),
3891 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3892 .tag_mode = 0,
3893 .type = &asn_DEF_Int1,
3894 .memb_constraints = memb_int1_c_constraint_1,
3895 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3896 .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */
3897 .name = "int1-c"
3898 },
3899 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4),
3900 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
3901 .tag_mode = +1, /* EXPLICIT tag at current level */
3902 .type = &asn_DEF_Int4,
3903 .memb_constraints = 0, /* Defer constraints checking to the member type */
3904 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3905 .default_value = 0,
3906 .name = "int4"
3907 },
3908 { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c),
3909 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3910 .tag_mode = 0,
3911 .type = &asn_DEF_Int4,
3912 .memb_constraints = memb_int4_c_constraint_1,
3913 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3914 .default_value = 0,
3915 .name = "int4-c"
3916 },
Lev Walkin2a744a72013-03-27 01:56:23 -07003917 { ATF_POINTER, 1, offsetof(struct Sequence, Bool),
Lev Walkin59b176e2005-11-26 11:25:14 +00003918 .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)),
3919 .tag_mode = 0,
3920 .type = &asn_DEF_BOOLEAN,
3921 .memb_constraints = 0, /* Defer constraints checking to the member type */
3922 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3923 .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */
3924 .name = "bool"
3925 },
3926 { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c),
3927 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
3928 .tag_mode = 0,
3929 .type = &asn_DEF_enum_c_6,
3930 .memb_constraints = 0, /* Defer constraints checking to the member type */
3931 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3932 .default_value = 0,
3933 .name = "enum-c"
3934 },
3935 { ATF_POINTER, 2, offsetof(struct Sequence, null),
3936 .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)),
3937 .tag_mode = 0,
3938 .type = &asn_DEF_NULL,
3939 .memb_constraints = 0, /* Defer constraints checking to the member type */
3940 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3941 .default_value = 0,
3942 .name = "null"
3943 },
3944 { ATF_POINTER, 1, offsetof(struct Sequence, int5_c),
3945 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
3946 .tag_mode = 0,
3947 .type = &asn_DEF_Int5,
3948 .memb_constraints = memb_int5_c_constraint_1,
3949 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
3950 .default_value = 0,
3951 .name = "int5-c"
3952 },
3953};
Lev Walkina7591b52014-10-12 18:37:35 -07003954static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00003955 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
3956};
Lev Walkina7591b52014-10-12 18:37:35 -07003957static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -07003958 { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */
3959 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c */
3960 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c */
3961 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c */
3962 { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null */
3963 { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c */
3964 { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 */
Lev Walkin59b176e2005-11-26 11:25:14 +00003965};
3966static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = {
3967 sizeof(struct Sequence),
3968 offsetof(struct Sequence, _asn_ctx),
3969 asn_MAP_Sequence_tag2el_1,
3970 7, /* Count of tags in the map */
3971 0, 0, 0, /* Optional elements (not needed) */
3972 5, /* Start extensions */
3973 8 /* Stop extensions */
3974};
3975asn_TYPE_descriptor_t asn_DEF_Sequence = {
3976 "Sequence",
3977 "Sequence",
3978 SEQUENCE_free,
3979 SEQUENCE_print,
3980 SEQUENCE_constraint,
3981 SEQUENCE_decode_ber,
3982 SEQUENCE_encode_der,
3983 SEQUENCE_decode_xer,
3984 SEQUENCE_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00003985 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07003986 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00003987 0, /* Use generic outmost tag fetcher */
3988 asn_DEF_Sequence_tags_1,
3989 sizeof(asn_DEF_Sequence_tags_1)
3990 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3991 asn_DEF_Sequence_tags_1, /* Same as above */
3992 sizeof(asn_DEF_Sequence_tags_1)
3993 /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */
3994 0, /* No PER visible constraints */
3995 asn_MBR_Sequence_1,
3996 7, /* Elements count */
3997 &asn_SPC_Sequence_specs_1 /* Additional specs */
3998};
3999
4000
4001/*** <<< INCLUDES [SequenceOf] >>> ***/
4002
4003#include <asn_SEQUENCE_OF.h>
4004#include <constr_SEQUENCE_OF.h>
4005
4006/*** <<< FWD-DECLS [SequenceOf] >>> ***/
4007
4008struct Sequence;
4009
4010/*** <<< TYPE-DECLS [SequenceOf] >>> ***/
4011
4012typedef struct SequenceOf {
4013 A_SEQUENCE_OF(struct Sequence) list;
4014
4015 /* Context for parsing across buffer boundaries */
4016 asn_struct_ctx_t _asn_ctx;
4017} SequenceOf_t;
4018
4019/*** <<< FUNC-DECLS [SequenceOf] >>> ***/
4020
4021extern asn_TYPE_descriptor_t asn_DEF_SequenceOf;
4022
4023/*** <<< POST-INCLUDE [SequenceOf] >>> ***/
4024
Lev Walkin22b5ed42006-09-13 02:51:20 +00004025#include "Sequence.h"
Lev Walkin59b176e2005-11-26 11:25:14 +00004026
4027/*** <<< STAT-DEFS [SequenceOf] >>> ***/
4028
4029static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = {
4030 { ATF_POINTER, 0, 0,
4031 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
4032 .tag_mode = 0,
4033 .type = &asn_DEF_Sequence,
4034 .memb_constraints = 0, /* Defer constraints checking to the member type */
4035 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
4036 .default_value = 0,
4037 .name = ""
4038 },
4039};
Lev Walkina7591b52014-10-12 18:37:35 -07004040static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004041 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
4042};
4043static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = {
4044 sizeof(struct SequenceOf),
4045 offsetof(struct SequenceOf, _asn_ctx),
4046 0, /* XER encoding is XMLDelimitedItemList */
4047};
4048asn_TYPE_descriptor_t asn_DEF_SequenceOf = {
4049 "SequenceOf",
4050 "SequenceOf",
4051 SEQUENCE_OF_free,
4052 SEQUENCE_OF_print,
4053 SEQUENCE_OF_constraint,
4054 SEQUENCE_OF_decode_ber,
4055 SEQUENCE_OF_encode_der,
4056 SEQUENCE_OF_decode_xer,
4057 SEQUENCE_OF_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004058 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07004059 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004060 0, /* Use generic outmost tag fetcher */
4061 asn_DEF_SequenceOf_tags_1,
4062 sizeof(asn_DEF_SequenceOf_tags_1)
4063 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
4064 asn_DEF_SequenceOf_tags_1, /* Same as above */
4065 sizeof(asn_DEF_SequenceOf_tags_1)
4066 /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */
4067 0, /* No PER visible constraints */
4068 asn_MBR_SequenceOf_1,
4069 1, /* Single element */
4070 &asn_SPC_SequenceOf_specs_1 /* Additional specs */
4071};
4072
4073
4074/*** <<< INCLUDES [Enum0] >>> ***/
4075
4076#include <ENUMERATED.h>
4077
4078/*** <<< DEPS [Enum0] >>> ***/
4079
4080typedef enum Enum0 {
4081 Enum0_one = 0,
4082 Enum0_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00004083} e_Enum0;
Lev Walkin59b176e2005-11-26 11:25:14 +00004084
4085/*** <<< TYPE-DECLS [Enum0] >>> ***/
4086
4087typedef ENUMERATED_t Enum0_t;
4088
4089/*** <<< FUNC-DECLS [Enum0] >>> ***/
4090
4091extern asn_TYPE_descriptor_t asn_DEF_Enum0;
4092asn_struct_free_f Enum0_free;
4093asn_struct_print_f Enum0_print;
4094asn_constr_check_f Enum0_constraint;
4095ber_type_decoder_f Enum0_decode_ber;
4096der_type_encoder_f Enum0_encode_der;
4097xer_type_decoder_f Enum0_decode_xer;
4098xer_type_encoder_f Enum0_encode_xer;
4099
4100/*** <<< CODE [Enum0] >>> ***/
4101
4102int
4103Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004104 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004105 /* Replace with underlying type checker */
4106 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +00004107 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkin59b176e2005-11-26 11:25:14 +00004108}
4109
4110/*
4111 * This type is implemented using ENUMERATED,
4112 * so here we adjust the DEF accordingly.
4113 */
4114static void
4115Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4116 td->free_struct = asn_DEF_ENUMERATED.free_struct;
4117 td->print_struct = asn_DEF_ENUMERATED.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004118 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00004119 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
4120 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
4121 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
4122 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
4123 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004124 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07004125 td->oer_decoder = asn_DEF_ENUMERATED.oer_decoder;
4126 td->oer_encoder = asn_DEF_ENUMERATED.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004127 if(!td->per_constraints)
4128 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
4129 td->elements = asn_DEF_ENUMERATED.elements;
4130 td->elements_count = asn_DEF_ENUMERATED.elements_count;
4131 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
4132}
4133
4134void
4135Enum0_free(asn_TYPE_descriptor_t *td,
4136 void *struct_ptr, int contents_only) {
4137 Enum0_1_inherit_TYPE_descriptor(td);
4138 td->free_struct(td, struct_ptr, contents_only);
4139}
4140
4141int
4142Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4143 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4144 Enum0_1_inherit_TYPE_descriptor(td);
4145 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4146}
4147
4148asn_dec_rval_t
4149Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4150 void **structure, const void *bufptr, size_t size, int tag_mode) {
4151 Enum0_1_inherit_TYPE_descriptor(td);
4152 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4153}
4154
4155asn_enc_rval_t
4156Enum0_encode_der(asn_TYPE_descriptor_t *td,
4157 void *structure, int tag_mode, ber_tlv_tag_t tag,
4158 asn_app_consume_bytes_f *cb, void *app_key) {
4159 Enum0_1_inherit_TYPE_descriptor(td);
4160 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4161}
4162
4163asn_dec_rval_t
4164Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4165 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4166 Enum0_1_inherit_TYPE_descriptor(td);
4167 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4168}
4169
4170asn_enc_rval_t
4171Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4172 int ilevel, enum xer_encoder_flags_e flags,
4173 asn_app_consume_bytes_f *cb, void *app_key) {
4174 Enum0_1_inherit_TYPE_descriptor(td);
4175 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4176}
4177
4178
4179/*** <<< STAT-DEFS [Enum0] >>> ***/
4180
Lev Walkina7591b52014-10-12 18:37:35 -07004181static const asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004182 { 0, 3, "one" },
4183 { 1, 3, "two" }
4184};
Lev Walkina7591b52014-10-12 18:37:35 -07004185static const unsigned int asn_MAP_Enum0_enum2value_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004186 0, /* one(0) */
4187 1 /* two(1) */
4188};
johvike70c4072017-05-09 11:06:12 +02004189static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004190 asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */
4191 asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */
4192 2, /* Number of elements in the maps */
4193 0, /* Enumeration is not extensible */
Lev Walkin8bb57a22007-12-03 13:41:36 +00004194 1, /* Strict enumeration */
4195 0, /* Native long size */
4196 0
Lev Walkin59b176e2005-11-26 11:25:14 +00004197};
Lev Walkina7591b52014-10-12 18:37:35 -07004198static const ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004199 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4200};
4201asn_TYPE_descriptor_t asn_DEF_Enum0 = {
4202 "Enum0",
4203 "Enum0",
4204 Enum0_free,
4205 Enum0_print,
4206 Enum0_constraint,
4207 Enum0_decode_ber,
4208 Enum0_encode_der,
4209 Enum0_decode_xer,
4210 Enum0_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004211 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07004212 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004213 0, /* Use generic outmost tag fetcher */
4214 asn_DEF_Enum0_tags_1,
4215 sizeof(asn_DEF_Enum0_tags_1)
4216 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4217 asn_DEF_Enum0_tags_1, /* Same as above */
4218 sizeof(asn_DEF_Enum0_tags_1)
4219 /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */
4220 0, /* No PER visible constraints */
4221 0, 0, /* Defined elsewhere */
4222 &asn_SPC_Enum0_specs_1 /* Additional specs */
4223};
4224
4225
4226/*** <<< INCLUDES [Enum1] >>> ***/
4227
4228#include <NativeEnumerated.h>
4229
4230/*** <<< DEPS [Enum1] >>> ***/
4231
4232typedef enum Enum1 {
4233 Enum1_one = 0,
4234 Enum1_two = 1
Lev Walkin171487e2006-03-21 07:25:18 +00004235} e_Enum1;
Lev Walkin59b176e2005-11-26 11:25:14 +00004236
4237/*** <<< TYPE-DECLS [Enum1] >>> ***/
4238
4239typedef long Enum1_t;
4240
4241/*** <<< FUNC-DECLS [Enum1] >>> ***/
4242
4243extern asn_TYPE_descriptor_t asn_DEF_Enum1;
4244asn_struct_free_f Enum1_free;
4245asn_struct_print_f Enum1_print;
4246asn_constr_check_f Enum1_constraint;
4247ber_type_decoder_f Enum1_decode_ber;
4248der_type_encoder_f Enum1_encode_der;
4249xer_type_decoder_f Enum1_decode_xer;
4250xer_type_encoder_f Enum1_encode_xer;
4251
4252/*** <<< CODE [Enum1] >>> ***/
4253
4254int
4255Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004256 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin59b176e2005-11-26 11:25:14 +00004257 long value;
4258
4259 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07004260 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004261 "%s: value not given (%s:%d)",
4262 td->name, __FILE__, __LINE__);
4263 return -1;
4264 }
4265
4266 value = *(const long *)sptr;
4267
4268 if((value == 0)) {
4269 /* Constraint check succeeded */
4270 return 0;
4271 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07004272 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin59b176e2005-11-26 11:25:14 +00004273 "%s: constraint failed (%s:%d)",
4274 td->name, __FILE__, __LINE__);
4275 return -1;
4276 }
4277}
4278
4279/*
4280 * This type is implemented using NativeEnumerated,
4281 * so here we adjust the DEF accordingly.
4282 */
4283static void
4284Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
4285 td->free_struct = asn_DEF_NativeEnumerated.free_struct;
4286 td->print_struct = asn_DEF_NativeEnumerated.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004287 td->check_constraints = asn_DEF_NativeEnumerated.check_constraints;
Lev Walkin59b176e2005-11-26 11:25:14 +00004288 td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder;
4289 td->der_encoder = asn_DEF_NativeEnumerated.der_encoder;
4290 td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder;
4291 td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder;
4292 td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004293 td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07004294 td->oer_decoder = asn_DEF_NativeEnumerated.oer_decoder;
4295 td->oer_encoder = asn_DEF_NativeEnumerated.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004296 if(!td->per_constraints)
4297 td->per_constraints = asn_DEF_NativeEnumerated.per_constraints;
4298 td->elements = asn_DEF_NativeEnumerated.elements;
4299 td->elements_count = asn_DEF_NativeEnumerated.elements_count;
4300 /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */
4301}
4302
4303void
4304Enum1_free(asn_TYPE_descriptor_t *td,
4305 void *struct_ptr, int contents_only) {
4306 Enum1_1_inherit_TYPE_descriptor(td);
4307 td->free_struct(td, struct_ptr, contents_only);
4308}
4309
4310int
4311Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
4312 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
4313 Enum1_1_inherit_TYPE_descriptor(td);
4314 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4315}
4316
4317asn_dec_rval_t
4318Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4319 void **structure, const void *bufptr, size_t size, int tag_mode) {
4320 Enum1_1_inherit_TYPE_descriptor(td);
4321 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
4322}
4323
4324asn_enc_rval_t
4325Enum1_encode_der(asn_TYPE_descriptor_t *td,
4326 void *structure, int tag_mode, ber_tlv_tag_t tag,
4327 asn_app_consume_bytes_f *cb, void *app_key) {
4328 Enum1_1_inherit_TYPE_descriptor(td);
4329 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4330}
4331
4332asn_dec_rval_t
4333Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
4334 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
4335 Enum1_1_inherit_TYPE_descriptor(td);
4336 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4337}
4338
4339asn_enc_rval_t
4340Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
4341 int ilevel, enum xer_encoder_flags_e flags,
4342 asn_app_consume_bytes_f *cb, void *app_key) {
4343 Enum1_1_inherit_TYPE_descriptor(td);
4344 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
4345}
4346
4347
4348/*** <<< STAT-DEFS [Enum1] >>> ***/
4349
Lev Walkina7591b52014-10-12 18:37:35 -07004350static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004351 { 0, 3, "one" },
4352 { 1, 3, "two" }
4353};
Lev Walkina7591b52014-10-12 18:37:35 -07004354static const unsigned int asn_MAP_Enum1_enum2value_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004355 0, /* one(0) */
4356 1 /* two(1) */
4357};
johvike70c4072017-05-09 11:06:12 +02004358static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004359 asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */
4360 asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */
4361 2, /* Number of elements in the maps */
4362 0, /* Enumeration is not extensible */
Lev Walkin8bb57a22007-12-03 13:41:36 +00004363 1, /* Strict enumeration */
4364 0, /* Native long size */
4365 0
Lev Walkin59b176e2005-11-26 11:25:14 +00004366};
Lev Walkina7591b52014-10-12 18:37:35 -07004367static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = {
Lev Walkin59b176e2005-11-26 11:25:14 +00004368 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
4369};
4370asn_TYPE_descriptor_t asn_DEF_Enum1 = {
4371 "Enum1",
4372 "Enum1",
4373 Enum1_free,
4374 Enum1_print,
4375 Enum1_constraint,
4376 Enum1_decode_ber,
4377 Enum1_encode_der,
4378 Enum1_decode_xer,
4379 Enum1_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004380 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07004381 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin59b176e2005-11-26 11:25:14 +00004382 0, /* Use generic outmost tag fetcher */
4383 asn_DEF_Enum1_tags_1,
4384 sizeof(asn_DEF_Enum1_tags_1)
4385 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4386 asn_DEF_Enum1_tags_1, /* Same as above */
4387 sizeof(asn_DEF_Enum1_tags_1)
4388 /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */
4389 0, /* No PER visible constraints */
4390 0, 0, /* Defined elsewhere */
4391 &asn_SPC_Enum1_specs_1 /* Additional specs */
4392};
4393
4394
Lev Walkin154aa182004-09-26 13:12:56 +00004395/*** <<< INCLUDES [Identifier] >>> ***/
4396
4397#include <VisibleString.h>
4398
4399/*** <<< TYPE-DECLS [Identifier] >>> ***/
4400
Lev Walkin154aa182004-09-26 13:12:56 +00004401typedef VisibleString_t Identifier_t;
4402
4403/*** <<< FUNC-DECLS [Identifier] >>> ***/
4404
Lev Walkindfae9752004-09-29 13:19:37 +00004405extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00004406asn_struct_free_f Identifier_free;
4407asn_struct_print_f Identifier_print;
4408asn_constr_check_f Identifier_constraint;
4409ber_type_decoder_f Identifier_decode_ber;
4410der_type_encoder_f Identifier_encode_der;
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004411xer_type_decoder_f Identifier_decode_xer;
Lev Walkin154aa182004-09-26 13:12:56 +00004412xer_type_encoder_f Identifier_encode_xer;
4413
4414/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004415
Lev Walkina7591b52014-10-12 18:37:35 -07004416static const int permitted_alphabet_table_1[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +00004417 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
4418 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
4419 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */
4420 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */
4421 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */
442227,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */
4423 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */
442454,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004425};
4426
Lev Walkine8318b82005-03-06 09:29:03 +00004427static int check_permitted_alphabet_1(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -07004428 const int *table = permitted_alphabet_table_1;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004429 /* The underlying type is VisibleString */
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004430 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004431 const uint8_t *ch = st->buf;
4432 const uint8_t *end = ch + st->size;
4433
4434 for(; ch < end; ch++) {
4435 uint8_t cv = *ch;
4436 if(!table[cv]) return -1;
4437 }
4438 return 0;
4439}
4440
4441
Lev Walkin154aa182004-09-26 13:12:56 +00004442/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004443
4444int
Lev Walkindfae9752004-09-29 13:19:37 +00004445Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +00004446 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +00004447 const VisibleString_t *st = (const VisibleString_t *)sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004448 size_t size;
4449
4450 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -07004451 ASN__CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004452 "%s: value not given (%s:%d)",
4453 td->name, __FILE__, __LINE__);
4454 return -1;
4455 }
4456
4457 size = st->size;
4458
4459 if((size >= 1 && size <= 32)
Lev Walkine8318b82005-03-06 09:29:03 +00004460 && !check_permitted_alphabet_1(st)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004461 /* Constraint check succeeded */
4462 return 0;
4463 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -07004464 ASN__CTFAIL(app_key, td, sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004465 "%s: constraint failed (%s:%d)",
4466 td->name, __FILE__, __LINE__);
4467 return -1;
4468 }
4469}
4470
4471/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004472 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00004473 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004474 */
4475static void
Lev Walkine8318b82005-03-06 09:29:03 +00004476Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
Lev Walkindfae9752004-09-29 13:19:37 +00004477 td->free_struct = asn_DEF_VisibleString.free_struct;
4478 td->print_struct = asn_DEF_VisibleString.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -08004479 td->check_constraints = asn_DEF_VisibleString.check_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00004480 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
4481 td->der_encoder = asn_DEF_VisibleString.der_encoder;
4482 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
4483 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004484 td->uper_decoder = asn_DEF_VisibleString.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004485 td->uper_encoder = asn_DEF_VisibleString.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -07004486 td->oer_decoder = asn_DEF_VisibleString.oer_decoder;
4487 td->oer_encoder = asn_DEF_VisibleString.oer_encoder;
Lev Walkin59b176e2005-11-26 11:25:14 +00004488 if(!td->per_constraints)
4489 td->per_constraints = asn_DEF_VisibleString.per_constraints;
Lev Walkindfae9752004-09-29 13:19:37 +00004490 td->elements = asn_DEF_VisibleString.elements;
4491 td->elements_count = asn_DEF_VisibleString.elements_count;
4492 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004493}
4494
Lev Walkina9cc46e2004-09-22 16:06:28 +00004495void
Lev Walkindfae9752004-09-29 13:19:37 +00004496Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004497 void *struct_ptr, int contents_only) {
Lev Walkine8318b82005-03-06 09:29:03 +00004498 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004499 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004500}
4501
4502int
Lev Walkindfae9752004-09-29 13:19:37 +00004503Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004504 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004505 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004506 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
4507}
4508
Lev Walkindc06f6b2004-10-20 15:50:55 +00004509asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004510Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004511 void **structure, const void *bufptr, size_t size, int tag_mode) {
Lev Walkine8318b82005-03-06 09:29:03 +00004512 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00004513 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004514}
4515
4516asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004517Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004518 void *structure, int tag_mode, ber_tlv_tag_t tag,
4519 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004520 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004521 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
4522}
4523
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004524asn_dec_rval_t
4525Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkin3ebc65a2005-03-17 21:57:19 +00004526 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Lev Walkine8318b82005-03-06 09:29:03 +00004527 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004528 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
4529}
4530
Lev Walkina9cc46e2004-09-22 16:06:28 +00004531asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00004532Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004533 int ilevel, enum xer_encoder_flags_e flags,
4534 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine8318b82005-03-06 09:29:03 +00004535 Identifier_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00004536 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004537}
4538
4539
4540/*** <<< STAT-DEFS [Identifier] >>> ***/
4541
Lev Walkina7591b52014-10-12 18:37:35 -07004542static const ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004543 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
4544};
Lev Walkindfae9752004-09-29 13:19:37 +00004545asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004546 "Identifier",
Lev Walkindc06f6b2004-10-20 15:50:55 +00004547 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00004548 Identifier_free,
4549 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004550 Identifier_constraint,
4551 Identifier_decode_ber,
4552 Identifier_encode_der,
Lev Walkin0ebe8b32004-10-23 13:26:56 +00004553 Identifier_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +00004554 Identifier_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +00004555 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkinba68c912017-07-06 07:52:39 -07004556 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004557 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +00004558 asn_DEF_Identifier_tags_1,
4559 sizeof(asn_DEF_Identifier_tags_1)
4560 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4561 asn_DEF_Identifier_tags_1, /* Same as above */
4562 sizeof(asn_DEF_Identifier_tags_1)
4563 /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */
4564 0, /* No PER visible constraints */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00004565 0, 0, /* No members */
4566 0 /* No specifics */
4567};
4568