blob: 6f4dac108c154688a386772a19f5f04d7a32b2f6 [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 Walkindc06f6b2004-10-20 15:50:55 +0000100asn_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 Walkindc06f6b2004-10-20 15:50:55 +0000131 "Int2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000132 Int2_free,
133 Int2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000134 Int2_constraint,
135 Int2_decode_ber,
136 Int2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000137 0, /* Not implemented yet */
138 Int2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000139 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000140 asn_DEF_Int2_tags,
141 sizeof(asn_DEF_Int2_tags)
142 /sizeof(asn_DEF_Int2_tags[0]), /* 1 */
143 asn_DEF_Int2_tags, /* Same as above */
144 sizeof(asn_DEF_Int2_tags)
145 /sizeof(asn_DEF_Int2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000146 0, 0, /* No members */
147 0 /* No specifics */
148};
149
150
151/*** <<< INCLUDES [Int3] >>> ***/
152
153#include <Int2.h>
154
155/*** <<< TYPE-DECLS [Int3] >>> ***/
156
157
158typedef Int2_t Int3_t;
159
Lev Walkin006de1c2004-08-20 13:37:45 +0000160/*** <<< FUNC-DECLS [Int3] >>> ***/
161
Lev Walkindfae9752004-09-29 13:19:37 +0000162extern asn_TYPE_descriptor_t asn_DEF_Int3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000163asn_struct_free_f Int3_free;
164asn_struct_print_f Int3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000165asn_constr_check_f Int3_constraint;
166ber_type_decoder_f Int3_decode_ber;
167der_type_encoder_f Int3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000168xer_type_encoder_f Int3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000169
170/*** <<< CODE [Int3] >>> ***/
171
172int
Lev Walkindfae9752004-09-29 13:19:37 +0000173Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000174 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000175 const Int2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000176 long value;
177
178 if(!sptr) {
179 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000180 "%s: value not given (%s:%d)",
181 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000182 return -1;
183 }
184
Lev Walkindfae9752004-09-29 13:19:37 +0000185 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000186 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000187 "%s: value too large (%s:%d)",
188 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000189 return -1;
190 }
191
192 if((value >= 0 && value <= 10)) {
193 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000194 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000195 } else {
196 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000197 "%s: constraint failed (%s:%d)",
198 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000199 return -1;
200 }
201}
202
203/*
204 * This type is implemented using Int2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000205 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000206 */
207static void
Lev Walkindfae9752004-09-29 13:19:37 +0000208Int3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
209 td->free_struct = asn_DEF_Int2.free_struct;
210 td->print_struct = asn_DEF_Int2.print_struct;
211 td->ber_decoder = asn_DEF_Int2.ber_decoder;
212 td->der_encoder = asn_DEF_Int2.der_encoder;
213 td->xer_decoder = asn_DEF_Int2.xer_decoder;
214 td->xer_encoder = asn_DEF_Int2.xer_encoder;
215 td->elements = asn_DEF_Int2.elements;
216 td->elements_count = asn_DEF_Int2.elements_count;
217 td->specifics = asn_DEF_Int2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000218}
219
Lev Walkina9cc46e2004-09-22 16:06:28 +0000220void
Lev Walkindfae9752004-09-29 13:19:37 +0000221Int3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000222 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000223 Int3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000224 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000225}
226
227int
Lev Walkindfae9752004-09-29 13:19:37 +0000228Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000229 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
230 Int3_inherit_TYPE_descriptor(td);
231 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
232}
233
Lev Walkindc06f6b2004-10-20 15:50:55 +0000234asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000235Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000236 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000237 Int3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000238 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000239}
240
241asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000242Int3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000243 void *structure, int tag_mode, ber_tlv_tag_t tag,
244 asn_app_consume_bytes_f *cb, void *app_key) {
245 Int3_inherit_TYPE_descriptor(td);
246 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
247}
248
249asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000250Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000251 int ilevel, enum xer_encoder_flags_e flags,
252 asn_app_consume_bytes_f *cb, void *app_key) {
253 Int3_inherit_TYPE_descriptor(td);
254 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000255}
256
257
258/*** <<< STAT-DEFS [Int3] >>> ***/
259
Lev Walkindfae9752004-09-29 13:19:37 +0000260static ber_tlv_tag_t asn_DEF_Int3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000261 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000262};
Lev Walkindfae9752004-09-29 13:19:37 +0000263asn_TYPE_descriptor_t asn_DEF_Int3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000264 "Int3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000265 "Int3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000266 Int3_free,
267 Int3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000268 Int3_constraint,
269 Int3_decode_ber,
270 Int3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000271 0, /* Not implemented yet */
272 Int3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000273 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000274 asn_DEF_Int3_tags,
275 sizeof(asn_DEF_Int3_tags)
276 /sizeof(asn_DEF_Int3_tags[0]), /* 1 */
277 asn_DEF_Int3_tags, /* Same as above */
278 sizeof(asn_DEF_Int3_tags)
279 /sizeof(asn_DEF_Int3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000280 0, 0, /* No members */
281 0 /* No specifics */
282};
283
284
285/*** <<< INCLUDES [Int4] >>> ***/
286
287#include <Int3.h>
288
289/*** <<< TYPE-DECLS [Int4] >>> ***/
290
291
292typedef Int3_t Int4_t;
293
Lev Walkin006de1c2004-08-20 13:37:45 +0000294/*** <<< FUNC-DECLS [Int4] >>> ***/
295
Lev Walkindfae9752004-09-29 13:19:37 +0000296extern asn_TYPE_descriptor_t asn_DEF_Int4;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000297asn_struct_free_f Int4_free;
298asn_struct_print_f Int4_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000299asn_constr_check_f Int4_constraint;
300ber_type_decoder_f Int4_decode_ber;
301der_type_encoder_f Int4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000302xer_type_encoder_f Int4_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000303
304/*** <<< CODE [Int4] >>> ***/
305
306int
Lev Walkindfae9752004-09-29 13:19:37 +0000307Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000308 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000309 const Int3_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000310 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000311
312 if(!sptr) {
313 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000314 "%s: value not given (%s:%d)",
315 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000316 return -1;
317 }
318
Lev Walkindfae9752004-09-29 13:19:37 +0000319 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000320 _ASN_ERRLOG(app_errlog, app_key,
321 "%s: value too large (%s:%d)",
322 td->name, __FILE__, __LINE__);
323 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000324 }
325
Lev Walkind35c8b52004-08-25 02:08:08 +0000326 if((value >= 1 && value <= 10)) {
327 /* Constraint check succeeded */
328 return 0;
329 } else {
330 _ASN_ERRLOG(app_errlog, app_key,
331 "%s: constraint failed (%s:%d)",
332 td->name, __FILE__, __LINE__);
333 return -1;
334 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000335}
336
337/*
338 * This type is implemented using Int3,
Lev Walkinc3808c12004-09-23 22:14:58 +0000339 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000340 */
341static void
Lev Walkindfae9752004-09-29 13:19:37 +0000342Int4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
343 td->free_struct = asn_DEF_Int3.free_struct;
344 td->print_struct = asn_DEF_Int3.print_struct;
345 td->ber_decoder = asn_DEF_Int3.ber_decoder;
346 td->der_encoder = asn_DEF_Int3.der_encoder;
347 td->xer_decoder = asn_DEF_Int3.xer_decoder;
348 td->xer_encoder = asn_DEF_Int3.xer_encoder;
349 td->elements = asn_DEF_Int3.elements;
350 td->elements_count = asn_DEF_Int3.elements_count;
351 td->specifics = asn_DEF_Int3.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000352}
353
Lev Walkina9cc46e2004-09-22 16:06:28 +0000354void
Lev Walkindfae9752004-09-29 13:19:37 +0000355Int4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000356 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000357 Int4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000358 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000359}
360
361int
Lev Walkindfae9752004-09-29 13:19:37 +0000362Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000363 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
364 Int4_inherit_TYPE_descriptor(td);
365 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
366}
367
Lev Walkindc06f6b2004-10-20 15:50:55 +0000368asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000369Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000370 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000371 Int4_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000372 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000373}
374
375asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000376Int4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000377 void *structure, int tag_mode, ber_tlv_tag_t tag,
378 asn_app_consume_bytes_f *cb, void *app_key) {
379 Int4_inherit_TYPE_descriptor(td);
380 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
381}
382
383asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000384Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000385 int ilevel, enum xer_encoder_flags_e flags,
386 asn_app_consume_bytes_f *cb, void *app_key) {
387 Int4_inherit_TYPE_descriptor(td);
388 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000389}
390
391
392/*** <<< STAT-DEFS [Int4] >>> ***/
393
Lev Walkindfae9752004-09-29 13:19:37 +0000394static ber_tlv_tag_t asn_DEF_Int4_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000395 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000396};
Lev Walkindfae9752004-09-29 13:19:37 +0000397asn_TYPE_descriptor_t asn_DEF_Int4 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000398 "Int4",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000399 "Int4",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000400 Int4_free,
401 Int4_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000402 Int4_constraint,
403 Int4_decode_ber,
404 Int4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000405 0, /* Not implemented yet */
406 Int4_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000407 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000408 asn_DEF_Int4_tags,
409 sizeof(asn_DEF_Int4_tags)
410 /sizeof(asn_DEF_Int4_tags[0]), /* 1 */
411 asn_DEF_Int4_tags, /* Same as above */
412 sizeof(asn_DEF_Int4_tags)
413 /sizeof(asn_DEF_Int4_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000414 0, 0, /* No members */
415 0 /* No specifics */
416};
417
418
419/*** <<< INCLUDES [Int5] >>> ***/
420
421#include <Int4.h>
422
423/*** <<< TYPE-DECLS [Int5] >>> ***/
424
425
426typedef Int4_t Int5_t;
427
Lev Walkin006de1c2004-08-20 13:37:45 +0000428/*** <<< FUNC-DECLS [Int5] >>> ***/
429
Lev Walkindfae9752004-09-29 13:19:37 +0000430extern asn_TYPE_descriptor_t asn_DEF_Int5;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000431asn_struct_free_f Int5_free;
432asn_struct_print_f Int5_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000433asn_constr_check_f Int5_constraint;
434ber_type_decoder_f Int5_decode_ber;
435der_type_encoder_f Int5_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000436xer_type_encoder_f Int5_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000437
438/*** <<< CODE [Int5] >>> ***/
439
440int
Lev Walkindfae9752004-09-29 13:19:37 +0000441Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000442 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000443 const Int4_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000444 long value;
445
446 if(!sptr) {
447 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000448 "%s: value not given (%s:%d)",
449 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000450 return -1;
451 }
452
Lev Walkindfae9752004-09-29 13:19:37 +0000453 if(asn_INTEGER2long(st, &value)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000454 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000455 "%s: value too large (%s:%d)",
456 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000457 return -1;
458 }
459
460 if((value == 5)) {
461 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000462 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000463 } else {
464 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000465 "%s: constraint failed (%s:%d)",
466 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000467 return -1;
468 }
469}
470
471/*
472 * This type is implemented using Int4,
Lev Walkinc3808c12004-09-23 22:14:58 +0000473 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000474 */
475static void
Lev Walkindfae9752004-09-29 13:19:37 +0000476Int5_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
477 td->free_struct = asn_DEF_Int4.free_struct;
478 td->print_struct = asn_DEF_Int4.print_struct;
479 td->ber_decoder = asn_DEF_Int4.ber_decoder;
480 td->der_encoder = asn_DEF_Int4.der_encoder;
481 td->xer_decoder = asn_DEF_Int4.xer_decoder;
482 td->xer_encoder = asn_DEF_Int4.xer_encoder;
483 td->elements = asn_DEF_Int4.elements;
484 td->elements_count = asn_DEF_Int4.elements_count;
485 td->specifics = asn_DEF_Int4.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000486}
487
Lev Walkina9cc46e2004-09-22 16:06:28 +0000488void
Lev Walkindfae9752004-09-29 13:19:37 +0000489Int5_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000490 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000491 Int5_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000492 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000493}
494
495int
Lev Walkindfae9752004-09-29 13:19:37 +0000496Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000497 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
498 Int5_inherit_TYPE_descriptor(td);
499 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
500}
501
Lev Walkindc06f6b2004-10-20 15:50:55 +0000502asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000503Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000504 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000505 Int5_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000506 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000507}
508
509asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000510Int5_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000511 void *structure, int tag_mode, ber_tlv_tag_t tag,
512 asn_app_consume_bytes_f *cb, void *app_key) {
513 Int5_inherit_TYPE_descriptor(td);
514 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
515}
516
517asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000518Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000519 int ilevel, enum xer_encoder_flags_e flags,
520 asn_app_consume_bytes_f *cb, void *app_key) {
521 Int5_inherit_TYPE_descriptor(td);
522 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000523}
524
525
526/*** <<< STAT-DEFS [Int5] >>> ***/
527
Lev Walkindfae9752004-09-29 13:19:37 +0000528static ber_tlv_tag_t asn_DEF_Int5_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000529 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000530};
Lev Walkindfae9752004-09-29 13:19:37 +0000531asn_TYPE_descriptor_t asn_DEF_Int5 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000532 "Int5",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000533 "Int5",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000534 Int5_free,
535 Int5_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000536 Int5_constraint,
537 Int5_decode_ber,
538 Int5_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000539 0, /* Not implemented yet */
540 Int5_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000541 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000542 asn_DEF_Int5_tags,
543 sizeof(asn_DEF_Int5_tags)
544 /sizeof(asn_DEF_Int5_tags[0]), /* 1 */
545 asn_DEF_Int5_tags, /* Same as above */
546 sizeof(asn_DEF_Int5_tags)
547 /sizeof(asn_DEF_Int5_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000548 0, 0, /* No members */
549 0 /* No specifics */
550};
551
552
553/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
554
555#include <INTEGER.h>
556
557/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
558
559
560typedef INTEGER_t ExtensibleExtensions_t;
561
Lev Walkin006de1c2004-08-20 13:37:45 +0000562/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
563
Lev Walkindfae9752004-09-29 13:19:37 +0000564extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000565asn_struct_free_f ExtensibleExtensions_free;
566asn_struct_print_f ExtensibleExtensions_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000567asn_constr_check_f ExtensibleExtensions_constraint;
568ber_type_decoder_f ExtensibleExtensions_decode_ber;
569der_type_encoder_f ExtensibleExtensions_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000570xer_type_encoder_f ExtensibleExtensions_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000571
572/*** <<< CODE [ExtensibleExtensions] >>> ***/
573
574int
Lev Walkindfae9752004-09-29 13:19:37 +0000575ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000576 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000577 const INTEGER_t *st = sptr;
Lev Walkind35c8b52004-08-25 02:08:08 +0000578 long value;
Lev Walkin006de1c2004-08-20 13:37:45 +0000579
580 if(!sptr) {
581 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000582 "%s: value not given (%s:%d)",
583 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000584 return -1;
585 }
586
Lev Walkindfae9752004-09-29 13:19:37 +0000587 if(asn_INTEGER2long(st, &value)) {
Lev Walkind35c8b52004-08-25 02:08:08 +0000588 _ASN_ERRLOG(app_errlog, app_key,
589 "%s: value too large (%s:%d)",
590 td->name, __FILE__, __LINE__);
591 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000592 }
593
Lev Walkind35c8b52004-08-25 02:08:08 +0000594 if((value >= 1 && value <= 256)) {
595 /* Constraint check succeeded */
596 return 0;
597 } else {
598 _ASN_ERRLOG(app_errlog, app_key,
599 "%s: constraint failed (%s:%d)",
600 td->name, __FILE__, __LINE__);
601 return -1;
602 }
Lev Walkin006de1c2004-08-20 13:37:45 +0000603}
604
605/*
606 * This type is implemented using INTEGER,
Lev Walkinc3808c12004-09-23 22:14:58 +0000607 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000608 */
609static void
Lev Walkindfae9752004-09-29 13:19:37 +0000610ExtensibleExtensions_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
611 td->free_struct = asn_DEF_INTEGER.free_struct;
612 td->print_struct = asn_DEF_INTEGER.print_struct;
613 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
614 td->der_encoder = asn_DEF_INTEGER.der_encoder;
615 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
616 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
617 td->elements = asn_DEF_INTEGER.elements;
618 td->elements_count = asn_DEF_INTEGER.elements_count;
619 td->specifics = asn_DEF_INTEGER.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000620}
621
Lev Walkina9cc46e2004-09-22 16:06:28 +0000622void
Lev Walkindfae9752004-09-29 13:19:37 +0000623ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000624 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000625 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000626 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000627}
628
629int
Lev Walkindfae9752004-09-29 13:19:37 +0000630ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000631 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
632 ExtensibleExtensions_inherit_TYPE_descriptor(td);
633 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
634}
635
Lev Walkindc06f6b2004-10-20 15:50:55 +0000636asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000637ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000638 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000639 ExtensibleExtensions_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000640 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000641}
642
643asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000644ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000645 void *structure, int tag_mode, ber_tlv_tag_t tag,
646 asn_app_consume_bytes_f *cb, void *app_key) {
647 ExtensibleExtensions_inherit_TYPE_descriptor(td);
648 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
649}
650
651asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000652ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000653 int ilevel, enum xer_encoder_flags_e flags,
654 asn_app_consume_bytes_f *cb, void *app_key) {
655 ExtensibleExtensions_inherit_TYPE_descriptor(td);
656 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000657}
658
659
660/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
661
Lev Walkindfae9752004-09-29 13:19:37 +0000662static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000663 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
664};
Lev Walkindfae9752004-09-29 13:19:37 +0000665asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000666 "ExtensibleExtensions",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000667 "ExtensibleExtensions",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000668 ExtensibleExtensions_free,
669 ExtensibleExtensions_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000670 ExtensibleExtensions_constraint,
671 ExtensibleExtensions_decode_ber,
672 ExtensibleExtensions_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000673 0, /* Not implemented yet */
674 ExtensibleExtensions_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000675 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000676 asn_DEF_ExtensibleExtensions_tags,
677 sizeof(asn_DEF_ExtensibleExtensions_tags)
678 /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */
679 asn_DEF_ExtensibleExtensions_tags, /* Same as above */
680 sizeof(asn_DEF_ExtensibleExtensions_tags)
681 /sizeof(asn_DEF_ExtensibleExtensions_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000682 0, 0, /* No members */
683 0 /* No specifics */
684};
685
686
687/*** <<< INCLUDES [Str1] >>> ***/
688
689#include <IA5String.h>
690
691/*** <<< TYPE-DECLS [Str1] >>> ***/
692
693
694typedef IA5String_t Str1_t;
695
Lev Walkin006de1c2004-08-20 13:37:45 +0000696/*** <<< FUNC-DECLS [Str1] >>> ***/
697
Lev Walkin154aa182004-09-26 13:12:56 +0000698/* This type is equivalent to IA5String */
Lev Walkindfae9752004-09-29 13:19:37 +0000699#define asn_DEF_Str1 asn_DEF_IA5String
Lev Walkin006de1c2004-08-20 13:37:45 +0000700
701/*** <<< CODE [Str1] >>> ***/
702
Lev Walkin154aa182004-09-26 13:12:56 +0000703/* This type is equivalent to IA5String */
Lev Walkin006de1c2004-08-20 13:37:45 +0000704
705
706/*** <<< INCLUDES [Str2] >>> ***/
707
708#include <Str1.h>
709
710/*** <<< TYPE-DECLS [Str2] >>> ***/
711
712
713typedef Str1_t Str2_t;
714
Lev Walkin006de1c2004-08-20 13:37:45 +0000715/*** <<< FUNC-DECLS [Str2] >>> ***/
716
Lev Walkindfae9752004-09-29 13:19:37 +0000717extern asn_TYPE_descriptor_t asn_DEF_Str2;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000718asn_struct_free_f Str2_free;
719asn_struct_print_f Str2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000720asn_constr_check_f Str2_constraint;
721ber_type_decoder_f Str2_decode_ber;
722der_type_encoder_f Str2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000723xer_type_encoder_f Str2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000724
725/*** <<< CTABLES [Str2] >>> ***/
726
727static int check_permitted_alphabet_1(const void *sptr) {
728 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000729 const IA5String_t *st = sptr;
730 const uint8_t *ch = st->buf;
731 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000732
733 for(; ch < end; ch++) {
734 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000735 if(!(cv <= 127)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000736 }
Lev Walkin775885e2004-08-22 12:47:03 +0000737 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000738}
739
740
741/*** <<< CODE [Str2] >>> ***/
742
743int
Lev Walkindfae9752004-09-29 13:19:37 +0000744Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000745 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000746 const Str1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000747 size_t size;
748
749 if(!sptr) {
750 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000751 "%s: value not given (%s:%d)",
752 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000753 return -1;
754 }
755
756 size = st->size;
757
758 if(((size <= 20) || (size >= 25 && size <= 30))
Lev Walkin730b15a2004-08-22 13:11:40 +0000759 && !check_permitted_alphabet_1(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000760 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000761 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000762 } else {
763 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000764 "%s: constraint failed (%s:%d)",
765 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000766 return -1;
767 }
768}
769
770/*
771 * This type is implemented using Str1,
Lev Walkinc3808c12004-09-23 22:14:58 +0000772 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000773 */
774static void
Lev Walkindfae9752004-09-29 13:19:37 +0000775Str2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
776 td->free_struct = asn_DEF_Str1.free_struct;
777 td->print_struct = asn_DEF_Str1.print_struct;
778 td->ber_decoder = asn_DEF_Str1.ber_decoder;
779 td->der_encoder = asn_DEF_Str1.der_encoder;
780 td->xer_decoder = asn_DEF_Str1.xer_decoder;
781 td->xer_encoder = asn_DEF_Str1.xer_encoder;
782 td->elements = asn_DEF_Str1.elements;
783 td->elements_count = asn_DEF_Str1.elements_count;
784 td->specifics = asn_DEF_Str1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000785}
786
Lev Walkina9cc46e2004-09-22 16:06:28 +0000787void
Lev Walkindfae9752004-09-29 13:19:37 +0000788Str2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000789 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000790 Str2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000791 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000792}
793
794int
Lev Walkindfae9752004-09-29 13:19:37 +0000795Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000796 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
797 Str2_inherit_TYPE_descriptor(td);
798 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
799}
800
Lev Walkindc06f6b2004-10-20 15:50:55 +0000801asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000802Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000803 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000804 Str2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000805 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000806}
807
808asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000809Str2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000810 void *structure, int tag_mode, ber_tlv_tag_t tag,
811 asn_app_consume_bytes_f *cb, void *app_key) {
812 Str2_inherit_TYPE_descriptor(td);
813 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
814}
815
816asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000817Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000818 int ilevel, enum xer_encoder_flags_e flags,
819 asn_app_consume_bytes_f *cb, void *app_key) {
820 Str2_inherit_TYPE_descriptor(td);
821 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000822}
823
824
825/*** <<< STAT-DEFS [Str2] >>> ***/
826
Lev Walkindfae9752004-09-29 13:19:37 +0000827static ber_tlv_tag_t asn_DEF_Str2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000828 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000829};
Lev Walkindfae9752004-09-29 13:19:37 +0000830asn_TYPE_descriptor_t asn_DEF_Str2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000831 "Str2",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000832 "Str2",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000833 Str2_free,
834 Str2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000835 Str2_constraint,
836 Str2_decode_ber,
837 Str2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000838 0, /* Not implemented yet */
839 Str2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000840 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000841 asn_DEF_Str2_tags,
842 sizeof(asn_DEF_Str2_tags)
843 /sizeof(asn_DEF_Str2_tags[0]), /* 1 */
844 asn_DEF_Str2_tags, /* Same as above */
845 sizeof(asn_DEF_Str2_tags)
846 /sizeof(asn_DEF_Str2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +0000847 0, 0, /* No members */
848 0 /* No specifics */
849};
850
851
852/*** <<< INCLUDES [Str3] >>> ***/
853
854#include <Str2.h>
855
856/*** <<< TYPE-DECLS [Str3] >>> ***/
857
858
859typedef Str2_t Str3_t;
860
Lev Walkin006de1c2004-08-20 13:37:45 +0000861/*** <<< FUNC-DECLS [Str3] >>> ***/
862
Lev Walkindfae9752004-09-29 13:19:37 +0000863extern asn_TYPE_descriptor_t asn_DEF_Str3;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000864asn_struct_free_f Str3_free;
865asn_struct_print_f Str3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +0000866asn_constr_check_f Str3_constraint;
867ber_type_decoder_f Str3_decode_ber;
868der_type_encoder_f Str3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000869xer_type_encoder_f Str3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +0000870
871/*** <<< CTABLES [Str3] >>> ***/
872
873static int permitted_alphabet_table_2[256] = {
8740,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8750,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8770,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8780,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */
8790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
8800,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */
881};
882
883static int check_permitted_alphabet_2(const void *sptr) {
884 int *table = permitted_alphabet_table_2;
885 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +0000886 const IA5String_t *st = sptr;
887 const uint8_t *ch = st->buf;
888 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000889
890 for(; ch < end; ch++) {
891 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000892 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000893 }
Lev Walkin775885e2004-08-22 12:47:03 +0000894 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000895}
896
897
898/*** <<< CODE [Str3] >>> ***/
899
900int
Lev Walkindfae9752004-09-29 13:19:37 +0000901Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000902 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +0000903 const Str2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000904 size_t size;
905
906 if(!sptr) {
907 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000908 "%s: value not given (%s:%d)",
909 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000910 return -1;
911 }
912
913 size = st->size;
914
915 if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
Lev Walkin730b15a2004-08-22 13:11:40 +0000916 && !check_permitted_alphabet_2(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000917 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000918 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000919 } else {
920 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +0000921 "%s: constraint failed (%s:%d)",
922 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000923 return -1;
924 }
925}
926
927/*
928 * This type is implemented using Str2,
Lev Walkinc3808c12004-09-23 22:14:58 +0000929 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +0000930 */
931static void
Lev Walkindfae9752004-09-29 13:19:37 +0000932Str3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
933 td->free_struct = asn_DEF_Str2.free_struct;
934 td->print_struct = asn_DEF_Str2.print_struct;
935 td->ber_decoder = asn_DEF_Str2.ber_decoder;
936 td->der_encoder = asn_DEF_Str2.der_encoder;
937 td->xer_decoder = asn_DEF_Str2.xer_decoder;
938 td->xer_encoder = asn_DEF_Str2.xer_encoder;
939 td->elements = asn_DEF_Str2.elements;
940 td->elements_count = asn_DEF_Str2.elements_count;
941 td->specifics = asn_DEF_Str2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +0000942}
943
Lev Walkina9cc46e2004-09-22 16:06:28 +0000944void
Lev Walkindfae9752004-09-29 13:19:37 +0000945Str3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000946 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000947 Str3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000948 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +0000949}
950
951int
Lev Walkindfae9752004-09-29 13:19:37 +0000952Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +0000953 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
954 Str3_inherit_TYPE_descriptor(td);
955 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
956}
957
Lev Walkindc06f6b2004-10-20 15:50:55 +0000958asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000959Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000960 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000961 Str3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +0000962 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000963}
964
965asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000966Str3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000967 void *structure, int tag_mode, ber_tlv_tag_t tag,
968 asn_app_consume_bytes_f *cb, void *app_key) {
969 Str3_inherit_TYPE_descriptor(td);
970 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
971}
972
973asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +0000974Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000975 int ilevel, enum xer_encoder_flags_e flags,
976 asn_app_consume_bytes_f *cb, void *app_key) {
977 Str3_inherit_TYPE_descriptor(td);
978 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +0000979}
980
981
982/*** <<< STAT-DEFS [Str3] >>> ***/
983
Lev Walkindfae9752004-09-29 13:19:37 +0000984static ber_tlv_tag_t asn_DEF_Str3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +0000985 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +0000986};
Lev Walkindfae9752004-09-29 13:19:37 +0000987asn_TYPE_descriptor_t asn_DEF_Str3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000988 "Str3",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000989 "Str3",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000990 Str3_free,
991 Str3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000992 Str3_constraint,
993 Str3_decode_ber,
994 Str3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000995 0, /* Not implemented yet */
996 Str3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +0000997 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +0000998 asn_DEF_Str3_tags,
999 sizeof(asn_DEF_Str3_tags)
1000 /sizeof(asn_DEF_Str3_tags[0]), /* 1 */
1001 asn_DEF_Str3_tags, /* Same as above */
1002 sizeof(asn_DEF_Str3_tags)
1003 /sizeof(asn_DEF_Str3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001004 0, 0, /* No members */
1005 0 /* No specifics */
1006};
1007
1008
Lev Walkin8a99bf72004-09-10 06:07:39 +00001009/*** <<< INCLUDES [Str4] >>> ***/
1010
1011#include <IA5String.h>
1012
1013/*** <<< TYPE-DECLS [Str4] >>> ***/
1014
1015
1016typedef IA5String_t Str4_t;
1017
1018/*** <<< FUNC-DECLS [Str4] >>> ***/
1019
Lev Walkindfae9752004-09-29 13:19:37 +00001020extern asn_TYPE_descriptor_t asn_DEF_Str4;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001021asn_struct_free_f Str4_free;
1022asn_struct_print_f Str4_print;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001023asn_constr_check_f Str4_constraint;
1024ber_type_decoder_f Str4_decode_ber;
1025der_type_encoder_f Str4_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001026xer_type_encoder_f Str4_encode_xer;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001027
1028/*** <<< CTABLES [Str4] >>> ***/
1029
1030static int check_permitted_alphabet_3(const void *sptr) {
1031 /* The underlying type is IA5String */
1032 const IA5String_t *st = sptr;
1033 const uint8_t *ch = st->buf;
1034 const uint8_t *end = ch + st->size;
1035
1036 for(; ch < end; ch++) {
1037 uint8_t cv = *ch;
1038 if(!(cv <= 127)) return -1;
1039 }
1040 return 0;
1041}
1042
1043
1044/*** <<< CODE [Str4] >>> ***/
1045
1046int
Lev Walkindfae9752004-09-29 13:19:37 +00001047Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001048 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001049 const IA5String_t *st = sptr;
1050
1051 if(!sptr) {
1052 _ASN_ERRLOG(app_errlog, app_key,
1053 "%s: value not given (%s:%d)",
1054 td->name, __FILE__, __LINE__);
1055 return -1;
1056 }
1057
1058
1059 if(!check_permitted_alphabet_3(sptr)) {
1060 /* Constraint check succeeded */
1061 return 0;
1062 } else {
1063 _ASN_ERRLOG(app_errlog, app_key,
1064 "%s: constraint failed (%s:%d)",
1065 td->name, __FILE__, __LINE__);
1066 return -1;
1067 }
1068}
1069
1070/*
1071 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001072 * so here we adjust the DEF accordingly.
Lev Walkin8a99bf72004-09-10 06:07:39 +00001073 */
1074static void
Lev Walkindfae9752004-09-29 13:19:37 +00001075Str4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1076 td->free_struct = asn_DEF_IA5String.free_struct;
1077 td->print_struct = asn_DEF_IA5String.print_struct;
1078 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1079 td->der_encoder = asn_DEF_IA5String.der_encoder;
1080 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1081 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1082 td->elements = asn_DEF_IA5String.elements;
1083 td->elements_count = asn_DEF_IA5String.elements_count;
1084 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin8a99bf72004-09-10 06:07:39 +00001085}
1086
Lev Walkina9cc46e2004-09-22 16:06:28 +00001087void
Lev Walkindfae9752004-09-29 13:19:37 +00001088Str4_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001089 void *struct_ptr, int contents_only) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001090 Str4_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001091 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001092}
1093
1094int
Lev Walkindfae9752004-09-29 13:19:37 +00001095Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001096 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1097 Str4_inherit_TYPE_descriptor(td);
1098 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1099}
1100
Lev Walkindc06f6b2004-10-20 15:50:55 +00001101asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001102Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001103 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001104 Str4_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001105 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001106}
1107
1108asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001109Str4_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001110 void *structure, int tag_mode, ber_tlv_tag_t tag,
1111 asn_app_consume_bytes_f *cb, void *app_key) {
1112 Str4_inherit_TYPE_descriptor(td);
1113 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1114}
1115
1116asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001117Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001118 int ilevel, enum xer_encoder_flags_e flags,
1119 asn_app_consume_bytes_f *cb, void *app_key) {
1120 Str4_inherit_TYPE_descriptor(td);
1121 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin8a99bf72004-09-10 06:07:39 +00001122}
1123
1124
1125/*** <<< STAT-DEFS [Str4] >>> ***/
1126
Lev Walkindfae9752004-09-29 13:19:37 +00001127static ber_tlv_tag_t asn_DEF_Str4_tags[] = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001128 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1129};
Lev Walkindfae9752004-09-29 13:19:37 +00001130asn_TYPE_descriptor_t asn_DEF_Str4 = {
Lev Walkin8a99bf72004-09-10 06:07:39 +00001131 "Str4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001132 "Str4",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001133 Str4_free,
1134 Str4_print,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001135 Str4_constraint,
1136 Str4_decode_ber,
1137 Str4_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001138 0, /* Not implemented yet */
1139 Str4_encode_xer,
Lev Walkin8a99bf72004-09-10 06:07:39 +00001140 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001141 asn_DEF_Str4_tags,
1142 sizeof(asn_DEF_Str4_tags)
1143 /sizeof(asn_DEF_Str4_tags[0]), /* 1 */
1144 asn_DEF_Str4_tags, /* Same as above */
1145 sizeof(asn_DEF_Str4_tags)
1146 /sizeof(asn_DEF_Str4_tags[0]), /* 1 */
Lev Walkin8a99bf72004-09-10 06:07:39 +00001147 0, 0, /* No members */
1148 0 /* No specifics */
1149};
1150
1151
Lev Walkin006de1c2004-08-20 13:37:45 +00001152/*** <<< INCLUDES [PER-Visible] >>> ***/
1153
1154#include <IA5String.h>
1155
1156/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
1157
1158
1159typedef IA5String_t PER_Visible_t;
1160
Lev Walkin006de1c2004-08-20 13:37:45 +00001161/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
1162
Lev Walkindfae9752004-09-29 13:19:37 +00001163extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001164asn_struct_free_f PER_Visible_free;
1165asn_struct_print_f PER_Visible_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001166asn_constr_check_f PER_Visible_constraint;
1167ber_type_decoder_f PER_Visible_decode_ber;
1168der_type_encoder_f PER_Visible_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001169xer_type_encoder_f PER_Visible_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001170
1171/*** <<< CTABLES [PER-Visible] >>> ***/
1172
Lev Walkin8a99bf72004-09-10 06:07:39 +00001173static int check_permitted_alphabet_4(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001174 /* The underlying type is IA5String */
Lev Walkind1e54942004-08-21 07:34:17 +00001175 const IA5String_t *st = sptr;
Lev Walkin634a3b82004-08-22 03:30:05 +00001176 const uint8_t *ch = st->buf;
1177 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001178
1179 for(; ch < end; ch++) {
1180 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001181 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001182 }
Lev Walkin775885e2004-08-22 12:47:03 +00001183 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001184}
1185
1186
1187/*** <<< CODE [PER-Visible] >>> ***/
1188
1189int
Lev Walkindfae9752004-09-29 13:19:37 +00001190PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001191 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001192 const IA5String_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001193
1194 if(!sptr) {
1195 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001196 "%s: value not given (%s:%d)",
1197 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001198 return -1;
1199 }
1200
1201
Lev Walkin8a99bf72004-09-10 06:07:39 +00001202 if(!check_permitted_alphabet_4(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001203 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001204 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001205 } else {
1206 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001207 "%s: constraint failed (%s:%d)",
1208 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001209 return -1;
1210 }
1211}
1212
1213/*
1214 * This type is implemented using IA5String,
Lev Walkinc3808c12004-09-23 22:14:58 +00001215 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001216 */
1217static void
Lev Walkindfae9752004-09-29 13:19:37 +00001218PER_Visible_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1219 td->free_struct = asn_DEF_IA5String.free_struct;
1220 td->print_struct = asn_DEF_IA5String.print_struct;
1221 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
1222 td->der_encoder = asn_DEF_IA5String.der_encoder;
1223 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
1224 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
1225 td->elements = asn_DEF_IA5String.elements;
1226 td->elements_count = asn_DEF_IA5String.elements_count;
1227 td->specifics = asn_DEF_IA5String.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001228}
1229
Lev Walkina9cc46e2004-09-22 16:06:28 +00001230void
Lev Walkindfae9752004-09-29 13:19:37 +00001231PER_Visible_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001232 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001233 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001234 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001235}
1236
1237int
Lev Walkindfae9752004-09-29 13:19:37 +00001238PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001239 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1240 PER_Visible_inherit_TYPE_descriptor(td);
1241 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1242}
1243
Lev Walkindc06f6b2004-10-20 15:50:55 +00001244asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001245PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001246 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001247 PER_Visible_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001248 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001249}
1250
1251asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001252PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001253 void *structure, int tag_mode, ber_tlv_tag_t tag,
1254 asn_app_consume_bytes_f *cb, void *app_key) {
1255 PER_Visible_inherit_TYPE_descriptor(td);
1256 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1257}
1258
1259asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001260PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001261 int ilevel, enum xer_encoder_flags_e flags,
1262 asn_app_consume_bytes_f *cb, void *app_key) {
1263 PER_Visible_inherit_TYPE_descriptor(td);
1264 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001265}
1266
1267
1268/*** <<< STAT-DEFS [PER-Visible] >>> ***/
1269
Lev Walkindfae9752004-09-29 13:19:37 +00001270static ber_tlv_tag_t asn_DEF_PER_Visible_tags[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001271 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
1272};
Lev Walkindfae9752004-09-29 13:19:37 +00001273asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001274 "PER-Visible",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001275 "PER-Visible",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001276 PER_Visible_free,
1277 PER_Visible_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001278 PER_Visible_constraint,
1279 PER_Visible_decode_ber,
1280 PER_Visible_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001281 0, /* Not implemented yet */
1282 PER_Visible_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001283 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001284 asn_DEF_PER_Visible_tags,
1285 sizeof(asn_DEF_PER_Visible_tags)
1286 /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */
1287 asn_DEF_PER_Visible_tags, /* Same as above */
1288 sizeof(asn_DEF_PER_Visible_tags)
1289 /sizeof(asn_DEF_PER_Visible_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001290 0, 0, /* No members */
1291 0 /* No specifics */
1292};
1293
1294
1295/*** <<< INCLUDES [PER-Visible-2] >>> ***/
1296
1297#include <PER-Visible.h>
1298
1299/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
1300
1301
1302typedef PER_Visible_t PER_Visible_2_t;
1303
Lev Walkin006de1c2004-08-20 13:37:45 +00001304/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
1305
Lev Walkindfae9752004-09-29 13:19:37 +00001306extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001307asn_struct_free_f PER_Visible_2_free;
1308asn_struct_print_f PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001309asn_constr_check_f PER_Visible_2_constraint;
1310ber_type_decoder_f PER_Visible_2_decode_ber;
1311der_type_encoder_f PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001312xer_type_encoder_f PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001313
1314/*** <<< CTABLES [PER-Visible-2] >>> ***/
1315
Lev Walkin8a99bf72004-09-10 06:07:39 +00001316static int check_permitted_alphabet_5(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001317 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001318 const IA5String_t *st = sptr;
1319 const uint8_t *ch = st->buf;
1320 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001321
1322 for(; ch < end; ch++) {
1323 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001324 if(!(cv >= 69 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001325 }
Lev Walkin775885e2004-08-22 12:47:03 +00001326 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001327}
1328
1329
1330/*** <<< CODE [PER-Visible-2] >>> ***/
1331
1332int
Lev Walkindfae9752004-09-29 13:19:37 +00001333PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001334 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001335 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001336
1337 if(!sptr) {
1338 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001339 "%s: value not given (%s:%d)",
1340 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001341 return -1;
1342 }
1343
1344
Lev Walkin8a99bf72004-09-10 06:07:39 +00001345 if(!check_permitted_alphabet_5(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001346 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001347 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001348 } else {
1349 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001350 "%s: constraint failed (%s:%d)",
1351 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001352 return -1;
1353 }
1354}
1355
1356/*
1357 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001358 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001359 */
1360static void
Lev Walkindfae9752004-09-29 13:19:37 +00001361PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1362 td->free_struct = asn_DEF_PER_Visible.free_struct;
1363 td->print_struct = asn_DEF_PER_Visible.print_struct;
1364 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1365 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1366 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1367 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1368 td->elements = asn_DEF_PER_Visible.elements;
1369 td->elements_count = asn_DEF_PER_Visible.elements_count;
1370 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001371}
1372
Lev Walkina9cc46e2004-09-22 16:06:28 +00001373void
Lev Walkindfae9752004-09-29 13:19:37 +00001374PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001375 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001376 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001377 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001378}
1379
1380int
Lev Walkindfae9752004-09-29 13:19:37 +00001381PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001382 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1383 PER_Visible_2_inherit_TYPE_descriptor(td);
1384 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1385}
1386
Lev Walkindc06f6b2004-10-20 15:50:55 +00001387asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001388PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001389 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001390 PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001391 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001392}
1393
1394asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001395PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001396 void *structure, int tag_mode, ber_tlv_tag_t tag,
1397 asn_app_consume_bytes_f *cb, void *app_key) {
1398 PER_Visible_2_inherit_TYPE_descriptor(td);
1399 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1400}
1401
1402asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001403PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001404 int ilevel, enum xer_encoder_flags_e flags,
1405 asn_app_consume_bytes_f *cb, void *app_key) {
1406 PER_Visible_2_inherit_TYPE_descriptor(td);
1407 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001408}
1409
1410
1411/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
1412
Lev Walkindfae9752004-09-29 13:19:37 +00001413static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001414 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001415};
Lev Walkindfae9752004-09-29 13:19:37 +00001416asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001417 "PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001418 "PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001419 PER_Visible_2_free,
1420 PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001421 PER_Visible_2_constraint,
1422 PER_Visible_2_decode_ber,
1423 PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001424 0, /* Not implemented yet */
1425 PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001426 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001427 asn_DEF_PER_Visible_2_tags,
1428 sizeof(asn_DEF_PER_Visible_2_tags)
1429 /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */
1430 asn_DEF_PER_Visible_2_tags, /* Same as above */
1431 sizeof(asn_DEF_PER_Visible_2_tags)
1432 /sizeof(asn_DEF_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001433 0, 0, /* No members */
1434 0 /* No specifics */
1435};
1436
1437
1438/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
1439
1440#include <PER-Visible.h>
1441
1442/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
1443
1444
1445typedef PER_Visible_t Not_PER_Visible_1_t;
1446
Lev Walkin006de1c2004-08-20 13:37:45 +00001447/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
1448
Lev Walkindfae9752004-09-29 13:19:37 +00001449extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001450asn_struct_free_f Not_PER_Visible_1_free;
1451asn_struct_print_f Not_PER_Visible_1_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001452asn_constr_check_f Not_PER_Visible_1_constraint;
1453ber_type_decoder_f Not_PER_Visible_1_decode_ber;
1454der_type_encoder_f Not_PER_Visible_1_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001455xer_type_encoder_f Not_PER_Visible_1_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001456
1457/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
1458
Lev Walkin8a99bf72004-09-10 06:07:39 +00001459static int check_permitted_alphabet_6(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001460 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001461 const IA5String_t *st = sptr;
1462 const uint8_t *ch = st->buf;
1463 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001464
1465 for(; ch < end; ch++) {
1466 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00001467 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001468 }
Lev Walkin775885e2004-08-22 12:47:03 +00001469 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001470}
1471
1472
1473/*** <<< CODE [Not-PER-Visible-1] >>> ***/
1474
1475int
Lev Walkindfae9752004-09-29 13:19:37 +00001476Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001477 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001478 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001479
1480 if(!sptr) {
1481 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001482 "%s: value not given (%s:%d)",
1483 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001484 return -1;
1485 }
1486
1487
Lev Walkin8a99bf72004-09-10 06:07:39 +00001488 if(!check_permitted_alphabet_6(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001489 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001490 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001491 } else {
1492 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001493 "%s: constraint failed (%s:%d)",
1494 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001495 return -1;
1496 }
1497}
1498
1499/*
1500 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001501 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001502 */
1503static void
Lev Walkindfae9752004-09-29 13:19:37 +00001504Not_PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1505 td->free_struct = asn_DEF_PER_Visible.free_struct;
1506 td->print_struct = asn_DEF_PER_Visible.print_struct;
1507 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1508 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1509 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1510 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1511 td->elements = asn_DEF_PER_Visible.elements;
1512 td->elements_count = asn_DEF_PER_Visible.elements_count;
1513 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001514}
1515
Lev Walkina9cc46e2004-09-22 16:06:28 +00001516void
Lev Walkindfae9752004-09-29 13:19:37 +00001517Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001518 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001519 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001520 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001521}
1522
1523int
Lev Walkindfae9752004-09-29 13:19:37 +00001524Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001525 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1526 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1527 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1528}
1529
Lev Walkindc06f6b2004-10-20 15:50:55 +00001530asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001531Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001532 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001533 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001534 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001535}
1536
1537asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001538Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001539 void *structure, int tag_mode, ber_tlv_tag_t tag,
1540 asn_app_consume_bytes_f *cb, void *app_key) {
1541 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1542 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1543}
1544
1545asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001546Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001547 int ilevel, enum xer_encoder_flags_e flags,
1548 asn_app_consume_bytes_f *cb, void *app_key) {
1549 Not_PER_Visible_1_inherit_TYPE_descriptor(td);
1550 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001551}
1552
1553
1554/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
1555
Lev Walkindfae9752004-09-29 13:19:37 +00001556static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001557 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001558};
Lev Walkindfae9752004-09-29 13:19:37 +00001559asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001560 "Not-PER-Visible-1",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001561 "Not-PER-Visible-1",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001562 Not_PER_Visible_1_free,
1563 Not_PER_Visible_1_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001564 Not_PER_Visible_1_constraint,
1565 Not_PER_Visible_1_decode_ber,
1566 Not_PER_Visible_1_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001567 0, /* Not implemented yet */
1568 Not_PER_Visible_1_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001569 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001570 asn_DEF_Not_PER_Visible_1_tags,
1571 sizeof(asn_DEF_Not_PER_Visible_1_tags)
1572 /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
1573 asn_DEF_Not_PER_Visible_1_tags, /* Same as above */
1574 sizeof(asn_DEF_Not_PER_Visible_1_tags)
1575 /sizeof(asn_DEF_Not_PER_Visible_1_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001576 0, 0, /* No members */
1577 0 /* No specifics */
1578};
1579
1580
1581/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
1582
1583#include <PER-Visible.h>
1584
1585/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
1586
1587
1588typedef PER_Visible_t Not_PER_Visible_2_t;
1589
Lev Walkin006de1c2004-08-20 13:37:45 +00001590/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
1591
Lev Walkindfae9752004-09-29 13:19:37 +00001592extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001593asn_struct_free_f Not_PER_Visible_2_free;
1594asn_struct_print_f Not_PER_Visible_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001595asn_constr_check_f Not_PER_Visible_2_constraint;
1596ber_type_decoder_f Not_PER_Visible_2_decode_ber;
1597der_type_encoder_f Not_PER_Visible_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001598xer_type_encoder_f Not_PER_Visible_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001599
Lev Walkind35c8b52004-08-25 02:08:08 +00001600/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
1601
Lev Walkin8a99bf72004-09-10 06:07:39 +00001602static int check_permitted_alphabet_7(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001603 /* The underlying type is IA5String */
1604 const IA5String_t *st = sptr;
1605 const uint8_t *ch = st->buf;
1606 const uint8_t *end = ch + st->size;
1607
1608 for(; ch < end; ch++) {
1609 uint8_t cv = *ch;
1610 if(!(cv >= 65 && cv <= 66)) return -1;
1611 }
1612 return 0;
1613}
1614
1615
Lev Walkin006de1c2004-08-20 13:37:45 +00001616/*** <<< CODE [Not-PER-Visible-2] >>> ***/
1617
1618int
Lev Walkindfae9752004-09-29 13:19:37 +00001619Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001620 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001621 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001622
1623 if(!sptr) {
1624 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001625 "%s: value not given (%s:%d)",
1626 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001627 return -1;
1628 }
1629
1630
Lev Walkin8a99bf72004-09-10 06:07:39 +00001631 if(!check_permitted_alphabet_7(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001632 /* Constraint check succeeded */
1633 return 0;
1634 } else {
1635 _ASN_ERRLOG(app_errlog, app_key,
1636 "%s: constraint failed (%s:%d)",
1637 td->name, __FILE__, __LINE__);
1638 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001639 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001640}
1641
1642/*
1643 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001644 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001645 */
1646static void
Lev Walkindfae9752004-09-29 13:19:37 +00001647Not_PER_Visible_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1648 td->free_struct = asn_DEF_PER_Visible.free_struct;
1649 td->print_struct = asn_DEF_PER_Visible.print_struct;
1650 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1651 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1652 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1653 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1654 td->elements = asn_DEF_PER_Visible.elements;
1655 td->elements_count = asn_DEF_PER_Visible.elements_count;
1656 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001657}
1658
Lev Walkina9cc46e2004-09-22 16:06:28 +00001659void
Lev Walkindfae9752004-09-29 13:19:37 +00001660Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001661 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001662 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001663 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001664}
1665
1666int
Lev Walkindfae9752004-09-29 13:19:37 +00001667Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001668 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1669 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1670 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1671}
1672
Lev Walkindc06f6b2004-10-20 15:50:55 +00001673asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001674Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001675 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001676 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001677 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001678}
1679
1680asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001681Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001682 void *structure, int tag_mode, ber_tlv_tag_t tag,
1683 asn_app_consume_bytes_f *cb, void *app_key) {
1684 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1685 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1686}
1687
1688asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001689Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001690 int ilevel, enum xer_encoder_flags_e flags,
1691 asn_app_consume_bytes_f *cb, void *app_key) {
1692 Not_PER_Visible_2_inherit_TYPE_descriptor(td);
1693 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001694}
1695
1696
1697/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
1698
Lev Walkindfae9752004-09-29 13:19:37 +00001699static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001700 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001701};
Lev Walkindfae9752004-09-29 13:19:37 +00001702asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001703 "Not-PER-Visible-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001704 "Not-PER-Visible-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001705 Not_PER_Visible_2_free,
1706 Not_PER_Visible_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001707 Not_PER_Visible_2_constraint,
1708 Not_PER_Visible_2_decode_ber,
1709 Not_PER_Visible_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001710 0, /* Not implemented yet */
1711 Not_PER_Visible_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001712 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001713 asn_DEF_Not_PER_Visible_2_tags,
1714 sizeof(asn_DEF_Not_PER_Visible_2_tags)
1715 /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
1716 asn_DEF_Not_PER_Visible_2_tags, /* Same as above */
1717 sizeof(asn_DEF_Not_PER_Visible_2_tags)
1718 /sizeof(asn_DEF_Not_PER_Visible_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001719 0, 0, /* No members */
1720 0 /* No specifics */
1721};
1722
1723
1724/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
1725
1726#include <PER-Visible.h>
1727
1728/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
1729
1730
1731typedef PER_Visible_t Not_PER_Visible_3_t;
1732
Lev Walkin006de1c2004-08-20 13:37:45 +00001733/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
1734
Lev Walkindfae9752004-09-29 13:19:37 +00001735extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001736asn_struct_free_f Not_PER_Visible_3_free;
1737asn_struct_print_f Not_PER_Visible_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001738asn_constr_check_f Not_PER_Visible_3_constraint;
1739ber_type_decoder_f Not_PER_Visible_3_decode_ber;
1740der_type_encoder_f Not_PER_Visible_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001741xer_type_encoder_f Not_PER_Visible_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001742
Lev Walkind35c8b52004-08-25 02:08:08 +00001743/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
1744
Lev Walkin8a99bf72004-09-10 06:07:39 +00001745static int check_permitted_alphabet_8(const void *sptr) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001746 /* The underlying type is IA5String */
1747 const IA5String_t *st = sptr;
1748 const uint8_t *ch = st->buf;
1749 const uint8_t *end = ch + st->size;
1750
1751 for(; ch < end; ch++) {
1752 uint8_t cv = *ch;
1753 if(!(cv >= 65 && cv <= 66)) return -1;
1754 }
1755 return 0;
1756}
1757
1758
Lev Walkin006de1c2004-08-20 13:37:45 +00001759/*** <<< CODE [Not-PER-Visible-3] >>> ***/
1760
1761int
Lev Walkindfae9752004-09-29 13:19:37 +00001762Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001763 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001764 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001765
1766 if(!sptr) {
1767 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001768 "%s: value not given (%s:%d)",
1769 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001770 return -1;
1771 }
1772
1773
Lev Walkin8a99bf72004-09-10 06:07:39 +00001774 if(!check_permitted_alphabet_8(sptr)) {
Lev Walkind35c8b52004-08-25 02:08:08 +00001775 /* Constraint check succeeded */
1776 return 0;
1777 } else {
1778 _ASN_ERRLOG(app_errlog, app_key,
1779 "%s: constraint failed (%s:%d)",
1780 td->name, __FILE__, __LINE__);
1781 return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001782 }
Lev Walkin006de1c2004-08-20 13:37:45 +00001783}
1784
1785/*
1786 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001787 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001788 */
1789static void
Lev Walkindfae9752004-09-29 13:19:37 +00001790Not_PER_Visible_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1791 td->free_struct = asn_DEF_PER_Visible.free_struct;
1792 td->print_struct = asn_DEF_PER_Visible.print_struct;
1793 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1794 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1795 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1796 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1797 td->elements = asn_DEF_PER_Visible.elements;
1798 td->elements_count = asn_DEF_PER_Visible.elements_count;
1799 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001800}
1801
Lev Walkina9cc46e2004-09-22 16:06:28 +00001802void
Lev Walkindfae9752004-09-29 13:19:37 +00001803Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001804 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001805 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001806 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001807}
1808
1809int
Lev Walkindfae9752004-09-29 13:19:37 +00001810Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001811 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1812 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1813 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1814}
1815
Lev Walkindc06f6b2004-10-20 15:50:55 +00001816asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001817Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001818 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001819 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001820 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001821}
1822
1823asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001824Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001825 void *structure, int tag_mode, ber_tlv_tag_t tag,
1826 asn_app_consume_bytes_f *cb, void *app_key) {
1827 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1828 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1829}
1830
1831asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001832Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001833 int ilevel, enum xer_encoder_flags_e flags,
1834 asn_app_consume_bytes_f *cb, void *app_key) {
1835 Not_PER_Visible_3_inherit_TYPE_descriptor(td);
1836 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001837}
1838
1839
1840/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
1841
Lev Walkindfae9752004-09-29 13:19:37 +00001842static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001843 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001844};
Lev Walkindfae9752004-09-29 13:19:37 +00001845asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001846 "Not-PER-Visible-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001847 "Not-PER-Visible-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001848 Not_PER_Visible_3_free,
1849 Not_PER_Visible_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001850 Not_PER_Visible_3_constraint,
1851 Not_PER_Visible_3_decode_ber,
1852 Not_PER_Visible_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001853 0, /* Not implemented yet */
1854 Not_PER_Visible_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00001855 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00001856 asn_DEF_Not_PER_Visible_3_tags,
1857 sizeof(asn_DEF_Not_PER_Visible_3_tags)
1858 /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
1859 asn_DEF_Not_PER_Visible_3_tags, /* Same as above */
1860 sizeof(asn_DEF_Not_PER_Visible_3_tags)
1861 /sizeof(asn_DEF_Not_PER_Visible_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00001862 0, 0, /* No members */
1863 0 /* No specifics */
1864};
1865
1866
1867/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
1868
1869#include <PER-Visible.h>
1870
1871/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
1872
1873
1874typedef PER_Visible_t SIZE_but_not_FROM_t;
1875
Lev Walkin006de1c2004-08-20 13:37:45 +00001876/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
1877
Lev Walkindfae9752004-09-29 13:19:37 +00001878extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001879asn_struct_free_f SIZE_but_not_FROM_free;
1880asn_struct_print_f SIZE_but_not_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00001881asn_constr_check_f SIZE_but_not_FROM_constraint;
1882ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
1883der_type_encoder_f SIZE_but_not_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00001884xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00001885
1886/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
1887
Lev Walkin8a99bf72004-09-10 06:07:39 +00001888static int check_permitted_alphabet_9(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001889 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00001890 const IA5String_t *st = sptr;
1891 const uint8_t *ch = st->buf;
1892 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00001893
1894 for(; ch < end; ch++) {
1895 uint8_t cv = *ch;
Lev Walkind35c8b52004-08-25 02:08:08 +00001896 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00001897 }
Lev Walkin775885e2004-08-22 12:47:03 +00001898 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001899}
1900
1901
1902/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
1903
1904int
Lev Walkindfae9752004-09-29 13:19:37 +00001905SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001906 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00001907 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00001908 size_t size;
1909
1910 if(!sptr) {
1911 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001912 "%s: value not given (%s:%d)",
1913 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001914 return -1;
1915 }
1916
1917 size = st->size;
1918
1919 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00001920 && !check_permitted_alphabet_9(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001921 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00001922 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00001923 } else {
1924 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00001925 "%s: constraint failed (%s:%d)",
1926 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00001927 return -1;
1928 }
1929}
1930
1931/*
1932 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00001933 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00001934 */
1935static void
Lev Walkindfae9752004-09-29 13:19:37 +00001936SIZE_but_not_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
1937 td->free_struct = asn_DEF_PER_Visible.free_struct;
1938 td->print_struct = asn_DEF_PER_Visible.print_struct;
1939 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
1940 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
1941 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
1942 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
1943 td->elements = asn_DEF_PER_Visible.elements;
1944 td->elements_count = asn_DEF_PER_Visible.elements_count;
1945 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00001946}
1947
Lev Walkina9cc46e2004-09-22 16:06:28 +00001948void
Lev Walkindfae9752004-09-29 13:19:37 +00001949SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001950 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001951 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001952 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00001953}
1954
1955int
Lev Walkindfae9752004-09-29 13:19:37 +00001956SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00001957 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
1958 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1959 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
1960}
1961
Lev Walkindc06f6b2004-10-20 15:50:55 +00001962asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001963SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001964 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00001965 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00001966 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00001967}
1968
1969asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001970SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001971 void *structure, int tag_mode, ber_tlv_tag_t tag,
1972 asn_app_consume_bytes_f *cb, void *app_key) {
1973 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1974 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
1975}
1976
1977asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00001978SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001979 int ilevel, enum xer_encoder_flags_e flags,
1980 asn_app_consume_bytes_f *cb, void *app_key) {
1981 SIZE_but_not_FROM_inherit_TYPE_descriptor(td);
1982 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00001983}
1984
1985
1986/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
1987
Lev Walkindfae9752004-09-29 13:19:37 +00001988static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00001989 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00001990};
Lev Walkindfae9752004-09-29 13:19:37 +00001991asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00001992 "SIZE-but-not-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00001993 "SIZE-but-not-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00001994 SIZE_but_not_FROM_free,
1995 SIZE_but_not_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00001996 SIZE_but_not_FROM_constraint,
1997 SIZE_but_not_FROM_decode_ber,
1998 SIZE_but_not_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00001999 0, /* Not implemented yet */
2000 SIZE_but_not_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002001 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002002 asn_DEF_SIZE_but_not_FROM_tags,
2003 sizeof(asn_DEF_SIZE_but_not_FROM_tags)
2004 /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
2005 asn_DEF_SIZE_but_not_FROM_tags, /* Same as above */
2006 sizeof(asn_DEF_SIZE_but_not_FROM_tags)
2007 /sizeof(asn_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002008 0, 0, /* No members */
2009 0 /* No specifics */
2010};
2011
2012
2013/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
2014
2015#include <PER-Visible.h>
2016
2017/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
2018
2019
2020typedef PER_Visible_t SIZE_and_FROM_t;
2021
Lev Walkin006de1c2004-08-20 13:37:45 +00002022/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
2023
Lev Walkindfae9752004-09-29 13:19:37 +00002024extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002025asn_struct_free_f SIZE_and_FROM_free;
2026asn_struct_print_f SIZE_and_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002027asn_constr_check_f SIZE_and_FROM_constraint;
2028ber_type_decoder_f SIZE_and_FROM_decode_ber;
2029der_type_encoder_f SIZE_and_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002030xer_type_encoder_f SIZE_and_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002031
2032/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
2033
Lev Walkin8a99bf72004-09-10 06:07:39 +00002034static int check_permitted_alphabet_10(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002035 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002036 const IA5String_t *st = sptr;
2037 const uint8_t *ch = st->buf;
2038 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002039
2040 for(; ch < end; ch++) {
2041 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002042 if(!(cv >= 65 && cv <= 68)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002043 }
Lev Walkin775885e2004-08-22 12:47:03 +00002044 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002045}
2046
2047
2048/*** <<< CODE [SIZE-and-FROM] >>> ***/
2049
2050int
Lev Walkindfae9752004-09-29 13:19:37 +00002051SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002052 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002053 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002054 size_t size;
2055
2056 if(!sptr) {
2057 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002058 "%s: value not given (%s:%d)",
2059 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002060 return -1;
2061 }
2062
2063 size = st->size;
2064
2065 if((size >= 1 && size <= 4)
Lev Walkin8a99bf72004-09-10 06:07:39 +00002066 && !check_permitted_alphabet_10(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002067 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002068 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002069 } else {
2070 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002071 "%s: constraint failed (%s:%d)",
2072 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002073 return -1;
2074 }
2075}
2076
2077/*
2078 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002079 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002080 */
2081static void
Lev Walkindfae9752004-09-29 13:19:37 +00002082SIZE_and_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2083 td->free_struct = asn_DEF_PER_Visible.free_struct;
2084 td->print_struct = asn_DEF_PER_Visible.print_struct;
2085 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2086 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2087 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2088 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2089 td->elements = asn_DEF_PER_Visible.elements;
2090 td->elements_count = asn_DEF_PER_Visible.elements_count;
2091 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002092}
2093
Lev Walkina9cc46e2004-09-22 16:06:28 +00002094void
Lev Walkindfae9752004-09-29 13:19:37 +00002095SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002096 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002097 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002098 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002099}
2100
2101int
Lev Walkindfae9752004-09-29 13:19:37 +00002102SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002103 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2104 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2105 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2106}
2107
Lev Walkindc06f6b2004-10-20 15:50:55 +00002108asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002109SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002110 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002111 SIZE_and_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002112 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002113}
2114
2115asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002116SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002117 void *structure, int tag_mode, ber_tlv_tag_t tag,
2118 asn_app_consume_bytes_f *cb, void *app_key) {
2119 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2120 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2121}
2122
2123asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002124SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002125 int ilevel, enum xer_encoder_flags_e flags,
2126 asn_app_consume_bytes_f *cb, void *app_key) {
2127 SIZE_and_FROM_inherit_TYPE_descriptor(td);
2128 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002129}
2130
2131
2132/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
2133
Lev Walkindfae9752004-09-29 13:19:37 +00002134static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002135 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002136};
Lev Walkindfae9752004-09-29 13:19:37 +00002137asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002138 "SIZE-and-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002139 "SIZE-and-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002140 SIZE_and_FROM_free,
2141 SIZE_and_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002142 SIZE_and_FROM_constraint,
2143 SIZE_and_FROM_decode_ber,
2144 SIZE_and_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002145 0, /* Not implemented yet */
2146 SIZE_and_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002147 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002148 asn_DEF_SIZE_and_FROM_tags,
2149 sizeof(asn_DEF_SIZE_and_FROM_tags)
2150 /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */
2151 asn_DEF_SIZE_and_FROM_tags, /* Same as above */
2152 sizeof(asn_DEF_SIZE_and_FROM_tags)
2153 /sizeof(asn_DEF_SIZE_and_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002154 0, 0, /* No members */
2155 0 /* No specifics */
2156};
2157
2158
2159/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
2160
2161#include <PER-Visible.h>
2162
2163/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2164
2165
2166typedef PER_Visible_t Neither_SIZE_nor_FROM_t;
2167
Lev Walkin006de1c2004-08-20 13:37:45 +00002168/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
2169
Lev Walkindfae9752004-09-29 13:19:37 +00002170extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002171asn_struct_free_f Neither_SIZE_nor_FROM_free;
2172asn_struct_print_f Neither_SIZE_nor_FROM_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002173asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
2174ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
2175der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002176xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002177
2178/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
2179
Lev Walkin8a99bf72004-09-10 06:07:39 +00002180static int check_permitted_alphabet_11(const void *sptr) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002181 /* The underlying type is IA5String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002182 const IA5String_t *st = sptr;
2183 const uint8_t *ch = st->buf;
2184 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002185
2186 for(; ch < end; ch++) {
2187 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002188 if(!(cv >= 65 && cv <= 70)) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002189 }
Lev Walkin775885e2004-08-22 12:47:03 +00002190 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002191}
2192
2193
2194/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
2195
2196int
Lev Walkindfae9752004-09-29 13:19:37 +00002197Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002198 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002199 const PER_Visible_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002200
2201 if(!sptr) {
2202 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002203 "%s: value not given (%s:%d)",
2204 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002205 return -1;
2206 }
2207
2208
Lev Walkin8a99bf72004-09-10 06:07:39 +00002209 if(!check_permitted_alphabet_11(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002210 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002211 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002212 } else {
2213 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002214 "%s: constraint failed (%s:%d)",
2215 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002216 return -1;
2217 }
2218}
2219
2220/*
2221 * This type is implemented using PER_Visible,
Lev Walkinc3808c12004-09-23 22:14:58 +00002222 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002223 */
2224static void
Lev Walkindfae9752004-09-29 13:19:37 +00002225Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2226 td->free_struct = asn_DEF_PER_Visible.free_struct;
2227 td->print_struct = asn_DEF_PER_Visible.print_struct;
2228 td->ber_decoder = asn_DEF_PER_Visible.ber_decoder;
2229 td->der_encoder = asn_DEF_PER_Visible.der_encoder;
2230 td->xer_decoder = asn_DEF_PER_Visible.xer_decoder;
2231 td->xer_encoder = asn_DEF_PER_Visible.xer_encoder;
2232 td->elements = asn_DEF_PER_Visible.elements;
2233 td->elements_count = asn_DEF_PER_Visible.elements_count;
2234 td->specifics = asn_DEF_PER_Visible.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002235}
2236
Lev Walkina9cc46e2004-09-22 16:06:28 +00002237void
Lev Walkindfae9752004-09-29 13:19:37 +00002238Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002239 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002240 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002241 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002242}
2243
2244int
Lev Walkindfae9752004-09-29 13:19:37 +00002245Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002246 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2247 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2248 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2249}
2250
Lev Walkindc06f6b2004-10-20 15:50:55 +00002251asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002252Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002253 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002254 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002255 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002256}
2257
2258asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002259Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002260 void *structure, int tag_mode, ber_tlv_tag_t tag,
2261 asn_app_consume_bytes_f *cb, void *app_key) {
2262 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2263 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2264}
2265
2266asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002267Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002268 int ilevel, enum xer_encoder_flags_e flags,
2269 asn_app_consume_bytes_f *cb, void *app_key) {
2270 Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td);
2271 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002272}
2273
2274
2275/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
2276
Lev Walkindfae9752004-09-29 13:19:37 +00002277static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002278 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002279};
Lev Walkindfae9752004-09-29 13:19:37 +00002280asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002281 "Neither-SIZE-nor-FROM",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002282 "Neither-SIZE-nor-FROM",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002283 Neither_SIZE_nor_FROM_free,
2284 Neither_SIZE_nor_FROM_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002285 Neither_SIZE_nor_FROM_constraint,
2286 Neither_SIZE_nor_FROM_decode_ber,
2287 Neither_SIZE_nor_FROM_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002288 0, /* Not implemented yet */
2289 Neither_SIZE_nor_FROM_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002290 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002291 asn_DEF_Neither_SIZE_nor_FROM_tags,
2292 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags)
2293 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
2294 asn_DEF_Neither_SIZE_nor_FROM_tags, /* Same as above */
2295 sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags)
2296 /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002297 0, 0, /* No members */
2298 0 /* No specifics */
2299};
2300
2301
Lev Walkin55cc44a2004-10-03 09:14:32 +00002302/*** <<< INCLUDES [Utf8-4] >>> ***/
2303
2304#include <UTF8String.h>
2305
2306/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
2307
2308
2309typedef UTF8String_t Utf8_4_t;
2310
2311/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
2312
2313extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
2314asn_struct_free_f Utf8_4_free;
2315asn_struct_print_f Utf8_4_print;
2316asn_constr_check_f Utf8_4_constraint;
2317ber_type_decoder_f Utf8_4_decode_ber;
2318der_type_encoder_f Utf8_4_encode_der;
2319xer_type_encoder_f Utf8_4_encode_xer;
2320
2321/*** <<< CTABLES [Utf8-4] >>> ***/
2322
2323static int check_permitted_alphabet_12(const void *sptr) {
2324 if(UTF8String_length((const UTF8String_t *)sptr) < 0)
2325 return -1; /* Alphabet (sic!) test failed. */
2326
2327 return 0;
2328}
2329
2330
2331/*** <<< CODE [Utf8-4] >>> ***/
2332
2333int
2334Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
2335 asn_app_consume_bytes_f *app_errlog, void *app_key) {
2336 const UTF8String_t *st = sptr;
2337
2338 if(!sptr) {
2339 _ASN_ERRLOG(app_errlog, app_key,
2340 "%s: value not given (%s:%d)",
2341 td->name, __FILE__, __LINE__);
2342 return -1;
2343 }
2344
2345
2346 if(!check_permitted_alphabet_12(sptr)) {
2347 /* Constraint check succeeded */
2348 return 0;
2349 } else {
2350 _ASN_ERRLOG(app_errlog, app_key,
2351 "%s: constraint failed (%s:%d)",
2352 td->name, __FILE__, __LINE__);
2353 return -1;
2354 }
2355}
2356
2357/*
2358 * This type is implemented using UTF8String,
2359 * so here we adjust the DEF accordingly.
2360 */
2361static void
2362Utf8_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2363 td->free_struct = asn_DEF_UTF8String.free_struct;
2364 td->print_struct = asn_DEF_UTF8String.print_struct;
2365 td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
2366 td->der_encoder = asn_DEF_UTF8String.der_encoder;
2367 td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
2368 td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
2369 td->elements = asn_DEF_UTF8String.elements;
2370 td->elements_count = asn_DEF_UTF8String.elements_count;
2371 td->specifics = asn_DEF_UTF8String.specifics;
2372}
2373
2374void
2375Utf8_4_free(asn_TYPE_descriptor_t *td,
2376 void *struct_ptr, int contents_only) {
2377 Utf8_4_inherit_TYPE_descriptor(td);
2378 td->free_struct(td, struct_ptr, contents_only);
2379}
2380
2381int
2382Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
2383 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2384 Utf8_4_inherit_TYPE_descriptor(td);
2385 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2386}
2387
Lev Walkindc06f6b2004-10-20 15:50:55 +00002388asn_dec_rval_t
Lev Walkin55cc44a2004-10-03 09:14:32 +00002389Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
2390 void **structure, void *bufptr, size_t size, int tag_mode) {
2391 Utf8_4_inherit_TYPE_descriptor(td);
2392 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
2393}
2394
2395asn_enc_rval_t
2396Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
2397 void *structure, int tag_mode, ber_tlv_tag_t tag,
2398 asn_app_consume_bytes_f *cb, void *app_key) {
2399 Utf8_4_inherit_TYPE_descriptor(td);
2400 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2401}
2402
2403asn_enc_rval_t
2404Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
2405 int ilevel, enum xer_encoder_flags_e flags,
2406 asn_app_consume_bytes_f *cb, void *app_key) {
2407 Utf8_4_inherit_TYPE_descriptor(td);
2408 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
2409}
2410
2411
2412/*** <<< STAT-DEFS [Utf8-4] >>> ***/
2413
2414static ber_tlv_tag_t asn_DEF_Utf8_4_tags[] = {
2415 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
2416};
2417asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
2418 "Utf8-4",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002419 "Utf8-4",
Lev Walkin55cc44a2004-10-03 09:14:32 +00002420 Utf8_4_free,
2421 Utf8_4_print,
2422 Utf8_4_constraint,
2423 Utf8_4_decode_ber,
2424 Utf8_4_encode_der,
2425 0, /* Not implemented yet */
2426 Utf8_4_encode_xer,
2427 0, /* Use generic outmost tag fetcher */
2428 asn_DEF_Utf8_4_tags,
2429 sizeof(asn_DEF_Utf8_4_tags)
2430 /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
2431 asn_DEF_Utf8_4_tags, /* Same as above */
2432 sizeof(asn_DEF_Utf8_4_tags)
2433 /sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
2434 0, 0, /* No members */
2435 0 /* No specifics */
2436};
2437
2438
Lev Walkin006de1c2004-08-20 13:37:45 +00002439/*** <<< INCLUDES [Utf8-3] >>> ***/
2440
2441#include <Utf8-2.h>
2442
2443/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
2444
2445
2446typedef Utf8_2_t Utf8_3_t;
2447
Lev Walkin006de1c2004-08-20 13:37:45 +00002448/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
2449
Lev Walkindfae9752004-09-29 13:19:37 +00002450extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002451asn_struct_free_f Utf8_3_free;
2452asn_struct_print_f Utf8_3_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002453asn_constr_check_f Utf8_3_constraint;
2454ber_type_decoder_f Utf8_3_decode_ber;
2455der_type_encoder_f Utf8_3_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002456xer_type_encoder_f Utf8_3_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002457
2458/*** <<< CTABLES [Utf8-3] >>> ***/
2459
Lev Walkin55cc44a2004-10-03 09:14:32 +00002460static int permitted_alphabet_table_13[128] = {
Lev Walkin006de1c2004-08-20 13:37:45 +000024610,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24630,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
24650,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
24661,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */
24670,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
24681,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2469};
2470
Lev Walkin55cc44a2004-10-03 09:14:32 +00002471static int check_permitted_alphabet_13(const void *sptr) {
2472 int *table = permitted_alphabet_table_13;
Lev Walkin006de1c2004-08-20 13:37:45 +00002473 /* The underlying type is UTF8String */
Lev Walkin634a3b82004-08-22 03:30:05 +00002474 const UTF8String_t *st = sptr;
2475 const uint8_t *ch = st->buf;
2476 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +00002477
2478 for(; ch < end; ch++) {
2479 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +00002480 if(cv >= 0x80) return -1;
2481 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +00002482 }
Lev Walkin775885e2004-08-22 12:47:03 +00002483 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002484}
2485
2486
2487/*** <<< CODE [Utf8-3] >>> ***/
2488
2489int
Lev Walkindfae9752004-09-29 13:19:37 +00002490Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002491 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002492 const Utf8_2_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002493 size_t size;
2494
2495 if(!sptr) {
2496 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002497 "%s: value not given (%s:%d)",
2498 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002499 return -1;
2500 }
2501
Lev Walkinfac2e942004-10-02 16:33:46 +00002502 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002503 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002504 _ASN_ERRLOG(app_errlog, app_key,
2505 "%s: UTF-8: broken encoding (%s:%d)",
2506 td->name, __FILE__, __LINE__);
2507 return -1;
2508 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002509
2510 if((size >= 1 && size <= 2)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002511 && !check_permitted_alphabet_13(sptr)) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002512 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002513 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002514 } else {
2515 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002516 "%s: constraint failed (%s:%d)",
2517 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002518 return -1;
2519 }
2520}
2521
2522/*
2523 * This type is implemented using Utf8_2,
Lev Walkinc3808c12004-09-23 22:14:58 +00002524 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002525 */
2526static void
Lev Walkindfae9752004-09-29 13:19:37 +00002527Utf8_3_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2528 td->free_struct = asn_DEF_Utf8_2.free_struct;
2529 td->print_struct = asn_DEF_Utf8_2.print_struct;
2530 td->ber_decoder = asn_DEF_Utf8_2.ber_decoder;
2531 td->der_encoder = asn_DEF_Utf8_2.der_encoder;
2532 td->xer_decoder = asn_DEF_Utf8_2.xer_decoder;
2533 td->xer_encoder = asn_DEF_Utf8_2.xer_encoder;
2534 td->elements = asn_DEF_Utf8_2.elements;
2535 td->elements_count = asn_DEF_Utf8_2.elements_count;
2536 td->specifics = asn_DEF_Utf8_2.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002537}
2538
Lev Walkina9cc46e2004-09-22 16:06:28 +00002539void
Lev Walkindfae9752004-09-29 13:19:37 +00002540Utf8_3_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002541 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002542 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002543 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002544}
2545
2546int
Lev Walkindfae9752004-09-29 13:19:37 +00002547Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002548 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2549 Utf8_3_inherit_TYPE_descriptor(td);
2550 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2551}
2552
Lev Walkindc06f6b2004-10-20 15:50:55 +00002553asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002554Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002555 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002556 Utf8_3_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002557 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002558}
2559
2560asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002561Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002562 void *structure, int tag_mode, ber_tlv_tag_t tag,
2563 asn_app_consume_bytes_f *cb, void *app_key) {
2564 Utf8_3_inherit_TYPE_descriptor(td);
2565 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2566}
2567
2568asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002569Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002570 int ilevel, enum xer_encoder_flags_e flags,
2571 asn_app_consume_bytes_f *cb, void *app_key) {
2572 Utf8_3_inherit_TYPE_descriptor(td);
2573 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002574}
2575
2576
2577/*** <<< STAT-DEFS [Utf8-3] >>> ***/
2578
Lev Walkindfae9752004-09-29 13:19:37 +00002579static ber_tlv_tag_t asn_DEF_Utf8_3_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002580 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002581};
Lev Walkindfae9752004-09-29 13:19:37 +00002582asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002583 "Utf8-3",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002584 "Utf8-3",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002585 Utf8_3_free,
2586 Utf8_3_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002587 Utf8_3_constraint,
2588 Utf8_3_decode_ber,
2589 Utf8_3_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002590 0, /* Not implemented yet */
2591 Utf8_3_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002592 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002593 asn_DEF_Utf8_3_tags,
2594 sizeof(asn_DEF_Utf8_3_tags)
2595 /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */
2596 asn_DEF_Utf8_3_tags, /* Same as above */
2597 sizeof(asn_DEF_Utf8_3_tags)
2598 /sizeof(asn_DEF_Utf8_3_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002599 0, 0, /* No members */
2600 0 /* No specifics */
2601};
2602
2603
2604/*** <<< INCLUDES [Utf8-2] >>> ***/
2605
2606#include <Utf8-1.h>
2607
2608/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
2609
2610
2611typedef Utf8_1_t Utf8_2_t;
2612
Lev Walkin006de1c2004-08-20 13:37:45 +00002613/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
2614
Lev Walkindfae9752004-09-29 13:19:37 +00002615extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002616asn_struct_free_f Utf8_2_free;
2617asn_struct_print_f Utf8_2_print;
Lev Walkin006de1c2004-08-20 13:37:45 +00002618asn_constr_check_f Utf8_2_constraint;
2619ber_type_decoder_f Utf8_2_decode_ber;
2620der_type_encoder_f Utf8_2_encode_der;
Lev Walkina9cc46e2004-09-22 16:06:28 +00002621xer_type_encoder_f Utf8_2_encode_xer;
Lev Walkin006de1c2004-08-20 13:37:45 +00002622
2623/*** <<< CODE [Utf8-2] >>> ***/
2624
2625int
Lev Walkindfae9752004-09-29 13:19:37 +00002626Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002627 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin634a3b82004-08-22 03:30:05 +00002628 const Utf8_1_t *st = sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +00002629 size_t size;
2630
2631 if(!sptr) {
2632 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002633 "%s: value not given (%s:%d)",
2634 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002635 return -1;
2636 }
2637
Lev Walkinfac2e942004-10-02 16:33:46 +00002638 size = UTF8String_length(st);
Lev Walkin00df16d2004-10-02 16:44:30 +00002639 if((ssize_t)size < 0) {
Lev Walkinfac2e942004-10-02 16:33:46 +00002640 _ASN_ERRLOG(app_errlog, app_key,
2641 "%s: UTF-8: broken encoding (%s:%d)",
2642 td->name, __FILE__, __LINE__);
2643 return -1;
2644 }
Lev Walkin006de1c2004-08-20 13:37:45 +00002645
2646 if((size >= 1 && size <= 2)) {
2647 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +00002648 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +00002649 } else {
2650 _ASN_ERRLOG(app_errlog, app_key,
Lev Walkin16835b62004-08-22 13:47:59 +00002651 "%s: constraint failed (%s:%d)",
2652 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +00002653 return -1;
2654 }
2655}
2656
2657/*
2658 * This type is implemented using Utf8_1,
Lev Walkinc3808c12004-09-23 22:14:58 +00002659 * so here we adjust the DEF accordingly.
Lev Walkin006de1c2004-08-20 13:37:45 +00002660 */
2661static void
Lev Walkindfae9752004-09-29 13:19:37 +00002662Utf8_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2663 td->free_struct = asn_DEF_Utf8_1.free_struct;
2664 td->print_struct = asn_DEF_Utf8_1.print_struct;
2665 td->ber_decoder = asn_DEF_Utf8_1.ber_decoder;
2666 td->der_encoder = asn_DEF_Utf8_1.der_encoder;
2667 td->xer_decoder = asn_DEF_Utf8_1.xer_decoder;
2668 td->xer_encoder = asn_DEF_Utf8_1.xer_encoder;
2669 td->elements = asn_DEF_Utf8_1.elements;
2670 td->elements_count = asn_DEF_Utf8_1.elements_count;
2671 td->specifics = asn_DEF_Utf8_1.specifics;
Lev Walkin006de1c2004-08-20 13:37:45 +00002672}
2673
Lev Walkina9cc46e2004-09-22 16:06:28 +00002674void
Lev Walkindfae9752004-09-29 13:19:37 +00002675Utf8_2_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002676 void *struct_ptr, int contents_only) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002677 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002678 td->free_struct(td, struct_ptr, contents_only);
Lev Walkin006de1c2004-08-20 13:37:45 +00002679}
2680
2681int
Lev Walkindfae9752004-09-29 13:19:37 +00002682Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkin006de1c2004-08-20 13:37:45 +00002683 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2684 Utf8_2_inherit_TYPE_descriptor(td);
2685 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2686}
2687
Lev Walkindc06f6b2004-10-20 15:50:55 +00002688asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002689Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002690 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkin006de1c2004-08-20 13:37:45 +00002691 Utf8_2_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002692 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002693}
2694
2695asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002696Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002697 void *structure, int tag_mode, ber_tlv_tag_t tag,
2698 asn_app_consume_bytes_f *cb, void *app_key) {
2699 Utf8_2_inherit_TYPE_descriptor(td);
2700 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2701}
2702
2703asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002704Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002705 int ilevel, enum xer_encoder_flags_e flags,
2706 asn_app_consume_bytes_f *cb, void *app_key) {
2707 Utf8_2_inherit_TYPE_descriptor(td);
2708 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkin006de1c2004-08-20 13:37:45 +00002709}
2710
2711
2712/*** <<< STAT-DEFS [Utf8-2] >>> ***/
2713
Lev Walkindfae9752004-09-29 13:19:37 +00002714static ber_tlv_tag_t asn_DEF_Utf8_2_tags[] = {
Lev Walkin906654e2004-09-10 15:49:15 +00002715 (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
Lev Walkin006de1c2004-08-20 13:37:45 +00002716};
Lev Walkindfae9752004-09-29 13:19:37 +00002717asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +00002718 "Utf8-2",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002719 "Utf8-2",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002720 Utf8_2_free,
2721 Utf8_2_print,
Lev Walkin006de1c2004-08-20 13:37:45 +00002722 Utf8_2_constraint,
2723 Utf8_2_decode_ber,
2724 Utf8_2_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002725 0, /* Not implemented yet */
2726 Utf8_2_encode_xer,
Lev Walkin006de1c2004-08-20 13:37:45 +00002727 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002728 asn_DEF_Utf8_2_tags,
2729 sizeof(asn_DEF_Utf8_2_tags)
2730 /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */
2731 asn_DEF_Utf8_2_tags, /* Same as above */
2732 sizeof(asn_DEF_Utf8_2_tags)
2733 /sizeof(asn_DEF_Utf8_2_tags[0]), /* 1 */
Lev Walkin006de1c2004-08-20 13:37:45 +00002734 0, 0, /* No members */
2735 0 /* No specifics */
2736};
2737
2738
2739/*** <<< INCLUDES [Utf8-1] >>> ***/
2740
2741#include <UTF8String.h>
2742
2743/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
2744
2745
2746typedef UTF8String_t Utf8_1_t;
2747
Lev Walkin006de1c2004-08-20 13:37:45 +00002748/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
2749
Lev Walkin154aa182004-09-26 13:12:56 +00002750/* This type is equivalent to UTF8String */
Lev Walkindfae9752004-09-29 13:19:37 +00002751#define asn_DEF_Utf8_1 asn_DEF_UTF8String
Lev Walkin006de1c2004-08-20 13:37:45 +00002752
2753/*** <<< CODE [Utf8-1] >>> ***/
2754
Lev Walkin154aa182004-09-26 13:12:56 +00002755/* This type is equivalent to UTF8String */
Lev Walkin006de1c2004-08-20 13:37:45 +00002756
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002757
2758/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
2759
2760#include <Identifier.h>
2761
2762/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
2763
2764
2765typedef Identifier_t VisibleIdentifier_t;
2766
2767/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
2768
Lev Walkin154aa182004-09-26 13:12:56 +00002769/* This type is equivalent to Identifier */
Lev Walkindfae9752004-09-29 13:19:37 +00002770#define asn_DEF_VisibleIdentifier asn_DEF_Identifier
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002771
Lev Walkin154aa182004-09-26 13:12:56 +00002772/*** <<< CODE [VisibleIdentifier] >>> ***/
2773
2774/* This type is equivalent to Identifier */
2775
2776
2777/*** <<< INCLUDES [Identifier] >>> ***/
2778
2779#include <VisibleString.h>
2780
2781/*** <<< TYPE-DECLS [Identifier] >>> ***/
2782
2783
2784typedef VisibleString_t Identifier_t;
2785
2786/*** <<< FUNC-DECLS [Identifier] >>> ***/
2787
Lev Walkindfae9752004-09-29 13:19:37 +00002788extern asn_TYPE_descriptor_t asn_DEF_Identifier;
Lev Walkin154aa182004-09-26 13:12:56 +00002789asn_struct_free_f Identifier_free;
2790asn_struct_print_f Identifier_print;
2791asn_constr_check_f Identifier_constraint;
2792ber_type_decoder_f Identifier_decode_ber;
2793der_type_encoder_f Identifier_encode_der;
2794xer_type_encoder_f Identifier_encode_xer;
2795
2796/*** <<< CTABLES [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002797
Lev Walkin55cc44a2004-10-03 09:14:32 +00002798static int permitted_alphabet_table_15[256] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +000027990,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
28010,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
28021,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */
28030,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */
28041,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */
28050,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */
28061,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
2807};
2808
Lev Walkin55cc44a2004-10-03 09:14:32 +00002809static int check_permitted_alphabet_15(const void *sptr) {
2810 int *table = permitted_alphabet_table_15;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002811 /* The underlying type is VisibleString */
2812 const VisibleString_t *st = sptr;
2813 const uint8_t *ch = st->buf;
2814 const uint8_t *end = ch + st->size;
2815
2816 for(; ch < end; ch++) {
2817 uint8_t cv = *ch;
2818 if(!table[cv]) return -1;
2819 }
2820 return 0;
2821}
2822
2823
Lev Walkin154aa182004-09-26 13:12:56 +00002824/*** <<< CODE [Identifier] >>> ***/
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002825
2826int
Lev Walkindfae9752004-09-29 13:19:37 +00002827Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002828 asn_app_consume_bytes_f *app_errlog, void *app_key) {
Lev Walkin154aa182004-09-26 13:12:56 +00002829 const VisibleString_t *st = sptr;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002830 size_t size;
2831
2832 if(!sptr) {
2833 _ASN_ERRLOG(app_errlog, app_key,
2834 "%s: value not given (%s:%d)",
2835 td->name, __FILE__, __LINE__);
2836 return -1;
2837 }
2838
2839 size = st->size;
2840
2841 if((size >= 1 && size <= 32)
Lev Walkin55cc44a2004-10-03 09:14:32 +00002842 && !check_permitted_alphabet_15(sptr)) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002843 /* Constraint check succeeded */
2844 return 0;
2845 } else {
2846 _ASN_ERRLOG(app_errlog, app_key,
2847 "%s: constraint failed (%s:%d)",
2848 td->name, __FILE__, __LINE__);
2849 return -1;
2850 }
2851}
2852
2853/*
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002854 * This type is implemented using VisibleString,
Lev Walkinc3808c12004-09-23 22:14:58 +00002855 * so here we adjust the DEF accordingly.
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002856 */
2857static void
Lev Walkindfae9752004-09-29 13:19:37 +00002858Identifier_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
2859 td->free_struct = asn_DEF_VisibleString.free_struct;
2860 td->print_struct = asn_DEF_VisibleString.print_struct;
2861 td->ber_decoder = asn_DEF_VisibleString.ber_decoder;
2862 td->der_encoder = asn_DEF_VisibleString.der_encoder;
2863 td->xer_decoder = asn_DEF_VisibleString.xer_decoder;
2864 td->xer_encoder = asn_DEF_VisibleString.xer_encoder;
2865 td->elements = asn_DEF_VisibleString.elements;
2866 td->elements_count = asn_DEF_VisibleString.elements_count;
2867 td->specifics = asn_DEF_VisibleString.specifics;
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002868}
2869
Lev Walkina9cc46e2004-09-22 16:06:28 +00002870void
Lev Walkindfae9752004-09-29 13:19:37 +00002871Identifier_free(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002872 void *struct_ptr, int contents_only) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002873 Identifier_inherit_TYPE_descriptor(td);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002874 td->free_struct(td, struct_ptr, contents_only);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002875}
2876
2877int
Lev Walkindfae9752004-09-29 13:19:37 +00002878Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002879 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
2880 Identifier_inherit_TYPE_descriptor(td);
2881 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
2882}
2883
Lev Walkindc06f6b2004-10-20 15:50:55 +00002884asn_dec_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002885Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002886 void **structure, void *bufptr, size_t size, int tag_mode) {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002887 Identifier_inherit_TYPE_descriptor(td);
Lev Walkindfae9752004-09-29 13:19:37 +00002888 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
Lev Walkina9cc46e2004-09-22 16:06:28 +00002889}
2890
2891asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002892Identifier_encode_der(asn_TYPE_descriptor_t *td,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002893 void *structure, int tag_mode, ber_tlv_tag_t tag,
2894 asn_app_consume_bytes_f *cb, void *app_key) {
2895 Identifier_inherit_TYPE_descriptor(td);
2896 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
2897}
2898
2899asn_enc_rval_t
Lev Walkindfae9752004-09-29 13:19:37 +00002900Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002901 int ilevel, enum xer_encoder_flags_e flags,
2902 asn_app_consume_bytes_f *cb, void *app_key) {
2903 Identifier_inherit_TYPE_descriptor(td);
2904 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002905}
2906
2907
2908/*** <<< STAT-DEFS [Identifier] >>> ***/
2909
Lev Walkindfae9752004-09-29 13:19:37 +00002910static ber_tlv_tag_t asn_DEF_Identifier_tags[] = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002911 (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
2912};
Lev Walkindfae9752004-09-29 13:19:37 +00002913asn_TYPE_descriptor_t asn_DEF_Identifier = {
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002914 "Identifier",
Lev Walkindc06f6b2004-10-20 15:50:55 +00002915 "Identifier",
Lev Walkina9cc46e2004-09-22 16:06:28 +00002916 Identifier_free,
2917 Identifier_print,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002918 Identifier_constraint,
2919 Identifier_decode_ber,
2920 Identifier_encode_der,
Lev Walkina9cc46e2004-09-22 16:06:28 +00002921 0, /* Not implemented yet */
2922 Identifier_encode_xer,
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002923 0, /* Use generic outmost tag fetcher */
Lev Walkindfae9752004-09-29 13:19:37 +00002924 asn_DEF_Identifier_tags,
2925 sizeof(asn_DEF_Identifier_tags)
2926 /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */
2927 asn_DEF_Identifier_tags, /* Same as above */
2928 sizeof(asn_DEF_Identifier_tags)
2929 /sizeof(asn_DEF_Identifier_tags[0]), /* 1 */
Lev Walkine4ca5ce2004-09-15 11:44:13 +00002930 0, 0, /* No members */
2931 0 /* No specifics */
2932};
2933