blob: 88cc9cde338bf041116465ed095ef496bdd0dd29 [file] [log] [blame]
Lev Walkin20dc6242017-08-27 23:44:39 -07001
2/*** <<< INCLUDES [Short] >>> ***/
3
4#include <NativeInteger.h>
5
6/*** <<< TYPE-DECLS [Short] >>> ***/
7
8typedef long Short_t;
9
10/*** <<< FUNC-DECLS [Short] >>> ***/
11
12extern asn_per_constraints_t asn_PER_type_Short_constr_1;
13extern asn_TYPE_descriptor_t asn_DEF_Short;
14asn_struct_free_f Short_free;
15asn_struct_print_f Short_print;
16asn_constr_check_f Short_constraint;
17ber_type_decoder_f Short_decode_ber;
18der_type_encoder_f Short_encode_der;
19xer_type_decoder_f Short_decode_xer;
20xer_type_encoder_f Short_encode_xer;
21per_type_decoder_f Short_decode_uper;
22per_type_encoder_f Short_encode_uper;
23
24/*** <<< CODE [Short] >>> ***/
25
26int
27Short_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
28 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
29 long value;
30
31 if(!sptr) {
32 ASN__CTFAIL(app_key, td, sptr,
33 "%s: value not given (%s:%d)",
34 td->name, __FILE__, __LINE__);
35 return -1;
36 }
37
38 value = *(const long *)sptr;
39
40 if((value >= 0 && value <= 65535)) {
41 /* Constraint check succeeded */
42 return 0;
43 } else {
44 ASN__CTFAIL(app_key, td, sptr,
45 "%s: constraint failed (%s:%d)",
46 td->name, __FILE__, __LINE__);
47 return -1;
48 }
49}
50
51/*
52 * This type is implemented using NativeInteger,
53 * so here we adjust the DEF accordingly.
54 */
55
56/*** <<< CTDEFS [Short] >>> ***/
57
58asn_per_constraints_t asn_PER_type_Short_constr_1 GCC_NOTUSED = {
59 { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
60 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
61 0, 0 /* No PER value map */
62};
63
64/*** <<< STAT-DEFS [Short] >>> ***/
65
66static const ber_tlv_tag_t asn_DEF_Short_tags_1[] = {
67 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
68};
69asn_TYPE_descriptor_t asn_DEF_Short = {
70 "Short",
71 "Short",
72 &asn_OP_NativeInteger,
73 Short_constraint,
74 asn_DEF_Short_tags_1,
75 sizeof(asn_DEF_Short_tags_1)
76 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
77 asn_DEF_Short_tags_1, /* Same as above */
78 sizeof(asn_DEF_Short_tags_1)
79 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
80 0, /* No OER visible constraints */
81 &asn_PER_type_Short_constr_1,
82 0, 0, /* No members */
83 0 /* No specifics */
84};
85
86
87/*** <<< INCLUDES [Alias] >>> ***/
88
89#include "Short.h"
90
91/*** <<< TYPE-DECLS [Alias] >>> ***/
92
93typedef Short_t Alias_t;
94
95/*** <<< FUNC-DECLS [Alias] >>> ***/
96
Lev Walkin135d7dd2017-08-28 00:21:38 -070097extern asn_per_constraints_t asn_PER_type_Alias_constr_1;
Lev Walkin20dc6242017-08-27 23:44:39 -070098extern asn_TYPE_descriptor_t asn_DEF_Alias;
99asn_struct_free_f Alias_free;
100asn_struct_print_f Alias_print;
101asn_constr_check_f Alias_constraint;
102ber_type_decoder_f Alias_decode_ber;
103der_type_encoder_f Alias_encode_der;
104xer_type_decoder_f Alias_decode_xer;
105xer_type_encoder_f Alias_encode_xer;
106per_type_decoder_f Alias_decode_uper;
107per_type_encoder_f Alias_encode_uper;
108
109/*** <<< CODE [Alias] >>> ***/
110
111int
112Alias_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
113 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
114 long value;
115
116 if(!sptr) {
117 ASN__CTFAIL(app_key, td, sptr,
118 "%s: value not given (%s:%d)",
119 td->name, __FILE__, __LINE__);
120 return -1;
121 }
122
123 value = *(const long *)sptr;
124
125 if((value >= 0 && value <= 65535)) {
126 /* Constraint check succeeded */
127 return 0;
128 } else {
129 ASN__CTFAIL(app_key, td, sptr,
130 "%s: constraint failed (%s:%d)",
131 td->name, __FILE__, __LINE__);
132 return -1;
133 }
134}
135
136/*
137 * This type is implemented using Short,
138 * so here we adjust the DEF accordingly.
139 */
140
Lev Walkin135d7dd2017-08-28 00:21:38 -0700141/*** <<< CTDEFS [Alias] >>> ***/
142
143asn_per_constraints_t asn_PER_type_Alias_constr_1 GCC_NOTUSED = {
144 { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
145 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
146 0, 0 /* No PER value map */
147};
148
Lev Walkin20dc6242017-08-27 23:44:39 -0700149/*** <<< STAT-DEFS [Alias] >>> ***/
150
151static const ber_tlv_tag_t asn_DEF_Alias_tags_1[] = {
152 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
153};
154asn_TYPE_descriptor_t asn_DEF_Alias = {
155 "Alias",
156 "Alias",
157 &asn_OP_NativeInteger,
158 Alias_constraint,
159 asn_DEF_Alias_tags_1,
160 sizeof(asn_DEF_Alias_tags_1)
161 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
162 asn_DEF_Alias_tags_1, /* Same as above */
163 sizeof(asn_DEF_Alias_tags_1)
164 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
165 0, /* No OER visible constraints */
Lev Walkin135d7dd2017-08-28 00:21:38 -0700166 &asn_PER_type_Alias_constr_1,
Lev Walkin20dc6242017-08-27 23:44:39 -0700167 0, 0, /* No members */
168 0 /* No specifics */
169};
170
171
172/*** <<< INCLUDES [Soo] >>> ***/
173
174#include <NativeInteger.h>
175#include "Short.h"
176#include "Alias.h"
177#include <constr_SEQUENCE.h>
178
179/*** <<< TYPE-DECLS [Soo] >>> ***/
180
181typedef struct Soo {
182 long foo;
183 Short_t bar;
184 Alias_t baz;
185
186 /* Context for parsing across buffer boundaries */
187 asn_struct_ctx_t _asn_ctx;
188} Soo_t;
189
190/*** <<< FUNC-DECLS [Soo] >>> ***/
191
192extern asn_TYPE_descriptor_t asn_DEF_Soo;
193
194/*** <<< CODE [Soo] >>> ***/
195
196static int
197memb_foo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
198 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
199 long value;
200
201 if(!sptr) {
202 ASN__CTFAIL(app_key, td, sptr,
203 "%s: value not given (%s:%d)",
204 td->name, __FILE__, __LINE__);
205 return -1;
206 }
207
208 value = *(const long *)sptr;
209
210 if((value >= 0 && value <= 65535)) {
211 /* Constraint check succeeded */
212 return 0;
213 } else {
214 ASN__CTFAIL(app_key, td, sptr,
215 "%s: constraint failed (%s:%d)",
216 td->name, __FILE__, __LINE__);
217 return -1;
218 }
219}
220
221
222/*** <<< CTDEFS [Soo] >>> ***/
223
224static asn_per_constraints_t asn_PER_memb_foo_constr_2 GCC_NOTUSED = {
225 { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
226 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
227 0, 0 /* No PER value map */
228};
229
230/*** <<< STAT-DEFS [Soo] >>> ***/
231
232static asn_TYPE_member_t asn_MBR_Soo_1[] = {
233 { ATF_NOFLAGS, 0, offsetof(struct Soo, foo),
234 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
235 .tag_mode = 0,
236 .type = &asn_DEF_NativeInteger,
237 .type_selector = 0,
238 .memb_constraints = memb_foo_constraint_1,
239 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
240 .per_constraints = &asn_PER_memb_foo_constr_2,
241 .default_value = 0,
242 .name = "foo"
243 },
244 { ATF_NOFLAGS, 0, offsetof(struct Soo, bar),
245 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
246 .tag_mode = 0,
247 .type = &asn_DEF_Short,
248 .type_selector = 0,
249 .memb_constraints = 0, /* Defer constraints checking to the member type */
250 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
251 .per_constraints = 0, /* No PER visible constraints */
252 .default_value = 0,
253 .name = "bar"
254 },
255 { ATF_NOFLAGS, 0, offsetof(struct Soo, baz),
256 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
257 .tag_mode = 0,
258 .type = &asn_DEF_Alias,
259 .type_selector = 0,
260 .memb_constraints = 0, /* Defer constraints checking to the member type */
261 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
262 .per_constraints = 0, /* No PER visible constraints */
263 .default_value = 0,
264 .name = "baz"
265 },
266};
267static const ber_tlv_tag_t asn_DEF_Soo_tags_1[] = {
268 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
269};
270static const asn_TYPE_tag2member_t asn_MAP_Soo_tag2el_1[] = {
271 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* foo */
272 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* bar */
273 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* baz */
274};
275static asn_SEQUENCE_specifics_t asn_SPC_Soo_specs_1 = {
276 sizeof(struct Soo),
277 offsetof(struct Soo, _asn_ctx),
278 .tag2el = asn_MAP_Soo_tag2el_1,
279 .tag2el_count = 3, /* Count of tags in the map */
280 0, 0, 0, /* Optional elements (not needed) */
281 -1, /* Start extensions */
282 -1 /* Stop extensions */
283};
284asn_TYPE_descriptor_t asn_DEF_Soo = {
285 "Soo",
286 "Soo",
287 &asn_OP_SEQUENCE,
288 SEQUENCE_constraint,
289 asn_DEF_Soo_tags_1,
290 sizeof(asn_DEF_Soo_tags_1)
291 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
292 asn_DEF_Soo_tags_1, /* Same as above */
293 sizeof(asn_DEF_Soo_tags_1)
294 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
295 0, /* No OER visible constraints */
296 0, /* No PER visible constraints */
297 asn_MBR_Soo_1,
298 3, /* Elements count */
299 &asn_SPC_Soo_specs_1 /* Additional specs */
300};
301