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