blob: 9eba469500a34d11d68dcd60b5bb7ac1562bec26 [file] [log] [blame]
Lev Walkin006de1c2004-08-20 13:37:45 +00001
2/*** <<< INCLUDES [Int1] >>> ***/
3
4#include <INTEGER.h>
5
6/*** <<< TYPE-DECLS [Int1] >>> ***/
7
8
9typedef INTEGER_t Int1_t;
10
Lev Walkin006de1c2004-08-20 13:37:45 +000011/*** <<< FUNC-DECLS [Int1] >>> ***/
12
Lev Walkin154aa182004-09-26 13:12:56 +000013/* This type is equivalent to INTEGER */
Lev Walkindfae9752004-09-29 13:19:37 +000014#define asn_DEF_Int1 asn_DEF_INTEGER
Lev Walkin006de1c2004-08-20 13:37:45 +000015
16/*** <<< CODE [Int1] >>> ***/
17
Lev Walkin154aa182004-09-26 13:12:56 +000018/* This type is equivalent to INTEGER */
Lev Walkin006de1c2004-08-20 13:37:45 +000019
20
21/*** <<< INCLUDES [Int2] >>> ***/
22
23#include <Int1.h>
24
25/*** <<< TYPE-DECLS [Int2] >>> ***/
26
27
28typedef Int1_t Int2_t;
29
Lev Walkin006de1c2004-08-20 13:37:45 +000030/*** <<< FUNC-DECLS [Int2] >>> ***/
31
Lev Walkindfae9752004-09-29 13:19:37 +000032extern asn_TYPE_descriptor_t asn_DEF_Int2;
Lev Walkina9cc46e2004-09-22 16:06:28 +000033asn_struct_free_f Int2_free;
34asn_struct_print_f Int2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +000035asn_constr_check_f Int2_constraint;
36ber_type_decoder_f Int2_decode_ber;
37der_type_encoder_f Int2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +000038xer_type_encoder_f Int2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +000039
40/*** <<< CODE [Int2] >>> ***/
41
42int
Lev Walkindfae9752004-09-29 13:19:37 +000043Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +000044 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +000045 const Int1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +000046 long value;
47
48 if(!sptr) {
49 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +000050 "%s: value not given (%s:%d)",
51 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +000052 return -1;
53 }
54
Lev Walkin44467432004-09-07 06:43:57 +000055 /* Check if the sign bit is present */
56 value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
Lev Walkin006de1c2004-08-20 13:37:45 +000057
58 if((value >= 0)) {
59 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +000060 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +000061 } else {
62 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +000063 "%s: constraint failed (%s:%d)",
64 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +000065 return -1;
66 }
67}
68
69/*
70 * This type is implemented using Int1,
Lev Walkinc3808c12004-09-23 22:14:58 +000071 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +000072 */
73static void
Lev Walkindfae9752004-09-29 13:19:37 +000074Int2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
75 td->free_struct = asn_DEF_Int1.free_struct;
76 td->print_struct = asn_DEF_Int1.print_struct;
77 td->ber_decoder = asn_DEF_Int1.ber_decoder;
78 td->der_encoder = asn_DEF_Int1.der_encoder;
79 td->xer_decoder = asn_DEF_Int1.xer_decoder;
80 td->xer_encoder = asn_DEF_Int1.xer_encoder;
81 td->elements = asn_DEF_Int1.elements;
82 td->elements_count = asn_DEF_Int1.elements_count;
83 td->specifics = asn_DEF_Int1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +000084}
85
Lev Walkina9cc46e2004-09-22 16:06:28 +000086void
Lev Walkindfae9752004-09-29 13:19:37 +000087Int2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +000088 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +000089 Int2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +000090 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +000091}
92
93int
Lev Walkindfae9752004-09-29 13:19:37 +000094Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +000095 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
96 Int2_inherit_TYPE_descriptor(td);
97 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
98}
99
Lev Walkina9cc46e2004-09-22 16:06:28 +0000100ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000101Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000102 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000103 Int2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000104 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000105}
106
107asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000108Int2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000109 void *structure, int tag_mode, ber_tlv_tag_t tag,
110 asn_app_consume_bytes_f *cb, void *app_key) {
111 Int2_inherit_TYPE_descriptor(td);
112 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
113}
114
115asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000116Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000117 int ilevel, enum xer_encoder_flags_e flags,
118 asn_app_consume_bytes_f *cb, void *app_key) {
119 Int2_inherit_TYPE_descriptor(td);
120 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000121}
122
123
124/*** <<< STAT-DEFS [Int2] >>> ***/
125
Lev Walkindfae9752004-09-29 13:19:37 +0000126static ber_tlv_tag_t asn_DEF_Int2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000127 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000128};
Lev Walkindfae9752004-09-29 13:19:37 +0000129asn_TYPE_descriptor_t asn_DEF_Int2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000130 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000131 Int2_free,
132 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000133 Int2_constraint,
134 Int2_decode_ber,
135 Int2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000136 0, /* Not implemented yet */
137 Int2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000138 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000139 asn_DEF_Int2_tags,
140 sizeof(asn_DEF_Int2_tags)
141 /sizeof(asn_DEF_Int2_tags[0]), /* 1 */
142 asn_DEF_Int2_tags, /* Same as above */
143 sizeof(asn_DEF_Int2_tags)
144 /sizeof(asn_DEF_Int2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000145 0, 0, /* No members */
146 0 /* No specifics */
147};
148
149
150/*** <<< INCLUDES [Int3] >>> ***/
151
152#include <Int2.h>
153
154/*** <<< TYPE-DECLS [Int3] >>> ***/
155
156
157typedef Int2_t Int3_t;
158
Lev Walkin006de1c2004-08-20 13:37:45 +0000159/*** <<< FUNC-DECLS [Int3] >>> ***/
160
Lev Walkindfae9752004-09-29 13:19:37 +0000161extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000162asn_struct_free_f Int3_free;
163asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000164asn_constr_check_f Int3_constraint;
165ber_type_decoder_f Int3_decode_ber;
166der_type_encoder_f Int3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000167xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000168
169/*** <<< CODE [Int3] >>> ***/
170
171int
Lev Walkindfae9752004-09-29 13:19:37 +0000172Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000173 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000174 const Int2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000175 long value;
176
177 if(!sptr) {
178 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000179 "%s: value not given (%s:%d)",
180 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000181 return -1;
182 }
183
Lev Walkindfae9752004-09-29 13:19:37 +0000184 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000185 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000186 "%s: value too large (%s:%d)",
187 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000188 return -1;
189 }
190
191 if((value >= 0 && value <= 10)) {
192 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000193 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000194 } else {
195 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000196 "%s: constraint failed (%s:%d)",
197 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000198 return -1;
199 }
200}
201
202/*
203 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000204 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000205 */
206static void
Lev Walkindfae9752004-09-29 13:19:37 +0000207Int3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
208 td->free_struct = asn_DEF_Int2.free_struct;
209 td->print_struct = asn_DEF_Int2.print_struct;
210 td->ber_decoder = asn_DEF_Int2.ber_decoder;
211 td->der_encoder = asn_DEF_Int2.der_encoder;
212 td->xer_decoder = asn_DEF_Int2.xer_decoder;
213 td->xer_encoder = asn_DEF_Int2.xer_encoder;
214 td->elements = asn_DEF_Int2.elements;
215 td->elements_count = asn_DEF_Int2.elements_count;
216 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000217}
218
Lev Walkina9cc46e2004-09-22 16:06:28 +0000219void
Lev Walkindfae9752004-09-29 13:19:37 +0000220Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000221 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000222 Int3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000223 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000224}
225
226int
Lev Walkindfae9752004-09-29 13:19:37 +0000227Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000228 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
229 Int3_inherit_TYPE_descriptor(td);
230 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
231}
232
Lev Walkina9cc46e2004-09-22 16:06:28 +0000233ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000234Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000235 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000236 Int3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000237 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000238}
239
240asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000241Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000242 void *structure, int tag_mode, ber_tlv_tag_t tag,
243 asn_app_consume_bytes_f *cb, void *app_key) {
244 Int3_inherit_TYPE_descriptor(td);
245 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
246}
247
248asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000249Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000250 int ilevel, enum xer_encoder_flags_e flags,
251 asn_app_consume_bytes_f *cb, void *app_key) {
252 Int3_inherit_TYPE_descriptor(td);
253 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000254}
255
256
257/*** <<< STAT-DEFS [Int3] >>> ***/
258
Lev Walkindfae9752004-09-29 13:19:37 +0000259static ber_tlv_tag_t asn_DEF_Int3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000260 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000261};
Lev Walkindfae9752004-09-29 13:19:37 +0000262asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000263 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000264 Int3_free,
265 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000266 Int3_constraint,
267 Int3_decode_ber,
268 Int3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000269 0, /* Not implemented yet */
270 Int3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000271 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000272 asn_DEF_Int3_tags,
273 sizeof(asn_DEF_Int3_tags)
274 /sizeof(asn_DEF_Int3_tags[0]), /* 1 */
275 asn_DEF_Int3_tags, /* Same as above */
276 sizeof(asn_DEF_Int3_tags)
277 /sizeof(asn_DEF_Int3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000278 0, 0, /* No members */
279 0 /* No specifics */
280};
281
282
283/*** <<< INCLUDES [Int4] >>> ***/
284
285#include <Int3.h>
286
287/*** <<< TYPE-DECLS [Int4] >>> ***/
288
289
290typedef Int3_t Int4_t;
291
Lev Walkin006de1c2004-08-20 13:37:45 +0000292/*** <<< FUNC-DECLS [Int4] >>> ***/
293
Lev Walkindfae9752004-09-29 13:19:37 +0000294extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000295asn_struct_free_f Int4_free;
296asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000297asn_constr_check_f Int4_constraint;
298ber_type_decoder_f Int4_decode_ber;
299der_type_encoder_f Int4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000300xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000301
302/*** <<< CODE [Int4] >>> ***/
303
304int
Lev Walkindfae9752004-09-29 13:19:37 +0000305Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000306 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000307 const Int3_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000308 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000309
310 if(!sptr) {
311 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000312 "%s: value not given (%s:%d)",
313 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000314 return -1;
315 }
316
Lev Walkindfae9752004-09-29 13:19:37 +0000317 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000318 _ASN_ERRLOG(app_errlog, app_key,
319 "%s: value too large (%s:%d)",
320 td->name, __FILE__, __LINE__);
321 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000322 }
323
Lev Walkind35c8b52004-08-25 02:08:08 +0000324 if((value >= 1 && value <= 10)) {
325 /* Constraint check succeeded */
326 return 0;
327 } else {
328 _ASN_ERRLOG(app_errlog, app_key,
329 "%s: constraint failed (%s:%d)",
330 td->name, __FILE__, __LINE__);
331 return -1;
332 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000333}
334
335/*
336 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000337 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000338 */
339static void
Lev Walkindfae9752004-09-29 13:19:37 +0000340Int4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
341 td->free_struct = asn_DEF_Int3.free_struct;
342 td->print_struct = asn_DEF_Int3.print_struct;
343 td->ber_decoder = asn_DEF_Int3.ber_decoder;
344 td->der_encoder = asn_DEF_Int3.der_encoder;
345 td->xer_decoder = asn_DEF_Int3.xer_decoder;
346 td->xer_encoder = asn_DEF_Int3.xer_encoder;
347 td->elements = asn_DEF_Int3.elements;
348 td->elements_count = asn_DEF_Int3.elements_count;
349 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000350}
351
Lev Walkina9cc46e2004-09-22 16:06:28 +0000352void
Lev Walkindfae9752004-09-29 13:19:37 +0000353Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000354 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000355 Int4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000356 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000357}
358
359int
Lev Walkindfae9752004-09-29 13:19:37 +0000360Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000361 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
362 Int4_inherit_TYPE_descriptor(td);
363 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
364}
365
Lev Walkina9cc46e2004-09-22 16:06:28 +0000366ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000367Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000368 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000369 Int4_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000370 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000371}
372
373asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000374Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000375 void *structure, int tag_mode, ber_tlv_tag_t tag,
376 asn_app_consume_bytes_f *cb, void *app_key) {
377 Int4_inherit_TYPE_descriptor(td);
378 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
379}
380
381asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000382Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000383 int ilevel, enum xer_encoder_flags_e flags,
384 asn_app_consume_bytes_f *cb, void *app_key) {
385 Int4_inherit_TYPE_descriptor(td);
386 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000387}
388
389
390/*** <<< STAT-DEFS [Int4] >>> ***/
391
Lev Walkindfae9752004-09-29 13:19:37 +0000392static ber_tlv_tag_t asn_DEF_Int4_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000393 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000394};
Lev Walkindfae9752004-09-29 13:19:37 +0000395asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000396 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000397 Int4_free,
398 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000399 Int4_constraint,
400 Int4_decode_ber,
401 Int4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000402 0, /* Not implemented yet */
403 Int4_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000404 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000405 asn_DEF_Int4_tags,
406 sizeof(asn_DEF_Int4_tags)
407 /sizeof(asn_DEF_Int4_tags[0]), /* 1 */
408 asn_DEF_Int4_tags, /* Same as above */
409 sizeof(asn_DEF_Int4_tags)
410 /sizeof(asn_DEF_Int4_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000411 0, 0, /* No members */
412 0 /* No specifics */
413};
414
415
416/*** <<< INCLUDES [Int5] >>> ***/
417
418#include <Int4.h>
419
420/*** <<< TYPE-DECLS [Int5] >>> ***/
421
422
423typedef Int4_t Int5_t;
424
Lev Walkin006de1c2004-08-20 13:37:45 +0000425/*** <<< FUNC-DECLS [Int5] >>> ***/
426
Lev Walkindfae9752004-09-29 13:19:37 +0000427extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000428asn_struct_free_f Int5_free;
429asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000430asn_constr_check_f Int5_constraint;
431ber_type_decoder_f Int5_decode_ber;
432der_type_encoder_f Int5_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000433xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000434
435/*** <<< CODE [Int5] >>> ***/
436
437int
Lev Walkindfae9752004-09-29 13:19:37 +0000438Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000439 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000440 const Int4_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000441 long value;
442
443 if(!sptr) {
444 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000445 "%s: value not given (%s:%d)",
446 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000447 return -1;
448 }
449
Lev Walkindfae9752004-09-29 13:19:37 +0000450 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000451 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000452 "%s: value too large (%s:%d)",
453 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000454 return -1;
455 }
456
457 if((value == 5)) {
458 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000459 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000460 } else {
461 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000462 "%s: constraint failed (%s:%d)",
463 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000464 return -1;
465 }
466}
467
468/*
469 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000470 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000471 */
472static void
Lev Walkindfae9752004-09-29 13:19:37 +0000473Int5_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
474 td->free_struct = asn_DEF_Int4.free_struct;
475 td->print_struct = asn_DEF_Int4.print_struct;
476 td->ber_decoder = asn_DEF_Int4.ber_decoder;
477 td->der_encoder = asn_DEF_Int4.der_encoder;
478 td->xer_decoder = asn_DEF_Int4.xer_decoder;
479 td->xer_encoder = asn_DEF_Int4.xer_encoder;
480 td->elements = asn_DEF_Int4.elements;
481 td->elements_count = asn_DEF_Int4.elements_count;
482 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000483}
484
Lev Walkina9cc46e2004-09-22 16:06:28 +0000485void
Lev Walkindfae9752004-09-29 13:19:37 +0000486Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000487 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000488 Int5_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000489 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000490}
491
492int
Lev Walkindfae9752004-09-29 13:19:37 +0000493Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000494 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
495 Int5_inherit_TYPE_descriptor(td);
496 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
497}
498
Lev Walkina9cc46e2004-09-22 16:06:28 +0000499ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000500Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000501 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000502 Int5_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000503 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000504}
505
506asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000507Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000508 void *structure, int tag_mode, ber_tlv_tag_t tag,
509 asn_app_consume_bytes_f *cb, void *app_key) {
510 Int5_inherit_TYPE_descriptor(td);
511 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
512}
513
514asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000515Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000516 int ilevel, enum xer_encoder_flags_e flags,
517 asn_app_consume_bytes_f *cb, void *app_key) {
518 Int5_inherit_TYPE_descriptor(td);
519 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000520}
521
522
523/*** <<< STAT-DEFS [Int5] >>> ***/
524
Lev Walkindfae9752004-09-29 13:19:37 +0000525static ber_tlv_tag_t asn_DEF_Int5_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000526 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000527};
Lev Walkindfae9752004-09-29 13:19:37 +0000528asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000529 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000530 Int5_free,
531 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000532 Int5_constraint,
533 Int5_decode_ber,
534 Int5_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000535 0, /* Not implemented yet */
536 Int5_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000537 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000538 asn_DEF_Int5_tags,
539 sizeof(asn_DEF_Int5_tags)
540 /sizeof(asn_DEF_Int5_tags[0]), /* 1 */
541 asn_DEF_Int5_tags, /* Same as above */
542 sizeof(asn_DEF_Int5_tags)
543 /sizeof(asn_DEF_Int5_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000544 0, 0, /* No members */
545 0 /* No specifics */
546};
547
548
549/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
550
551#include <INTEGER.h>
552
553/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
554
555
556typedef INTEGER_t ExtensibleExtensions_t;
557
Lev Walkin006de1c2004-08-20 13:37:45 +0000558/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
559
Lev Walkindfae9752004-09-29 13:19:37 +0000560extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000561asn_struct_free_f ExtensibleExtensions_free;
562asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000563asn_constr_check_f ExtensibleExtensions_constraint;
564ber_type_decoder_f ExtensibleExtensions_decode_ber;
565der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000566xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000567
568/*** <<< CODE [ExtensibleExtensions] >>> ***/
569
570int
Lev Walkindfae9752004-09-29 13:19:37 +0000571ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000572 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000573 const INTEGER_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000574 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000575
576 if(!sptr) {
577 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000578 "%s: value not given (%s:%d)",
579 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000580 return -1;
581 }
582
Lev Walkindfae9752004-09-29 13:19:37 +0000583 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000584 _ASN_ERRLOG(app_errlog, app_key,
585 "%s: value too large (%s:%d)",
586 td->name, __FILE__, __LINE__);
587 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000588 }
589
Lev Walkind35c8b52004-08-25 02:08:08 +0000590 if((value >= 1 && value <= 256)) {
591 /* Constraint check succeeded */
592 return 0;
593 } else {
594 _ASN_ERRLOG(app_errlog, app_key,
595 "%s: constraint failed (%s:%d)",
596 td->name, __FILE__, __LINE__);
597 return -1;
598 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000599}
600
601/*
602 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000603 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000604 */
605static void
Lev Walkindfae9752004-09-29 13:19:37 +0000606ExtensibleExtensions_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
607 td->free_struct = asn_DEF_INTEGER.free_struct;
608 td->print_struct = asn_DEF_INTEGER.print_struct;
609 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
610 td->der_encoder = asn_DEF_INTEGER.der_encoder;
611 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
612 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
613 td->elements = asn_DEF_INTEGER.elements;
614 td->elements_count = asn_DEF_INTEGER.elements_count;
615 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000616}
617
Lev Walkina9cc46e2004-09-22 16:06:28 +0000618void
Lev Walkindfae9752004-09-29 13:19:37 +0000619ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000620 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000621 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000622 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000623}
624
625int
Lev Walkindfae9752004-09-29 13:19:37 +0000626ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000627 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
628 ExtensibleExtensions_inherit_TYPE_descriptor(td);
629 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
630}
631
Lev Walkina9cc46e2004-09-22 16:06:28 +0000632ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000633ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000634 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000635 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000636 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000637}
638
639asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000640ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000641 void *structure, int tag_mode, ber_tlv_tag_t tag,
642 asn_app_consume_bytes_f *cb, void *app_key) {
643 ExtensibleExtensions_inherit_TYPE_descriptor(td);
644 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
645}
646
647asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000648ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000649 int ilevel, enum xer_encoder_flags_e flags,
650 asn_app_consume_bytes_f *cb, void *app_key) {
651 ExtensibleExtensions_inherit_TYPE_descriptor(td);
652 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000653}
654
655
656/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
657
Lev Walkindfae9752004-09-29 13:19:37 +0000658static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000659 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
660};
Lev Walkindfae9752004-09-29 13:19:37 +0000661asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000662 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000663 ExtensibleExtensions_free,
664 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000665 ExtensibleExtensions_constraint,
666 ExtensibleExtensions_decode_ber,
667 ExtensibleExtensions_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000668 0, /* Not implemented yet */
669 ExtensibleExtensions_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000670 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000671 asn_DEF_ExtensibleExtensions_tags,
672 sizeof(asn_DEF_ExtensibleExtensions_tags)
673 /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */
674 asn_DEF_ExtensibleExtensions_tags, /* Same as above */
675 sizeof(asn_DEF_ExtensibleExtensions_tags)
676 /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000677 0, 0, /* No members */
678 0 /* No specifics */
679};
680
681
682/*** <<< INCLUDES [Str1] >>> ***/
683
684#include <IA5String.h>
685
686/*** <<< TYPE-DECLS [Str1] >>> ***/
687
688
689typedef IA5String_t Str1_t;
690
Lev Walkin006de1c2004-08-20 13:37:45 +0000691/*** <<< FUNC-DECLS [Str1] >>> ***/
692
Lev Walkin154aa182004-09-26 13:12:56 +0000693/* This type is equivalent to IA5String */
Lev Walkindfae9752004-09-29 13:19:37 +0000694#define asn_DEF_Str1 asn_DEF_IA5String
Lev Walkin006de1c2004-08-20 13:37:45 +0000695
696/*** <<< CODE [Str1] >>> ***/
697
Lev Walkin154aa182004-09-26 13:12:56 +0000698/* This type is equivalent to IA5String */
Lev Walkin006de1c2004-08-20 13:37:45 +0000699
700
701/*** <<< INCLUDES [Str2] >>> ***/
702
703#include <Str1.h>
704
705/*** <<< TYPE-DECLS [Str2] >>> ***/
706
707
708typedef Str1_t Str2_t;
709
Lev Walkin006de1c2004-08-20 13:37:45 +0000710/*** <<< FUNC-DECLS [Str2] >>> ***/
711
Lev Walkindfae9752004-09-29 13:19:37 +0000712extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000713asn_struct_free_f Str2_free;
714asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000715asn_constr_check_f Str2_constraint;
716ber_type_decoder_f Str2_decode_ber;
717der_type_encoder_f Str2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000718xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000719
720/*** <<< CTABLES [Str2] >>> ***/
721
722static int check_permitted_alphabet_1(const void *sptr) {
723 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000724 const IA5String_t *st = sptr;
725 const uint8_t *ch = st->buf;
726 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000727
728 for(; ch < end; ch++) {
729 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000730 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000731 }
Lev Walkin775885e2004-08-22 12:47:03 +0000732 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000733}
734
735
736/*** <<< CODE [Str2] >>> ***/
737
738int
Lev Walkindfae9752004-09-29 13:19:37 +0000739Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000740 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000741 const Str1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000742 size_t size;
743
744 if(!sptr) {
745 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000746 "%s: value not given (%s:%d)",
747 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000748 return -1;
749 }
750
751 size = st->size;
752
753 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000754 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000755 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000756 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000757 } else {
758 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000759 "%s: constraint failed (%s:%d)",
760 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000761 return -1;
762 }
763}
764
765/*
766 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000767 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000768 */
769static void
Lev Walkindfae9752004-09-29 13:19:37 +0000770Str2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
771 td->free_struct = asn_DEF_Str1.free_struct;
772 td->print_struct = asn_DEF_Str1.print_struct;
773 td->ber_decoder = asn_DEF_Str1.ber_decoder;
774 td->der_encoder = asn_DEF_Str1.der_encoder;
775 td->xer_decoder = asn_DEF_Str1.xer_decoder;
776 td->xer_encoder = asn_DEF_Str1.xer_encoder;
777 td->elements = asn_DEF_Str1.elements;
778 td->elements_count = asn_DEF_Str1.elements_count;
779 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000780}
781
Lev Walkina9cc46e2004-09-22 16:06:28 +0000782void
Lev Walkindfae9752004-09-29 13:19:37 +0000783Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000784 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000785 Str2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000786 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000787}
788
789int
Lev Walkindfae9752004-09-29 13:19:37 +0000790Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000791 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
792 Str2_inherit_TYPE_descriptor(td);
793 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
794}
795
Lev Walkina9cc46e2004-09-22 16:06:28 +0000796ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000797Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000798 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000799 Str2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000800 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000801}
802
803asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000804Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000805 void *structure, int tag_mode, ber_tlv_tag_t tag,
806 asn_app_consume_bytes_f *cb, void *app_key) {
807 Str2_inherit_TYPE_descriptor(td);
808 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
809}
810
811asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000812Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000813 int ilevel, enum xer_encoder_flags_e flags,
814 asn_app_consume_bytes_f *cb, void *app_key) {
815 Str2_inherit_TYPE_descriptor(td);
816 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000817}
818
819
820/*** <<< STAT-DEFS [Str2] >>> ***/
821
Lev Walkindfae9752004-09-29 13:19:37 +0000822static ber_tlv_tag_t asn_DEF_Str2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000823 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000824};
Lev Walkindfae9752004-09-29 13:19:37 +0000825asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000826 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000827 Str2_free,
828 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000829 Str2_constraint,
830 Str2_decode_ber,
831 Str2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000832 0, /* Not implemented yet */
833 Str2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000834 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000835 asn_DEF_Str2_tags,
836 sizeof(asn_DEF_Str2_tags)
837 /sizeof(asn_DEF_Str2_tags[0]), /* 1 */
838 asn_DEF_Str2_tags, /* Same as above */
839 sizeof(asn_DEF_Str2_tags)
840 /sizeof(asn_DEF_Str2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000841 0, 0, /* No members */
842 0 /* No specifics */
843};
844
845
846/*** <<< INCLUDES [Str3] >>> ***/
847
848#include <Str2.h>
849
850/*** <<< TYPE-DECLS [Str3] >>> ***/
851
852
853typedef Str2_t Str3_t;
854
Lev Walkin006de1c2004-08-20 13:37:45 +0000855/*** <<< FUNC-DECLS [Str3] >>> ***/
856
Lev Walkindfae9752004-09-29 13:19:37 +0000857extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000858asn_struct_free_f Str3_free;
859asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000860asn_constr_check_f Str3_constraint;
861ber_type_decoder_f Str3_decode_ber;
862der_type_encoder_f Str3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000863xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000864
865/*** <<< CTABLES [Str3] >>> ***/
866
867static int permitted_alphabet_table_2[256] = {
8680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8700,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8720,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
8730,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8740,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
875};
876
877static int check_permitted_alphabet_2(const void *sptr) {
878 int *table = permitted_alphabet_table_2;
879 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000880 const IA5String_t *st = sptr;
881 const uint8_t *ch = st->buf;
882 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000883
884 for(; ch < end; ch++) {
885 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000886 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000887 }
Lev Walkin775885e2004-08-22 12:47:03 +0000888 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000889}
890
891
892/*** <<< CODE [Str3] >>> ***/
893
894int
Lev Walkindfae9752004-09-29 13:19:37 +0000895Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000896 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000897 const Str2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000898 size_t size;
899
900 if(!sptr) {
901 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000902 "%s: value not given (%s:%d)",
903 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000904 return -1;
905 }
906
907 size = st->size;
908
909 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +0000910 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000911 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000912 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000913 } else {
914 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000915 "%s: constraint failed (%s:%d)",
916 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000917 return -1;
918 }
919}
920
921/*
922 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000923 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000924 */
925static void
Lev Walkindfae9752004-09-29 13:19:37 +0000926Str3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
927 td->free_struct = asn_DEF_Str2.free_struct;
928 td->print_struct = asn_DEF_Str2.print_struct;
929 td->ber_decoder = asn_DEF_Str2.ber_decoder;
930 td->der_encoder = asn_DEF_Str2.der_encoder;
931 td->xer_decoder = asn_DEF_Str2.xer_decoder;
932 td->xer_encoder = asn_DEF_Str2.xer_encoder;
933 td->elements = asn_DEF_Str2.elements;
934 td->elements_count = asn_DEF_Str2.elements_count;
935 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000936}
937
Lev Walkina9cc46e2004-09-22 16:06:28 +0000938void
Lev Walkindfae9752004-09-29 13:19:37 +0000939Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000940 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000941 Str3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000942 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000943}
944
945int
Lev Walkindfae9752004-09-29 13:19:37 +0000946Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000947 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
948 Str3_inherit_TYPE_descriptor(td);
949 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
950}
951
Lev Walkina9cc46e2004-09-22 16:06:28 +0000952ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000953Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000954 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000955 Str3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000956 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000957}
958
959asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000960Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000961 void *structure, int tag_mode, ber_tlv_tag_t tag,
962 asn_app_consume_bytes_f *cb, void *app_key) {
963 Str3_inherit_TYPE_descriptor(td);
964 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
965}
966
967asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000968Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000969 int ilevel, enum xer_encoder_flags_e flags,
970 asn_app_consume_bytes_f *cb, void *app_key) {
971 Str3_inherit_TYPE_descriptor(td);
972 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000973}
974
975
976/*** <<< STAT-DEFS [Str3] >>> ***/
977
Lev Walkindfae9752004-09-29 13:19:37 +0000978static ber_tlv_tag_t asn_DEF_Str3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000979 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000980};
Lev Walkindfae9752004-09-29 13:19:37 +0000981asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000982 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000983 Str3_free,
984 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000985 Str3_constraint,
986 Str3_decode_ber,
987 Str3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000988 0, /* Not implemented yet */
989 Str3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000990 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000991 asn_DEF_Str3_tags,
992 sizeof(asn_DEF_Str3_tags)
993 /sizeof(asn_DEF_Str3_tags[0]), /* 1 */
994 asn_DEF_Str3_tags, /* Same as above */
995 sizeof(asn_DEF_Str3_tags)
996 /sizeof(asn_DEF_Str3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000997 0, 0, /* No members */
998 0 /* No specifics */
999};
1000
1001
Lev Walkin8a99bf72004-09-10 06:07:39 +00001002/*** <<< INCLUDES [Str4] >>> ***/
1003
1004#include <IA5String.h>
1005
1006/*** <<< TYPE-DECLS [Str4] >>> ***/
1007
1008
1009typedef IA5String_t Str4_t;
1010
1011/*** <<< FUNC-DECLS [Str4] >>> ***/
1012
Lev Walkindfae9752004-09-29 13:19:37 +00001013extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001014asn_struct_free_f Str4_free;
1015asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001016asn_constr_check_f Str4_constraint;
1017ber_type_decoder_f Str4_decode_ber;
1018der_type_encoder_f Str4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001019xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001020
1021/*** <<< CTABLES [Str4] >>> ***/
1022
1023static int check_permitted_alphabet_3(const void *sptr) {
1024 /* The underlying type is IA5String */
1025 const IA5String_t *st = sptr;
1026 const uint8_t *ch = st->buf;
1027 const uint8_t *end = ch + st->size;
1028
1029 for(; ch < end; ch++) {
1030 uint8_t cv = *ch;
1031 if(!(cv <= 127)) return -1;
1032 }
1033 return 0;
1034}
1035
1036
1037/*** <<< CODE [Str4] >>> ***/
1038
1039int
Lev Walkindfae9752004-09-29 13:19:37 +00001040Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001041 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001042 const IA5String_t *st = sptr;
1043
1044 if(!sptr) {
1045 _ASN_ERRLOG(app_errlog, app_key,
1046 "%s: value not given (%s:%d)",
1047 td->name, __FILE__, __LINE__);
1048 return -1;
1049 }
1050
1051
1052 if(!check_permitted_alphabet_3(sptr)) {
1053 /* Constraint check succeeded */
1054 return 0;
1055 } else {
1056 _ASN_ERRLOG(app_errlog, app_key,
1057 "%s: constraint failed (%s:%d)",
1058 td->name, __FILE__, __LINE__);
1059 return -1;
1060 }
1061}
1062
1063/*
1064 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001065 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001066 */
1067static void
Lev Walkindfae9752004-09-29 13:19:37 +00001068Str4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1069 td->free_struct = asn_DEF_IA5String.free_struct;
1070 td->print_struct = asn_DEF_IA5String.print_struct;
1071 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1072 td->der_encoder = asn_DEF_IA5String.der_encoder;
1073 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1074 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1075 td->elements = asn_DEF_IA5String.elements;
1076 td->elements_count = asn_DEF_IA5String.elements_count;
1077 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001078}
1079
Lev Walkina9cc46e2004-09-22 16:06:28 +00001080void
Lev Walkindfae9752004-09-29 13:19:37 +00001081Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001082 void *struct_ptr, int contents_only) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001083 Str4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001084 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001085}
1086
1087int
Lev Walkindfae9752004-09-29 13:19:37 +00001088Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001089 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1090 Str4_inherit_TYPE_descriptor(td);
1091 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1092}
1093
Lev Walkina9cc46e2004-09-22 16:06:28 +00001094ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001095Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001096 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001097 Str4_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001098 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001099}
1100
1101asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001102Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001103 void *structure, int tag_mode, ber_tlv_tag_t tag,
1104 asn_app_consume_bytes_f *cb, void *app_key) {
1105 Str4_inherit_TYPE_descriptor(td);
1106 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1107}
1108
1109asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001110Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001111 int ilevel, enum xer_encoder_flags_e flags,
1112 asn_app_consume_bytes_f *cb, void *app_key) {
1113 Str4_inherit_TYPE_descriptor(td);
1114 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001115}
1116
1117
1118/*** <<< STAT-DEFS [Str4] >>> ***/
1119
Lev Walkindfae9752004-09-29 13:19:37 +00001120static ber_tlv_tag_t asn_DEF_Str4_tags[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001121 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1122};
Lev Walkindfae9752004-09-29 13:19:37 +00001123asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001124 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001125 Str4_free,
1126 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001127 Str4_constraint,
1128 Str4_decode_ber,
1129 Str4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001130 0, /* Not implemented yet */
1131 Str4_encode_xer,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001132 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001133 asn_DEF_Str4_tags,
1134 sizeof(asn_DEF_Str4_tags)
1135 /sizeof(asn_DEF_Str4_tags[0]), /* 1 */
1136 asn_DEF_Str4_tags, /* Same as above */
1137 sizeof(asn_DEF_Str4_tags)
1138 /sizeof(asn_DEF_Str4_tags[0]), /* 1 */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001139 0, 0, /* No members */
1140 0 /* No specifics */
1141};
1142
1143
Lev Walkin006de1c2004-08-20 13:37:45 +00001144/*** <<< INCLUDES [PER-Visible] >>> ***/
1145
1146#include <IA5String.h>
1147
1148/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1149
1150
1151typedef IA5String_t PER_Visible_t;
1152
Lev Walkin006de1c2004-08-20 13:37:45 +00001153/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1154
Lev Walkindfae9752004-09-29 13:19:37 +00001155extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001156asn_struct_free_f PER_Visible_free;
1157asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001158asn_constr_check_f PER_Visible_constraint;
1159ber_type_decoder_f PER_Visible_decode_ber;
1160der_type_encoder_f PER_Visible_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001161xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001162
1163/*** <<< CTABLES [PER-Visible] >>> ***/
1164
Lev Walkin8a99bf72004-09-10 06:07:39 +00001165static int check_permitted_alphabet_4(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001166 /* The underlying type is IA5String */
Lev Walkind1e54942004-08-21 07:34:17 +00001167 const IA5String_t *st = sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001168 const uint8_t *ch = st->buf;
1169 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001170
1171 for(; ch < end; ch++) {
1172 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001173 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001174 }
Lev Walkin775885e2004-08-22 12:47:03 +00001175 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001176}
1177
1178
1179/*** <<< CODE [PER-Visible] >>> ***/
1180
1181int
Lev Walkindfae9752004-09-29 13:19:37 +00001182PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001183 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001184 const IA5String_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001185
1186 if(!sptr) {
1187 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001188 "%s: value not given (%s:%d)",
1189 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001190 return -1;
1191 }
1192
1193
Lev Walkin8a99bf72004-09-10 06:07:39 +00001194 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001195 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001196 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001197 } else {
1198 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001199 "%s: constraint failed (%s:%d)",
1200 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001201 return -1;
1202 }
1203}
1204
1205/*
1206 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001207 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001208 */
1209static void
Lev Walkindfae9752004-09-29 13:19:37 +00001210PER_Visible_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1211 td->free_struct = asn_DEF_IA5String.free_struct;
1212 td->print_struct = asn_DEF_IA5String.print_struct;
1213 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1214 td->der_encoder = asn_DEF_IA5String.der_encoder;
1215 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1216 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1217 td->elements = asn_DEF_IA5String.elements;
1218 td->elements_count = asn_DEF_IA5String.elements_count;
1219 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001220}
1221
Lev Walkina9cc46e2004-09-22 16:06:28 +00001222void
Lev Walkindfae9752004-09-29 13:19:37 +00001223PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001224 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001225 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001226 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001227}
1228
1229int
Lev Walkindfae9752004-09-29 13:19:37 +00001230PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001231 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1232 PER_Visible_inherit_TYPE_descriptor(td);
1233 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1234}
1235
Lev Walkina9cc46e2004-09-22 16:06:28 +00001236ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001237PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001238 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001239 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001240 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001241}
1242
1243asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001244PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001245 void *structure, int tag_mode, ber_tlv_tag_t tag,
1246 asn_app_consume_bytes_f *cb, void *app_key) {
1247 PER_Visible_inherit_TYPE_descriptor(td);
1248 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1249}
1250
1251asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001252PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001253 int ilevel, enum xer_encoder_flags_e flags,
1254 asn_app_consume_bytes_f *cb, void *app_key) {
1255 PER_Visible_inherit_TYPE_descriptor(td);
1256 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001257}
1258
1259
1260/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1261
Lev Walkindfae9752004-09-29 13:19:37 +00001262static ber_tlv_tag_t asn_DEF_PER_Visible_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001263 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1264};
Lev Walkindfae9752004-09-29 13:19:37 +00001265asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001266 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001267 PER_Visible_free,
1268 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001269 PER_Visible_constraint,
1270 PER_Visible_decode_ber,
1271 PER_Visible_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001272 0, /* Not implemented yet */
1273 PER_Visible_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001274 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001275 asn_DEF_PER_Visible_tags,
1276 sizeof(asn_DEF_PER_Visible_tags)
1277 /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */
1278 asn_DEF_PER_Visible_tags, /* Same as above */
1279 sizeof(asn_DEF_PER_Visible_tags)
1280 /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001281 0, 0, /* No members */
1282 0 /* No specifics */
1283};
1284
1285
1286/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1287
1288#include <PER-Visible.h>
1289
1290/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1291
1292
1293typedef PER_Visible_t PER_Visible_2_t;
1294
Lev Walkin006de1c2004-08-20 13:37:45 +00001295/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1296
Lev Walkindfae9752004-09-29 13:19:37 +00001297extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001298asn_struct_free_f PER_Visible_2_free;
1299asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001300asn_constr_check_f PER_Visible_2_constraint;
1301ber_type_decoder_f PER_Visible_2_decode_ber;
1302der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001303xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001304
1305/*** <<< CTABLES [PER-Visible-2] >>> ***/
1306
Lev Walkin8a99bf72004-09-10 06:07:39 +00001307static int check_permitted_alphabet_5(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001308 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001309 const IA5String_t *st = sptr;
1310 const uint8_t *ch = st->buf;
1311 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001312
1313 for(; ch < end; ch++) {
1314 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001315 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001316 }
Lev Walkin775885e2004-08-22 12:47:03 +00001317 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001318}
1319
1320
1321/*** <<< CODE [PER-Visible-2] >>> ***/
1322
1323int
Lev Walkindfae9752004-09-29 13:19:37 +00001324PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001325 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001326 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001327
1328 if(!sptr) {
1329 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001330 "%s: value not given (%s:%d)",
1331 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001332 return -1;
1333 }
1334
1335
Lev Walkin8a99bf72004-09-10 06:07:39 +00001336 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001337 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001338 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001339 } else {
1340 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001341 "%s: constraint failed (%s:%d)",
1342 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001343 return -1;
1344 }
1345}
1346
1347/*
1348 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001349 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001350 */
1351static void
Lev Walkindfae9752004-09-29 13:19:37 +00001352PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1353 td->free_struct = asn_DEF_PER_Visible.free_struct;
1354 td->print_struct = asn_DEF_PER_Visible.print_struct;
1355 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1356 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1357 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1358 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1359 td->elements = asn_DEF_PER_Visible.elements;
1360 td->elements_count = asn_DEF_PER_Visible.elements_count;
1361 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001362}
1363
Lev Walkina9cc46e2004-09-22 16:06:28 +00001364void
Lev Walkindfae9752004-09-29 13:19:37 +00001365PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001366 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001367 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001368 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001369}
1370
1371int
Lev Walkindfae9752004-09-29 13:19:37 +00001372PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001373 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1374 PER_Visible_2_inherit_TYPE_descriptor(td);
1375 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1376}
1377
Lev Walkina9cc46e2004-09-22 16:06:28 +00001378ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001379PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001380 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001381 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001382 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001383}
1384
1385asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001386PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001387 void *structure, int tag_mode, ber_tlv_tag_t tag,
1388 asn_app_consume_bytes_f *cb, void *app_key) {
1389 PER_Visible_2_inherit_TYPE_descriptor(td);
1390 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1391}
1392
1393asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001394PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001395 int ilevel, enum xer_encoder_flags_e flags,
1396 asn_app_consume_bytes_f *cb, void *app_key) {
1397 PER_Visible_2_inherit_TYPE_descriptor(td);
1398 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001399}
1400
1401
1402/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1403
Lev Walkindfae9752004-09-29 13:19:37 +00001404static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001405 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001406};
Lev Walkindfae9752004-09-29 13:19:37 +00001407asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001408 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001409 PER_Visible_2_free,
1410 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001411 PER_Visible_2_constraint,
1412 PER_Visible_2_decode_ber,
1413 PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001414 0, /* Not implemented yet */
1415 PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001416 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001417 asn_DEF_PER_Visible_2_tags,
1418 sizeof(asn_DEF_PER_Visible_2_tags)
1419 /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */
1420 asn_DEF_PER_Visible_2_tags, /* Same as above */
1421 sizeof(asn_DEF_PER_Visible_2_tags)
1422 /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001423 0, 0, /* No members */
1424 0 /* No specifics */
1425};
1426
1427
1428/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1429
1430#include <PER-Visible.h>
1431
1432/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1433
1434
1435typedef PER_Visible_t Not_PER_Visible_1_t;
1436
Lev Walkin006de1c2004-08-20 13:37:45 +00001437/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1438
Lev Walkindfae9752004-09-29 13:19:37 +00001439extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001440asn_struct_free_f Not_PER_Visible_1_free;
1441asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001442asn_constr_check_f Not_PER_Visible_1_constraint;
1443ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1444der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001445xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001446
1447/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1448
Lev Walkin8a99bf72004-09-10 06:07:39 +00001449static int check_permitted_alphabet_6(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001450 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001451 const IA5String_t *st = sptr;
1452 const uint8_t *ch = st->buf;
1453 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001454
1455 for(; ch < end; ch++) {
1456 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001457 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001458 }
Lev Walkin775885e2004-08-22 12:47:03 +00001459 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001460}
1461
1462
1463/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1464
1465int
Lev Walkindfae9752004-09-29 13:19:37 +00001466Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001467 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001468 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001469
1470 if(!sptr) {
1471 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001472 "%s: value not given (%s:%d)",
1473 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001474 return -1;
1475 }
1476
1477
Lev Walkin8a99bf72004-09-10 06:07:39 +00001478 if(!check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001479 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001480 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001481 } else {
1482 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001483 "%s: constraint failed (%s:%d)",
1484 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001485 return -1;
1486 }
1487}
1488
1489/*
1490 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001491 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001492 */
1493static void
Lev Walkindfae9752004-09-29 13:19:37 +00001494Not_PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1495 td->free_struct = asn_DEF_PER_Visible.free_struct;
1496 td->print_struct = asn_DEF_PER_Visible.print_struct;
1497 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1498 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1499 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1500 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1501 td->elements = asn_DEF_PER_Visible.elements;
1502 td->elements_count = asn_DEF_PER_Visible.elements_count;
1503 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001504}
1505
Lev Walkina9cc46e2004-09-22 16:06:28 +00001506void
Lev Walkindfae9752004-09-29 13:19:37 +00001507Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001508 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001509 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001510 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001511}
1512
1513int
Lev Walkindfae9752004-09-29 13:19:37 +00001514Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001515 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1516 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1517 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1518}
1519
Lev Walkina9cc46e2004-09-22 16:06:28 +00001520ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001521Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001522 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001523 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001524 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001525}
1526
1527asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001528Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001529 void *structure, int tag_mode, ber_tlv_tag_t tag,
1530 asn_app_consume_bytes_f *cb, void *app_key) {
1531 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1532 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1533}
1534
1535asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001536Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001537 int ilevel, enum xer_encoder_flags_e flags,
1538 asn_app_consume_bytes_f *cb, void *app_key) {
1539 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1540 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001541}
1542
1543
1544/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1545
Lev Walkindfae9752004-09-29 13:19:37 +00001546static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001547 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001548};
Lev Walkindfae9752004-09-29 13:19:37 +00001549asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001550 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001551 Not_PER_Visible_1_free,
1552 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001553 Not_PER_Visible_1_constraint,
1554 Not_PER_Visible_1_decode_ber,
1555 Not_PER_Visible_1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001556 0, /* Not implemented yet */
1557 Not_PER_Visible_1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001558 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001559 asn_DEF_Not_PER_Visible_1_tags,
1560 sizeof(asn_DEF_Not_PER_Visible_1_tags)
1561 /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1562 asn_DEF_Not_PER_Visible_1_tags, /* Same as above */
1563 sizeof(asn_DEF_Not_PER_Visible_1_tags)
1564 /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001565 0, 0, /* No members */
1566 0 /* No specifics */
1567};
1568
1569
1570/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1571
1572#include <PER-Visible.h>
1573
1574/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1575
1576
1577typedef PER_Visible_t Not_PER_Visible_2_t;
1578
Lev Walkin006de1c2004-08-20 13:37:45 +00001579/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1580
Lev Walkindfae9752004-09-29 13:19:37 +00001581extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001582asn_struct_free_f Not_PER_Visible_2_free;
1583asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001584asn_constr_check_f Not_PER_Visible_2_constraint;
1585ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1586der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001587xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001588
Lev Walkind35c8b52004-08-25 02:08:08 +00001589/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1590
Lev Walkin8a99bf72004-09-10 06:07:39 +00001591static int check_permitted_alphabet_7(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001592 /* The underlying type is IA5String */
1593 const IA5String_t *st = sptr;
1594 const uint8_t *ch = st->buf;
1595 const uint8_t *end = ch + st->size;
1596
1597 for(; ch < end; ch++) {
1598 uint8_t cv = *ch;
1599 if(!(cv >= 65 && cv <= 66)) return -1;
1600 }
1601 return 0;
1602}
1603
1604
Lev Walkin006de1c2004-08-20 13:37:45 +00001605/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1606
1607int
Lev Walkindfae9752004-09-29 13:19:37 +00001608Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001609 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001610 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001611
1612 if(!sptr) {
1613 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001614 "%s: value not given (%s:%d)",
1615 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001616 return -1;
1617 }
1618
1619
Lev Walkin8a99bf72004-09-10 06:07:39 +00001620 if(!check_permitted_alphabet_7(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001621 /* Constraint check succeeded */
1622 return 0;
1623 } else {
1624 _ASN_ERRLOG(app_errlog, app_key,
1625 "%s: constraint failed (%s:%d)",
1626 td->name, __FILE__, __LINE__);
1627 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001628 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001629}
1630
1631/*
1632 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001633 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001634 */
1635static void
Lev Walkindfae9752004-09-29 13:19:37 +00001636Not_PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1637 td->free_struct = asn_DEF_PER_Visible.free_struct;
1638 td->print_struct = asn_DEF_PER_Visible.print_struct;
1639 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1640 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1641 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1642 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1643 td->elements = asn_DEF_PER_Visible.elements;
1644 td->elements_count = asn_DEF_PER_Visible.elements_count;
1645 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001646}
1647
Lev Walkina9cc46e2004-09-22 16:06:28 +00001648void
Lev Walkindfae9752004-09-29 13:19:37 +00001649Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001650 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001651 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001652 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001653}
1654
1655int
Lev Walkindfae9752004-09-29 13:19:37 +00001656Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001657 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1658 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1659 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1660}
1661
Lev Walkina9cc46e2004-09-22 16:06:28 +00001662ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001663Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001664 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001665 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001666 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001667}
1668
1669asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001670Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001671 void *structure, int tag_mode, ber_tlv_tag_t tag,
1672 asn_app_consume_bytes_f *cb, void *app_key) {
1673 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1674 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1675}
1676
1677asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001678Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001679 int ilevel, enum xer_encoder_flags_e flags,
1680 asn_app_consume_bytes_f *cb, void *app_key) {
1681 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1682 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001683}
1684
1685
1686/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1687
Lev Walkindfae9752004-09-29 13:19:37 +00001688static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001689 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001690};
Lev Walkindfae9752004-09-29 13:19:37 +00001691asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001692 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001693 Not_PER_Visible_2_free,
1694 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001695 Not_PER_Visible_2_constraint,
1696 Not_PER_Visible_2_decode_ber,
1697 Not_PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001698 0, /* Not implemented yet */
1699 Not_PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001700 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001701 asn_DEF_Not_PER_Visible_2_tags,
1702 sizeof(asn_DEF_Not_PER_Visible_2_tags)
1703 /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1704 asn_DEF_Not_PER_Visible_2_tags, /* Same as above */
1705 sizeof(asn_DEF_Not_PER_Visible_2_tags)
1706 /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001707 0, 0, /* No members */
1708 0 /* No specifics */
1709};
1710
1711
1712/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1713
1714#include <PER-Visible.h>
1715
1716/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1717
1718
1719typedef PER_Visible_t Not_PER_Visible_3_t;
1720
Lev Walkin006de1c2004-08-20 13:37:45 +00001721/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1722
Lev Walkindfae9752004-09-29 13:19:37 +00001723extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001724asn_struct_free_f Not_PER_Visible_3_free;
1725asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001726asn_constr_check_f Not_PER_Visible_3_constraint;
1727ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1728der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001729xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001730
Lev Walkind35c8b52004-08-25 02:08:08 +00001731/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1732
Lev Walkin8a99bf72004-09-10 06:07:39 +00001733static int check_permitted_alphabet_8(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001734 /* The underlying type is IA5String */
1735 const IA5String_t *st = sptr;
1736 const uint8_t *ch = st->buf;
1737 const uint8_t *end = ch + st->size;
1738
1739 for(; ch < end; ch++) {
1740 uint8_t cv = *ch;
1741 if(!(cv >= 65 && cv <= 66)) return -1;
1742 }
1743 return 0;
1744}
1745
1746
Lev Walkin006de1c2004-08-20 13:37:45 +00001747/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1748
1749int
Lev Walkindfae9752004-09-29 13:19:37 +00001750Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001751 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001752 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001753
1754 if(!sptr) {
1755 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001756 "%s: value not given (%s:%d)",
1757 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001758 return -1;
1759 }
1760
1761
Lev Walkin8a99bf72004-09-10 06:07:39 +00001762 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001763 /* Constraint check succeeded */
1764 return 0;
1765 } else {
1766 _ASN_ERRLOG(app_errlog, app_key,
1767 "%s: constraint failed (%s:%d)",
1768 td->name, __FILE__, __LINE__);
1769 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001770 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001771}
1772
1773/*
1774 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001775 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001776 */
1777static void
Lev Walkindfae9752004-09-29 13:19:37 +00001778Not_PER_Visible_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1779 td->free_struct = asn_DEF_PER_Visible.free_struct;
1780 td->print_struct = asn_DEF_PER_Visible.print_struct;
1781 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1782 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1783 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1784 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1785 td->elements = asn_DEF_PER_Visible.elements;
1786 td->elements_count = asn_DEF_PER_Visible.elements_count;
1787 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001788}
1789
Lev Walkina9cc46e2004-09-22 16:06:28 +00001790void
Lev Walkindfae9752004-09-29 13:19:37 +00001791Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001792 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001793 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001794 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001795}
1796
1797int
Lev Walkindfae9752004-09-29 13:19:37 +00001798Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001799 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1800 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1801 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1802}
1803
Lev Walkina9cc46e2004-09-22 16:06:28 +00001804ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001805Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001806 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001807 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001808 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001809}
1810
1811asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001812Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001813 void *structure, int tag_mode, ber_tlv_tag_t tag,
1814 asn_app_consume_bytes_f *cb, void *app_key) {
1815 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1816 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1817}
1818
1819asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001820Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001821 int ilevel, enum xer_encoder_flags_e flags,
1822 asn_app_consume_bytes_f *cb, void *app_key) {
1823 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1824 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001825}
1826
1827
1828/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1829
Lev Walkindfae9752004-09-29 13:19:37 +00001830static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001831 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001832};
Lev Walkindfae9752004-09-29 13:19:37 +00001833asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001834 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001835 Not_PER_Visible_3_free,
1836 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001837 Not_PER_Visible_3_constraint,
1838 Not_PER_Visible_3_decode_ber,
1839 Not_PER_Visible_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001840 0, /* Not implemented yet */
1841 Not_PER_Visible_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001842 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001843 asn_DEF_Not_PER_Visible_3_tags,
1844 sizeof(asn_DEF_Not_PER_Visible_3_tags)
1845 /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1846 asn_DEF_Not_PER_Visible_3_tags, /* Same as above */
1847 sizeof(asn_DEF_Not_PER_Visible_3_tags)
1848 /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001849 0, 0, /* No members */
1850 0 /* No specifics */
1851};
1852
1853
1854/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1855
1856#include <PER-Visible.h>
1857
1858/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1859
1860
1861typedef PER_Visible_t SIZE_but_not_FROM_t;
1862
Lev Walkin006de1c2004-08-20 13:37:45 +00001863/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1864
Lev Walkindfae9752004-09-29 13:19:37 +00001865extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001866asn_struct_free_f SIZE_but_not_FROM_free;
1867asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001868asn_constr_check_f SIZE_but_not_FROM_constraint;
1869ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1870der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001871xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001872
1873/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1874
Lev Walkin8a99bf72004-09-10 06:07:39 +00001875static int check_permitted_alphabet_9(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001876 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001877 const IA5String_t *st = sptr;
1878 const uint8_t *ch = st->buf;
1879 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001880
1881 for(; ch < end; ch++) {
1882 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00001883 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001884 }
Lev Walkin775885e2004-08-22 12:47:03 +00001885 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001886}
1887
1888
1889/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1890
1891int
Lev Walkindfae9752004-09-29 13:19:37 +00001892SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001893 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001894 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001895 size_t size;
1896
1897 if(!sptr) {
1898 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001899 "%s: value not given (%s:%d)",
1900 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001901 return -1;
1902 }
1903
1904 size = st->size;
1905
1906 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00001907 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001908 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001909 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001910 } else {
1911 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001912 "%s: constraint failed (%s:%d)",
1913 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001914 return -1;
1915 }
1916}
1917
1918/*
1919 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001920 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001921 */
1922static void
Lev Walkindfae9752004-09-29 13:19:37 +00001923SIZE_but_not_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1924 td->free_struct = asn_DEF_PER_Visible.free_struct;
1925 td->print_struct = asn_DEF_PER_Visible.print_struct;
1926 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1927 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1928 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1929 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1930 td->elements = asn_DEF_PER_Visible.elements;
1931 td->elements_count = asn_DEF_PER_Visible.elements_count;
1932 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001933}
1934
Lev Walkina9cc46e2004-09-22 16:06:28 +00001935void
Lev Walkindfae9752004-09-29 13:19:37 +00001936SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001937 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001938 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001939 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001940}
1941
1942int
Lev Walkindfae9752004-09-29 13:19:37 +00001943SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001944 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1945 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1946 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1947}
1948
Lev Walkina9cc46e2004-09-22 16:06:28 +00001949ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001950SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001951 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001952 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001953 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001954}
1955
1956asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001957SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001958 void *structure, int tag_mode, ber_tlv_tag_t tag,
1959 asn_app_consume_bytes_f *cb, void *app_key) {
1960 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1961 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1962}
1963
1964asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001965SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001966 int ilevel, enum xer_encoder_flags_e flags,
1967 asn_app_consume_bytes_f *cb, void *app_key) {
1968 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1969 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001970}
1971
1972
1973/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1974
Lev Walkindfae9752004-09-29 13:19:37 +00001975static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001976 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001977};
Lev Walkindfae9752004-09-29 13:19:37 +00001978asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001979 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001980 SIZE_but_not_FROM_free,
1981 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001982 SIZE_but_not_FROM_constraint,
1983 SIZE_but_not_FROM_decode_ber,
1984 SIZE_but_not_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001985 0, /* Not implemented yet */
1986 SIZE_but_not_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001987 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001988 asn_DEF_SIZE_but_not_FROM_tags,
1989 sizeof(asn_DEF_SIZE_but_not_FROM_tags)
1990 /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
1991 asn_DEF_SIZE_but_not_FROM_tags, /* Same as above */
1992 sizeof(asn_DEF_SIZE_but_not_FROM_tags)
1993 /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001994 0, 0, /* No members */
1995 0 /* No specifics */
1996};
1997
1998
1999/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2000
2001#include <PER-Visible.h>
2002
2003/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2004
2005
2006typedef PER_Visible_t SIZE_and_FROM_t;
2007
Lev Walkin006de1c2004-08-20 13:37:45 +00002008/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2009
Lev Walkindfae9752004-09-29 13:19:37 +00002010extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002011asn_struct_free_f SIZE_and_FROM_free;
2012asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002013asn_constr_check_f SIZE_and_FROM_constraint;
2014ber_type_decoder_f SIZE_and_FROM_decode_ber;
2015der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002016xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002017
2018/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2019
Lev Walkin8a99bf72004-09-10 06:07:39 +00002020static int check_permitted_alphabet_10(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002021 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002022 const IA5String_t *st = sptr;
2023 const uint8_t *ch = st->buf;
2024 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002025
2026 for(; ch < end; ch++) {
2027 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002028 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002029 }
Lev Walkin775885e2004-08-22 12:47:03 +00002030 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002031}
2032
2033
2034/*** <<< CODE [SIZE-and-FROM] >>> ***/
2035
2036int
Lev Walkindfae9752004-09-29 13:19:37 +00002037SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002038 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002039 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002040 size_t size;
2041
2042 if(!sptr) {
2043 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002044 "%s: value not given (%s:%d)",
2045 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002046 return -1;
2047 }
2048
2049 size = st->size;
2050
2051 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002052 && !check_permitted_alphabet_10(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002053 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002054 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002055 } else {
2056 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002057 "%s: constraint failed (%s:%d)",
2058 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002059 return -1;
2060 }
2061}
2062
2063/*
2064 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002065 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002066 */
2067static void
Lev Walkindfae9752004-09-29 13:19:37 +00002068SIZE_and_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2069 td->free_struct = asn_DEF_PER_Visible.free_struct;
2070 td->print_struct = asn_DEF_PER_Visible.print_struct;
2071 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2072 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2073 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2074 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2075 td->elements = asn_DEF_PER_Visible.elements;
2076 td->elements_count = asn_DEF_PER_Visible.elements_count;
2077 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002078}
2079
Lev Walkina9cc46e2004-09-22 16:06:28 +00002080void
Lev Walkindfae9752004-09-29 13:19:37 +00002081SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002082 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002083 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002084 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002085}
2086
2087int
Lev Walkindfae9752004-09-29 13:19:37 +00002088SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002089 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2090 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2091 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2092}
2093
Lev Walkina9cc46e2004-09-22 16:06:28 +00002094ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002095SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002096 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002097 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002098 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002099}
2100
2101asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002102SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002103 void *structure, int tag_mode, ber_tlv_tag_t tag,
2104 asn_app_consume_bytes_f *cb, void *app_key) {
2105 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2106 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2107}
2108
2109asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002110SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002111 int ilevel, enum xer_encoder_flags_e flags,
2112 asn_app_consume_bytes_f *cb, void *app_key) {
2113 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2114 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002115}
2116
2117
2118/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2119
Lev Walkindfae9752004-09-29 13:19:37 +00002120static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002121 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002122};
Lev Walkindfae9752004-09-29 13:19:37 +00002123asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002124 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002125 SIZE_and_FROM_free,
2126 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002127 SIZE_and_FROM_constraint,
2128 SIZE_and_FROM_decode_ber,
2129 SIZE_and_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002130 0, /* Not implemented yet */
2131 SIZE_and_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002132 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002133 asn_DEF_SIZE_and_FROM_tags,
2134 sizeof(asn_DEF_SIZE_and_FROM_tags)
2135 /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */
2136 asn_DEF_SIZE_and_FROM_tags, /* Same as above */
2137 sizeof(asn_DEF_SIZE_and_FROM_tags)
2138 /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002139 0, 0, /* No members */
2140 0 /* No specifics */
2141};
2142
2143
2144/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2145
2146#include <PER-Visible.h>
2147
2148/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2149
2150
2151typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2152
Lev Walkin006de1c2004-08-20 13:37:45 +00002153/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2154
Lev Walkindfae9752004-09-29 13:19:37 +00002155extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002156asn_struct_free_f Neither_SIZE_nor_FROM_free;
2157asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002158asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2159ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2160der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002161xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002162
2163/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2164
Lev Walkin8a99bf72004-09-10 06:07:39 +00002165static int check_permitted_alphabet_11(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002166 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002167 const IA5String_t *st = sptr;
2168 const uint8_t *ch = st->buf;
2169 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002170
2171 for(; ch < end; ch++) {
2172 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002173 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002174 }
Lev Walkin775885e2004-08-22 12:47:03 +00002175 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002176}
2177
2178
2179/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2180
2181int
Lev Walkindfae9752004-09-29 13:19:37 +00002182Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002183 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002184 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002185
2186 if(!sptr) {
2187 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002188 "%s: value not given (%s:%d)",
2189 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002190 return -1;
2191 }
2192
2193
Lev Walkin8a99bf72004-09-10 06:07:39 +00002194 if(!check_permitted_alphabet_11(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002195 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002196 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002197 } else {
2198 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002199 "%s: constraint failed (%s:%d)",
2200 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002201 return -1;
2202 }
2203}
2204
2205/*
2206 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002207 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002208 */
2209static void
Lev Walkindfae9752004-09-29 13:19:37 +00002210Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2211 td->free_struct = asn_DEF_PER_Visible.free_struct;
2212 td->print_struct = asn_DEF_PER_Visible.print_struct;
2213 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2214 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2215 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2216 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2217 td->elements = asn_DEF_PER_Visible.elements;
2218 td->elements_count = asn_DEF_PER_Visible.elements_count;
2219 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002220}
2221
Lev Walkina9cc46e2004-09-22 16:06:28 +00002222void
Lev Walkindfae9752004-09-29 13:19:37 +00002223Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002224 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002225 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002226 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002227}
2228
2229int
Lev Walkindfae9752004-09-29 13:19:37 +00002230Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002231 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2232 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2233 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2234}
2235
Lev Walkina9cc46e2004-09-22 16:06:28 +00002236ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002237Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002238 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002239 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002240 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002241}
2242
2243asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002244Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002245 void *structure, int tag_mode, ber_tlv_tag_t tag,
2246 asn_app_consume_bytes_f *cb, void *app_key) {
2247 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2248 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2249}
2250
2251asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002252Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002253 int ilevel, enum xer_encoder_flags_e flags,
2254 asn_app_consume_bytes_f *cb, void *app_key) {
2255 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2256 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002257}
2258
2259
2260/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2261
Lev Walkindfae9752004-09-29 13:19:37 +00002262static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002263 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002264};
Lev Walkindfae9752004-09-29 13:19:37 +00002265asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002266 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002267 Neither_SIZE_nor_FROM_free,
2268 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002269 Neither_SIZE_nor_FROM_constraint,
2270 Neither_SIZE_nor_FROM_decode_ber,
2271 Neither_SIZE_nor_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002272 0, /* Not implemented yet */
2273 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002274 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002275 asn_DEF_Neither_SIZE_nor_FROM_tags,
2276 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags)
2277 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2278 asn_DEF_Neither_SIZE_nor_FROM_tags, /* Same as above */
2279 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags)
2280 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002281 0, 0, /* No members */
2282 0 /* No specifics */
2283};
2284
2285
Lev Walkin55cc44a2004-10-03 09:14:32 +00002286/*** <<< INCLUDES [Utf8-4] >>> ***/
2287
2288#include <UTF8String.h>
2289
2290/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2291
2292
2293typedef UTF8String_t Utf8_4_t;
2294
2295/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2296
2297extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2298asn_struct_free_f Utf8_4_free;
2299asn_struct_print_f Utf8_4_print;
2300asn_constr_check_f Utf8_4_constraint;
2301ber_type_decoder_f Utf8_4_decode_ber;
2302der_type_encoder_f Utf8_4_encode_der;
2303xer_type_encoder_f Utf8_4_encode_xer;
2304
2305/*** <<< CTABLES [Utf8-4] >>> ***/
2306
2307static int check_permitted_alphabet_12(const void *sptr) {
2308 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2309 return -1; /* Alphabet (sic!) test failed. */
2310
2311 return 0;
2312}
2313
2314
2315/*** <<< CODE [Utf8-4] >>> ***/
2316
2317int
2318Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
2319 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2320 const UTF8String_t *st = sptr;
2321
2322 if(!sptr) {
2323 _ASN_ERRLOG(app_errlog, app_key,
2324 "%s: value not given (%s:%d)",
2325 td->name, __FILE__, __LINE__);
2326 return -1;
2327 }
2328
2329
2330 if(!check_permitted_alphabet_12(sptr)) {
2331 /* Constraint check succeeded */
2332 return 0;
2333 } else {
2334 _ASN_ERRLOG(app_errlog, app_key,
2335 "%s: constraint failed (%s:%d)",
2336 td->name, __FILE__, __LINE__);
2337 return -1;
2338 }
2339}
2340
2341/*
2342 * This type is implemented using UTF8String,
2343 * so here we adjust the DEF accordingly.
2344 */
2345static void
2346Utf8_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2347 td->free_struct = asn_DEF_UTF8String.free_struct;
2348 td->print_struct = asn_DEF_UTF8String.print_struct;
2349 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2350 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2351 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2352 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
2353 td->elements = asn_DEF_UTF8String.elements;
2354 td->elements_count = asn_DEF_UTF8String.elements_count;
2355 td->specifics = asn_DEF_UTF8String.specifics;
2356}
2357
2358void
2359Utf8_4_free(asn_TYPE_descriptor_t *td,
2360 void *struct_ptr, int contents_only) {
2361 Utf8_4_inherit_TYPE_descriptor(td);
2362 td->free_struct(td, struct_ptr, contents_only);
2363}
2364
2365int
2366Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2367 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2368 Utf8_4_inherit_TYPE_descriptor(td);
2369 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2370}
2371
2372ber_dec_rval_t
2373Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2374 void **structure, void *bufptr, size_t size, int tag_mode) {
2375 Utf8_4_inherit_TYPE_descriptor(td);
2376 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2377}
2378
2379asn_enc_rval_t
2380Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2381 void *structure, int tag_mode, ber_tlv_tag_t tag,
2382 asn_app_consume_bytes_f *cb, void *app_key) {
2383 Utf8_4_inherit_TYPE_descriptor(td);
2384 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2385}
2386
2387asn_enc_rval_t
2388Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2389 int ilevel, enum xer_encoder_flags_e flags,
2390 asn_app_consume_bytes_f *cb, void *app_key) {
2391 Utf8_4_inherit_TYPE_descriptor(td);
2392 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2393}
2394
2395
2396/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2397
2398static ber_tlv_tag_t asn_DEF_Utf8_4_tags[] = {
2399 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2400};
2401asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2402 "Utf8-4",
2403 Utf8_4_free,
2404 Utf8_4_print,
2405 Utf8_4_constraint,
2406 Utf8_4_decode_ber,
2407 Utf8_4_encode_der,
2408 0, /* Not implemented yet */
2409 Utf8_4_encode_xer,
2410 0, /* Use generic outmost tag fetcher */
2411 asn_DEF_Utf8_4_tags,
2412 sizeof(asn_DEF_Utf8_4_tags)
2413 /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
2414 asn_DEF_Utf8_4_tags, /* Same as above */
2415 sizeof(asn_DEF_Utf8_4_tags)
2416 /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
2417 0, 0, /* No members */
2418 0 /* No specifics */
2419};
2420
2421
Lev Walkin006de1c2004-08-20 13:37:45 +00002422/*** <<< INCLUDES [Utf8-3] >>> ***/
2423
2424#include <Utf8-2.h>
2425
2426/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2427
2428
2429typedef Utf8_2_t Utf8_3_t;
2430
Lev Walkin006de1c2004-08-20 13:37:45 +00002431/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2432
Lev Walkindfae9752004-09-29 13:19:37 +00002433extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002434asn_struct_free_f Utf8_3_free;
2435asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002436asn_constr_check_f Utf8_3_constraint;
2437ber_type_decoder_f Utf8_3_decode_ber;
2438der_type_encoder_f Utf8_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002439xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002440
2441/*** <<< CTABLES [Utf8-3] >>> ***/
2442
Lev Walkin55cc44a2004-10-03 09:14:32 +00002443static int permitted_alphabet_table_13[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000024440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24480,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
24491,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
24500,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
24511,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2452};
2453
Lev Walkin55cc44a2004-10-03 09:14:32 +00002454static int check_permitted_alphabet_13(const void *sptr) {
2455 int *table = permitted_alphabet_table_13;
Lev Walkin006de1c2004-08-20 13:37:45 +00002456 /* The underlying type is UTF8String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002457 const UTF8String_t *st = sptr;
2458 const uint8_t *ch = st->buf;
2459 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002460
2461 for(; ch < end; ch++) {
2462 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002463 if(cv >= 0x80) return -1;
2464 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002465 }
Lev Walkin775885e2004-08-22 12:47:03 +00002466 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002467}
2468
2469
2470/*** <<< CODE [Utf8-3] >>> ***/
2471
2472int
Lev Walkindfae9752004-09-29 13:19:37 +00002473Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002474 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002475 const Utf8_2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002476 size_t size;
2477
2478 if(!sptr) {
2479 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002480 "%s: value not given (%s:%d)",
2481 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002482 return -1;
2483 }
2484
Lev Walkinfac2e942004-10-02 16:33:46 +00002485 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002486 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002487 _ASN_ERRLOG(app_errlog, app_key,
2488 "%s: UTF-8: broken encoding (%s:%d)",
2489 td->name, __FILE__, __LINE__);
2490 return -1;
2491 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002492
2493 if((size >= 1 && size <= 2)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002494 && !check_permitted_alphabet_13(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002495 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002496 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002497 } else {
2498 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002499 "%s: constraint failed (%s:%d)",
2500 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002501 return -1;
2502 }
2503}
2504
2505/*
2506 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002507 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002508 */
2509static void
Lev Walkindfae9752004-09-29 13:19:37 +00002510Utf8_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2511 td->free_struct = asn_DEF_Utf8_2.free_struct;
2512 td->print_struct = asn_DEF_Utf8_2.print_struct;
2513 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
2514 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
2515 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
2516 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
2517 td->elements = asn_DEF_Utf8_2.elements;
2518 td->elements_count = asn_DEF_Utf8_2.elements_count;
2519 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002520}
2521
Lev Walkina9cc46e2004-09-22 16:06:28 +00002522void
Lev Walkindfae9752004-09-29 13:19:37 +00002523Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002524 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002525 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002526 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002527}
2528
2529int
Lev Walkindfae9752004-09-29 13:19:37 +00002530Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002531 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2532 Utf8_3_inherit_TYPE_descriptor(td);
2533 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2534}
2535
Lev Walkina9cc46e2004-09-22 16:06:28 +00002536ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002537Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002538 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002539 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002540 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002541}
2542
2543asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002544Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002545 void *structure, int tag_mode, ber_tlv_tag_t tag,
2546 asn_app_consume_bytes_f *cb, void *app_key) {
2547 Utf8_3_inherit_TYPE_descriptor(td);
2548 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2549}
2550
2551asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002552Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002553 int ilevel, enum xer_encoder_flags_e flags,
2554 asn_app_consume_bytes_f *cb, void *app_key) {
2555 Utf8_3_inherit_TYPE_descriptor(td);
2556 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002557}
2558
2559
2560/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2561
Lev Walkindfae9752004-09-29 13:19:37 +00002562static ber_tlv_tag_t asn_DEF_Utf8_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002563 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002564};
Lev Walkindfae9752004-09-29 13:19:37 +00002565asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002566 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002567 Utf8_3_free,
2568 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002569 Utf8_3_constraint,
2570 Utf8_3_decode_ber,
2571 Utf8_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002572 0, /* Not implemented yet */
2573 Utf8_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002574 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002575 asn_DEF_Utf8_3_tags,
2576 sizeof(asn_DEF_Utf8_3_tags)
2577 /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */
2578 asn_DEF_Utf8_3_tags, /* Same as above */
2579 sizeof(asn_DEF_Utf8_3_tags)
2580 /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002581 0, 0, /* No members */
2582 0 /* No specifics */
2583};
2584
2585
2586/*** <<< INCLUDES [Utf8-2] >>> ***/
2587
2588#include <Utf8-1.h>
2589
2590/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2591
2592
2593typedef Utf8_1_t Utf8_2_t;
2594
Lev Walkin006de1c2004-08-20 13:37:45 +00002595/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2596
Lev Walkindfae9752004-09-29 13:19:37 +00002597extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002598asn_struct_free_f Utf8_2_free;
2599asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002600asn_constr_check_f Utf8_2_constraint;
2601ber_type_decoder_f Utf8_2_decode_ber;
2602der_type_encoder_f Utf8_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002603xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002604
2605/*** <<< CODE [Utf8-2] >>> ***/
2606
2607int
Lev Walkindfae9752004-09-29 13:19:37 +00002608Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002609 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002610 const Utf8_1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002611 size_t size;
2612
2613 if(!sptr) {
2614 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002615 "%s: value not given (%s:%d)",
2616 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002617 return -1;
2618 }
2619
Lev Walkinfac2e942004-10-02 16:33:46 +00002620 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002621 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002622 _ASN_ERRLOG(app_errlog, app_key,
2623 "%s: UTF-8: broken encoding (%s:%d)",
2624 td->name, __FILE__, __LINE__);
2625 return -1;
2626 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002627
2628 if((size >= 1 && size <= 2)) {
2629 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002630 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002631 } else {
2632 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002633 "%s: constraint failed (%s:%d)",
2634 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002635 return -1;
2636 }
2637}
2638
2639/*
2640 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00002641 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002642 */
2643static void
Lev Walkindfae9752004-09-29 13:19:37 +00002644Utf8_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2645 td->free_struct = asn_DEF_Utf8_1.free_struct;
2646 td->print_struct = asn_DEF_Utf8_1.print_struct;
2647 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
2648 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
2649 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
2650 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
2651 td->elements = asn_DEF_Utf8_1.elements;
2652 td->elements_count = asn_DEF_Utf8_1.elements_count;
2653 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002654}
2655
Lev Walkina9cc46e2004-09-22 16:06:28 +00002656void
Lev Walkindfae9752004-09-29 13:19:37 +00002657Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002658 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002659 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002660 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002661}
2662
2663int
Lev Walkindfae9752004-09-29 13:19:37 +00002664Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002665 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2666 Utf8_2_inherit_TYPE_descriptor(td);
2667 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2668}
2669
Lev Walkina9cc46e2004-09-22 16:06:28 +00002670ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002671Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002672 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002673 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002674 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002675}
2676
2677asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002678Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002679 void *structure, int tag_mode, ber_tlv_tag_t tag,
2680 asn_app_consume_bytes_f *cb, void *app_key) {
2681 Utf8_2_inherit_TYPE_descriptor(td);
2682 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2683}
2684
2685asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002686Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002687 int ilevel, enum xer_encoder_flags_e flags,
2688 asn_app_consume_bytes_f *cb, void *app_key) {
2689 Utf8_2_inherit_TYPE_descriptor(td);
2690 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002691}
2692
2693
2694/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2695
Lev Walkindfae9752004-09-29 13:19:37 +00002696static ber_tlv_tag_t asn_DEF_Utf8_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002697 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002698};
Lev Walkindfae9752004-09-29 13:19:37 +00002699asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002700 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002701 Utf8_2_free,
2702 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002703 Utf8_2_constraint,
2704 Utf8_2_decode_ber,
2705 Utf8_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002706 0, /* Not implemented yet */
2707 Utf8_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002708 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002709 asn_DEF_Utf8_2_tags,
2710 sizeof(asn_DEF_Utf8_2_tags)
2711 /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */
2712 asn_DEF_Utf8_2_tags, /* Same as above */
2713 sizeof(asn_DEF_Utf8_2_tags)
2714 /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002715 0, 0, /* No members */
2716 0 /* No specifics */
2717};
2718
2719
2720/*** <<< INCLUDES [Utf8-1] >>> ***/
2721
2722#include <UTF8String.h>
2723
2724/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2725
2726
2727typedef UTF8String_t Utf8_1_t;
2728
Lev Walkin006de1c2004-08-20 13:37:45 +00002729/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2730
Lev Walkin154aa182004-09-26 13:12:56 +00002731/* This type is equivalent to UTF8String */
Lev Walkindfae9752004-09-29 13:19:37 +00002732#define asn_DEF_Utf8_1 asn_DEF_UTF8String
Lev Walkin006de1c2004-08-20 13:37:45 +00002733
2734/*** <<< CODE [Utf8-1] >>> ***/
2735
Lev Walkin154aa182004-09-26 13:12:56 +00002736/* This type is equivalent to UTF8String */
Lev Walkin006de1c2004-08-20 13:37:45 +00002737
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002738
2739/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
2740
2741#include <Identifier.h>
2742
2743/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
2744
2745
2746typedef Identifier_t VisibleIdentifier_t;
2747
2748/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
2749
Lev Walkin154aa182004-09-26 13:12:56 +00002750/* This type is equivalent to Identifier */
Lev Walkindfae9752004-09-29 13:19:37 +00002751#define asn_DEF_VisibleIdentifier asn_DEF_Identifier
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002752
Lev Walkin154aa182004-09-26 13:12:56 +00002753/*** <<< CODE [VisibleIdentifier] >>> ***/
2754
2755/* This type is equivalent to Identifier */
2756
2757
2758/*** <<< INCLUDES [Identifier] >>> ***/
2759
2760#include <VisibleString.h>
2761
2762/*** <<< TYPE-DECLS [Identifier] >>> ***/
2763
2764
2765typedef VisibleString_t Identifier_t;
2766
2767/*** <<< FUNC-DECLS [Identifier] >>> ***/
2768
Lev Walkindfae9752004-09-29 13:19:37 +00002769extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00002770asn_struct_free_f Identifier_free;
2771asn_struct_print_f Identifier_print;
2772asn_constr_check_f Identifier_constraint;
2773ber_type_decoder_f Identifier_decode_ber;
2774der_type_encoder_f Identifier_encode_der;
2775xer_type_encoder_f Identifier_encode_xer;
2776
2777/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002778
Lev Walkin55cc44a2004-10-03 09:14:32 +00002779static int permitted_alphabet_table_15[256] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +000027800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
27810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
27820,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
27831,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
27840,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
27851,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
27860,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
27871,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2788};
2789
Lev Walkin55cc44a2004-10-03 09:14:32 +00002790static int check_permitted_alphabet_15(const void *sptr) {
2791 int *table = permitted_alphabet_table_15;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002792 /* The underlying type is VisibleString */
2793 const VisibleString_t *st = sptr;
2794 const uint8_t *ch = st->buf;
2795 const uint8_t *end = ch + st->size;
2796
2797 for(; ch < end; ch++) {
2798 uint8_t cv = *ch;
2799 if(!table[cv]) return -1;
2800 }
2801 return 0;
2802}
2803
2804
Lev Walkin154aa182004-09-26 13:12:56 +00002805/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002806
2807int
Lev Walkindfae9752004-09-29 13:19:37 +00002808Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002809 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin154aa182004-09-26 13:12:56 +00002810 const VisibleString_t *st = sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002811 size_t size;
2812
2813 if(!sptr) {
2814 _ASN_ERRLOG(app_errlog, app_key,
2815 "%s: value not given (%s:%d)",
2816 td->name, __FILE__, __LINE__);
2817 return -1;
2818 }
2819
2820 size = st->size;
2821
2822 if((size >= 1 && size <= 32)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002823 && !check_permitted_alphabet_15(sptr)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002824 /* Constraint check succeeded */
2825 return 0;
2826 } else {
2827 _ASN_ERRLOG(app_errlog, app_key,
2828 "%s: constraint failed (%s:%d)",
2829 td->name, __FILE__, __LINE__);
2830 return -1;
2831 }
2832}
2833
2834/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002835 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00002836 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002837 */
2838static void
Lev Walkindfae9752004-09-29 13:19:37 +00002839Identifier_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2840 td->free_struct = asn_DEF_VisibleString.free_struct;
2841 td->print_struct = asn_DEF_VisibleString.print_struct;
2842 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
2843 td->der_encoder = asn_DEF_VisibleString.der_encoder;
2844 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
2845 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
2846 td->elements = asn_DEF_VisibleString.elements;
2847 td->elements_count = asn_DEF_VisibleString.elements_count;
2848 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002849}
2850
Lev Walkina9cc46e2004-09-22 16:06:28 +00002851void
Lev Walkindfae9752004-09-29 13:19:37 +00002852Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002853 void *struct_ptr, int contents_only) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002854 Identifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002855 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002856}
2857
2858int
Lev Walkindfae9752004-09-29 13:19:37 +00002859Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002860 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2861 Identifier_inherit_TYPE_descriptor(td);
2862 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2863}
2864
Lev Walkina9cc46e2004-09-22 16:06:28 +00002865ber_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002866Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002867 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002868 Identifier_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002869 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002870}
2871
2872asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002873Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002874 void *structure, int tag_mode, ber_tlv_tag_t tag,
2875 asn_app_consume_bytes_f *cb, void *app_key) {
2876 Identifier_inherit_TYPE_descriptor(td);
2877 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2878}
2879
2880asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002881Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002882 int ilevel, enum xer_encoder_flags_e flags,
2883 asn_app_consume_bytes_f *cb, void *app_key) {
2884 Identifier_inherit_TYPE_descriptor(td);
2885 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002886}
2887
2888
2889/*** <<< STAT-DEFS [Identifier] >>> ***/
2890
Lev Walkindfae9752004-09-29 13:19:37 +00002891static ber_tlv_tag_t asn_DEF_Identifier_tags[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002892 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
2893};
Lev Walkindfae9752004-09-29 13:19:37 +00002894asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002895 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002896 Identifier_free,
2897 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002898 Identifier_constraint,
2899 Identifier_decode_ber,
2900 Identifier_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002901 0, /* Not implemented yet */
2902 Identifier_encode_xer,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002903 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002904 asn_DEF_Identifier_tags,
2905 sizeof(asn_DEF_Identifier_tags)
2906 /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */
2907 asn_DEF_Identifier_tags, /* Same as above */
2908 sizeof(asn_DEF_Identifier_tags)
2909 /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002910 0, 0, /* No members */
2911 0 /* No specifics */
2912};
2913