blob: f9d3c8080ab13a9df5137ff3f7cba7bfc0aadf35 [file] [log] [blame]
Lev Walkin8bb57a22007-12-03 13:41:36 +00001
2/*** <<< INCLUDES [T] >>> ***/
3
4#include <NativeInteger.h>
5#include <constr_SEQUENCE.h>
6
7/*** <<< TYPE-DECLS [T] >>> ***/
8
9typedef struct T {
10 long small32range;
11 long full32range;
12 unsigned long unsigned32;
13 unsigned long unsplit32;
14
15 /* Context for parsing across buffer boundaries */
16 asn_struct_ctx_t _asn_ctx;
17} T_t;
18
19/*** <<< FUNC-DECLS [T] >>> ***/
20
21/* extern asn_TYPE_descriptor_t asn_DEF_unsigned32_4; // (Use -fall-defs-global to expose) */
22/* extern asn_TYPE_descriptor_t asn_DEF_unsplit32_5; // (Use -fall-defs-global to expose) */
23extern asn_TYPE_descriptor_t asn_DEF_T;
24
25/*** <<< CODE [T] >>> ***/
26
27static int
28unsigned32_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
29 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8bb57a22007-12-03 13:41:36 +000030
31 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070032 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +000033 "%s: value not given (%s:%d)",
34 td->name, __FILE__, __LINE__);
35 return -1;
36 }
37
Lev Walkin8bb57a22007-12-03 13:41:36 +000038
39 /* Constraint check succeeded */
40 return 0;
41}
42
43/*
44 * This type is implemented using NativeInteger,
45 * so here we adjust the DEF accordingly.
46 */
Lev Walkin8bb57a22007-12-03 13:41:36 +000047static int
48unsplit32_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
49 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
50 unsigned long value;
51
52 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070053 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +000054 "%s: value not given (%s:%d)",
55 td->name, __FILE__, __LINE__);
56 return -1;
57 }
58
59 value = *(const unsigned long *)sptr;
60
61 if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) {
62 /* Constraint check succeeded */
63 return 0;
64 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -070065 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +000066 "%s: constraint failed (%s:%d)",
67 td->name, __FILE__, __LINE__);
68 return -1;
69 }
70}
71
72/*
73 * This type is implemented using NativeInteger,
74 * so here we adjust the DEF accordingly.
75 */
Lev Walkin8bb57a22007-12-03 13:41:36 +000076static int
77memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
78 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
79 long value;
80
81 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070082 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +000083 "%s: value not given (%s:%d)",
84 td->name, __FILE__, __LINE__);
85 return -1;
86 }
87
88 value = *(const long *)sptr;
89
90 if((value >= -2000000000 && value <= 2000000000)) {
91 /* Constraint check succeeded */
92 return 0;
93 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -070094 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +000095 "%s: constraint failed (%s:%d)",
96 td->name, __FILE__, __LINE__);
97 return -1;
98 }
99}
100
101static int
102memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
103 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
104 long value;
105
106 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700107 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000108 "%s: value not given (%s:%d)",
109 td->name, __FILE__, __LINE__);
110 return -1;
111 }
112
113 value = *(const long *)sptr;
114
115 if((value >= (-2147483647L - 1) && value <= 2147483647)) {
116 /* Constraint check succeeded */
117 return 0;
118 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700119 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000120 "%s: constraint failed (%s:%d)",
121 td->name, __FILE__, __LINE__);
122 return -1;
123 }
124}
125
126static int
127memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
128 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000129
130 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700131 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000132 "%s: value not given (%s:%d)",
133 td->name, __FILE__, __LINE__);
134 return -1;
135 }
136
Lev Walkin8bb57a22007-12-03 13:41:36 +0000137
138 /* Constraint check succeeded */
139 return 0;
140}
141
142static int
143memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
144 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
145 unsigned long value;
146
147 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700148 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000149 "%s: value not given (%s:%d)",
150 td->name, __FILE__, __LINE__);
151 return -1;
152 }
153
154 value = *(const unsigned long *)sptr;
155
156 if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) {
157 /* Constraint check succeeded */
158 return 0;
159 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700160 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000161 "%s: constraint failed (%s:%d)",
162 td->name, __FILE__, __LINE__);
163 return -1;
164 }
165}
166
167
168/*** <<< CTDEFS [T] >>> ***/
169
Lev Walkin2fce55d2013-03-28 05:00:39 -0700170static asn_per_constraints_t asn_PER_type_unsigned32_constr_4 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000171 { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */,
172 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
173 0, 0 /* No PER value map */
174};
Lev Walkin2fce55d2013-03-28 05:00:39 -0700175static asn_per_constraints_t asn_PER_type_unsplit32_constr_5 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000176 { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */,
177 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
178 0, 0 /* No PER value map */
179};
Lev Walkin2fce55d2013-03-28 05:00:39 -0700180static asn_per_constraints_t asn_PER_memb_small32range_constr_2 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000181 { APC_CONSTRAINED, 32, -1, -2000000000, 2000000000 } /* (-2000000000..2000000000) */,
182 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
183 0, 0 /* No PER value map */
184};
Lev Walkin2fce55d2013-03-28 05:00:39 -0700185static asn_per_constraints_t asn_PER_memb_full32range_constr_3 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000186 { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */,
187 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
188 0, 0 /* No PER value map */
189};
Lev Walkin2fce55d2013-03-28 05:00:39 -0700190static asn_per_constraints_t asn_PER_memb_unsigned32_constr_4 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000191 { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */,
192 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
193 0, 0 /* No PER value map */
194};
Lev Walkin2fce55d2013-03-28 05:00:39 -0700195static asn_per_constraints_t asn_PER_memb_unsplit32_constr_5 GCC_NOTUSED = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000196 { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */,
197 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
198 0, 0 /* No PER value map */
199};
200
201/*** <<< STAT-DEFS [T] >>> ***/
202
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800203static const asn_INTEGER_specifics_t asn_SPC_unsigned32_specs_4 = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000204 0, 0, 0, 0, 0,
205 0, /* Native long size */
206 1 /* Unsigned representation */
207};
Lev Walkina7591b52014-10-12 18:37:35 -0700208static const ber_tlv_tag_t asn_DEF_unsigned32_tags_4[] = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000209 (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
210 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
211};
212static /* Use -fall-defs-global to expose */
213asn_TYPE_descriptor_t asn_DEF_unsigned32_4 = {
214 "unsigned32",
215 "unsigned32",
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800216 NativeInteger_free,
217 NativeInteger_print,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000218 unsigned32_4_constraint,
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800219 NativeInteger_decode_ber,
220 NativeInteger_encode_der,
221 NativeInteger_decode_xer,
222 NativeInteger_encode_xer,
Lev Walkinb33425f2017-07-14 14:59:52 +0400223 0, 0, /* No OER support, use "-gen-OER" to enable */
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800224 NativeInteger_decode_uper,
225 NativeInteger_encode_uper,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000226 0, /* Use generic outmost tag fetcher */
227 asn_DEF_unsigned32_tags_4,
228 sizeof(asn_DEF_unsigned32_tags_4)
229 /sizeof(asn_DEF_unsigned32_tags_4[0]) - 1, /* 1 */
230 asn_DEF_unsigned32_tags_4, /* Same as above */
231 sizeof(asn_DEF_unsigned32_tags_4)
232 /sizeof(asn_DEF_unsigned32_tags_4[0]), /* 2 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400233 0, /* No OER visible constraints */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000234 &asn_PER_type_unsigned32_constr_4,
235 0, 0, /* No members */
236 &asn_SPC_unsigned32_specs_4 /* Additional specs */
237};
238
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800239static const asn_INTEGER_specifics_t asn_SPC_unsplit32_specs_5 = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000240 0, 0, 0, 0, 0,
241 0, /* Native long size */
242 1 /* Unsigned representation */
243};
Lev Walkina7591b52014-10-12 18:37:35 -0700244static const ber_tlv_tag_t asn_DEF_unsplit32_tags_5[] = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000245 (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
246 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
247};
248static /* Use -fall-defs-global to expose */
249asn_TYPE_descriptor_t asn_DEF_unsplit32_5 = {
250 "unsplit32",
251 "unsplit32",
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800252 NativeInteger_free,
253 NativeInteger_print,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000254 unsplit32_5_constraint,
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800255 NativeInteger_decode_ber,
256 NativeInteger_encode_der,
257 NativeInteger_decode_xer,
258 NativeInteger_encode_xer,
Lev Walkinb33425f2017-07-14 14:59:52 +0400259 0, 0, /* No OER support, use "-gen-OER" to enable */
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +0800260 NativeInteger_decode_uper,
261 NativeInteger_encode_uper,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000262 0, /* Use generic outmost tag fetcher */
263 asn_DEF_unsplit32_tags_5,
264 sizeof(asn_DEF_unsplit32_tags_5)
265 /sizeof(asn_DEF_unsplit32_tags_5[0]) - 1, /* 1 */
266 asn_DEF_unsplit32_tags_5, /* Same as above */
267 sizeof(asn_DEF_unsplit32_tags_5)
268 /sizeof(asn_DEF_unsplit32_tags_5[0]), /* 2 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400269 0, /* No OER visible constraints */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000270 &asn_PER_type_unsplit32_constr_5,
271 0, 0, /* No members */
272 &asn_SPC_unsplit32_specs_5 /* Additional specs */
273};
274
275static asn_TYPE_member_t asn_MBR_T_1[] = {
276 { ATF_NOFLAGS, 0, offsetof(struct T, small32range),
277 .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
278 .tag_mode = -1, /* IMPLICIT tag at current level */
279 .type = &asn_DEF_NativeInteger,
280 .memb_constraints = memb_small32range_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400281 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000282 .per_constraints = &asn_PER_memb_small32range_constr_2,
283 .default_value = 0,
284 .name = "small32range"
285 },
286 { ATF_NOFLAGS, 0, offsetof(struct T, full32range),
287 .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
288 .tag_mode = -1, /* IMPLICIT tag at current level */
289 .type = &asn_DEF_NativeInteger,
290 .memb_constraints = memb_full32range_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400291 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000292 .per_constraints = &asn_PER_memb_full32range_constr_3,
293 .default_value = 0,
294 .name = "full32range"
295 },
296 { ATF_NOFLAGS, 0, offsetof(struct T, unsigned32),
297 .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
298 .tag_mode = -1, /* IMPLICIT tag at current level */
299 .type = &asn_DEF_unsigned32_4,
300 .memb_constraints = memb_unsigned32_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400301 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000302 .per_constraints = &asn_PER_memb_unsigned32_constr_4,
303 .default_value = 0,
304 .name = "unsigned32"
305 },
306 { ATF_NOFLAGS, 0, offsetof(struct T, unsplit32),
307 .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
308 .tag_mode = -1, /* IMPLICIT tag at current level */
309 .type = &asn_DEF_unsplit32_5,
310 .memb_constraints = memb_unsplit32_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400311 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000312 .per_constraints = &asn_PER_memb_unsplit32_constr_5,
313 .default_value = 0,
314 .name = "unsplit32"
315 },
316};
Lev Walkina7591b52014-10-12 18:37:35 -0700317static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000318 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
319};
Lev Walkina7591b52014-10-12 18:37:35 -0700320static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700321 { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* small32range */
322 { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* full32range */
323 { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* unsigned32 */
324 { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* unsplit32 */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000325};
326static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = {
327 sizeof(struct T),
328 offsetof(struct T, _asn_ctx),
329 asn_MAP_T_tag2el_1,
330 4, /* Count of tags in the map */
331 0, 0, 0, /* Optional elements (not needed) */
332 -1, /* Start extensions */
333 -1 /* Stop extensions */
334};
335asn_TYPE_descriptor_t asn_DEF_T = {
336 "T",
337 "T",
338 SEQUENCE_free,
339 SEQUENCE_print,
340 SEQUENCE_constraint,
341 SEQUENCE_decode_ber,
342 SEQUENCE_encode_der,
343 SEQUENCE_decode_xer,
344 SEQUENCE_encode_xer,
Lev Walkinb33425f2017-07-14 14:59:52 +0400345 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000346 SEQUENCE_decode_uper,
347 SEQUENCE_encode_uper,
Lev Walkin8bb57a22007-12-03 13:41:36 +0000348 0, /* Use generic outmost tag fetcher */
349 asn_DEF_T_tags_1,
350 sizeof(asn_DEF_T_tags_1)
351 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
352 asn_DEF_T_tags_1, /* Same as above */
353 sizeof(asn_DEF_T_tags_1)
354 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400355 0, /* No OER visible constraints */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000356 0, /* No PER visible constraints */
357 asn_MBR_T_1,
358 4, /* Elements count */
359 &asn_SPC_T_specs_1 /* Additional specs */
360};
361