aboutsummaryrefslogtreecommitdiffstats
path: root/tests/44-choice-in-sequence-OK.asn1.-P
blob: 3c6c152313e1fb9565f9089d4932fd278695d3ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
/*** <<< INCLUDES [T] >>> ***/

#include <NULL.h>
#include <constr_CHOICE.h>
#include <constr_SEQUENCE.h>

/*** <<< DEPS [T] >>> ***/

typedef enum b_PR {
	b_PR_NOTHING,	/* No components present */
	b_PR_c,
	b_PR_d,
	b_PR_e,
	b_PR_h,
} b_PR;
typedef enum e_PR {
	e_PR_NOTHING,	/* No components present */
	e_PR_f,
	e_PR_g,
} e_PR;
typedef enum h_PR {
	h_PR_NOTHING,	/* No components present */
	h_PR_i,
	h_PR_j,
} h_PR;
extern asn1_TYPE_descriptor_t asn1_DEF_T;

/*** <<< TYPE-DECLS [T] >>> ***/


typedef struct T {
	NULL_t	 a;
	struct b {
		b_PR present;
		union {
			NULL_t	 c;
			NULL_t	 d;
			struct e {
				e_PR present;
				union {
					NULL_t	 f;
					NULL_t	 g;
				} choice;
				
				/* Context for parsing across buffer boundaries */
				ber_dec_ctx_t _ber_dec_ctx;
			} e;
			struct h {
				h_PR present;
				union {
					NULL_t	 i;
					NULL_t	 j;
				} choice;
				
				/* Context for parsing across buffer boundaries */
				ber_dec_ctx_t _ber_dec_ctx;
			} h;
		} choice;
		
		/* Context for parsing across buffer boundaries */
		ber_dec_ctx_t _ber_dec_ctx;
	} b;
	
	/* Context for parsing across buffer boundaries */
	ber_dec_ctx_t _ber_dec_ctx;
} T_t;

/*** <<< STAT-DEFS [T] >>> ***/

static asn1_TYPE_member_t asn1_MBR_e[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct e, choice.f),
		.tag = (ASN_TAG_CLASS_PRIVATE | (7 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "f"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct e, choice.g),
		.tag = (ASN_TAG_CLASS_PRIVATE | (8 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "g"
		},
};
static asn1_TYPE_tag2member_t asn1_DEF_e_tag2el[] = {
    { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 0, 0, 0 }, /* f at 20 */
    { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */
};
static asn1_CHOICE_specifics_t asn1_DEF_e_specs = {
	sizeof(struct e),
	offsetof(struct e, _ber_dec_ctx),
	offsetof(struct e, present),
	sizeof(((struct e *)0)->present),
	asn1_DEF_e_tag2el,
	2,	/* Count of tags in the map */
	0	/* Whether extensible */
};
static /* Use -fall-defs-global to expose */
asn1_TYPE_descriptor_t asn1_DEF_e = {
	"e",
	CHOICE_constraint,
	CHOICE_decode_ber,
	CHOICE_encode_der,
	CHOICE_print,
	CHOICE_free,
	CHOICE_outmost_tag,
	0,	/* No explicit tags (pointer) */
	0,	/* No explicit tags (count) */
	0,	/* Tags to skip */
	1,	/* Whether CONSTRUCTED */
	asn1_MBR_e,
	2,	/* Elements count */
	&asn1_DEF_e_specs	/* Additional specs */
};

static asn1_TYPE_member_t asn1_MBR_h[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct h, choice.i),
		.tag = (ASN_TAG_CLASS_PRIVATE | (1 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "i"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct h, choice.j),
		.tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "j"
		},
};
static asn1_TYPE_tag2member_t asn1_DEF_h_tag2el[] = {
    { (ASN_TAG_CLASS_PRIVATE | (1 << 2)), 0, 0, 0 }, /* i at 24 */
    { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 1, 0, 0 }, /* j at 25 */
};
static asn1_CHOICE_specifics_t asn1_DEF_h_specs = {
	sizeof(struct h),
	offsetof(struct h, _ber_dec_ctx),
	offsetof(struct h, present),
	sizeof(((struct h *)0)->present),
	asn1_DEF_h_tag2el,
	2,	/* Count of tags in the map */
	0	/* Whether extensible */
};
static /* Use -fall-defs-global to expose */
asn1_TYPE_descriptor_t asn1_DEF_h = {
	"h",
	CHOICE_constraint,
	CHOICE_decode_ber,
	CHOICE_encode_der,
	CHOICE_print,
	CHOICE_free,
	CHOICE_outmost_tag,
	0,	/* No explicit tags (pointer) */
	0,	/* No explicit tags (count) */
	0,	/* Tags to skip */
	1,	/* Whether CONSTRUCTED */
	asn1_MBR_h,
	2,	/* Elements count */
	&asn1_DEF_h_specs	/* Additional specs */
};

static asn1_TYPE_member_t asn1_MBR_b[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.c),
		.tag = (ASN_TAG_CLASS_PRIVATE | (5 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "c"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.d),
		.tag = (ASN_TAG_CLASS_PRIVATE | (6 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "d"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.e),
		.tag = -1 /* Ambiguous tag (CHOICE|ANY?) */,
		.tag_mode = 0,
		.type = (void *)&asn1_DEF_e,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "e"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct b, choice.h),
		.tag = (ASN_TAG_CLASS_PRIVATE | (9 << 2)),
		.tag_mode = +1,	/* EXPLICIT tag at current level */
		.type = (void *)&asn1_DEF_h,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "h"
		},
};
static asn1_TYPE_tag2member_t asn1_DEF_b_tag2el[] = {
    { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 0, 0, 0 }, /* c at 17 */
    { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */
    { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 2, 0, 0 }, /* f at 20 */
    { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 2, 0, 0 }, /* g at 21 */
    { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 3, 0, 0 }, /* h at 24 */
};
static asn1_CHOICE_specifics_t asn1_DEF_b_specs = {
	sizeof(struct b),
	offsetof(struct b, _ber_dec_ctx),
	offsetof(struct b, present),
	sizeof(((struct b *)0)->present),
	asn1_DEF_b_tag2el,
	5,	/* Count of tags in the map */
	0	/* Whether extensible */
};
static /* Use -fall-defs-global to expose */
asn1_TYPE_descriptor_t asn1_DEF_b = {
	"b",
	CHOICE_constraint,
	CHOICE_decode_ber,
	CHOICE_encode_der,
	CHOICE_print,
	CHOICE_free,
	CHOICE_outmost_tag,
	0,	/* No explicit tags (pointer) */
	0,	/* No explicit tags (count) */
	0,	/* Tags to skip */
	1,	/* Whether CONSTRUCTED */
	asn1_MBR_b,
	4,	/* Elements count */
	&asn1_DEF_b_specs	/* Additional specs */
};

static asn1_TYPE_member_t asn1_MBR_T[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct T, a),
		.tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)),
		.tag_mode = -1,	/* IMPLICIT tag at current level */
		.type = (void *)&asn1_DEF_NULL,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "a"
		},
	{ ATF_NOFLAGS, 0, offsetof(struct T, b),
		.tag = -1 /* Ambiguous tag (CHOICE|ANY?) */,
		.tag_mode = 0,
		.type = (void *)&asn1_DEF_b,
		.memb_constraints = 0,	/* Defer to actual type */
		.name = "b"
		},
};
static ber_tlv_tag_t asn1_DEF_T_tags[] = {
	(ASN_TAG_CLASS_PRIVATE | (1 << 2))
};
static asn1_TYPE_tag2member_t asn1_DEF_T_tag2el[] = {
    { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 0, 0, 0 }, /* a at 15 */
    { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 1, 0, 0 }, /* c at 17 */
    { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */
    { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 1, 0, 0 }, /* f at 20 */
    { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */
    { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 1, 0, 0 }, /* h at 24 */
};
static asn1_SEQUENCE_specifics_t asn1_DEF_T_specs = {
	sizeof(struct T),
	offsetof(struct T, _ber_dec_ctx),
	asn1_DEF_T_tag2el,
	6,	/* Count of tags in the map */
	-1,	/* Start extensions */
	-1	/* Stop extensions */
};
asn1_TYPE_descriptor_t asn1_DEF_T = {
	"T",
	SEQUENCE_constraint,
	SEQUENCE_decode_ber,
	SEQUENCE_encode_der,
	SEQUENCE_print,
	SEQUENCE_free,
	0,	/* Use generic outmost tag fetcher */
	asn1_DEF_T_tags,
	sizeof(asn1_DEF_T_tags)
		/sizeof(asn1_DEF_T_tags[0]), /* 1 */
	1,	/* Tags to skip */
	1,	/* Whether CONSTRUCTED */
	asn1_MBR_T,
	2,	/* Elements count */
	&asn1_DEF_T_specs	/* Additional specs */
};