blob: 272cceec8670eec8f08ff4e1ce4a16d4339bd3c6 [file] [log] [blame]
Lev Walkin006de1c2004-08-20 13:37:45 +00001
Lev Walkina00d6b32006-03-21 03:40:38 +00002/*** <<< INCLUDES [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +00003
4#include <OBJECT_IDENTIFIER.h>
5#include <BIT_STRING.h>
6#include <INTEGER.h>
7#include <Name.h>
8#include <constr_SEQUENCE.h>
9
Lev Walkina00d6b32006-03-21 03:40:38 +000010/*** <<< TYPE-DECLS [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +000011
Lev Walkina00d6b32006-03-21 03:40:38 +000012typedef struct SIGNED_15P0 {
Lev Walkin006de1c2004-08-20 13:37:45 +000013 struct toBeSigned {
14 INTEGER_t version;
15 OBJECT_IDENTIFIER_t signature;
16 Name_t issuer;
17
18 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +000019 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +000020 } toBeSigned;
21 OBJECT_IDENTIFIER_t algorithm;
22 BIT_STRING_t signature;
23
24 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +000025 asn_struct_ctx_t _asn_ctx;
Lev Walkina00d6b32006-03-21 03:40:38 +000026} SIGNED_15P0_t;
Lev Walkin006de1c2004-08-20 13:37:45 +000027
Lev Walkina00d6b32006-03-21 03:40:38 +000028/*** <<< FUNC-DECLS [SIGNED] >>> ***/
Lev Walkinc8285712005-03-04 22:18:20 +000029
Lev Walkina00d6b32006-03-21 03:40:38 +000030extern asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0;
Lev Walkinc8285712005-03-04 22:18:20 +000031
Lev Walkina00d6b32006-03-21 03:40:38 +000032/*** <<< CODE [SIGNED] >>> ***/
Lev Walkindaa7d2b2004-09-05 10:37:18 +000033
34static int
Lev Walkin59b176e2005-11-26 11:25:14 +000035memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkindaa7d2b2004-09-05 10:37:18 +000036 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +000037 const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
Lev Walkindaa7d2b2004-09-05 10:37:18 +000038 size_t size;
39
40 if(!sptr) {
41 _ASN_ERRLOG(app_errlog, app_key,
42 "%s: value not given (%s:%d)",
43 td->name, __FILE__, __LINE__);
44 return -1;
45 }
46
47 if(st->size > 0) {
48 /* Size in bits */
49 size = 8 * (st->size - 1) - (st->buf[0] & 0x7);
50 } else {
51 size = 0;
52 }
53
54 if((size <= 256)) {
55 /* Constraint check succeeded */
56 return 0;
57 } else {
58 _ASN_ERRLOG(app_errlog, app_key,
59 "%s: constraint failed (%s:%d)",
60 td->name, __FILE__, __LINE__);
61 return -1;
62 }
63}
64
65
Lev Walkina00d6b32006-03-21 03:40:38 +000066/*** <<< STAT-DEFS [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +000067
Lev Walkine0272aa2005-03-04 11:26:08 +000068static asn_TYPE_member_t asn_MBR_toBeSigned_2[] = {
Lev Walkincc93b0f2004-09-10 09:18:20 +000069 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, version),
Lev Walkin006de1c2004-08-20 13:37:45 +000070 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
71 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000072 .type = &asn_DEF_INTEGER,
Lev Walkinba58e1b2005-01-17 12:20:19 +000073 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +000074 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
75 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000076 .name = "version"
77 },
Lev Walkincc93b0f2004-09-10 09:18:20 +000078 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature),
Lev Walkin006de1c2004-08-20 13:37:45 +000079 .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
80 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000081 .type = &asn_DEF_OBJECT_IDENTIFIER,
Lev Walkinba58e1b2005-01-17 12:20:19 +000082 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +000083 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
84 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000085 .name = "signature"
86 },
Lev Walkincc93b0f2004-09-10 09:18:20 +000087 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer),
Lev Walkin006de1c2004-08-20 13:37:45 +000088 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
89 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000090 .type = &asn_DEF_Name,
Lev Walkinba58e1b2005-01-17 12:20:19 +000091 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +000092 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
93 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000094 .name = "issuer"
95 },
96};
Lev Walkin59b176e2005-11-26 11:25:14 +000097static ber_tlv_tag_t asn_DEF_toBeSigned_tags_2[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000098 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
99};
Lev Walkin59b176e2005-11-26 11:25:14 +0000100static asn_TYPE_tag2member_t asn_MAP_toBeSigned_tag2el_2[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000101 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* version at 21 */
102 { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* signature at 22 */
Lev Walkin4756e5e2005-02-25 08:19:34 +0000103 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* issuer at 24 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000104};
Lev Walkin59b176e2005-11-26 11:25:14 +0000105static asn_SEQUENCE_specifics_t asn_SPC_toBeSigned_specs_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000106 sizeof(struct toBeSigned),
Lev Walkindfae9752004-09-29 13:19:37 +0000107 offsetof(struct toBeSigned, _asn_ctx),
Lev Walkin59b176e2005-11-26 11:25:14 +0000108 asn_MAP_toBeSigned_tag2el_2,
Lev Walkin006de1c2004-08-20 13:37:45 +0000109 3, /* Count of tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +0000110 0, 0, 0, /* Optional elements (not needed) */
Lev Walkin006de1c2004-08-20 13:37:45 +0000111 -1, /* Start extensions */
112 -1 /* Stop extensions */
113};
Lev Walkind04430c2004-09-07 06:44:29 +0000114static /* Use -fall-defs-global to expose */
Lev Walkine0272aa2005-03-04 11:26:08 +0000115asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000116 "toBeSigned",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000117 "toBeSigned",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000118 SEQUENCE_free,
119 SEQUENCE_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000120 SEQUENCE_constraint,
121 SEQUENCE_decode_ber,
122 SEQUENCE_encode_der,
Lev Walkin61b40d82004-10-23 15:07:45 +0000123 SEQUENCE_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000124 SEQUENCE_encode_xer,
Lev Walkin59b176e2005-11-26 11:25:14 +0000125 0, /* No PER decoder, -gen-PER to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000126 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000127 asn_DEF_toBeSigned_tags_2,
128 sizeof(asn_DEF_toBeSigned_tags_2)
129 /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */
130 asn_DEF_toBeSigned_tags_2, /* Same as above */
131 sizeof(asn_DEF_toBeSigned_tags_2)
132 /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */
133 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000134 asn_MBR_toBeSigned_2,
Lev Walkin006de1c2004-08-20 13:37:45 +0000135 3, /* Elements count */
Lev Walkin59b176e2005-11-26 11:25:14 +0000136 &asn_SPC_toBeSigned_specs_2 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000137};
138
Lev Walkina00d6b32006-03-21 03:40:38 +0000139static asn_TYPE_member_t asn_MBR_SIGNED_15P0_1[] = {
140 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, toBeSigned),
Lev Walkin006de1c2004-08-20 13:37:45 +0000141 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
142 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000143 .type = &asn_DEF_toBeSigned_2,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000144 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +0000145 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
146 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000147 .name = "toBeSigned"
148 },
Lev Walkina00d6b32006-03-21 03:40:38 +0000149 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, algorithm),
Lev Walkin006de1c2004-08-20 13:37:45 +0000150 .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
151 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000152 .type = &asn_DEF_OBJECT_IDENTIFIER,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000153 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +0000154 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
155 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000156 .name = "algorithm"
157 },
Lev Walkina00d6b32006-03-21 03:40:38 +0000158 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, signature),
Lev Walkin006de1c2004-08-20 13:37:45 +0000159 .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)),
160 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000161 .type = &asn_DEF_BIT_STRING,
Lev Walkin59b176e2005-11-26 11:25:14 +0000162 .memb_constraints = memb_signature_constraint_1,
163 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
164 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000165 .name = "signature"
166 },
167};
Lev Walkina00d6b32006-03-21 03:40:38 +0000168static ber_tlv_tag_t asn_DEF_SIGNED_15P0_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000169 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
170};
Lev Walkina00d6b32006-03-21 03:40:38 +0000171static asn_TYPE_tag2member_t asn_MAP_SIGNED_15P0_tag2el_1[] = {
Lev Walkindaa7d2b2004-09-05 10:37:18 +0000172 { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 0 }, /* signature at 17 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000173 { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* algorithm at 16 */
Lev Walkin4756e5e2005-02-25 08:19:34 +0000174 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* toBeSigned at 21 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000175};
Lev Walkina00d6b32006-03-21 03:40:38 +0000176static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_15P0_specs_1 = {
177 sizeof(struct SIGNED_15P0),
178 offsetof(struct SIGNED_15P0, _asn_ctx),
179 asn_MAP_SIGNED_15P0_tag2el_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000180 3, /* Count of tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +0000181 0, 0, 0, /* Optional elements (not needed) */
Lev Walkin006de1c2004-08-20 13:37:45 +0000182 -1, /* Start extensions */
183 -1 /* Stop extensions */
184};
Lev Walkina00d6b32006-03-21 03:40:38 +0000185asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0 = {
186 "SIGNED",
187 "SIGNED",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000188 SEQUENCE_free,
189 SEQUENCE_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000190 SEQUENCE_constraint,
191 SEQUENCE_decode_ber,
192 SEQUENCE_encode_der,
Lev Walkin61b40d82004-10-23 15:07:45 +0000193 SEQUENCE_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000194 SEQUENCE_encode_xer,
Lev Walkin59b176e2005-11-26 11:25:14 +0000195 0, /* No PER decoder, -gen-PER to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000196 0, /* Use generic outmost tag fetcher */
Lev Walkina00d6b32006-03-21 03:40:38 +0000197 asn_DEF_SIGNED_15P0_tags_1,
198 sizeof(asn_DEF_SIGNED_15P0_tags_1)
199 /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */
200 asn_DEF_SIGNED_15P0_tags_1, /* Same as above */
201 sizeof(asn_DEF_SIGNED_15P0_tags_1)
202 /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */
203 0, /* No PER visible constraints */
204 asn_MBR_SIGNED_15P0_1,
205 3, /* Elements count */
206 &asn_SPC_SIGNED_15P0_specs_1 /* Additional specs */
207};
208
209
210/*** <<< INCLUDES [Certificate] >>> ***/
211
212#include <SIGNED.h>
213
214/*** <<< TYPE-DECLS [Certificate] >>> ***/
215
216typedef SIGNED_15P0_t Certificate_t;
217
218/*** <<< FUNC-DECLS [Certificate] >>> ***/
219
220extern asn_TYPE_descriptor_t asn_DEF_Certificate;
221asn_struct_free_f Certificate_free;
222asn_struct_print_f Certificate_print;
223asn_constr_check_f Certificate_constraint;
224ber_type_decoder_f Certificate_decode_ber;
225der_type_encoder_f Certificate_encode_der;
226xer_type_decoder_f Certificate_decode_xer;
227xer_type_encoder_f Certificate_encode_xer;
228
229/*** <<< CODE [Certificate] >>> ***/
230
231int
232Certificate_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
233 asn_app_consume_bytes_f *app_errlog, void *app_key) {
234 /* Replace with underlying type checker */
235 td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints;
236 return td->check_constraints(td, sptr, app_errlog, app_key);
237}
238
239/*
240 * This type is implemented using SIGNED_15P0,
241 * so here we adjust the DEF accordingly.
242 */
243static void
244Certificate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
245 td->free_struct = asn_DEF_SIGNED_15P0.free_struct;
246 td->print_struct = asn_DEF_SIGNED_15P0.print_struct;
247 td->ber_decoder = asn_DEF_SIGNED_15P0.ber_decoder;
248 td->der_encoder = asn_DEF_SIGNED_15P0.der_encoder;
249 td->xer_decoder = asn_DEF_SIGNED_15P0.xer_decoder;
250 td->xer_encoder = asn_DEF_SIGNED_15P0.xer_encoder;
251 td->uper_decoder = asn_DEF_SIGNED_15P0.uper_decoder;
252 if(!td->per_constraints)
253 td->per_constraints = asn_DEF_SIGNED_15P0.per_constraints;
254 td->elements = asn_DEF_SIGNED_15P0.elements;
255 td->elements_count = asn_DEF_SIGNED_15P0.elements_count;
256 td->specifics = asn_DEF_SIGNED_15P0.specifics;
257}
258
259void
260Certificate_free(asn_TYPE_descriptor_t *td,
261 void *struct_ptr, int contents_only) {
262 Certificate_1_inherit_TYPE_descriptor(td);
263 td->free_struct(td, struct_ptr, contents_only);
264}
265
266int
267Certificate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
268 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
269 Certificate_1_inherit_TYPE_descriptor(td);
270 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
271}
272
273asn_dec_rval_t
274Certificate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
275 void **structure, const void *bufptr, size_t size, int tag_mode) {
276 Certificate_1_inherit_TYPE_descriptor(td);
277 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
278}
279
280asn_enc_rval_t
281Certificate_encode_der(asn_TYPE_descriptor_t *td,
282 void *structure, int tag_mode, ber_tlv_tag_t tag,
283 asn_app_consume_bytes_f *cb, void *app_key) {
284 Certificate_1_inherit_TYPE_descriptor(td);
285 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
286}
287
288asn_dec_rval_t
289Certificate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
290 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
291 Certificate_1_inherit_TYPE_descriptor(td);
292 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
293}
294
295asn_enc_rval_t
296Certificate_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
297 int ilevel, enum xer_encoder_flags_e flags,
298 asn_app_consume_bytes_f *cb, void *app_key) {
299 Certificate_1_inherit_TYPE_descriptor(td);
300 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
301}
302
303
304/*** <<< STAT-DEFS [Certificate] >>> ***/
305
306static ber_tlv_tag_t asn_DEF_Certificate_tags_1[] = {
307 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
308};
309asn_TYPE_descriptor_t asn_DEF_Certificate = {
310 "Certificate",
311 "Certificate",
312 Certificate_free,
313 Certificate_print,
314 Certificate_constraint,
315 Certificate_decode_ber,
316 Certificate_encode_der,
317 Certificate_decode_xer,
318 Certificate_encode_xer,
319 0, /* No PER decoder, -gen-PER to enable */
320 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000321 asn_DEF_Certificate_tags_1,
322 sizeof(asn_DEF_Certificate_tags_1)
323 /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
324 asn_DEF_Certificate_tags_1, /* Same as above */
325 sizeof(asn_DEF_Certificate_tags_1)
326 /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
327 0, /* No PER visible constraints */
Lev Walkina00d6b32006-03-21 03:40:38 +0000328 0, 0, /* Defined elsewhere */
329 0 /* No specifics */
Lev Walkin006de1c2004-08-20 13:37:45 +0000330};
331
332
333/*** <<< INCLUDES [Name] >>> ***/
334
Lev Walkin006de1c2004-08-20 13:37:45 +0000335#include <asn_SEQUENCE_OF.h>
336#include <constr_SEQUENCE_OF.h>
337
Lev Walkinc8285712005-03-04 22:18:20 +0000338/*** <<< FWD-DECLS [Name] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +0000339
Lev Walkinbf56d542005-03-04 23:50:56 +0000340struct RelativeDistinguishedName;
Lev Walkin006de1c2004-08-20 13:37:45 +0000341
342/*** <<< TYPE-DECLS [Name] >>> ***/
343
Lev Walkin006de1c2004-08-20 13:37:45 +0000344typedef struct Name {
Lev Walkinc8285712005-03-04 22:18:20 +0000345 A_SEQUENCE_OF(struct RelativeDistinguishedName) list;
Lev Walkin006de1c2004-08-20 13:37:45 +0000346
347 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +0000348 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +0000349} Name_t;
350
Lev Walkinc8285712005-03-04 22:18:20 +0000351/*** <<< FUNC-DECLS [Name] >>> ***/
352
353extern asn_TYPE_descriptor_t asn_DEF_Name;
354
355/*** <<< POST-INCLUDE [Name] >>> ***/
356
357#include <RelativeDistinguishedName.h>
358
Lev Walkin006de1c2004-08-20 13:37:45 +0000359/*** <<< STAT-DEFS [Name] >>> ***/
360
Lev Walkine0272aa2005-03-04 11:26:08 +0000361static asn_TYPE_member_t asn_MBR_Name_1[] = {
Lev Walkin8eb4b572005-08-16 16:57:17 +0000362 { ATF_POINTER, 0, 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000363 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
364 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000365 .type = &asn_DEF_RelativeDistinguishedName,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000366 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkin59b176e2005-11-26 11:25:14 +0000367 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
368 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000369 .name = ""
370 },
371};
Lev Walkin59b176e2005-11-26 11:25:14 +0000372static ber_tlv_tag_t asn_DEF_Name_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000373 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
374};
Lev Walkin59b176e2005-11-26 11:25:14 +0000375static asn_SET_OF_specifics_t asn_SPC_Name_specs_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000376 sizeof(struct Name),
Lev Walkindfae9752004-09-29 13:19:37 +0000377 offsetof(struct Name, _asn_ctx),
Lev Walkina9cc46e2004-09-22 16:06:28 +0000378 0, /* XER encoding is XMLDelimitedItemList */
Lev Walkin006de1c2004-08-20 13:37:45 +0000379};
Lev Walkindfae9752004-09-29 13:19:37 +0000380asn_TYPE_descriptor_t asn_DEF_Name = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000381 "Name",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000382 "Name",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000383 SEQUENCE_OF_free,
384 SEQUENCE_OF_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000385 SEQUENCE_OF_constraint,
386 SEQUENCE_OF_decode_ber,
387 SEQUENCE_OF_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000388 SEQUENCE_OF_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000389 SEQUENCE_OF_encode_xer,
Lev Walkin59b176e2005-11-26 11:25:14 +0000390 0, /* No PER decoder, -gen-PER to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000391 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000392 asn_DEF_Name_tags_1,
393 sizeof(asn_DEF_Name_tags_1)
394 /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */
395 asn_DEF_Name_tags_1, /* Same as above */
396 sizeof(asn_DEF_Name_tags_1)
397 /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */
398 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000399 asn_MBR_Name_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000400 1, /* Single element */
Lev Walkin59b176e2005-11-26 11:25:14 +0000401 &asn_SPC_Name_specs_1 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000402};
403
404
405/*** <<< INCLUDES [RelativeDistinguishedName] >>> ***/
406
407#include <IA5String.h>
408#include <asn_SET_OF.h>
409#include <constr_SET_OF.h>
410
Lev Walkin006de1c2004-08-20 13:37:45 +0000411/*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/
412
Lev Walkin006de1c2004-08-20 13:37:45 +0000413typedef struct RelativeDistinguishedName {
414 A_SET_OF(IA5String_t) list;
415
416 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +0000417 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +0000418} RelativeDistinguishedName_t;
419
Lev Walkinc8285712005-03-04 22:18:20 +0000420/*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/
421
422extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName;
423
Lev Walkin006de1c2004-08-20 13:37:45 +0000424/*** <<< CTABLES [RelativeDistinguishedName] >>> ***/
425
Lev Walkine8318b82005-03-06 09:29:03 +0000426static int permitted_alphabet_table_2[256] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00004270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
4280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
4290,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0, /* ,-. */
4301,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, /* 0 9 */
4310,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
4321,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
4330,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
4341,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
435};
436
Lev Walkine8318b82005-03-06 09:29:03 +0000437static int check_permitted_alphabet_2(const void *sptr) {
438 int *table = permitted_alphabet_table_2;
Lev Walkin006de1c2004-08-20 13:37:45 +0000439 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000440 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkina09e5da2004-08-22 03:19:00 +0000441 const uint8_t *ch = st->buf;
442 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000443
444 for(; ch < end; ch++) {
445 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000446 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000447 }
Lev Walkin775885e2004-08-22 12:47:03 +0000448 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000449}
450
451
452/*** <<< CODE [RelativeDistinguishedName] >>> ***/
453
454static int
Lev Walkin59b176e2005-11-26 11:25:14 +0000455memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000456 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000457 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000458
459 if(!sptr) {
460 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000461 "%s: value not given (%s:%d)",
462 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000463 return -1;
464 }
465
466
Lev Walkine8318b82005-03-06 09:29:03 +0000467 if(!check_permitted_alphabet_2(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000468 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000469 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000470 } else {
471 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000472 "%s: constraint failed (%s:%d)",
473 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000474 return -1;
475 }
476}
477
478
479/*** <<< STAT-DEFS [RelativeDistinguishedName] >>> ***/
480
Lev Walkine0272aa2005-03-04 11:26:08 +0000481static asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[] = {
Lev Walkin8eb4b572005-08-16 16:57:17 +0000482 { ATF_POINTER, 0, 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000483 .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)),
484 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000485 .type = &asn_DEF_IA5String,
Lev Walkin59b176e2005-11-26 11:25:14 +0000486 .memb_constraints = memb_IA5String_constraint_1,
487 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
488 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000489 .name = ""
490 },
491};
Lev Walkin59b176e2005-11-26 11:25:14 +0000492static ber_tlv_tag_t asn_DEF_RelativeDistinguishedName_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000493 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
494};
Lev Walkin59b176e2005-11-26 11:25:14 +0000495static asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000496 sizeof(struct RelativeDistinguishedName),
Lev Walkindfae9752004-09-29 13:19:37 +0000497 offsetof(struct RelativeDistinguishedName, _asn_ctx),
Lev Walkina9cc46e2004-09-22 16:06:28 +0000498 0, /* XER encoding is XMLDelimitedItemList */
Lev Walkin006de1c2004-08-20 13:37:45 +0000499};
Lev Walkindfae9752004-09-29 13:19:37 +0000500asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000501 "RelativeDistinguishedName",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000502 "RelativeDistinguishedName",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000503 SET_OF_free,
504 SET_OF_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000505 SET_OF_constraint,
506 SET_OF_decode_ber,
507 SET_OF_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000508 SET_OF_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000509 SET_OF_encode_xer,
Lev Walkin59b176e2005-11-26 11:25:14 +0000510 0, /* No PER decoder, -gen-PER to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000511 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000512 asn_DEF_RelativeDistinguishedName_tags_1,
513 sizeof(asn_DEF_RelativeDistinguishedName_tags_1)
514 /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */
515 asn_DEF_RelativeDistinguishedName_tags_1, /* Same as above */
516 sizeof(asn_DEF_RelativeDistinguishedName_tags_1)
517 /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */
518 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000519 asn_MBR_RelativeDistinguishedName_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000520 1, /* Single element */
Lev Walkin59b176e2005-11-26 11:25:14 +0000521 &asn_SPC_RelativeDistinguishedName_specs_1 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000522};
523