2 /*** <<< INCLUDES [T] >>> ***/
5 #include <UTF8String.h>
6 #include <UniversalString.h>
7 #include <constr_SEQUENCE.h>
9 /*** <<< TYPE-DECLS [T] >>> ***/
12 struct unconstrained {
14 UTF8String_t unc_utf8;
15 UniversalString_t unc_universal;
17 /* Context for parsing across buffer boundaries */
18 asn_struct_ctx_t _asn_ctx;
22 UTF8String_t con_utf8;
23 UniversalString_t con_universal;
25 /* Context for parsing across buffer boundaries */
26 asn_struct_ctx_t _asn_ctx;
29 /* Context for parsing across buffer boundaries */
30 asn_struct_ctx_t _asn_ctx;
33 /*** <<< FUNC-DECLS [T] >>> ***/
35 extern asn_TYPE_descriptor_t asn_DEF_T;
37 /*** <<< CTABLES [T] >>> ***/
39 static int check_permitted_alphabet_7(const void *sptr) {
40 /* The underlying type is IA5String */
41 const IA5String_t *st = (const IA5String_t *)sptr;
42 const uint8_t *ch = st->buf;
43 const uint8_t *end = ch + st->size;
45 for(; ch < end; ch++) {
47 if(!(cv <= 127)) return -1;
52 static int check_permitted_alphabet_9(const void *sptr) {
53 /* The underlying type is UniversalString */
54 const UniversalString_t *st = (const UniversalString_t *)sptr;
55 const uint8_t *ch = st->buf;
56 const uint8_t *end = ch + st->size;
58 if(st->size % 4) return -1; /* (size%4)! */
59 for(; ch < end; ch += 4) {
60 uint32_t cv = (ch[0] << 24)
64 (void)cv; /* Unused variable */
70 /*** <<< CODE [T] >>> ***/
73 memb_con_ia5_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
74 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
75 const IA5String_t *st = (const IA5String_t *)sptr;
79 ASN__CTFAIL(app_key, td, sptr,
80 "%s: value not given (%s:%d)",
81 td->name, __FILE__, __LINE__);
88 && !check_permitted_alphabet_7(st)) {
89 /* Constraint check succeeded */
92 ASN__CTFAIL(app_key, td, sptr,
93 "%s: constraint failed (%s:%d)",
94 td->name, __FILE__, __LINE__);
100 memb_con_utf8_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
101 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
102 const UTF8String_t *st = (const UTF8String_t *)sptr;
106 ASN__CTFAIL(app_key, td, sptr,
107 "%s: value not given (%s:%d)",
108 td->name, __FILE__, __LINE__);
112 size = UTF8String_length(st);
113 if((ssize_t)size < 0) {
114 ASN__CTFAIL(app_key, td, sptr,
115 "%s: UTF-8: broken encoding (%s:%d)",
116 td->name, __FILE__, __LINE__);
121 /* Constraint check succeeded */
124 ASN__CTFAIL(app_key, td, sptr,
125 "%s: constraint failed (%s:%d)",
126 td->name, __FILE__, __LINE__);
132 memb_con_universal_constraint_6(const asn_TYPE_descriptor_t *td, const void *sptr,
133 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
134 const UniversalString_t *st = (const UniversalString_t *)sptr;
138 ASN__CTFAIL(app_key, td, sptr,
139 "%s: value not given (%s:%d)",
140 td->name, __FILE__, __LINE__);
144 size = st->size >> 2; /* 4 byte per character */
147 && !check_permitted_alphabet_9(st)) {
148 /* Constraint check succeeded */
151 ASN__CTFAIL(app_key, td, sptr,
152 "%s: constraint failed (%s:%d)",
153 td->name, __FILE__, __LINE__);
159 /*** <<< CTDEFS [T] >>> ***/
161 static asn_oer_constraints_t asn_OER_memb_con_ia5_constr_7 CC_NOTUSED = {
163 2 /* (SIZE(2..2)) */};
164 static asn_oer_constraints_t asn_OER_memb_con_utf8_constr_8 CC_NOTUSED = {
166 -1 /* (SIZE(0..MAX)) */};
167 static asn_oer_constraints_t asn_OER_memb_con_universal_constr_9 CC_NOTUSED = {
169 2 /* (SIZE(2..2)) */};
171 /*** <<< STAT-DEFS [T] >>> ***/
173 static asn_TYPE_member_t asn_MBR_unconstrained_2[] = {
174 { ATF_NOFLAGS, 0, offsetof(struct unconstrained, unc_ia5),
175 .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)),
177 .type = &asn_DEF_IA5String,
179 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
180 0, 0, /* No default value */
183 { ATF_NOFLAGS, 0, offsetof(struct unconstrained, unc_utf8),
184 .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
186 .type = &asn_DEF_UTF8String,
188 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
189 0, 0, /* No default value */
192 { ATF_NOFLAGS, 0, offsetof(struct unconstrained, unc_universal),
193 .tag = (ASN_TAG_CLASS_UNIVERSAL | (28 << 2)),
195 .type = &asn_DEF_UniversalString,
197 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
198 0, 0, /* No default value */
199 .name = "unc-universal"
202 static const ber_tlv_tag_t asn_DEF_unconstrained_tags_2[] = {
203 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
205 static const asn_TYPE_tag2member_t asn_MAP_unconstrained_tag2el_2[] = {
206 { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 }, /* unc-utf8 */
207 { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 }, /* unc-ia5 */
208 { (ASN_TAG_CLASS_UNIVERSAL | (28 << 2)), 2, 0, 0 } /* unc-universal */
210 static asn_SEQUENCE_specifics_t asn_SPC_unconstrained_specs_2 = {
211 sizeof(struct unconstrained),
212 offsetof(struct unconstrained, _asn_ctx),
213 .tag2el = asn_MAP_unconstrained_tag2el_2,
214 .tag2el_count = 3, /* Count of tags in the map */
215 0, 0, 0, /* Optional elements (not needed) */
216 -1, /* First extension addition */
218 static /* Use -fall-defs-global to expose */
219 asn_TYPE_descriptor_t asn_DEF_unconstrained_2 = {
223 asn_DEF_unconstrained_tags_2,
224 sizeof(asn_DEF_unconstrained_tags_2)
225 /sizeof(asn_DEF_unconstrained_tags_2[0]), /* 1 */
226 asn_DEF_unconstrained_tags_2, /* Same as above */
227 sizeof(asn_DEF_unconstrained_tags_2)
228 /sizeof(asn_DEF_unconstrained_tags_2[0]), /* 1 */
229 { 0, 0, SEQUENCE_constraint },
230 asn_MBR_unconstrained_2,
231 3, /* Elements count */
232 &asn_SPC_unconstrained_specs_2 /* Additional specs */
235 static asn_TYPE_member_t asn_MBR_constrained_6[] = {
236 { ATF_NOFLAGS, 0, offsetof(struct constrained, con_ia5),
237 .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)),
239 .type = &asn_DEF_IA5String,
241 { .oer_constraints = &asn_OER_memb_con_ia5_constr_7, .per_constraints = 0, .general_constraints = memb_con_ia5_constraint_6 },
242 0, 0, /* No default value */
245 { ATF_NOFLAGS, 0, offsetof(struct constrained, con_utf8),
246 .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
248 .type = &asn_DEF_UTF8String,
250 { .oer_constraints = &asn_OER_memb_con_utf8_constr_8, .per_constraints = 0, .general_constraints = memb_con_utf8_constraint_6 },
251 0, 0, /* No default value */
254 { ATF_NOFLAGS, 0, offsetof(struct constrained, con_universal),
255 .tag = (ASN_TAG_CLASS_UNIVERSAL | (28 << 2)),
257 .type = &asn_DEF_UniversalString,
259 { .oer_constraints = &asn_OER_memb_con_universal_constr_9, .per_constraints = 0, .general_constraints = memb_con_universal_constraint_6 },
260 0, 0, /* No default value */
261 .name = "con-universal"
264 static const ber_tlv_tag_t asn_DEF_constrained_tags_6[] = {
265 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
267 static const asn_TYPE_tag2member_t asn_MAP_constrained_tag2el_6[] = {
268 { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 }, /* con-utf8 */
269 { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 }, /* con-ia5 */
270 { (ASN_TAG_CLASS_UNIVERSAL | (28 << 2)), 2, 0, 0 } /* con-universal */
272 static asn_SEQUENCE_specifics_t asn_SPC_constrained_specs_6 = {
273 sizeof(struct constrained),
274 offsetof(struct constrained, _asn_ctx),
275 .tag2el = asn_MAP_constrained_tag2el_6,
276 .tag2el_count = 3, /* Count of tags in the map */
277 0, 0, 0, /* Optional elements (not needed) */
278 -1, /* First extension addition */
280 static /* Use -fall-defs-global to expose */
281 asn_TYPE_descriptor_t asn_DEF_constrained_6 = {
285 asn_DEF_constrained_tags_6,
286 sizeof(asn_DEF_constrained_tags_6)
287 /sizeof(asn_DEF_constrained_tags_6[0]), /* 1 */
288 asn_DEF_constrained_tags_6, /* Same as above */
289 sizeof(asn_DEF_constrained_tags_6)
290 /sizeof(asn_DEF_constrained_tags_6[0]), /* 1 */
291 { 0, 0, SEQUENCE_constraint },
292 asn_MBR_constrained_6,
293 3, /* Elements count */
294 &asn_SPC_constrained_specs_6 /* Additional specs */
297 static asn_TYPE_member_t asn_MBR_T_1[] = {
298 { ATF_NOFLAGS, 0, offsetof(struct T, unconstrained),
299 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
301 .type = &asn_DEF_unconstrained_2,
303 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
304 0, 0, /* No default value */
305 .name = "unconstrained"
307 { ATF_NOFLAGS, 0, offsetof(struct T, constrained),
308 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
310 .type = &asn_DEF_constrained_6,
312 { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 },
313 0, 0, /* No default value */
314 .name = "constrained"
317 static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
318 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
320 static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = {
321 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* unconstrained */
322 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* constrained */
324 static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = {
326 offsetof(struct T, _asn_ctx),
327 .tag2el = asn_MAP_T_tag2el_1,
328 .tag2el_count = 2, /* Count of tags in the map */
329 0, 0, 0, /* Optional elements (not needed) */
330 -1, /* First extension addition */
332 asn_TYPE_descriptor_t asn_DEF_T = {
337 sizeof(asn_DEF_T_tags_1)
338 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
339 asn_DEF_T_tags_1, /* Same as above */
340 sizeof(asn_DEF_T_tags_1)
341 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
342 { 0, 0, SEQUENCE_constraint },
344 2, /* Elements count */
345 &asn_SPC_T_specs_1 /* Additional specs */