blob: fd7c39e988020021fc33c7f6fcc54d641769bea9 [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
Lev Walkin20696a42017-10-17 21:27:33 -070027Short_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -070028 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
Lev Walkin0479e042017-09-26 18:39:58 -070058asn_per_constraints_t asn_PER_type_Short_constr_1 CC_NOTUSED = {
Lev Walkin20dc6242017-08-27 23:44:39 -070059 { 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,
Lev Walkin20dc6242017-08-27 23:44:39 -070073 asn_DEF_Short_tags_1,
74 sizeof(asn_DEF_Short_tags_1)
75 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
76 asn_DEF_Short_tags_1, /* Same as above */
77 sizeof(asn_DEF_Short_tags_1)
78 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -070079 { 0, &asn_PER_type_Short_constr_1, Short_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -070080 0, 0, /* No members */
81 0 /* No specifics */
82};
83
84
85/*** <<< INCLUDES [Alias] >>> ***/
86
87#include "Short.h"
88
89/*** <<< TYPE-DECLS [Alias] >>> ***/
90
91typedef Short_t Alias_t;
92
93/*** <<< FUNC-DECLS [Alias] >>> ***/
94
Lev Walkin135d7dd2017-08-28 00:21:38 -070095extern asn_per_constraints_t asn_PER_type_Alias_constr_1;
Lev Walkin20dc6242017-08-27 23:44:39 -070096extern asn_TYPE_descriptor_t asn_DEF_Alias;
97asn_struct_free_f Alias_free;
98asn_struct_print_f Alias_print;
99asn_constr_check_f Alias_constraint;
100ber_type_decoder_f Alias_decode_ber;
101der_type_encoder_f Alias_encode_der;
102xer_type_decoder_f Alias_decode_xer;
103xer_type_encoder_f Alias_encode_xer;
104per_type_decoder_f Alias_decode_uper;
105per_type_encoder_f Alias_encode_uper;
106
107/*** <<< CODE [Alias] >>> ***/
108
109int
Lev Walkin20696a42017-10-17 21:27:33 -0700110Alias_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -0700111 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
112 long value;
113
114 if(!sptr) {
115 ASN__CTFAIL(app_key, td, sptr,
116 "%s: value not given (%s:%d)",
117 td->name, __FILE__, __LINE__);
118 return -1;
119 }
120
121 value = *(const long *)sptr;
122
123 if((value >= 0 && value <= 65535)) {
124 /* Constraint check succeeded */
125 return 0;
126 } else {
127 ASN__CTFAIL(app_key, td, sptr,
128 "%s: constraint failed (%s:%d)",
129 td->name, __FILE__, __LINE__);
130 return -1;
131 }
132}
133
134/*
135 * This type is implemented using Short,
136 * so here we adjust the DEF accordingly.
137 */
138
Lev Walkin135d7dd2017-08-28 00:21:38 -0700139/*** <<< CTDEFS [Alias] >>> ***/
140
Lev Walkin0479e042017-09-26 18:39:58 -0700141asn_per_constraints_t asn_PER_type_Alias_constr_1 CC_NOTUSED = {
Lev Walkin135d7dd2017-08-28 00:21:38 -0700142 { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
143 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
144 0, 0 /* No PER value map */
145};
146
Lev Walkin20dc6242017-08-27 23:44:39 -0700147/*** <<< STAT-DEFS [Alias] >>> ***/
148
149static const ber_tlv_tag_t asn_DEF_Alias_tags_1[] = {
150 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
151};
152asn_TYPE_descriptor_t asn_DEF_Alias = {
153 "Alias",
154 "Alias",
155 &asn_OP_NativeInteger,
Lev Walkin20dc6242017-08-27 23:44:39 -0700156 asn_DEF_Alias_tags_1,
157 sizeof(asn_DEF_Alias_tags_1)
158 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
159 asn_DEF_Alias_tags_1, /* Same as above */
160 sizeof(asn_DEF_Alias_tags_1)
161 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700162 { 0, &asn_PER_type_Alias_constr_1, Alias_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -0700163 0, 0, /* No members */
164 0 /* No specifics */
165};
166
167
168/*** <<< INCLUDES [Soo] >>> ***/
169
170#include <NativeInteger.h>
171#include "Short.h"
172#include "Alias.h"
173#include <constr_SEQUENCE.h>
174
175/*** <<< TYPE-DECLS [Soo] >>> ***/
176
177typedef struct Soo {
178 long foo;
179 Short_t bar;
180 Alias_t baz;
181
182 /* Context for parsing across buffer boundaries */
183 asn_struct_ctx_t _asn_ctx;
184} Soo_t;
185
186/*** <<< FUNC-DECLS [Soo] >>> ***/
187
188extern asn_TYPE_descriptor_t asn_DEF_Soo;
189
190/*** <<< CODE [Soo] >>> ***/
191
192static int
Lev Walkin20696a42017-10-17 21:27:33 -0700193memb_foo_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -0700194 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
195 long value;
196
197 if(!sptr) {
198 ASN__CTFAIL(app_key, td, sptr,
199 "%s: value not given (%s:%d)",
200 td->name, __FILE__, __LINE__);
201 return -1;
202 }
203
204 value = *(const long *)sptr;
205
206 if((value >= 0 && value <= 65535)) {
207 /* Constraint check succeeded */
208 return 0;
209 } else {
210 ASN__CTFAIL(app_key, td, sptr,
211 "%s: constraint failed (%s:%d)",
212 td->name, __FILE__, __LINE__);
213 return -1;
214 }
215}
216
217
218/*** <<< CTDEFS [Soo] >>> ***/
219
Lev Walkin0479e042017-09-26 18:39:58 -0700220static asn_per_constraints_t asn_PER_memb_foo_constr_2 CC_NOTUSED = {
Lev Walkin20dc6242017-08-27 23:44:39 -0700221 { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */,
222 { APC_UNCONSTRAINED, -1, -1, 0, 0 },
223 0, 0 /* No PER value map */
224};
225
226/*** <<< STAT-DEFS [Soo] >>> ***/
227
228static asn_TYPE_member_t asn_MBR_Soo_1[] = {
229 { ATF_NOFLAGS, 0, offsetof(struct Soo, foo),
230 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
231 .tag_mode = 0,
232 .type = &asn_DEF_NativeInteger,
233 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700234 { .oer_constraints = 0, .per_constraints = &asn_PER_memb_foo_constr_2, .general_constraints = memb_foo_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700235 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700236 .name = "foo"
237 },
238 { ATF_NOFLAGS, 0, offsetof(struct Soo, bar),
239 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
240 .tag_mode = 0,
241 .type = &asn_DEF_Short,
242 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700243 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700244 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700245 .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,
Lev Walkin0bfea562017-09-29 23:16:48 -0700252 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700253 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700254 .name = "baz"
255 },
256};
257static const ber_tlv_tag_t asn_DEF_Soo_tags_1[] = {
258 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
259};
260static const asn_TYPE_tag2member_t asn_MAP_Soo_tag2el_1[] = {
261 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* foo */
262 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* bar */
263 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* baz */
264};
265static asn_SEQUENCE_specifics_t asn_SPC_Soo_specs_1 = {
266 sizeof(struct Soo),
267 offsetof(struct Soo, _asn_ctx),
268 .tag2el = asn_MAP_Soo_tag2el_1,
269 .tag2el_count = 3, /* Count of tags in the map */
270 0, 0, 0, /* Optional elements (not needed) */
Lev Walkindf2edbb2017-10-21 13:40:07 -0700271 -1, /* First extension addition */
Lev Walkin20dc6242017-08-27 23:44:39 -0700272};
273asn_TYPE_descriptor_t asn_DEF_Soo = {
274 "Soo",
275 "Soo",
276 &asn_OP_SEQUENCE,
Lev Walkin20dc6242017-08-27 23:44:39 -0700277 asn_DEF_Soo_tags_1,
278 sizeof(asn_DEF_Soo_tags_1)
279 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
280 asn_DEF_Soo_tags_1, /* Same as above */
281 sizeof(asn_DEF_Soo_tags_1)
282 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700283 { 0, 0, SEQUENCE_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -0700284 asn_MBR_Soo_1,
285 3, /* Elements count */
286 &asn_SPC_Soo_specs_1 /* Additional specs */
287};
288