blob: b8e9b11857b43197eb1f15eaccc64ebd6405cd5b [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
Lev Walkin20696a42017-10-17 21:27:33 -070026Short_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -070027 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
Lev Walkin0479e042017-09-26 18:39:58 -070057static asn_oer_constraints_t asn_OER_type_Short_constr_1 CC_NOTUSED = {
Lev Walkin20dc6242017-08-27 23:44:39 -070058 { 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,
Lev Walkin20dc6242017-08-27 23:44:39 -070070 asn_DEF_Short_tags_1,
71 sizeof(asn_DEF_Short_tags_1)
72 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
73 asn_DEF_Short_tags_1, /* Same as above */
74 sizeof(asn_DEF_Short_tags_1)
75 /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -070076 { &asn_OER_type_Short_constr_1, 0, Short_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -070077 0, 0, /* No members */
78 0 /* No specifics */
79};
80
81
82/*** <<< INCLUDES [Alias] >>> ***/
83
84#include "Short.h"
85
86/*** <<< TYPE-DECLS [Alias] >>> ***/
87
88typedef Short_t Alias_t;
89
90/*** <<< FUNC-DECLS [Alias] >>> ***/
91
92extern asn_TYPE_descriptor_t asn_DEF_Alias;
93asn_struct_free_f Alias_free;
94asn_struct_print_f Alias_print;
95asn_constr_check_f Alias_constraint;
96ber_type_decoder_f Alias_decode_ber;
97der_type_encoder_f Alias_encode_der;
98xer_type_decoder_f Alias_decode_xer;
99xer_type_encoder_f Alias_encode_xer;
100oer_type_decoder_f Alias_decode_oer;
101oer_type_encoder_f Alias_encode_oer;
102
103/*** <<< CODE [Alias] >>> ***/
104
105int
Lev Walkin20696a42017-10-17 21:27:33 -0700106Alias_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -0700107 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
108 long value;
109
110 if(!sptr) {
111 ASN__CTFAIL(app_key, td, sptr,
112 "%s: value not given (%s:%d)",
113 td->name, __FILE__, __LINE__);
114 return -1;
115 }
116
117 value = *(const long *)sptr;
118
119 if((value >= 0 && value <= 65535)) {
120 /* Constraint check succeeded */
121 return 0;
122 } else {
123 ASN__CTFAIL(app_key, td, sptr,
124 "%s: constraint failed (%s:%d)",
125 td->name, __FILE__, __LINE__);
126 return -1;
127 }
128}
129
130/*
131 * This type is implemented using Short,
132 * so here we adjust the DEF accordingly.
133 */
134
Lev Walkin135d7dd2017-08-28 00:21:38 -0700135/*** <<< CTDEFS [Alias] >>> ***/
136
Lev Walkin0479e042017-09-26 18:39:58 -0700137static asn_oer_constraints_t asn_OER_type_Alias_constr_1 CC_NOTUSED = {
Lev Walkin135d7dd2017-08-28 00:21:38 -0700138 { 2, 1 } /* (0..65535) */,
139 -1};
140
Lev Walkin20dc6242017-08-27 23:44:39 -0700141/*** <<< STAT-DEFS [Alias] >>> ***/
142
143static const ber_tlv_tag_t asn_DEF_Alias_tags_1[] = {
144 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
145};
146asn_TYPE_descriptor_t asn_DEF_Alias = {
147 "Alias",
148 "Alias",
149 &asn_OP_NativeInteger,
Lev Walkin20dc6242017-08-27 23:44:39 -0700150 asn_DEF_Alias_tags_1,
151 sizeof(asn_DEF_Alias_tags_1)
152 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
153 asn_DEF_Alias_tags_1, /* Same as above */
154 sizeof(asn_DEF_Alias_tags_1)
155 /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700156 { &asn_OER_type_Alias_constr_1, 0, Alias_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -0700157 0, 0, /* No members */
158 0 /* No specifics */
159};
160
161
162/*** <<< INCLUDES [Soo] >>> ***/
163
164#include <NativeInteger.h>
165#include "Short.h"
166#include "Alias.h"
167#include <constr_SEQUENCE.h>
168
169/*** <<< TYPE-DECLS [Soo] >>> ***/
170
171typedef struct Soo {
172 long foo;
173 Short_t bar;
174 Alias_t baz;
175
176 /* Context for parsing across buffer boundaries */
177 asn_struct_ctx_t _asn_ctx;
178} Soo_t;
179
180/*** <<< FUNC-DECLS [Soo] >>> ***/
181
182extern asn_TYPE_descriptor_t asn_DEF_Soo;
183
184/*** <<< CODE [Soo] >>> ***/
185
186static int
Lev Walkin20696a42017-10-17 21:27:33 -0700187memb_foo_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin20dc6242017-08-27 23:44:39 -0700188 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
189 long value;
190
191 if(!sptr) {
192 ASN__CTFAIL(app_key, td, sptr,
193 "%s: value not given (%s:%d)",
194 td->name, __FILE__, __LINE__);
195 return -1;
196 }
197
198 value = *(const long *)sptr;
199
200 if((value >= 0 && value <= 65535)) {
201 /* Constraint check succeeded */
202 return 0;
203 } else {
204 ASN__CTFAIL(app_key, td, sptr,
205 "%s: constraint failed (%s:%d)",
206 td->name, __FILE__, __LINE__);
207 return -1;
208 }
209}
210
211
212/*** <<< CTDEFS [Soo] >>> ***/
213
Lev Walkin0479e042017-09-26 18:39:58 -0700214static asn_oer_constraints_t asn_OER_memb_foo_constr_2 CC_NOTUSED = {
Lev Walkin20dc6242017-08-27 23:44:39 -0700215 { 2, 1 } /* (0..65535) */,
216 -1};
217
218/*** <<< STAT-DEFS [Soo] >>> ***/
219
220static asn_TYPE_member_t asn_MBR_Soo_1[] = {
221 { ATF_NOFLAGS, 0, offsetof(struct Soo, foo),
222 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
223 .tag_mode = 0,
224 .type = &asn_DEF_NativeInteger,
225 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700226 { .oer_constraints = &asn_OER_memb_foo_constr_2, .per_constraints = 0, .general_constraints = memb_foo_constraint_1 },
Lev Walkin20696a42017-10-17 21:27:33 -0700227 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700228 .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,
Lev Walkin0bfea562017-09-29 23:16:48 -0700235 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700236 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700237 .name = "bar"
238 },
239 { ATF_NOFLAGS, 0, offsetof(struct Soo, baz),
240 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
241 .tag_mode = 0,
242 .type = &asn_DEF_Alias,
243 .type_selector = 0,
Lev Walkin0bfea562017-09-29 23:16:48 -0700244 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
Lev Walkin20696a42017-10-17 21:27:33 -0700245 0, 0, /* No default value */
Lev Walkin20dc6242017-08-27 23:44:39 -0700246 .name = "baz"
247 },
248};
249static const ber_tlv_tag_t asn_DEF_Soo_tags_1[] = {
250 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
251};
252static const asn_TYPE_tag2member_t asn_MAP_Soo_tag2el_1[] = {
253 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* foo */
254 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* bar */
255 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* baz */
256};
257static asn_SEQUENCE_specifics_t asn_SPC_Soo_specs_1 = {
258 sizeof(struct Soo),
259 offsetof(struct Soo, _asn_ctx),
260 .tag2el = asn_MAP_Soo_tag2el_1,
261 .tag2el_count = 3, /* Count of tags in the map */
262 0, 0, 0, /* Optional elements (not needed) */
263 -1, /* Start extensions */
264 -1 /* Stop extensions */
265};
266asn_TYPE_descriptor_t asn_DEF_Soo = {
267 "Soo",
268 "Soo",
269 &asn_OP_SEQUENCE,
Lev Walkin20dc6242017-08-27 23:44:39 -0700270 asn_DEF_Soo_tags_1,
271 sizeof(asn_DEF_Soo_tags_1)
272 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
273 asn_DEF_Soo_tags_1, /* Same as above */
274 sizeof(asn_DEF_Soo_tags_1)
275 /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */
Lev Walkin0bfea562017-09-29 23:16:48 -0700276 { 0, 0, SEQUENCE_constraint },
Lev Walkin20dc6242017-08-27 23:44:39 -0700277 asn_MBR_Soo_1,
278 3, /* Elements count */
279 &asn_SPC_Soo_specs_1 /* Additional specs */
280};
281