blob: c0272c44dc27af5c522be82489151c14f4ec2829 [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
137/*** <<< STAT-DEFS [Alias] >>> ***/
138
139static const ber_tlv_tag_t asn_DEF_Alias_tags_1[] = {
140 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
141};
142asn_TYPE_descriptor_t asn_DEF_Alias = {
143 "Alias",
144 "Alias",
145 &asn_OP_NativeInteger,
146 Alias_constraint,
147 asn_DEF_Alias_tags_1,
148 sizeof(asn_DEF_Alias_tags_1)
149 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
150 asn_DEF_Alias_tags_1, /* Same as above */
151 sizeof(asn_DEF_Alias_tags_1)
152 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
153 0, /* No OER visible constraints */
154 0, /* No PER visible constraints */
155 0, 0, /* No members */
156 0 /* No specifics */
157};
158
159
160/*** <<< INCLUDES [Soo] >>> ***/
161
162#include <NativeInteger.h>
163#include "Short.h"
164#include "Alias.h"
165#include <constr_SEQUENCE.h>
166
167/*** <<< TYPE-DECLS [Soo] >>> ***/
168
169typedef struct Soo {
170 long foo;
171 Short_t bar;
172 Alias_t baz;
173
174 /* Context for parsing across buffer boundaries */
175 asn_struct_ctx_t _asn_ctx;
176} Soo_t;
177
178/*** <<< FUNC-DECLS [Soo] >>> ***/
179
180extern asn_TYPE_descriptor_t asn_DEF_Soo;
181
182/*** <<< CODE [Soo] >>> ***/
183
184static int
185memb_foo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
186 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
187 long value;
188
189 if(!sptr) {
190 ASN__CTFAIL(app_key, td, sptr,
191 "%s: value not given (%s:%d)",
192 td->name, __FILE__, __LINE__);
193 return -1;
194 }
195
196 value = *(const long *)sptr;
197
198 if((value >= 0 && value <= 65535)) {
199 /* Constraint check succeeded */
200 return 0;
201 } else {
202 ASN__CTFAIL(app_key, td, sptr,
203 "%s: constraint failed (%s:%d)",
204 td->name, __FILE__, __LINE__);
205 return -1;
206 }
207}
208
209
210/*** <<< CTDEFS [Soo] >>> ***/
211
212static asn_oer_constraints_t asn_OER_memb_foo_constr_2 GCC_NOTUSED = {
213 { 2, 1 } /* (0..65535) */,
214 -1};
215
216/*** <<< STAT-DEFS [Soo] >>> ***/
217
218static asn_TYPE_member_t asn_MBR_Soo_1[] = {
219 { ATF_NOFLAGS, 0, offsetof(struct Soo, foo),
220 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
221 .tag_mode = 0,
222 .type = &asn_DEF_NativeInteger,
223 .type_selector = 0,
224 .memb_constraints = memb_foo_constraint_1,
225 .oer_constraints = &asn_OER_memb_foo_constr_2,
226 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
227 .default_value = 0,
228 .name = "foo"
229 },
230 { ATF_NOFLAGS, 0, offsetof(struct Soo, bar),
231 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
232 .tag_mode = 0,
233 .type = &asn_DEF_Short,
234 .type_selector = 0,
235 .memb_constraints = 0, /* Defer constraints checking to the member type */
236 .oer_constraints = 0, /* No OER visible constraints */
237 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
238 .default_value = 0,
239 .name = "bar"
240 },
241 { ATF_NOFLAGS, 0, offsetof(struct Soo, baz),
242 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
243 .tag_mode = 0,
244 .type = &asn_DEF_Alias,
245 .type_selector = 0,
246 .memb_constraints = 0, /* Defer constraints checking to the member type */
247 .oer_constraints = 0, /* No OER visible constraints */
248 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
249 .default_value = 0,
250 .name = "baz"
251 },
252};
253static const ber_tlv_tag_t asn_DEF_Soo_tags_1[] = {
254 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
255};
256static const asn_TYPE_tag2member_t asn_MAP_Soo_tag2el_1[] = {
257 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* foo */
258 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* bar */
259 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* baz */
260};
261static asn_SEQUENCE_specifics_t asn_SPC_Soo_specs_1 = {
262 sizeof(struct Soo),
263 offsetof(struct Soo, _asn_ctx),
264 .tag2el = asn_MAP_Soo_tag2el_1,
265 .tag2el_count = 3, /* Count of tags in the map */
266 0, 0, 0, /* Optional elements (not needed) */
267 -1, /* Start extensions */
268 -1 /* Stop extensions */
269};
270asn_TYPE_descriptor_t asn_DEF_Soo = {
271 "Soo",
272 "Soo",
273 &asn_OP_SEQUENCE,
274 SEQUENCE_constraint,
275 asn_DEF_Soo_tags_1,
276 sizeof(asn_DEF_Soo_tags_1)
277 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
278 asn_DEF_Soo_tags_1, /* Same as above */
279 sizeof(asn_DEF_Soo_tags_1)
280 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
281 0, /* No OER visible constraints */
282 0, /* No PER visible constraints */
283 asn_MBR_Soo_1,
284 3, /* Elements count */
285 &asn_SPC_Soo_specs_1 /* Additional specs */
286};
287