~ubuntu-branches/ubuntu/intrepid/asn1c/intrepid

« back to all changes in this revision

Viewing changes to tests/50-constraint-OK.asn1.-P

  • Committer: Bazaar Package Importer
  • Author(s): W. Borgert
  • Date: 2005-05-28 12:36:42 UTC
  • Revision ID: james.westby@ubuntu.com-20050528123642-3h6kstws5u0xcovl
Tags: upstream-0.9.14
ImportĀ upstreamĀ versionĀ 0.9.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*** <<< INCLUDES [Int1] >>> ***/
 
3
 
 
4
#include <INTEGER.h>
 
5
 
 
6
/*** <<< TYPE-DECLS [Int1] >>> ***/
 
7
 
 
8
typedef INTEGER_t        Int1_t;
 
9
 
 
10
/*** <<< FUNC-DECLS [Int1] >>> ***/
 
11
 
 
12
extern asn_TYPE_descriptor_t asn_DEF_Int1;
 
13
asn_struct_free_f Int1_free;
 
14
asn_struct_print_f Int1_print;
 
15
asn_constr_check_f Int1_constraint;
 
16
ber_type_decoder_f Int1_decode_ber;
 
17
der_type_encoder_f Int1_encode_der;
 
18
xer_type_decoder_f Int1_decode_xer;
 
19
xer_type_encoder_f Int1_encode_xer;
 
20
 
 
21
/*** <<< CODE [Int1] >>> ***/
 
22
 
 
23
int
 
24
Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
25
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
26
        /* Replace with underlying type checker */
 
27
        td->check_constraints = asn_DEF_INTEGER.check_constraints;
 
28
        return td->check_constraints(td, sptr, app_errlog, app_key);
 
29
}
 
30
 
 
31
/*
 
32
 * This type is implemented using INTEGER,
 
33
 * so here we adjust the DEF accordingly.
 
34
 */
 
35
static void
 
36
Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
37
        td->free_struct    = asn_DEF_INTEGER.free_struct;
 
38
        td->print_struct   = asn_DEF_INTEGER.print_struct;
 
39
        td->ber_decoder    = asn_DEF_INTEGER.ber_decoder;
 
40
        td->der_encoder    = asn_DEF_INTEGER.der_encoder;
 
41
        td->xer_decoder    = asn_DEF_INTEGER.xer_decoder;
 
42
        td->xer_encoder    = asn_DEF_INTEGER.xer_encoder;
 
43
        td->elements       = asn_DEF_INTEGER.elements;
 
44
        td->elements_count = asn_DEF_INTEGER.elements_count;
 
45
        td->specifics      = asn_DEF_INTEGER.specifics;
 
46
}
 
47
 
 
48
void
 
49
Int1_free(asn_TYPE_descriptor_t *td,
 
50
                void *struct_ptr, int contents_only) {
 
51
        Int1_1_inherit_TYPE_descriptor(td);
 
52
        td->free_struct(td, struct_ptr, contents_only);
 
53
}
 
54
 
 
55
int
 
56
Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
57
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
58
        Int1_1_inherit_TYPE_descriptor(td);
 
59
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
60
}
 
61
 
 
62
asn_dec_rval_t
 
63
Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
64
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
65
        Int1_1_inherit_TYPE_descriptor(td);
 
66
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
67
}
 
68
 
 
69
asn_enc_rval_t
 
70
Int1_encode_der(asn_TYPE_descriptor_t *td,
 
71
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
72
                asn_app_consume_bytes_f *cb, void *app_key) {
 
73
        Int1_1_inherit_TYPE_descriptor(td);
 
74
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
75
}
 
76
 
 
77
asn_dec_rval_t
 
78
Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
79
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
80
        Int1_1_inherit_TYPE_descriptor(td);
 
81
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
82
}
 
83
 
 
84
asn_enc_rval_t
 
85
Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
86
                int ilevel, enum xer_encoder_flags_e flags,
 
87
                asn_app_consume_bytes_f *cb, void *app_key) {
 
88
        Int1_1_inherit_TYPE_descriptor(td);
 
89
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
90
}
 
91
 
 
92
 
 
93
/*** <<< STAT-DEFS [Int1] >>> ***/
 
94
 
 
95
static ber_tlv_tag_t asn_DEF_Int1_1_tags[] = {
 
96
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
97
};
 
98
asn_TYPE_descriptor_t asn_DEF_Int1 = {
 
99
        "Int1",
 
100
        "Int1",
 
101
        Int1_free,
 
102
        Int1_print,
 
103
        Int1_constraint,
 
104
        Int1_decode_ber,
 
105
        Int1_encode_der,
 
106
        Int1_decode_xer,
 
107
        Int1_encode_xer,
 
108
        0,      /* Use generic outmost tag fetcher */
 
109
        asn_DEF_Int1_1_tags,
 
110
        sizeof(asn_DEF_Int1_1_tags)
 
111
                /sizeof(asn_DEF_Int1_1_tags[0]), /* 1 */
 
112
        asn_DEF_Int1_1_tags,    /* Same as above */
 
113
        sizeof(asn_DEF_Int1_1_tags)
 
114
                /sizeof(asn_DEF_Int1_1_tags[0]), /* 1 */
 
115
        0, 0,   /* No members */
 
116
        0       /* No specifics */
 
117
};
 
118
 
 
119
 
 
120
/*** <<< INCLUDES [Int2] >>> ***/
 
121
 
 
122
#include <Int1.h>
 
123
 
 
124
/*** <<< TYPE-DECLS [Int2] >>> ***/
 
125
 
 
126
typedef Int1_t   Int2_t;
 
127
 
 
128
/*** <<< FUNC-DECLS [Int2] >>> ***/
 
129
 
 
130
extern asn_TYPE_descriptor_t asn_DEF_Int2;
 
131
asn_struct_free_f Int2_free;
 
132
asn_struct_print_f Int2_print;
 
133
asn_constr_check_f Int2_constraint;
 
134
ber_type_decoder_f Int2_decode_ber;
 
135
der_type_encoder_f Int2_encode_der;
 
136
xer_type_decoder_f Int2_decode_xer;
 
137
xer_type_encoder_f Int2_encode_xer;
 
138
 
 
139
/*** <<< CODE [Int2] >>> ***/
 
140
 
 
141
int
 
142
Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
143
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
144
        const Int1_t *st = (const Int1_t *)sptr;
 
145
        long value;
 
146
        
 
147
        if(!sptr) {
 
148
                _ASN_ERRLOG(app_errlog, app_key,
 
149
                        "%s: value not given (%s:%d)",
 
150
                        td->name, __FILE__, __LINE__);
 
151
                return -1;
 
152
        }
 
153
        
 
154
        /* Check if the sign bit is present */
 
155
        value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
 
156
        
 
157
        if((value >= 0)) {
 
158
                /* Constraint check succeeded */
 
159
                return 0;
 
160
        } else {
 
161
                _ASN_ERRLOG(app_errlog, app_key,
 
162
                        "%s: constraint failed (%s:%d)",
 
163
                        td->name, __FILE__, __LINE__);
 
164
                return -1;
 
165
        }
 
166
}
 
167
 
 
168
/*
 
169
 * This type is implemented using Int1,
 
170
 * so here we adjust the DEF accordingly.
 
171
 */
 
172
static void
 
173
Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
174
        td->free_struct    = asn_DEF_Int1.free_struct;
 
175
        td->print_struct   = asn_DEF_Int1.print_struct;
 
176
        td->ber_decoder    = asn_DEF_Int1.ber_decoder;
 
177
        td->der_encoder    = asn_DEF_Int1.der_encoder;
 
178
        td->xer_decoder    = asn_DEF_Int1.xer_decoder;
 
179
        td->xer_encoder    = asn_DEF_Int1.xer_encoder;
 
180
        td->elements       = asn_DEF_Int1.elements;
 
181
        td->elements_count = asn_DEF_Int1.elements_count;
 
182
        td->specifics      = asn_DEF_Int1.specifics;
 
183
}
 
184
 
 
185
void
 
186
Int2_free(asn_TYPE_descriptor_t *td,
 
187
                void *struct_ptr, int contents_only) {
 
188
        Int2_1_inherit_TYPE_descriptor(td);
 
189
        td->free_struct(td, struct_ptr, contents_only);
 
190
}
 
191
 
 
192
int
 
193
Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
194
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
195
        Int2_1_inherit_TYPE_descriptor(td);
 
196
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
197
}
 
198
 
 
199
asn_dec_rval_t
 
200
Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
201
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
202
        Int2_1_inherit_TYPE_descriptor(td);
 
203
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
204
}
 
205
 
 
206
asn_enc_rval_t
 
207
Int2_encode_der(asn_TYPE_descriptor_t *td,
 
208
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
209
                asn_app_consume_bytes_f *cb, void *app_key) {
 
210
        Int2_1_inherit_TYPE_descriptor(td);
 
211
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
212
}
 
213
 
 
214
asn_dec_rval_t
 
215
Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
216
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
217
        Int2_1_inherit_TYPE_descriptor(td);
 
218
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
219
}
 
220
 
 
221
asn_enc_rval_t
 
222
Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
223
                int ilevel, enum xer_encoder_flags_e flags,
 
224
                asn_app_consume_bytes_f *cb, void *app_key) {
 
225
        Int2_1_inherit_TYPE_descriptor(td);
 
226
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
227
}
 
228
 
 
229
 
 
230
/*** <<< STAT-DEFS [Int2] >>> ***/
 
231
 
 
232
static ber_tlv_tag_t asn_DEF_Int2_1_tags[] = {
 
233
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
234
};
 
235
asn_TYPE_descriptor_t asn_DEF_Int2 = {
 
236
        "Int2",
 
237
        "Int2",
 
238
        Int2_free,
 
239
        Int2_print,
 
240
        Int2_constraint,
 
241
        Int2_decode_ber,
 
242
        Int2_encode_der,
 
243
        Int2_decode_xer,
 
244
        Int2_encode_xer,
 
245
        0,      /* Use generic outmost tag fetcher */
 
246
        asn_DEF_Int2_1_tags,
 
247
        sizeof(asn_DEF_Int2_1_tags)
 
248
                /sizeof(asn_DEF_Int2_1_tags[0]), /* 1 */
 
249
        asn_DEF_Int2_1_tags,    /* Same as above */
 
250
        sizeof(asn_DEF_Int2_1_tags)
 
251
                /sizeof(asn_DEF_Int2_1_tags[0]), /* 1 */
 
252
        0, 0,   /* No members */
 
253
        0       /* No specifics */
 
254
};
 
255
 
 
256
 
 
257
/*** <<< INCLUDES [Int3] >>> ***/
 
258
 
 
259
#include <Int2.h>
 
260
 
 
261
/*** <<< TYPE-DECLS [Int3] >>> ***/
 
262
 
 
263
typedef Int2_t   Int3_t;
 
264
 
 
265
/*** <<< FUNC-DECLS [Int3] >>> ***/
 
266
 
 
267
extern asn_TYPE_descriptor_t asn_DEF_Int3;
 
268
asn_struct_free_f Int3_free;
 
269
asn_struct_print_f Int3_print;
 
270
asn_constr_check_f Int3_constraint;
 
271
ber_type_decoder_f Int3_decode_ber;
 
272
der_type_encoder_f Int3_encode_der;
 
273
xer_type_decoder_f Int3_decode_xer;
 
274
xer_type_encoder_f Int3_encode_xer;
 
275
 
 
276
/*** <<< CODE [Int3] >>> ***/
 
277
 
 
278
int
 
279
Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
280
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
281
        const Int2_t *st = (const Int2_t *)sptr;
 
282
        long value;
 
283
        
 
284
        if(!sptr) {
 
285
                _ASN_ERRLOG(app_errlog, app_key,
 
286
                        "%s: value not given (%s:%d)",
 
287
                        td->name, __FILE__, __LINE__);
 
288
                return -1;
 
289
        }
 
290
        
 
291
        if(asn_INTEGER2long(st, &value)) {
 
292
                _ASN_ERRLOG(app_errlog, app_key,
 
293
                        "%s: value too large (%s:%d)",
 
294
                        td->name, __FILE__, __LINE__);
 
295
                return -1;
 
296
        }
 
297
        
 
298
        if((value >= 0 && value <= 10)) {
 
299
                /* Constraint check succeeded */
 
300
                return 0;
 
301
        } else {
 
302
                _ASN_ERRLOG(app_errlog, app_key,
 
303
                        "%s: constraint failed (%s:%d)",
 
304
                        td->name, __FILE__, __LINE__);
 
305
                return -1;
 
306
        }
 
307
}
 
308
 
 
309
/*
 
310
 * This type is implemented using Int2,
 
311
 * so here we adjust the DEF accordingly.
 
312
 */
 
313
static void
 
314
Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
315
        td->free_struct    = asn_DEF_Int2.free_struct;
 
316
        td->print_struct   = asn_DEF_Int2.print_struct;
 
317
        td->ber_decoder    = asn_DEF_Int2.ber_decoder;
 
318
        td->der_encoder    = asn_DEF_Int2.der_encoder;
 
319
        td->xer_decoder    = asn_DEF_Int2.xer_decoder;
 
320
        td->xer_encoder    = asn_DEF_Int2.xer_encoder;
 
321
        td->elements       = asn_DEF_Int2.elements;
 
322
        td->elements_count = asn_DEF_Int2.elements_count;
 
323
        td->specifics      = asn_DEF_Int2.specifics;
 
324
}
 
325
 
 
326
void
 
327
Int3_free(asn_TYPE_descriptor_t *td,
 
328
                void *struct_ptr, int contents_only) {
 
329
        Int3_1_inherit_TYPE_descriptor(td);
 
330
        td->free_struct(td, struct_ptr, contents_only);
 
331
}
 
332
 
 
333
int
 
334
Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
335
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
336
        Int3_1_inherit_TYPE_descriptor(td);
 
337
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
338
}
 
339
 
 
340
asn_dec_rval_t
 
341
Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
342
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
343
        Int3_1_inherit_TYPE_descriptor(td);
 
344
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
345
}
 
346
 
 
347
asn_enc_rval_t
 
348
Int3_encode_der(asn_TYPE_descriptor_t *td,
 
349
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
350
                asn_app_consume_bytes_f *cb, void *app_key) {
 
351
        Int3_1_inherit_TYPE_descriptor(td);
 
352
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
353
}
 
354
 
 
355
asn_dec_rval_t
 
356
Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
357
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
358
        Int3_1_inherit_TYPE_descriptor(td);
 
359
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
360
}
 
361
 
 
362
asn_enc_rval_t
 
363
Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
364
                int ilevel, enum xer_encoder_flags_e flags,
 
365
                asn_app_consume_bytes_f *cb, void *app_key) {
 
366
        Int3_1_inherit_TYPE_descriptor(td);
 
367
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
368
}
 
369
 
 
370
 
 
371
/*** <<< STAT-DEFS [Int3] >>> ***/
 
372
 
 
373
static ber_tlv_tag_t asn_DEF_Int3_1_tags[] = {
 
374
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
375
};
 
376
asn_TYPE_descriptor_t asn_DEF_Int3 = {
 
377
        "Int3",
 
378
        "Int3",
 
379
        Int3_free,
 
380
        Int3_print,
 
381
        Int3_constraint,
 
382
        Int3_decode_ber,
 
383
        Int3_encode_der,
 
384
        Int3_decode_xer,
 
385
        Int3_encode_xer,
 
386
        0,      /* Use generic outmost tag fetcher */
 
387
        asn_DEF_Int3_1_tags,
 
388
        sizeof(asn_DEF_Int3_1_tags)
 
389
                /sizeof(asn_DEF_Int3_1_tags[0]), /* 1 */
 
390
        asn_DEF_Int3_1_tags,    /* Same as above */
 
391
        sizeof(asn_DEF_Int3_1_tags)
 
392
                /sizeof(asn_DEF_Int3_1_tags[0]), /* 1 */
 
393
        0, 0,   /* No members */
 
394
        0       /* No specifics */
 
395
};
 
396
 
 
397
 
 
398
/*** <<< INCLUDES [Int4] >>> ***/
 
399
 
 
400
#include <Int3.h>
 
401
 
 
402
/*** <<< TYPE-DECLS [Int4] >>> ***/
 
403
 
 
404
typedef Int3_t   Int4_t;
 
405
 
 
406
/*** <<< FUNC-DECLS [Int4] >>> ***/
 
407
 
 
408
extern asn_TYPE_descriptor_t asn_DEF_Int4;
 
409
asn_struct_free_f Int4_free;
 
410
asn_struct_print_f Int4_print;
 
411
asn_constr_check_f Int4_constraint;
 
412
ber_type_decoder_f Int4_decode_ber;
 
413
der_type_encoder_f Int4_encode_der;
 
414
xer_type_decoder_f Int4_decode_xer;
 
415
xer_type_encoder_f Int4_encode_xer;
 
416
 
 
417
/*** <<< CODE [Int4] >>> ***/
 
418
 
 
419
int
 
420
Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
421
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
422
        const Int3_t *st = (const Int3_t *)sptr;
 
423
        long value;
 
424
        
 
425
        if(!sptr) {
 
426
                _ASN_ERRLOG(app_errlog, app_key,
 
427
                        "%s: value not given (%s:%d)",
 
428
                        td->name, __FILE__, __LINE__);
 
429
                return -1;
 
430
        }
 
431
        
 
432
        if(asn_INTEGER2long(st, &value)) {
 
433
                _ASN_ERRLOG(app_errlog, app_key,
 
434
                        "%s: value too large (%s:%d)",
 
435
                        td->name, __FILE__, __LINE__);
 
436
                return -1;
 
437
        }
 
438
        
 
439
        if((value >= 1 && value <= 10)) {
 
440
                /* Constraint check succeeded */
 
441
                return 0;
 
442
        } else {
 
443
                _ASN_ERRLOG(app_errlog, app_key,
 
444
                        "%s: constraint failed (%s:%d)",
 
445
                        td->name, __FILE__, __LINE__);
 
446
                return -1;
 
447
        }
 
448
}
 
449
 
 
450
/*
 
451
 * This type is implemented using Int3,
 
452
 * so here we adjust the DEF accordingly.
 
453
 */
 
454
static void
 
455
Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
456
        td->free_struct    = asn_DEF_Int3.free_struct;
 
457
        td->print_struct   = asn_DEF_Int3.print_struct;
 
458
        td->ber_decoder    = asn_DEF_Int3.ber_decoder;
 
459
        td->der_encoder    = asn_DEF_Int3.der_encoder;
 
460
        td->xer_decoder    = asn_DEF_Int3.xer_decoder;
 
461
        td->xer_encoder    = asn_DEF_Int3.xer_encoder;
 
462
        td->elements       = asn_DEF_Int3.elements;
 
463
        td->elements_count = asn_DEF_Int3.elements_count;
 
464
        td->specifics      = asn_DEF_Int3.specifics;
 
465
}
 
466
 
 
467
void
 
468
Int4_free(asn_TYPE_descriptor_t *td,
 
469
                void *struct_ptr, int contents_only) {
 
470
        Int4_1_inherit_TYPE_descriptor(td);
 
471
        td->free_struct(td, struct_ptr, contents_only);
 
472
}
 
473
 
 
474
int
 
475
Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
476
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
477
        Int4_1_inherit_TYPE_descriptor(td);
 
478
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
479
}
 
480
 
 
481
asn_dec_rval_t
 
482
Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
483
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
484
        Int4_1_inherit_TYPE_descriptor(td);
 
485
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
486
}
 
487
 
 
488
asn_enc_rval_t
 
489
Int4_encode_der(asn_TYPE_descriptor_t *td,
 
490
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
491
                asn_app_consume_bytes_f *cb, void *app_key) {
 
492
        Int4_1_inherit_TYPE_descriptor(td);
 
493
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
494
}
 
495
 
 
496
asn_dec_rval_t
 
497
Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
498
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
499
        Int4_1_inherit_TYPE_descriptor(td);
 
500
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
501
}
 
502
 
 
503
asn_enc_rval_t
 
504
Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
505
                int ilevel, enum xer_encoder_flags_e flags,
 
506
                asn_app_consume_bytes_f *cb, void *app_key) {
 
507
        Int4_1_inherit_TYPE_descriptor(td);
 
508
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
509
}
 
510
 
 
511
 
 
512
/*** <<< STAT-DEFS [Int4] >>> ***/
 
513
 
 
514
static ber_tlv_tag_t asn_DEF_Int4_1_tags[] = {
 
515
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
516
};
 
517
asn_TYPE_descriptor_t asn_DEF_Int4 = {
 
518
        "Int4",
 
519
        "Int4",
 
520
        Int4_free,
 
521
        Int4_print,
 
522
        Int4_constraint,
 
523
        Int4_decode_ber,
 
524
        Int4_encode_der,
 
525
        Int4_decode_xer,
 
526
        Int4_encode_xer,
 
527
        0,      /* Use generic outmost tag fetcher */
 
528
        asn_DEF_Int4_1_tags,
 
529
        sizeof(asn_DEF_Int4_1_tags)
 
530
                /sizeof(asn_DEF_Int4_1_tags[0]), /* 1 */
 
531
        asn_DEF_Int4_1_tags,    /* Same as above */
 
532
        sizeof(asn_DEF_Int4_1_tags)
 
533
                /sizeof(asn_DEF_Int4_1_tags[0]), /* 1 */
 
534
        0, 0,   /* No members */
 
535
        0       /* No specifics */
 
536
};
 
537
 
 
538
 
 
539
/*** <<< INCLUDES [Int5] >>> ***/
 
540
 
 
541
#include <Int4.h>
 
542
 
 
543
/*** <<< TYPE-DECLS [Int5] >>> ***/
 
544
 
 
545
typedef Int4_t   Int5_t;
 
546
 
 
547
/*** <<< FUNC-DECLS [Int5] >>> ***/
 
548
 
 
549
extern asn_TYPE_descriptor_t asn_DEF_Int5;
 
550
asn_struct_free_f Int5_free;
 
551
asn_struct_print_f Int5_print;
 
552
asn_constr_check_f Int5_constraint;
 
553
ber_type_decoder_f Int5_decode_ber;
 
554
der_type_encoder_f Int5_encode_der;
 
555
xer_type_decoder_f Int5_decode_xer;
 
556
xer_type_encoder_f Int5_encode_xer;
 
557
 
 
558
/*** <<< CODE [Int5] >>> ***/
 
559
 
 
560
int
 
561
Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
562
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
563
        const Int4_t *st = (const Int4_t *)sptr;
 
564
        long value;
 
565
        
 
566
        if(!sptr) {
 
567
                _ASN_ERRLOG(app_errlog, app_key,
 
568
                        "%s: value not given (%s:%d)",
 
569
                        td->name, __FILE__, __LINE__);
 
570
                return -1;
 
571
        }
 
572
        
 
573
        if(asn_INTEGER2long(st, &value)) {
 
574
                _ASN_ERRLOG(app_errlog, app_key,
 
575
                        "%s: value too large (%s:%d)",
 
576
                        td->name, __FILE__, __LINE__);
 
577
                return -1;
 
578
        }
 
579
        
 
580
        if((value == 5)) {
 
581
                /* Constraint check succeeded */
 
582
                return 0;
 
583
        } else {
 
584
                _ASN_ERRLOG(app_errlog, app_key,
 
585
                        "%s: constraint failed (%s:%d)",
 
586
                        td->name, __FILE__, __LINE__);
 
587
                return -1;
 
588
        }
 
589
}
 
590
 
 
591
/*
 
592
 * This type is implemented using Int4,
 
593
 * so here we adjust the DEF accordingly.
 
594
 */
 
595
static void
 
596
Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
597
        td->free_struct    = asn_DEF_Int4.free_struct;
 
598
        td->print_struct   = asn_DEF_Int4.print_struct;
 
599
        td->ber_decoder    = asn_DEF_Int4.ber_decoder;
 
600
        td->der_encoder    = asn_DEF_Int4.der_encoder;
 
601
        td->xer_decoder    = asn_DEF_Int4.xer_decoder;
 
602
        td->xer_encoder    = asn_DEF_Int4.xer_encoder;
 
603
        td->elements       = asn_DEF_Int4.elements;
 
604
        td->elements_count = asn_DEF_Int4.elements_count;
 
605
        td->specifics      = asn_DEF_Int4.specifics;
 
606
}
 
607
 
 
608
void
 
609
Int5_free(asn_TYPE_descriptor_t *td,
 
610
                void *struct_ptr, int contents_only) {
 
611
        Int5_1_inherit_TYPE_descriptor(td);
 
612
        td->free_struct(td, struct_ptr, contents_only);
 
613
}
 
614
 
 
615
int
 
616
Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
617
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
618
        Int5_1_inherit_TYPE_descriptor(td);
 
619
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
620
}
 
621
 
 
622
asn_dec_rval_t
 
623
Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
624
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
625
        Int5_1_inherit_TYPE_descriptor(td);
 
626
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
627
}
 
628
 
 
629
asn_enc_rval_t
 
630
Int5_encode_der(asn_TYPE_descriptor_t *td,
 
631
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
632
                asn_app_consume_bytes_f *cb, void *app_key) {
 
633
        Int5_1_inherit_TYPE_descriptor(td);
 
634
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
635
}
 
636
 
 
637
asn_dec_rval_t
 
638
Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
639
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
640
        Int5_1_inherit_TYPE_descriptor(td);
 
641
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
642
}
 
643
 
 
644
asn_enc_rval_t
 
645
Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
646
                int ilevel, enum xer_encoder_flags_e flags,
 
647
                asn_app_consume_bytes_f *cb, void *app_key) {
 
648
        Int5_1_inherit_TYPE_descriptor(td);
 
649
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
650
}
 
651
 
 
652
 
 
653
/*** <<< STAT-DEFS [Int5] >>> ***/
 
654
 
 
655
static ber_tlv_tag_t asn_DEF_Int5_1_tags[] = {
 
656
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
657
};
 
658
asn_TYPE_descriptor_t asn_DEF_Int5 = {
 
659
        "Int5",
 
660
        "Int5",
 
661
        Int5_free,
 
662
        Int5_print,
 
663
        Int5_constraint,
 
664
        Int5_decode_ber,
 
665
        Int5_encode_der,
 
666
        Int5_decode_xer,
 
667
        Int5_encode_xer,
 
668
        0,      /* Use generic outmost tag fetcher */
 
669
        asn_DEF_Int5_1_tags,
 
670
        sizeof(asn_DEF_Int5_1_tags)
 
671
                /sizeof(asn_DEF_Int5_1_tags[0]), /* 1 */
 
672
        asn_DEF_Int5_1_tags,    /* Same as above */
 
673
        sizeof(asn_DEF_Int5_1_tags)
 
674
                /sizeof(asn_DEF_Int5_1_tags[0]), /* 1 */
 
675
        0, 0,   /* No members */
 
676
        0       /* No specifics */
 
677
};
 
678
 
 
679
 
 
680
/*** <<< INCLUDES [ExtensibleExtensions] >>> ***/
 
681
 
 
682
#include <INTEGER.h>
 
683
 
 
684
/*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/
 
685
 
 
686
typedef INTEGER_t        ExtensibleExtensions_t;
 
687
 
 
688
/*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/
 
689
 
 
690
extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions;
 
691
asn_struct_free_f ExtensibleExtensions_free;
 
692
asn_struct_print_f ExtensibleExtensions_print;
 
693
asn_constr_check_f ExtensibleExtensions_constraint;
 
694
ber_type_decoder_f ExtensibleExtensions_decode_ber;
 
695
der_type_encoder_f ExtensibleExtensions_encode_der;
 
696
xer_type_decoder_f ExtensibleExtensions_decode_xer;
 
697
xer_type_encoder_f ExtensibleExtensions_encode_xer;
 
698
 
 
699
/*** <<< CODE [ExtensibleExtensions] >>> ***/
 
700
 
 
701
int
 
702
ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
703
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
704
        const INTEGER_t *st = (const INTEGER_t *)sptr;
 
705
        long value;
 
706
        
 
707
        if(!sptr) {
 
708
                _ASN_ERRLOG(app_errlog, app_key,
 
709
                        "%s: value not given (%s:%d)",
 
710
                        td->name, __FILE__, __LINE__);
 
711
                return -1;
 
712
        }
 
713
        
 
714
        if(asn_INTEGER2long(st, &value)) {
 
715
                _ASN_ERRLOG(app_errlog, app_key,
 
716
                        "%s: value too large (%s:%d)",
 
717
                        td->name, __FILE__, __LINE__);
 
718
                return -1;
 
719
        }
 
720
        
 
721
        if((value >= 1 && value <= 256)) {
 
722
                /* Constraint check succeeded */
 
723
                return 0;
 
724
        } else {
 
725
                _ASN_ERRLOG(app_errlog, app_key,
 
726
                        "%s: constraint failed (%s:%d)",
 
727
                        td->name, __FILE__, __LINE__);
 
728
                return -1;
 
729
        }
 
730
}
 
731
 
 
732
/*
 
733
 * This type is implemented using INTEGER,
 
734
 * so here we adjust the DEF accordingly.
 
735
 */
 
736
static void
 
737
ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
738
        td->free_struct    = asn_DEF_INTEGER.free_struct;
 
739
        td->print_struct   = asn_DEF_INTEGER.print_struct;
 
740
        td->ber_decoder    = asn_DEF_INTEGER.ber_decoder;
 
741
        td->der_encoder    = asn_DEF_INTEGER.der_encoder;
 
742
        td->xer_decoder    = asn_DEF_INTEGER.xer_decoder;
 
743
        td->xer_encoder    = asn_DEF_INTEGER.xer_encoder;
 
744
        td->elements       = asn_DEF_INTEGER.elements;
 
745
        td->elements_count = asn_DEF_INTEGER.elements_count;
 
746
        td->specifics      = asn_DEF_INTEGER.specifics;
 
747
}
 
748
 
 
749
void
 
750
ExtensibleExtensions_free(asn_TYPE_descriptor_t *td,
 
751
                void *struct_ptr, int contents_only) {
 
752
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
753
        td->free_struct(td, struct_ptr, contents_only);
 
754
}
 
755
 
 
756
int
 
757
ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
758
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
759
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
760
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
761
}
 
762
 
 
763
asn_dec_rval_t
 
764
ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
765
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
766
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
767
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
768
}
 
769
 
 
770
asn_enc_rval_t
 
771
ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td,
 
772
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
773
                asn_app_consume_bytes_f *cb, void *app_key) {
 
774
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
775
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
776
}
 
777
 
 
778
asn_dec_rval_t
 
779
ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
780
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
781
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
782
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
783
}
 
784
 
 
785
asn_enc_rval_t
 
786
ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
787
                int ilevel, enum xer_encoder_flags_e flags,
 
788
                asn_app_consume_bytes_f *cb, void *app_key) {
 
789
        ExtensibleExtensions_1_inherit_TYPE_descriptor(td);
 
790
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
791
}
 
792
 
 
793
 
 
794
/*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/
 
795
 
 
796
static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_1_tags[] = {
 
797
        (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
 
798
};
 
799
asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = {
 
800
        "ExtensibleExtensions",
 
801
        "ExtensibleExtensions",
 
802
        ExtensibleExtensions_free,
 
803
        ExtensibleExtensions_print,
 
804
        ExtensibleExtensions_constraint,
 
805
        ExtensibleExtensions_decode_ber,
 
806
        ExtensibleExtensions_encode_der,
 
807
        ExtensibleExtensions_decode_xer,
 
808
        ExtensibleExtensions_encode_xer,
 
809
        0,      /* Use generic outmost tag fetcher */
 
810
        asn_DEF_ExtensibleExtensions_1_tags,
 
811
        sizeof(asn_DEF_ExtensibleExtensions_1_tags)
 
812
                /sizeof(asn_DEF_ExtensibleExtensions_1_tags[0]), /* 1 */
 
813
        asn_DEF_ExtensibleExtensions_1_tags,    /* Same as above */
 
814
        sizeof(asn_DEF_ExtensibleExtensions_1_tags)
 
815
                /sizeof(asn_DEF_ExtensibleExtensions_1_tags[0]), /* 1 */
 
816
        0, 0,   /* No members */
 
817
        0       /* No specifics */
 
818
};
 
819
 
 
820
 
 
821
/*** <<< INCLUDES [Str1] >>> ***/
 
822
 
 
823
#include <IA5String.h>
 
824
 
 
825
/*** <<< TYPE-DECLS [Str1] >>> ***/
 
826
 
 
827
typedef IA5String_t      Str1_t;
 
828
 
 
829
/*** <<< FUNC-DECLS [Str1] >>> ***/
 
830
 
 
831
extern asn_TYPE_descriptor_t asn_DEF_Str1;
 
832
asn_struct_free_f Str1_free;
 
833
asn_struct_print_f Str1_print;
 
834
asn_constr_check_f Str1_constraint;
 
835
ber_type_decoder_f Str1_decode_ber;
 
836
der_type_encoder_f Str1_encode_der;
 
837
xer_type_decoder_f Str1_decode_xer;
 
838
xer_type_encoder_f Str1_encode_xer;
 
839
 
 
840
/*** <<< CODE [Str1] >>> ***/
 
841
 
 
842
int
 
843
Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
844
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
845
        /* Replace with underlying type checker */
 
846
        td->check_constraints = asn_DEF_IA5String.check_constraints;
 
847
        return td->check_constraints(td, sptr, app_errlog, app_key);
 
848
}
 
849
 
 
850
/*
 
851
 * This type is implemented using IA5String,
 
852
 * so here we adjust the DEF accordingly.
 
853
 */
 
854
static void
 
855
Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
856
        td->free_struct    = asn_DEF_IA5String.free_struct;
 
857
        td->print_struct   = asn_DEF_IA5String.print_struct;
 
858
        td->ber_decoder    = asn_DEF_IA5String.ber_decoder;
 
859
        td->der_encoder    = asn_DEF_IA5String.der_encoder;
 
860
        td->xer_decoder    = asn_DEF_IA5String.xer_decoder;
 
861
        td->xer_encoder    = asn_DEF_IA5String.xer_encoder;
 
862
        td->elements       = asn_DEF_IA5String.elements;
 
863
        td->elements_count = asn_DEF_IA5String.elements_count;
 
864
        td->specifics      = asn_DEF_IA5String.specifics;
 
865
}
 
866
 
 
867
void
 
868
Str1_free(asn_TYPE_descriptor_t *td,
 
869
                void *struct_ptr, int contents_only) {
 
870
        Str1_1_inherit_TYPE_descriptor(td);
 
871
        td->free_struct(td, struct_ptr, contents_only);
 
872
}
 
873
 
 
874
int
 
875
Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
876
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
877
        Str1_1_inherit_TYPE_descriptor(td);
 
878
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
879
}
 
880
 
 
881
asn_dec_rval_t
 
882
Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
883
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
884
        Str1_1_inherit_TYPE_descriptor(td);
 
885
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
886
}
 
887
 
 
888
asn_enc_rval_t
 
889
Str1_encode_der(asn_TYPE_descriptor_t *td,
 
890
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
891
                asn_app_consume_bytes_f *cb, void *app_key) {
 
892
        Str1_1_inherit_TYPE_descriptor(td);
 
893
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
894
}
 
895
 
 
896
asn_dec_rval_t
 
897
Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
898
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
899
        Str1_1_inherit_TYPE_descriptor(td);
 
900
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
901
}
 
902
 
 
903
asn_enc_rval_t
 
904
Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
905
                int ilevel, enum xer_encoder_flags_e flags,
 
906
                asn_app_consume_bytes_f *cb, void *app_key) {
 
907
        Str1_1_inherit_TYPE_descriptor(td);
 
908
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
909
}
 
910
 
 
911
 
 
912
/*** <<< STAT-DEFS [Str1] >>> ***/
 
913
 
 
914
static ber_tlv_tag_t asn_DEF_Str1_1_tags[] = {
 
915
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
916
};
 
917
asn_TYPE_descriptor_t asn_DEF_Str1 = {
 
918
        "Str1",
 
919
        "Str1",
 
920
        Str1_free,
 
921
        Str1_print,
 
922
        Str1_constraint,
 
923
        Str1_decode_ber,
 
924
        Str1_encode_der,
 
925
        Str1_decode_xer,
 
926
        Str1_encode_xer,
 
927
        0,      /* Use generic outmost tag fetcher */
 
928
        asn_DEF_Str1_1_tags,
 
929
        sizeof(asn_DEF_Str1_1_tags)
 
930
                /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */
 
931
        asn_DEF_Str1_1_tags,    /* Same as above */
 
932
        sizeof(asn_DEF_Str1_1_tags)
 
933
                /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */
 
934
        0, 0,   /* No members */
 
935
        0       /* No specifics */
 
936
};
 
937
 
 
938
 
 
939
/*** <<< INCLUDES [Str2] >>> ***/
 
940
 
 
941
#include <Str1.h>
 
942
 
 
943
/*** <<< TYPE-DECLS [Str2] >>> ***/
 
944
 
 
945
typedef Str1_t   Str2_t;
 
946
 
 
947
/*** <<< FUNC-DECLS [Str2] >>> ***/
 
948
 
 
949
extern asn_TYPE_descriptor_t asn_DEF_Str2;
 
950
asn_struct_free_f Str2_free;
 
951
asn_struct_print_f Str2_print;
 
952
asn_constr_check_f Str2_constraint;
 
953
ber_type_decoder_f Str2_decode_ber;
 
954
der_type_encoder_f Str2_encode_der;
 
955
xer_type_decoder_f Str2_decode_xer;
 
956
xer_type_encoder_f Str2_encode_xer;
 
957
 
 
958
/*** <<< CTABLES [Str2] >>> ***/
 
959
 
 
960
static int check_permitted_alphabet_1(const void *sptr) {
 
961
        /* The underlying type is IA5String */
 
962
        const IA5String_t *st = (const IA5String_t *)sptr;
 
963
        const uint8_t *ch = st->buf;
 
964
        const uint8_t *end = ch + st->size;
 
965
        
 
966
        for(; ch < end; ch++) {
 
967
                uint8_t cv = *ch;
 
968
                if(!(cv <= 127)) return -1;
 
969
        }
 
970
        return 0;
 
971
}
 
972
 
 
973
 
 
974
/*** <<< CODE [Str2] >>> ***/
 
975
 
 
976
int
 
977
Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
978
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
979
        const Str1_t *st = (const Str1_t *)sptr;
 
980
        size_t size;
 
981
        
 
982
        if(!sptr) {
 
983
                _ASN_ERRLOG(app_errlog, app_key,
 
984
                        "%s: value not given (%s:%d)",
 
985
                        td->name, __FILE__, __LINE__);
 
986
                return -1;
 
987
        }
 
988
        
 
989
        size = st->size;
 
990
        
 
991
        if(((size <= 20) || (size >= 25 && size <= 30))
 
992
                 && !check_permitted_alphabet_1(st)) {
 
993
                /* Constraint check succeeded */
 
994
                return 0;
 
995
        } else {
 
996
                _ASN_ERRLOG(app_errlog, app_key,
 
997
                        "%s: constraint failed (%s:%d)",
 
998
                        td->name, __FILE__, __LINE__);
 
999
                return -1;
 
1000
        }
 
1001
}
 
1002
 
 
1003
/*
 
1004
 * This type is implemented using Str1,
 
1005
 * so here we adjust the DEF accordingly.
 
1006
 */
 
1007
static void
 
1008
Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1009
        td->free_struct    = asn_DEF_Str1.free_struct;
 
1010
        td->print_struct   = asn_DEF_Str1.print_struct;
 
1011
        td->ber_decoder    = asn_DEF_Str1.ber_decoder;
 
1012
        td->der_encoder    = asn_DEF_Str1.der_encoder;
 
1013
        td->xer_decoder    = asn_DEF_Str1.xer_decoder;
 
1014
        td->xer_encoder    = asn_DEF_Str1.xer_encoder;
 
1015
        td->elements       = asn_DEF_Str1.elements;
 
1016
        td->elements_count = asn_DEF_Str1.elements_count;
 
1017
        td->specifics      = asn_DEF_Str1.specifics;
 
1018
}
 
1019
 
 
1020
void
 
1021
Str2_free(asn_TYPE_descriptor_t *td,
 
1022
                void *struct_ptr, int contents_only) {
 
1023
        Str2_1_inherit_TYPE_descriptor(td);
 
1024
        td->free_struct(td, struct_ptr, contents_only);
 
1025
}
 
1026
 
 
1027
int
 
1028
Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1029
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1030
        Str2_1_inherit_TYPE_descriptor(td);
 
1031
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1032
}
 
1033
 
 
1034
asn_dec_rval_t
 
1035
Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1036
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1037
        Str2_1_inherit_TYPE_descriptor(td);
 
1038
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1039
}
 
1040
 
 
1041
asn_enc_rval_t
 
1042
Str2_encode_der(asn_TYPE_descriptor_t *td,
 
1043
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1044
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1045
        Str2_1_inherit_TYPE_descriptor(td);
 
1046
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1047
}
 
1048
 
 
1049
asn_dec_rval_t
 
1050
Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1051
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1052
        Str2_1_inherit_TYPE_descriptor(td);
 
1053
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1054
}
 
1055
 
 
1056
asn_enc_rval_t
 
1057
Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1058
                int ilevel, enum xer_encoder_flags_e flags,
 
1059
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1060
        Str2_1_inherit_TYPE_descriptor(td);
 
1061
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1062
}
 
1063
 
 
1064
 
 
1065
/*** <<< STAT-DEFS [Str2] >>> ***/
 
1066
 
 
1067
static ber_tlv_tag_t asn_DEF_Str2_1_tags[] = {
 
1068
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1069
};
 
1070
asn_TYPE_descriptor_t asn_DEF_Str2 = {
 
1071
        "Str2",
 
1072
        "Str2",
 
1073
        Str2_free,
 
1074
        Str2_print,
 
1075
        Str2_constraint,
 
1076
        Str2_decode_ber,
 
1077
        Str2_encode_der,
 
1078
        Str2_decode_xer,
 
1079
        Str2_encode_xer,
 
1080
        0,      /* Use generic outmost tag fetcher */
 
1081
        asn_DEF_Str2_1_tags,
 
1082
        sizeof(asn_DEF_Str2_1_tags)
 
1083
                /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */
 
1084
        asn_DEF_Str2_1_tags,    /* Same as above */
 
1085
        sizeof(asn_DEF_Str2_1_tags)
 
1086
                /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */
 
1087
        0, 0,   /* No members */
 
1088
        0       /* No specifics */
 
1089
};
 
1090
 
 
1091
 
 
1092
/*** <<< INCLUDES [Str3] >>> ***/
 
1093
 
 
1094
#include <Str2.h>
 
1095
 
 
1096
/*** <<< TYPE-DECLS [Str3] >>> ***/
 
1097
 
 
1098
typedef Str2_t   Str3_t;
 
1099
 
 
1100
/*** <<< FUNC-DECLS [Str3] >>> ***/
 
1101
 
 
1102
extern asn_TYPE_descriptor_t asn_DEF_Str3;
 
1103
asn_struct_free_f Str3_free;
 
1104
asn_struct_print_f Str3_print;
 
1105
asn_constr_check_f Str3_constraint;
 
1106
ber_type_decoder_f Str3_decode_ber;
 
1107
der_type_encoder_f Str3_encode_der;
 
1108
xer_type_decoder_f Str3_decode_xer;
 
1109
xer_type_encoder_f Str3_encode_xer;
 
1110
 
 
1111
/*** <<< CTABLES [Str3] >>> ***/
 
1112
 
 
1113
static int permitted_alphabet_table_1[256] = {
 
1114
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
1115
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
1116
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
1117
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
1118
0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,        /*  ABC             */
 
1119
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
1120
0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,        /*     def          */
 
1121
};
 
1122
 
 
1123
static int check_permitted_alphabet_1(const void *sptr) {
 
1124
        int *table = permitted_alphabet_table_1;
 
1125
        /* The underlying type is IA5String */
 
1126
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1127
        const uint8_t *ch = st->buf;
 
1128
        const uint8_t *end = ch + st->size;
 
1129
        
 
1130
        for(; ch < end; ch++) {
 
1131
                uint8_t cv = *ch;
 
1132
                if(!table[cv]) return -1;
 
1133
        }
 
1134
        return 0;
 
1135
}
 
1136
 
 
1137
 
 
1138
/*** <<< CODE [Str3] >>> ***/
 
1139
 
 
1140
int
 
1141
Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1142
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1143
        const Str2_t *st = (const Str2_t *)sptr;
 
1144
        size_t size;
 
1145
        
 
1146
        if(!sptr) {
 
1147
                _ASN_ERRLOG(app_errlog, app_key,
 
1148
                        "%s: value not given (%s:%d)",
 
1149
                        td->name, __FILE__, __LINE__);
 
1150
                return -1;
 
1151
        }
 
1152
        
 
1153
        size = st->size;
 
1154
        
 
1155
        if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27))
 
1156
                 && !check_permitted_alphabet_1(st)) {
 
1157
                /* Constraint check succeeded */
 
1158
                return 0;
 
1159
        } else {
 
1160
                _ASN_ERRLOG(app_errlog, app_key,
 
1161
                        "%s: constraint failed (%s:%d)",
 
1162
                        td->name, __FILE__, __LINE__);
 
1163
                return -1;
 
1164
        }
 
1165
}
 
1166
 
 
1167
/*
 
1168
 * This type is implemented using Str2,
 
1169
 * so here we adjust the DEF accordingly.
 
1170
 */
 
1171
static void
 
1172
Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1173
        td->free_struct    = asn_DEF_Str2.free_struct;
 
1174
        td->print_struct   = asn_DEF_Str2.print_struct;
 
1175
        td->ber_decoder    = asn_DEF_Str2.ber_decoder;
 
1176
        td->der_encoder    = asn_DEF_Str2.der_encoder;
 
1177
        td->xer_decoder    = asn_DEF_Str2.xer_decoder;
 
1178
        td->xer_encoder    = asn_DEF_Str2.xer_encoder;
 
1179
        td->elements       = asn_DEF_Str2.elements;
 
1180
        td->elements_count = asn_DEF_Str2.elements_count;
 
1181
        td->specifics      = asn_DEF_Str2.specifics;
 
1182
}
 
1183
 
 
1184
void
 
1185
Str3_free(asn_TYPE_descriptor_t *td,
 
1186
                void *struct_ptr, int contents_only) {
 
1187
        Str3_1_inherit_TYPE_descriptor(td);
 
1188
        td->free_struct(td, struct_ptr, contents_only);
 
1189
}
 
1190
 
 
1191
int
 
1192
Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1193
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1194
        Str3_1_inherit_TYPE_descriptor(td);
 
1195
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1196
}
 
1197
 
 
1198
asn_dec_rval_t
 
1199
Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1200
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1201
        Str3_1_inherit_TYPE_descriptor(td);
 
1202
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1203
}
 
1204
 
 
1205
asn_enc_rval_t
 
1206
Str3_encode_der(asn_TYPE_descriptor_t *td,
 
1207
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1208
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1209
        Str3_1_inherit_TYPE_descriptor(td);
 
1210
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1211
}
 
1212
 
 
1213
asn_dec_rval_t
 
1214
Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1215
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1216
        Str3_1_inherit_TYPE_descriptor(td);
 
1217
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1218
}
 
1219
 
 
1220
asn_enc_rval_t
 
1221
Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1222
                int ilevel, enum xer_encoder_flags_e flags,
 
1223
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1224
        Str3_1_inherit_TYPE_descriptor(td);
 
1225
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1226
}
 
1227
 
 
1228
 
 
1229
/*** <<< STAT-DEFS [Str3] >>> ***/
 
1230
 
 
1231
static ber_tlv_tag_t asn_DEF_Str3_1_tags[] = {
 
1232
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1233
};
 
1234
asn_TYPE_descriptor_t asn_DEF_Str3 = {
 
1235
        "Str3",
 
1236
        "Str3",
 
1237
        Str3_free,
 
1238
        Str3_print,
 
1239
        Str3_constraint,
 
1240
        Str3_decode_ber,
 
1241
        Str3_encode_der,
 
1242
        Str3_decode_xer,
 
1243
        Str3_encode_xer,
 
1244
        0,      /* Use generic outmost tag fetcher */
 
1245
        asn_DEF_Str3_1_tags,
 
1246
        sizeof(asn_DEF_Str3_1_tags)
 
1247
                /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */
 
1248
        asn_DEF_Str3_1_tags,    /* Same as above */
 
1249
        sizeof(asn_DEF_Str3_1_tags)
 
1250
                /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */
 
1251
        0, 0,   /* No members */
 
1252
        0       /* No specifics */
 
1253
};
 
1254
 
 
1255
 
 
1256
/*** <<< INCLUDES [Str4] >>> ***/
 
1257
 
 
1258
#include <IA5String.h>
 
1259
 
 
1260
/*** <<< TYPE-DECLS [Str4] >>> ***/
 
1261
 
 
1262
typedef IA5String_t      Str4_t;
 
1263
 
 
1264
/*** <<< FUNC-DECLS [Str4] >>> ***/
 
1265
 
 
1266
extern asn_TYPE_descriptor_t asn_DEF_Str4;
 
1267
asn_struct_free_f Str4_free;
 
1268
asn_struct_print_f Str4_print;
 
1269
asn_constr_check_f Str4_constraint;
 
1270
ber_type_decoder_f Str4_decode_ber;
 
1271
der_type_encoder_f Str4_encode_der;
 
1272
xer_type_decoder_f Str4_decode_xer;
 
1273
xer_type_encoder_f Str4_encode_xer;
 
1274
 
 
1275
/*** <<< CTABLES [Str4] >>> ***/
 
1276
 
 
1277
static int check_permitted_alphabet_1(const void *sptr) {
 
1278
        /* The underlying type is IA5String */
 
1279
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1280
        const uint8_t *ch = st->buf;
 
1281
        const uint8_t *end = ch + st->size;
 
1282
        
 
1283
        for(; ch < end; ch++) {
 
1284
                uint8_t cv = *ch;
 
1285
                if(!(cv <= 127)) return -1;
 
1286
        }
 
1287
        return 0;
 
1288
}
 
1289
 
 
1290
 
 
1291
/*** <<< CODE [Str4] >>> ***/
 
1292
 
 
1293
int
 
1294
Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1295
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1296
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1297
        
 
1298
        if(!sptr) {
 
1299
                _ASN_ERRLOG(app_errlog, app_key,
 
1300
                        "%s: value not given (%s:%d)",
 
1301
                        td->name, __FILE__, __LINE__);
 
1302
                return -1;
 
1303
        }
 
1304
        
 
1305
        
 
1306
        if(!check_permitted_alphabet_1(st)) {
 
1307
                /* Constraint check succeeded */
 
1308
                return 0;
 
1309
        } else {
 
1310
                _ASN_ERRLOG(app_errlog, app_key,
 
1311
                        "%s: constraint failed (%s:%d)",
 
1312
                        td->name, __FILE__, __LINE__);
 
1313
                return -1;
 
1314
        }
 
1315
}
 
1316
 
 
1317
/*
 
1318
 * This type is implemented using IA5String,
 
1319
 * so here we adjust the DEF accordingly.
 
1320
 */
 
1321
static void
 
1322
Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1323
        td->free_struct    = asn_DEF_IA5String.free_struct;
 
1324
        td->print_struct   = asn_DEF_IA5String.print_struct;
 
1325
        td->ber_decoder    = asn_DEF_IA5String.ber_decoder;
 
1326
        td->der_encoder    = asn_DEF_IA5String.der_encoder;
 
1327
        td->xer_decoder    = asn_DEF_IA5String.xer_decoder;
 
1328
        td->xer_encoder    = asn_DEF_IA5String.xer_encoder;
 
1329
        td->elements       = asn_DEF_IA5String.elements;
 
1330
        td->elements_count = asn_DEF_IA5String.elements_count;
 
1331
        td->specifics      = asn_DEF_IA5String.specifics;
 
1332
}
 
1333
 
 
1334
void
 
1335
Str4_free(asn_TYPE_descriptor_t *td,
 
1336
                void *struct_ptr, int contents_only) {
 
1337
        Str4_1_inherit_TYPE_descriptor(td);
 
1338
        td->free_struct(td, struct_ptr, contents_only);
 
1339
}
 
1340
 
 
1341
int
 
1342
Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1343
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1344
        Str4_1_inherit_TYPE_descriptor(td);
 
1345
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1346
}
 
1347
 
 
1348
asn_dec_rval_t
 
1349
Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1350
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1351
        Str4_1_inherit_TYPE_descriptor(td);
 
1352
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1353
}
 
1354
 
 
1355
asn_enc_rval_t
 
1356
Str4_encode_der(asn_TYPE_descriptor_t *td,
 
1357
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1358
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1359
        Str4_1_inherit_TYPE_descriptor(td);
 
1360
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1361
}
 
1362
 
 
1363
asn_dec_rval_t
 
1364
Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1365
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1366
        Str4_1_inherit_TYPE_descriptor(td);
 
1367
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1368
}
 
1369
 
 
1370
asn_enc_rval_t
 
1371
Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1372
                int ilevel, enum xer_encoder_flags_e flags,
 
1373
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1374
        Str4_1_inherit_TYPE_descriptor(td);
 
1375
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1376
}
 
1377
 
 
1378
 
 
1379
/*** <<< STAT-DEFS [Str4] >>> ***/
 
1380
 
 
1381
static ber_tlv_tag_t asn_DEF_Str4_1_tags[] = {
 
1382
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1383
};
 
1384
asn_TYPE_descriptor_t asn_DEF_Str4 = {
 
1385
        "Str4",
 
1386
        "Str4",
 
1387
        Str4_free,
 
1388
        Str4_print,
 
1389
        Str4_constraint,
 
1390
        Str4_decode_ber,
 
1391
        Str4_encode_der,
 
1392
        Str4_decode_xer,
 
1393
        Str4_encode_xer,
 
1394
        0,      /* Use generic outmost tag fetcher */
 
1395
        asn_DEF_Str4_1_tags,
 
1396
        sizeof(asn_DEF_Str4_1_tags)
 
1397
                /sizeof(asn_DEF_Str4_1_tags[0]), /* 1 */
 
1398
        asn_DEF_Str4_1_tags,    /* Same as above */
 
1399
        sizeof(asn_DEF_Str4_1_tags)
 
1400
                /sizeof(asn_DEF_Str4_1_tags[0]), /* 1 */
 
1401
        0, 0,   /* No members */
 
1402
        0       /* No specifics */
 
1403
};
 
1404
 
 
1405
 
 
1406
/*** <<< INCLUDES [PER-Visible] >>> ***/
 
1407
 
 
1408
#include <IA5String.h>
 
1409
 
 
1410
/*** <<< TYPE-DECLS [PER-Visible] >>> ***/
 
1411
 
 
1412
typedef IA5String_t      PER_Visible_t;
 
1413
 
 
1414
/*** <<< FUNC-DECLS [PER-Visible] >>> ***/
 
1415
 
 
1416
extern asn_TYPE_descriptor_t asn_DEF_PER_Visible;
 
1417
asn_struct_free_f PER_Visible_free;
 
1418
asn_struct_print_f PER_Visible_print;
 
1419
asn_constr_check_f PER_Visible_constraint;
 
1420
ber_type_decoder_f PER_Visible_decode_ber;
 
1421
der_type_encoder_f PER_Visible_encode_der;
 
1422
xer_type_decoder_f PER_Visible_decode_xer;
 
1423
xer_type_encoder_f PER_Visible_encode_xer;
 
1424
 
 
1425
/*** <<< CTABLES [PER-Visible] >>> ***/
 
1426
 
 
1427
static int check_permitted_alphabet_1(const void *sptr) {
 
1428
        /* The underlying type is IA5String */
 
1429
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1430
        const uint8_t *ch = st->buf;
 
1431
        const uint8_t *end = ch + st->size;
 
1432
        
 
1433
        for(; ch < end; ch++) {
 
1434
                uint8_t cv = *ch;
 
1435
                if(!(cv >= 65 && cv <= 70)) return -1;
 
1436
        }
 
1437
        return 0;
 
1438
}
 
1439
 
 
1440
 
 
1441
/*** <<< CODE [PER-Visible] >>> ***/
 
1442
 
 
1443
int
 
1444
PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1445
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1446
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1447
        
 
1448
        if(!sptr) {
 
1449
                _ASN_ERRLOG(app_errlog, app_key,
 
1450
                        "%s: value not given (%s:%d)",
 
1451
                        td->name, __FILE__, __LINE__);
 
1452
                return -1;
 
1453
        }
 
1454
        
 
1455
        
 
1456
        if(!check_permitted_alphabet_1(st)) {
 
1457
                /* Constraint check succeeded */
 
1458
                return 0;
 
1459
        } else {
 
1460
                _ASN_ERRLOG(app_errlog, app_key,
 
1461
                        "%s: constraint failed (%s:%d)",
 
1462
                        td->name, __FILE__, __LINE__);
 
1463
                return -1;
 
1464
        }
 
1465
}
 
1466
 
 
1467
/*
 
1468
 * This type is implemented using IA5String,
 
1469
 * so here we adjust the DEF accordingly.
 
1470
 */
 
1471
static void
 
1472
PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1473
        td->free_struct    = asn_DEF_IA5String.free_struct;
 
1474
        td->print_struct   = asn_DEF_IA5String.print_struct;
 
1475
        td->ber_decoder    = asn_DEF_IA5String.ber_decoder;
 
1476
        td->der_encoder    = asn_DEF_IA5String.der_encoder;
 
1477
        td->xer_decoder    = asn_DEF_IA5String.xer_decoder;
 
1478
        td->xer_encoder    = asn_DEF_IA5String.xer_encoder;
 
1479
        td->elements       = asn_DEF_IA5String.elements;
 
1480
        td->elements_count = asn_DEF_IA5String.elements_count;
 
1481
        td->specifics      = asn_DEF_IA5String.specifics;
 
1482
}
 
1483
 
 
1484
void
 
1485
PER_Visible_free(asn_TYPE_descriptor_t *td,
 
1486
                void *struct_ptr, int contents_only) {
 
1487
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1488
        td->free_struct(td, struct_ptr, contents_only);
 
1489
}
 
1490
 
 
1491
int
 
1492
PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1493
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1494
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1495
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1496
}
 
1497
 
 
1498
asn_dec_rval_t
 
1499
PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1500
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1501
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1502
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1503
}
 
1504
 
 
1505
asn_enc_rval_t
 
1506
PER_Visible_encode_der(asn_TYPE_descriptor_t *td,
 
1507
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1508
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1509
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1510
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1511
}
 
1512
 
 
1513
asn_dec_rval_t
 
1514
PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1515
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1516
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1517
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1518
}
 
1519
 
 
1520
asn_enc_rval_t
 
1521
PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1522
                int ilevel, enum xer_encoder_flags_e flags,
 
1523
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1524
        PER_Visible_1_inherit_TYPE_descriptor(td);
 
1525
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1526
}
 
1527
 
 
1528
 
 
1529
/*** <<< STAT-DEFS [PER-Visible] >>> ***/
 
1530
 
 
1531
static ber_tlv_tag_t asn_DEF_PER_Visible_1_tags[] = {
 
1532
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1533
};
 
1534
asn_TYPE_descriptor_t asn_DEF_PER_Visible = {
 
1535
        "PER-Visible",
 
1536
        "PER-Visible",
 
1537
        PER_Visible_free,
 
1538
        PER_Visible_print,
 
1539
        PER_Visible_constraint,
 
1540
        PER_Visible_decode_ber,
 
1541
        PER_Visible_encode_der,
 
1542
        PER_Visible_decode_xer,
 
1543
        PER_Visible_encode_xer,
 
1544
        0,      /* Use generic outmost tag fetcher */
 
1545
        asn_DEF_PER_Visible_1_tags,
 
1546
        sizeof(asn_DEF_PER_Visible_1_tags)
 
1547
                /sizeof(asn_DEF_PER_Visible_1_tags[0]), /* 1 */
 
1548
        asn_DEF_PER_Visible_1_tags,     /* Same as above */
 
1549
        sizeof(asn_DEF_PER_Visible_1_tags)
 
1550
                /sizeof(asn_DEF_PER_Visible_1_tags[0]), /* 1 */
 
1551
        0, 0,   /* No members */
 
1552
        0       /* No specifics */
 
1553
};
 
1554
 
 
1555
 
 
1556
/*** <<< INCLUDES [PER-Visible-2] >>> ***/
 
1557
 
 
1558
#include <PER-Visible.h>
 
1559
 
 
1560
/*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/
 
1561
 
 
1562
typedef PER_Visible_t    PER_Visible_2_t;
 
1563
 
 
1564
/*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/
 
1565
 
 
1566
extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2;
 
1567
asn_struct_free_f PER_Visible_2_free;
 
1568
asn_struct_print_f PER_Visible_2_print;
 
1569
asn_constr_check_f PER_Visible_2_constraint;
 
1570
ber_type_decoder_f PER_Visible_2_decode_ber;
 
1571
der_type_encoder_f PER_Visible_2_encode_der;
 
1572
xer_type_decoder_f PER_Visible_2_decode_xer;
 
1573
xer_type_encoder_f PER_Visible_2_encode_xer;
 
1574
 
 
1575
/*** <<< CTABLES [PER-Visible-2] >>> ***/
 
1576
 
 
1577
static int check_permitted_alphabet_1(const void *sptr) {
 
1578
        /* The underlying type is IA5String */
 
1579
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1580
        const uint8_t *ch = st->buf;
 
1581
        const uint8_t *end = ch + st->size;
 
1582
        
 
1583
        for(; ch < end; ch++) {
 
1584
                uint8_t cv = *ch;
 
1585
                if(!(cv >= 69 && cv <= 70)) return -1;
 
1586
        }
 
1587
        return 0;
 
1588
}
 
1589
 
 
1590
 
 
1591
/*** <<< CODE [PER-Visible-2] >>> ***/
 
1592
 
 
1593
int
 
1594
PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1595
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1596
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
1597
        
 
1598
        if(!sptr) {
 
1599
                _ASN_ERRLOG(app_errlog, app_key,
 
1600
                        "%s: value not given (%s:%d)",
 
1601
                        td->name, __FILE__, __LINE__);
 
1602
                return -1;
 
1603
        }
 
1604
        
 
1605
        
 
1606
        if(!check_permitted_alphabet_1(st)) {
 
1607
                /* Constraint check succeeded */
 
1608
                return 0;
 
1609
        } else {
 
1610
                _ASN_ERRLOG(app_errlog, app_key,
 
1611
                        "%s: constraint failed (%s:%d)",
 
1612
                        td->name, __FILE__, __LINE__);
 
1613
                return -1;
 
1614
        }
 
1615
}
 
1616
 
 
1617
/*
 
1618
 * This type is implemented using PER_Visible,
 
1619
 * so here we adjust the DEF accordingly.
 
1620
 */
 
1621
static void
 
1622
PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1623
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
1624
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
1625
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
1626
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
1627
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
1628
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
1629
        td->elements       = asn_DEF_PER_Visible.elements;
 
1630
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
1631
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
1632
}
 
1633
 
 
1634
void
 
1635
PER_Visible_2_free(asn_TYPE_descriptor_t *td,
 
1636
                void *struct_ptr, int contents_only) {
 
1637
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1638
        td->free_struct(td, struct_ptr, contents_only);
 
1639
}
 
1640
 
 
1641
int
 
1642
PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1643
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1644
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1645
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1646
}
 
1647
 
 
1648
asn_dec_rval_t
 
1649
PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1650
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1651
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1652
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1653
}
 
1654
 
 
1655
asn_enc_rval_t
 
1656
PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
 
1657
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1658
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1659
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1660
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1661
}
 
1662
 
 
1663
asn_dec_rval_t
 
1664
PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1665
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1666
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1667
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1668
}
 
1669
 
 
1670
asn_enc_rval_t
 
1671
PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1672
                int ilevel, enum xer_encoder_flags_e flags,
 
1673
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1674
        PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1675
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1676
}
 
1677
 
 
1678
 
 
1679
/*** <<< STAT-DEFS [PER-Visible-2] >>> ***/
 
1680
 
 
1681
static ber_tlv_tag_t asn_DEF_PER_Visible_2_1_tags[] = {
 
1682
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1683
};
 
1684
asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = {
 
1685
        "PER-Visible-2",
 
1686
        "PER-Visible-2",
 
1687
        PER_Visible_2_free,
 
1688
        PER_Visible_2_print,
 
1689
        PER_Visible_2_constraint,
 
1690
        PER_Visible_2_decode_ber,
 
1691
        PER_Visible_2_encode_der,
 
1692
        PER_Visible_2_decode_xer,
 
1693
        PER_Visible_2_encode_xer,
 
1694
        0,      /* Use generic outmost tag fetcher */
 
1695
        asn_DEF_PER_Visible_2_1_tags,
 
1696
        sizeof(asn_DEF_PER_Visible_2_1_tags)
 
1697
                /sizeof(asn_DEF_PER_Visible_2_1_tags[0]), /* 1 */
 
1698
        asn_DEF_PER_Visible_2_1_tags,   /* Same as above */
 
1699
        sizeof(asn_DEF_PER_Visible_2_1_tags)
 
1700
                /sizeof(asn_DEF_PER_Visible_2_1_tags[0]), /* 1 */
 
1701
        0, 0,   /* No members */
 
1702
        0       /* No specifics */
 
1703
};
 
1704
 
 
1705
 
 
1706
/*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/
 
1707
 
 
1708
#include <PER-Visible.h>
 
1709
 
 
1710
/*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/
 
1711
 
 
1712
typedef PER_Visible_t    Not_PER_Visible_1_t;
 
1713
 
 
1714
/*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/
 
1715
 
 
1716
extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1;
 
1717
asn_struct_free_f Not_PER_Visible_1_free;
 
1718
asn_struct_print_f Not_PER_Visible_1_print;
 
1719
asn_constr_check_f Not_PER_Visible_1_constraint;
 
1720
ber_type_decoder_f Not_PER_Visible_1_decode_ber;
 
1721
der_type_encoder_f Not_PER_Visible_1_encode_der;
 
1722
xer_type_decoder_f Not_PER_Visible_1_decode_xer;
 
1723
xer_type_encoder_f Not_PER_Visible_1_encode_xer;
 
1724
 
 
1725
/*** <<< CTABLES [Not-PER-Visible-1] >>> ***/
 
1726
 
 
1727
static int check_permitted_alphabet_1(const void *sptr) {
 
1728
        /* The underlying type is IA5String */
 
1729
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1730
        const uint8_t *ch = st->buf;
 
1731
        const uint8_t *end = ch + st->size;
 
1732
        
 
1733
        for(; ch < end; ch++) {
 
1734
                uint8_t cv = *ch;
 
1735
                if(!(cv >= 65 && cv <= 70)) return -1;
 
1736
        }
 
1737
        return 0;
 
1738
}
 
1739
 
 
1740
 
 
1741
/*** <<< CODE [Not-PER-Visible-1] >>> ***/
 
1742
 
 
1743
int
 
1744
Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1745
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1746
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
1747
        
 
1748
        if(!sptr) {
 
1749
                _ASN_ERRLOG(app_errlog, app_key,
 
1750
                        "%s: value not given (%s:%d)",
 
1751
                        td->name, __FILE__, __LINE__);
 
1752
                return -1;
 
1753
        }
 
1754
        
 
1755
        
 
1756
        if(!check_permitted_alphabet_1(st)) {
 
1757
                /* Constraint check succeeded */
 
1758
                return 0;
 
1759
        } else {
 
1760
                _ASN_ERRLOG(app_errlog, app_key,
 
1761
                        "%s: constraint failed (%s:%d)",
 
1762
                        td->name, __FILE__, __LINE__);
 
1763
                return -1;
 
1764
        }
 
1765
}
 
1766
 
 
1767
/*
 
1768
 * This type is implemented using PER_Visible,
 
1769
 * so here we adjust the DEF accordingly.
 
1770
 */
 
1771
static void
 
1772
Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1773
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
1774
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
1775
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
1776
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
1777
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
1778
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
1779
        td->elements       = asn_DEF_PER_Visible.elements;
 
1780
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
1781
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
1782
}
 
1783
 
 
1784
void
 
1785
Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td,
 
1786
                void *struct_ptr, int contents_only) {
 
1787
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1788
        td->free_struct(td, struct_ptr, contents_only);
 
1789
}
 
1790
 
 
1791
int
 
1792
Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1793
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1794
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1795
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1796
}
 
1797
 
 
1798
asn_dec_rval_t
 
1799
Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1800
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1801
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1802
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1803
}
 
1804
 
 
1805
asn_enc_rval_t
 
1806
Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td,
 
1807
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1808
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1809
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1810
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1811
}
 
1812
 
 
1813
asn_dec_rval_t
 
1814
Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1815
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1816
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1817
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1818
}
 
1819
 
 
1820
asn_enc_rval_t
 
1821
Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1822
                int ilevel, enum xer_encoder_flags_e flags,
 
1823
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1824
        Not_PER_Visible_1_1_inherit_TYPE_descriptor(td);
 
1825
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1826
}
 
1827
 
 
1828
 
 
1829
/*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/
 
1830
 
 
1831
static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_1_tags[] = {
 
1832
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1833
};
 
1834
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = {
 
1835
        "Not-PER-Visible-1",
 
1836
        "Not-PER-Visible-1",
 
1837
        Not_PER_Visible_1_free,
 
1838
        Not_PER_Visible_1_print,
 
1839
        Not_PER_Visible_1_constraint,
 
1840
        Not_PER_Visible_1_decode_ber,
 
1841
        Not_PER_Visible_1_encode_der,
 
1842
        Not_PER_Visible_1_decode_xer,
 
1843
        Not_PER_Visible_1_encode_xer,
 
1844
        0,      /* Use generic outmost tag fetcher */
 
1845
        asn_DEF_Not_PER_Visible_1_1_tags,
 
1846
        sizeof(asn_DEF_Not_PER_Visible_1_1_tags)
 
1847
                /sizeof(asn_DEF_Not_PER_Visible_1_1_tags[0]), /* 1 */
 
1848
        asn_DEF_Not_PER_Visible_1_1_tags,       /* Same as above */
 
1849
        sizeof(asn_DEF_Not_PER_Visible_1_1_tags)
 
1850
                /sizeof(asn_DEF_Not_PER_Visible_1_1_tags[0]), /* 1 */
 
1851
        0, 0,   /* No members */
 
1852
        0       /* No specifics */
 
1853
};
 
1854
 
 
1855
 
 
1856
/*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/
 
1857
 
 
1858
#include <PER-Visible.h>
 
1859
 
 
1860
/*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/
 
1861
 
 
1862
typedef PER_Visible_t    Not_PER_Visible_2_t;
 
1863
 
 
1864
/*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/
 
1865
 
 
1866
extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2;
 
1867
asn_struct_free_f Not_PER_Visible_2_free;
 
1868
asn_struct_print_f Not_PER_Visible_2_print;
 
1869
asn_constr_check_f Not_PER_Visible_2_constraint;
 
1870
ber_type_decoder_f Not_PER_Visible_2_decode_ber;
 
1871
der_type_encoder_f Not_PER_Visible_2_encode_der;
 
1872
xer_type_decoder_f Not_PER_Visible_2_decode_xer;
 
1873
xer_type_encoder_f Not_PER_Visible_2_encode_xer;
 
1874
 
 
1875
/*** <<< CTABLES [Not-PER-Visible-2] >>> ***/
 
1876
 
 
1877
static int check_permitted_alphabet_1(const void *sptr) {
 
1878
        /* The underlying type is IA5String */
 
1879
        const IA5String_t *st = (const IA5String_t *)sptr;
 
1880
        const uint8_t *ch = st->buf;
 
1881
        const uint8_t *end = ch + st->size;
 
1882
        
 
1883
        for(; ch < end; ch++) {
 
1884
                uint8_t cv = *ch;
 
1885
                if(!(cv >= 65 && cv <= 66)) return -1;
 
1886
        }
 
1887
        return 0;
 
1888
}
 
1889
 
 
1890
 
 
1891
/*** <<< CODE [Not-PER-Visible-2] >>> ***/
 
1892
 
 
1893
int
 
1894
Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
1895
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
1896
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
1897
        
 
1898
        if(!sptr) {
 
1899
                _ASN_ERRLOG(app_errlog, app_key,
 
1900
                        "%s: value not given (%s:%d)",
 
1901
                        td->name, __FILE__, __LINE__);
 
1902
                return -1;
 
1903
        }
 
1904
        
 
1905
        
 
1906
        if(!check_permitted_alphabet_1(st)) {
 
1907
                /* Constraint check succeeded */
 
1908
                return 0;
 
1909
        } else {
 
1910
                _ASN_ERRLOG(app_errlog, app_key,
 
1911
                        "%s: constraint failed (%s:%d)",
 
1912
                        td->name, __FILE__, __LINE__);
 
1913
                return -1;
 
1914
        }
 
1915
}
 
1916
 
 
1917
/*
 
1918
 * This type is implemented using PER_Visible,
 
1919
 * so here we adjust the DEF accordingly.
 
1920
 */
 
1921
static void
 
1922
Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
1923
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
1924
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
1925
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
1926
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
1927
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
1928
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
1929
        td->elements       = asn_DEF_PER_Visible.elements;
 
1930
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
1931
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
1932
}
 
1933
 
 
1934
void
 
1935
Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td,
 
1936
                void *struct_ptr, int contents_only) {
 
1937
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1938
        td->free_struct(td, struct_ptr, contents_only);
 
1939
}
 
1940
 
 
1941
int
 
1942
Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
1943
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
1944
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1945
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
1946
}
 
1947
 
 
1948
asn_dec_rval_t
 
1949
Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1950
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
1951
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1952
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
1953
}
 
1954
 
 
1955
asn_enc_rval_t
 
1956
Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td,
 
1957
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
1958
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1959
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1960
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
1961
}
 
1962
 
 
1963
asn_dec_rval_t
 
1964
Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
1965
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
1966
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1967
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
1968
}
 
1969
 
 
1970
asn_enc_rval_t
 
1971
Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
1972
                int ilevel, enum xer_encoder_flags_e flags,
 
1973
                asn_app_consume_bytes_f *cb, void *app_key) {
 
1974
        Not_PER_Visible_2_1_inherit_TYPE_descriptor(td);
 
1975
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
1976
}
 
1977
 
 
1978
 
 
1979
/*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/
 
1980
 
 
1981
static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_1_tags[] = {
 
1982
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
1983
};
 
1984
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = {
 
1985
        "Not-PER-Visible-2",
 
1986
        "Not-PER-Visible-2",
 
1987
        Not_PER_Visible_2_free,
 
1988
        Not_PER_Visible_2_print,
 
1989
        Not_PER_Visible_2_constraint,
 
1990
        Not_PER_Visible_2_decode_ber,
 
1991
        Not_PER_Visible_2_encode_der,
 
1992
        Not_PER_Visible_2_decode_xer,
 
1993
        Not_PER_Visible_2_encode_xer,
 
1994
        0,      /* Use generic outmost tag fetcher */
 
1995
        asn_DEF_Not_PER_Visible_2_1_tags,
 
1996
        sizeof(asn_DEF_Not_PER_Visible_2_1_tags)
 
1997
                /sizeof(asn_DEF_Not_PER_Visible_2_1_tags[0]), /* 1 */
 
1998
        asn_DEF_Not_PER_Visible_2_1_tags,       /* Same as above */
 
1999
        sizeof(asn_DEF_Not_PER_Visible_2_1_tags)
 
2000
                /sizeof(asn_DEF_Not_PER_Visible_2_1_tags[0]), /* 1 */
 
2001
        0, 0,   /* No members */
 
2002
        0       /* No specifics */
 
2003
};
 
2004
 
 
2005
 
 
2006
/*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/
 
2007
 
 
2008
#include <PER-Visible.h>
 
2009
 
 
2010
/*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/
 
2011
 
 
2012
typedef PER_Visible_t    Not_PER_Visible_3_t;
 
2013
 
 
2014
/*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/
 
2015
 
 
2016
extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3;
 
2017
asn_struct_free_f Not_PER_Visible_3_free;
 
2018
asn_struct_print_f Not_PER_Visible_3_print;
 
2019
asn_constr_check_f Not_PER_Visible_3_constraint;
 
2020
ber_type_decoder_f Not_PER_Visible_3_decode_ber;
 
2021
der_type_encoder_f Not_PER_Visible_3_encode_der;
 
2022
xer_type_decoder_f Not_PER_Visible_3_decode_xer;
 
2023
xer_type_encoder_f Not_PER_Visible_3_encode_xer;
 
2024
 
 
2025
/*** <<< CTABLES [Not-PER-Visible-3] >>> ***/
 
2026
 
 
2027
static int check_permitted_alphabet_1(const void *sptr) {
 
2028
        /* The underlying type is IA5String */
 
2029
        const IA5String_t *st = (const IA5String_t *)sptr;
 
2030
        const uint8_t *ch = st->buf;
 
2031
        const uint8_t *end = ch + st->size;
 
2032
        
 
2033
        for(; ch < end; ch++) {
 
2034
                uint8_t cv = *ch;
 
2035
                if(!(cv >= 65 && cv <= 66)) return -1;
 
2036
        }
 
2037
        return 0;
 
2038
}
 
2039
 
 
2040
 
 
2041
/*** <<< CODE [Not-PER-Visible-3] >>> ***/
 
2042
 
 
2043
int
 
2044
Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2045
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2046
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
2047
        
 
2048
        if(!sptr) {
 
2049
                _ASN_ERRLOG(app_errlog, app_key,
 
2050
                        "%s: value not given (%s:%d)",
 
2051
                        td->name, __FILE__, __LINE__);
 
2052
                return -1;
 
2053
        }
 
2054
        
 
2055
        
 
2056
        if(!check_permitted_alphabet_1(st)) {
 
2057
                /* Constraint check succeeded */
 
2058
                return 0;
 
2059
        } else {
 
2060
                _ASN_ERRLOG(app_errlog, app_key,
 
2061
                        "%s: constraint failed (%s:%d)",
 
2062
                        td->name, __FILE__, __LINE__);
 
2063
                return -1;
 
2064
        }
 
2065
}
 
2066
 
 
2067
/*
 
2068
 * This type is implemented using PER_Visible,
 
2069
 * so here we adjust the DEF accordingly.
 
2070
 */
 
2071
static void
 
2072
Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2073
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
2074
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
2075
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
2076
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
2077
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
2078
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
2079
        td->elements       = asn_DEF_PER_Visible.elements;
 
2080
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
2081
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
2082
}
 
2083
 
 
2084
void
 
2085
Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td,
 
2086
                void *struct_ptr, int contents_only) {
 
2087
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2088
        td->free_struct(td, struct_ptr, contents_only);
 
2089
}
 
2090
 
 
2091
int
 
2092
Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2093
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2094
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2095
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2096
}
 
2097
 
 
2098
asn_dec_rval_t
 
2099
Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2100
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2101
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2102
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2103
}
 
2104
 
 
2105
asn_enc_rval_t
 
2106
Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td,
 
2107
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2108
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2109
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2110
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2111
}
 
2112
 
 
2113
asn_dec_rval_t
 
2114
Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2115
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2116
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2117
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2118
}
 
2119
 
 
2120
asn_enc_rval_t
 
2121
Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2122
                int ilevel, enum xer_encoder_flags_e flags,
 
2123
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2124
        Not_PER_Visible_3_1_inherit_TYPE_descriptor(td);
 
2125
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2126
}
 
2127
 
 
2128
 
 
2129
/*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/
 
2130
 
 
2131
static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_1_tags[] = {
 
2132
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
2133
};
 
2134
asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = {
 
2135
        "Not-PER-Visible-3",
 
2136
        "Not-PER-Visible-3",
 
2137
        Not_PER_Visible_3_free,
 
2138
        Not_PER_Visible_3_print,
 
2139
        Not_PER_Visible_3_constraint,
 
2140
        Not_PER_Visible_3_decode_ber,
 
2141
        Not_PER_Visible_3_encode_der,
 
2142
        Not_PER_Visible_3_decode_xer,
 
2143
        Not_PER_Visible_3_encode_xer,
 
2144
        0,      /* Use generic outmost tag fetcher */
 
2145
        asn_DEF_Not_PER_Visible_3_1_tags,
 
2146
        sizeof(asn_DEF_Not_PER_Visible_3_1_tags)
 
2147
                /sizeof(asn_DEF_Not_PER_Visible_3_1_tags[0]), /* 1 */
 
2148
        asn_DEF_Not_PER_Visible_3_1_tags,       /* Same as above */
 
2149
        sizeof(asn_DEF_Not_PER_Visible_3_1_tags)
 
2150
                /sizeof(asn_DEF_Not_PER_Visible_3_1_tags[0]), /* 1 */
 
2151
        0, 0,   /* No members */
 
2152
        0       /* No specifics */
 
2153
};
 
2154
 
 
2155
 
 
2156
/*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/
 
2157
 
 
2158
#include <PER-Visible.h>
 
2159
 
 
2160
/*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/
 
2161
 
 
2162
typedef PER_Visible_t    SIZE_but_not_FROM_t;
 
2163
 
 
2164
/*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/
 
2165
 
 
2166
extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM;
 
2167
asn_struct_free_f SIZE_but_not_FROM_free;
 
2168
asn_struct_print_f SIZE_but_not_FROM_print;
 
2169
asn_constr_check_f SIZE_but_not_FROM_constraint;
 
2170
ber_type_decoder_f SIZE_but_not_FROM_decode_ber;
 
2171
der_type_encoder_f SIZE_but_not_FROM_encode_der;
 
2172
xer_type_decoder_f SIZE_but_not_FROM_decode_xer;
 
2173
xer_type_encoder_f SIZE_but_not_FROM_encode_xer;
 
2174
 
 
2175
/*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/
 
2176
 
 
2177
static int check_permitted_alphabet_1(const void *sptr) {
 
2178
        /* The underlying type is IA5String */
 
2179
        const IA5String_t *st = (const IA5String_t *)sptr;
 
2180
        const uint8_t *ch = st->buf;
 
2181
        const uint8_t *end = ch + st->size;
 
2182
        
 
2183
        for(; ch < end; ch++) {
 
2184
                uint8_t cv = *ch;
 
2185
                if(!(cv >= 65 && cv <= 68)) return -1;
 
2186
        }
 
2187
        return 0;
 
2188
}
 
2189
 
 
2190
 
 
2191
/*** <<< CODE [SIZE-but-not-FROM] >>> ***/
 
2192
 
 
2193
int
 
2194
SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2195
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2196
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
2197
        size_t size;
 
2198
        
 
2199
        if(!sptr) {
 
2200
                _ASN_ERRLOG(app_errlog, app_key,
 
2201
                        "%s: value not given (%s:%d)",
 
2202
                        td->name, __FILE__, __LINE__);
 
2203
                return -1;
 
2204
        }
 
2205
        
 
2206
        size = st->size;
 
2207
        
 
2208
        if((size >= 1 && size <= 4)
 
2209
                 && !check_permitted_alphabet_1(st)) {
 
2210
                /* Constraint check succeeded */
 
2211
                return 0;
 
2212
        } else {
 
2213
                _ASN_ERRLOG(app_errlog, app_key,
 
2214
                        "%s: constraint failed (%s:%d)",
 
2215
                        td->name, __FILE__, __LINE__);
 
2216
                return -1;
 
2217
        }
 
2218
}
 
2219
 
 
2220
/*
 
2221
 * This type is implemented using PER_Visible,
 
2222
 * so here we adjust the DEF accordingly.
 
2223
 */
 
2224
static void
 
2225
SIZE_but_not_FROM_1_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;
 
2235
}
 
2236
 
 
2237
void
 
2238
SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td,
 
2239
                void *struct_ptr, int contents_only) {
 
2240
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2241
        td->free_struct(td, struct_ptr, contents_only);
 
2242
}
 
2243
 
 
2244
int
 
2245
SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2246
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2247
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2248
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2249
}
 
2250
 
 
2251
asn_dec_rval_t
 
2252
SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2253
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2254
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2255
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2256
}
 
2257
 
 
2258
asn_enc_rval_t
 
2259
SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td,
 
2260
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2261
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2262
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2263
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2264
}
 
2265
 
 
2266
asn_dec_rval_t
 
2267
SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2268
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2269
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2270
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2271
}
 
2272
 
 
2273
asn_enc_rval_t
 
2274
SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2275
                int ilevel, enum xer_encoder_flags_e flags,
 
2276
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2277
        SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td);
 
2278
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2279
}
 
2280
 
 
2281
 
 
2282
/*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/
 
2283
 
 
2284
static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_1_tags[] = {
 
2285
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
2286
};
 
2287
asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = {
 
2288
        "SIZE-but-not-FROM",
 
2289
        "SIZE-but-not-FROM",
 
2290
        SIZE_but_not_FROM_free,
 
2291
        SIZE_but_not_FROM_print,
 
2292
        SIZE_but_not_FROM_constraint,
 
2293
        SIZE_but_not_FROM_decode_ber,
 
2294
        SIZE_but_not_FROM_encode_der,
 
2295
        SIZE_but_not_FROM_decode_xer,
 
2296
        SIZE_but_not_FROM_encode_xer,
 
2297
        0,      /* Use generic outmost tag fetcher */
 
2298
        asn_DEF_SIZE_but_not_FROM_1_tags,
 
2299
        sizeof(asn_DEF_SIZE_but_not_FROM_1_tags)
 
2300
                /sizeof(asn_DEF_SIZE_but_not_FROM_1_tags[0]), /* 1 */
 
2301
        asn_DEF_SIZE_but_not_FROM_1_tags,       /* Same as above */
 
2302
        sizeof(asn_DEF_SIZE_but_not_FROM_1_tags)
 
2303
                /sizeof(asn_DEF_SIZE_but_not_FROM_1_tags[0]), /* 1 */
 
2304
        0, 0,   /* No members */
 
2305
        0       /* No specifics */
 
2306
};
 
2307
 
 
2308
 
 
2309
/*** <<< INCLUDES [SIZE-and-FROM] >>> ***/
 
2310
 
 
2311
#include <PER-Visible.h>
 
2312
 
 
2313
/*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/
 
2314
 
 
2315
typedef PER_Visible_t    SIZE_and_FROM_t;
 
2316
 
 
2317
/*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/
 
2318
 
 
2319
extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM;
 
2320
asn_struct_free_f SIZE_and_FROM_free;
 
2321
asn_struct_print_f SIZE_and_FROM_print;
 
2322
asn_constr_check_f SIZE_and_FROM_constraint;
 
2323
ber_type_decoder_f SIZE_and_FROM_decode_ber;
 
2324
der_type_encoder_f SIZE_and_FROM_encode_der;
 
2325
xer_type_decoder_f SIZE_and_FROM_decode_xer;
 
2326
xer_type_encoder_f SIZE_and_FROM_encode_xer;
 
2327
 
 
2328
/*** <<< CTABLES [SIZE-and-FROM] >>> ***/
 
2329
 
 
2330
static int check_permitted_alphabet_1(const void *sptr) {
 
2331
        /* The underlying type is IA5String */
 
2332
        const IA5String_t *st = (const IA5String_t *)sptr;
 
2333
        const uint8_t *ch = st->buf;
 
2334
        const uint8_t *end = ch + st->size;
 
2335
        
 
2336
        for(; ch < end; ch++) {
 
2337
                uint8_t cv = *ch;
 
2338
                if(!(cv >= 65 && cv <= 68)) return -1;
 
2339
        }
 
2340
        return 0;
 
2341
}
 
2342
 
 
2343
 
 
2344
/*** <<< CODE [SIZE-and-FROM] >>> ***/
 
2345
 
 
2346
int
 
2347
SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2348
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2349
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
2350
        size_t size;
 
2351
        
 
2352
        if(!sptr) {
 
2353
                _ASN_ERRLOG(app_errlog, app_key,
 
2354
                        "%s: value not given (%s:%d)",
 
2355
                        td->name, __FILE__, __LINE__);
 
2356
                return -1;
 
2357
        }
 
2358
        
 
2359
        size = st->size;
 
2360
        
 
2361
        if((size >= 1 && size <= 4)
 
2362
                 && !check_permitted_alphabet_1(st)) {
 
2363
                /* Constraint check succeeded */
 
2364
                return 0;
 
2365
        } else {
 
2366
                _ASN_ERRLOG(app_errlog, app_key,
 
2367
                        "%s: constraint failed (%s:%d)",
 
2368
                        td->name, __FILE__, __LINE__);
 
2369
                return -1;
 
2370
        }
 
2371
}
 
2372
 
 
2373
/*
 
2374
 * This type is implemented using PER_Visible,
 
2375
 * so here we adjust the DEF accordingly.
 
2376
 */
 
2377
static void
 
2378
SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2379
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
2380
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
2381
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
2382
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
2383
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
2384
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
2385
        td->elements       = asn_DEF_PER_Visible.elements;
 
2386
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
2387
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
2388
}
 
2389
 
 
2390
void
 
2391
SIZE_and_FROM_free(asn_TYPE_descriptor_t *td,
 
2392
                void *struct_ptr, int contents_only) {
 
2393
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2394
        td->free_struct(td, struct_ptr, contents_only);
 
2395
}
 
2396
 
 
2397
int
 
2398
SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2399
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2400
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2401
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2402
}
 
2403
 
 
2404
asn_dec_rval_t
 
2405
SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2406
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2407
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2408
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2409
}
 
2410
 
 
2411
asn_enc_rval_t
 
2412
SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td,
 
2413
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2414
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2415
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2416
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2417
}
 
2418
 
 
2419
asn_dec_rval_t
 
2420
SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2421
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2422
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2423
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2424
}
 
2425
 
 
2426
asn_enc_rval_t
 
2427
SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2428
                int ilevel, enum xer_encoder_flags_e flags,
 
2429
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2430
        SIZE_and_FROM_1_inherit_TYPE_descriptor(td);
 
2431
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2432
}
 
2433
 
 
2434
 
 
2435
/*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/
 
2436
 
 
2437
static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_1_tags[] = {
 
2438
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
2439
};
 
2440
asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = {
 
2441
        "SIZE-and-FROM",
 
2442
        "SIZE-and-FROM",
 
2443
        SIZE_and_FROM_free,
 
2444
        SIZE_and_FROM_print,
 
2445
        SIZE_and_FROM_constraint,
 
2446
        SIZE_and_FROM_decode_ber,
 
2447
        SIZE_and_FROM_encode_der,
 
2448
        SIZE_and_FROM_decode_xer,
 
2449
        SIZE_and_FROM_encode_xer,
 
2450
        0,      /* Use generic outmost tag fetcher */
 
2451
        asn_DEF_SIZE_and_FROM_1_tags,
 
2452
        sizeof(asn_DEF_SIZE_and_FROM_1_tags)
 
2453
                /sizeof(asn_DEF_SIZE_and_FROM_1_tags[0]), /* 1 */
 
2454
        asn_DEF_SIZE_and_FROM_1_tags,   /* Same as above */
 
2455
        sizeof(asn_DEF_SIZE_and_FROM_1_tags)
 
2456
                /sizeof(asn_DEF_SIZE_and_FROM_1_tags[0]), /* 1 */
 
2457
        0, 0,   /* No members */
 
2458
        0       /* No specifics */
 
2459
};
 
2460
 
 
2461
 
 
2462
/*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/
 
2463
 
 
2464
#include <PER-Visible.h>
 
2465
 
 
2466
/*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/
 
2467
 
 
2468
typedef PER_Visible_t    Neither_SIZE_nor_FROM_t;
 
2469
 
 
2470
/*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/
 
2471
 
 
2472
extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM;
 
2473
asn_struct_free_f Neither_SIZE_nor_FROM_free;
 
2474
asn_struct_print_f Neither_SIZE_nor_FROM_print;
 
2475
asn_constr_check_f Neither_SIZE_nor_FROM_constraint;
 
2476
ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber;
 
2477
der_type_encoder_f Neither_SIZE_nor_FROM_encode_der;
 
2478
xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer;
 
2479
xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer;
 
2480
 
 
2481
/*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/
 
2482
 
 
2483
static int check_permitted_alphabet_1(const void *sptr) {
 
2484
        /* The underlying type is IA5String */
 
2485
        const IA5String_t *st = (const IA5String_t *)sptr;
 
2486
        const uint8_t *ch = st->buf;
 
2487
        const uint8_t *end = ch + st->size;
 
2488
        
 
2489
        for(; ch < end; ch++) {
 
2490
                uint8_t cv = *ch;
 
2491
                if(!(cv >= 65 && cv <= 70)) return -1;
 
2492
        }
 
2493
        return 0;
 
2494
}
 
2495
 
 
2496
 
 
2497
/*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/
 
2498
 
 
2499
int
 
2500
Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2501
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2502
        const PER_Visible_t *st = (const PER_Visible_t *)sptr;
 
2503
        
 
2504
        if(!sptr) {
 
2505
                _ASN_ERRLOG(app_errlog, app_key,
 
2506
                        "%s: value not given (%s:%d)",
 
2507
                        td->name, __FILE__, __LINE__);
 
2508
                return -1;
 
2509
        }
 
2510
        
 
2511
        
 
2512
        if(!check_permitted_alphabet_1(st)) {
 
2513
                /* Constraint check succeeded */
 
2514
                return 0;
 
2515
        } else {
 
2516
                _ASN_ERRLOG(app_errlog, app_key,
 
2517
                        "%s: constraint failed (%s:%d)",
 
2518
                        td->name, __FILE__, __LINE__);
 
2519
                return -1;
 
2520
        }
 
2521
}
 
2522
 
 
2523
/*
 
2524
 * This type is implemented using PER_Visible,
 
2525
 * so here we adjust the DEF accordingly.
 
2526
 */
 
2527
static void
 
2528
Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2529
        td->free_struct    = asn_DEF_PER_Visible.free_struct;
 
2530
        td->print_struct   = asn_DEF_PER_Visible.print_struct;
 
2531
        td->ber_decoder    = asn_DEF_PER_Visible.ber_decoder;
 
2532
        td->der_encoder    = asn_DEF_PER_Visible.der_encoder;
 
2533
        td->xer_decoder    = asn_DEF_PER_Visible.xer_decoder;
 
2534
        td->xer_encoder    = asn_DEF_PER_Visible.xer_encoder;
 
2535
        td->elements       = asn_DEF_PER_Visible.elements;
 
2536
        td->elements_count = asn_DEF_PER_Visible.elements_count;
 
2537
        td->specifics      = asn_DEF_PER_Visible.specifics;
 
2538
}
 
2539
 
 
2540
void
 
2541
Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td,
 
2542
                void *struct_ptr, int contents_only) {
 
2543
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2544
        td->free_struct(td, struct_ptr, contents_only);
 
2545
}
 
2546
 
 
2547
int
 
2548
Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2549
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2550
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2551
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2552
}
 
2553
 
 
2554
asn_dec_rval_t
 
2555
Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2556
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2557
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2558
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2559
}
 
2560
 
 
2561
asn_enc_rval_t
 
2562
Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td,
 
2563
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2564
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2565
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2566
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2567
}
 
2568
 
 
2569
asn_dec_rval_t
 
2570
Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2571
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2572
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2573
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2574
}
 
2575
 
 
2576
asn_enc_rval_t
 
2577
Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2578
                int ilevel, enum xer_encoder_flags_e flags,
 
2579
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2580
        Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td);
 
2581
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2582
}
 
2583
 
 
2584
 
 
2585
/*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/
 
2586
 
 
2587
static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_1_tags[] = {
 
2588
        (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
 
2589
};
 
2590
asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
 
2591
        "Neither-SIZE-nor-FROM",
 
2592
        "Neither-SIZE-nor-FROM",
 
2593
        Neither_SIZE_nor_FROM_free,
 
2594
        Neither_SIZE_nor_FROM_print,
 
2595
        Neither_SIZE_nor_FROM_constraint,
 
2596
        Neither_SIZE_nor_FROM_decode_ber,
 
2597
        Neither_SIZE_nor_FROM_encode_der,
 
2598
        Neither_SIZE_nor_FROM_decode_xer,
 
2599
        Neither_SIZE_nor_FROM_encode_xer,
 
2600
        0,      /* Use generic outmost tag fetcher */
 
2601
        asn_DEF_Neither_SIZE_nor_FROM_1_tags,
 
2602
        sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags)
 
2603
                /sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags[0]), /* 1 */
 
2604
        asn_DEF_Neither_SIZE_nor_FROM_1_tags,   /* Same as above */
 
2605
        sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags)
 
2606
                /sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags[0]), /* 1 */
 
2607
        0, 0,   /* No members */
 
2608
        0       /* No specifics */
 
2609
};
 
2610
 
 
2611
 
 
2612
/*** <<< INCLUDES [Utf8-4] >>> ***/
 
2613
 
 
2614
#include <UTF8String.h>
 
2615
 
 
2616
/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
 
2617
 
 
2618
typedef UTF8String_t     Utf8_4_t;
 
2619
 
 
2620
/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
 
2621
 
 
2622
extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
 
2623
asn_struct_free_f Utf8_4_free;
 
2624
asn_struct_print_f Utf8_4_print;
 
2625
asn_constr_check_f Utf8_4_constraint;
 
2626
ber_type_decoder_f Utf8_4_decode_ber;
 
2627
der_type_encoder_f Utf8_4_encode_der;
 
2628
xer_type_decoder_f Utf8_4_decode_xer;
 
2629
xer_type_encoder_f Utf8_4_encode_xer;
 
2630
 
 
2631
/*** <<< CTABLES [Utf8-4] >>> ***/
 
2632
 
 
2633
static int check_permitted_alphabet_1(const void *sptr) {
 
2634
        if(UTF8String_length((const UTF8String_t *)sptr) < 0)
 
2635
                return -1; /* Alphabet (sic!) test failed. */
 
2636
        
 
2637
        return 0;
 
2638
}
 
2639
 
 
2640
 
 
2641
/*** <<< CODE [Utf8-4] >>> ***/
 
2642
 
 
2643
int
 
2644
Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2645
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2646
        const UTF8String_t *st = (const UTF8String_t *)sptr;
 
2647
        
 
2648
        if(!sptr) {
 
2649
                _ASN_ERRLOG(app_errlog, app_key,
 
2650
                        "%s: value not given (%s:%d)",
 
2651
                        td->name, __FILE__, __LINE__);
 
2652
                return -1;
 
2653
        }
 
2654
        
 
2655
        
 
2656
        if(!check_permitted_alphabet_1(st)) {
 
2657
                /* Constraint check succeeded */
 
2658
                return 0;
 
2659
        } else {
 
2660
                _ASN_ERRLOG(app_errlog, app_key,
 
2661
                        "%s: constraint failed (%s:%d)",
 
2662
                        td->name, __FILE__, __LINE__);
 
2663
                return -1;
 
2664
        }
 
2665
}
 
2666
 
 
2667
/*
 
2668
 * This type is implemented using UTF8String,
 
2669
 * so here we adjust the DEF accordingly.
 
2670
 */
 
2671
static void
 
2672
Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2673
        td->free_struct    = asn_DEF_UTF8String.free_struct;
 
2674
        td->print_struct   = asn_DEF_UTF8String.print_struct;
 
2675
        td->ber_decoder    = asn_DEF_UTF8String.ber_decoder;
 
2676
        td->der_encoder    = asn_DEF_UTF8String.der_encoder;
 
2677
        td->xer_decoder    = asn_DEF_UTF8String.xer_decoder;
 
2678
        td->xer_encoder    = asn_DEF_UTF8String.xer_encoder;
 
2679
        td->elements       = asn_DEF_UTF8String.elements;
 
2680
        td->elements_count = asn_DEF_UTF8String.elements_count;
 
2681
        td->specifics      = asn_DEF_UTF8String.specifics;
 
2682
}
 
2683
 
 
2684
void
 
2685
Utf8_4_free(asn_TYPE_descriptor_t *td,
 
2686
                void *struct_ptr, int contents_only) {
 
2687
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2688
        td->free_struct(td, struct_ptr, contents_only);
 
2689
}
 
2690
 
 
2691
int
 
2692
Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2693
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2694
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2695
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2696
}
 
2697
 
 
2698
asn_dec_rval_t
 
2699
Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2700
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2701
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2702
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2703
}
 
2704
 
 
2705
asn_enc_rval_t
 
2706
Utf8_4_encode_der(asn_TYPE_descriptor_t *td,
 
2707
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2708
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2709
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2710
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2711
}
 
2712
 
 
2713
asn_dec_rval_t
 
2714
Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2715
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2716
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2717
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2718
}
 
2719
 
 
2720
asn_enc_rval_t
 
2721
Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2722
                int ilevel, enum xer_encoder_flags_e flags,
 
2723
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2724
        Utf8_4_1_inherit_TYPE_descriptor(td);
 
2725
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2726
}
 
2727
 
 
2728
 
 
2729
/*** <<< STAT-DEFS [Utf8-4] >>> ***/
 
2730
 
 
2731
static ber_tlv_tag_t asn_DEF_Utf8_4_1_tags[] = {
 
2732
        (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
 
2733
};
 
2734
asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
 
2735
        "Utf8-4",
 
2736
        "Utf8-4",
 
2737
        Utf8_4_free,
 
2738
        Utf8_4_print,
 
2739
        Utf8_4_constraint,
 
2740
        Utf8_4_decode_ber,
 
2741
        Utf8_4_encode_der,
 
2742
        Utf8_4_decode_xer,
 
2743
        Utf8_4_encode_xer,
 
2744
        0,      /* Use generic outmost tag fetcher */
 
2745
        asn_DEF_Utf8_4_1_tags,
 
2746
        sizeof(asn_DEF_Utf8_4_1_tags)
 
2747
                /sizeof(asn_DEF_Utf8_4_1_tags[0]), /* 1 */
 
2748
        asn_DEF_Utf8_4_1_tags,  /* Same as above */
 
2749
        sizeof(asn_DEF_Utf8_4_1_tags)
 
2750
                /sizeof(asn_DEF_Utf8_4_1_tags[0]), /* 1 */
 
2751
        0, 0,   /* No members */
 
2752
        0       /* No specifics */
 
2753
};
 
2754
 
 
2755
 
 
2756
/*** <<< INCLUDES [Utf8-3] >>> ***/
 
2757
 
 
2758
#include <Utf8-2.h>
 
2759
 
 
2760
/*** <<< TYPE-DECLS [Utf8-3] >>> ***/
 
2761
 
 
2762
typedef Utf8_2_t         Utf8_3_t;
 
2763
 
 
2764
/*** <<< FUNC-DECLS [Utf8-3] >>> ***/
 
2765
 
 
2766
extern asn_TYPE_descriptor_t asn_DEF_Utf8_3;
 
2767
asn_struct_free_f Utf8_3_free;
 
2768
asn_struct_print_f Utf8_3_print;
 
2769
asn_constr_check_f Utf8_3_constraint;
 
2770
ber_type_decoder_f Utf8_3_decode_ber;
 
2771
der_type_encoder_f Utf8_3_encode_der;
 
2772
xer_type_decoder_f Utf8_3_decode_xer;
 
2773
xer_type_encoder_f Utf8_3_encode_xer;
 
2774
 
 
2775
/*** <<< CTABLES [Utf8-3] >>> ***/
 
2776
 
 
2777
static int permitted_alphabet_table_1[128] = {
 
2778
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
2779
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
2780
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
2781
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
2782
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  ABCDEFGHIJKLMNO */
 
2783
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,        /* PQRSTUVWXYZ      */
 
2784
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  abcdefghijklmno */
 
2785
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,        /* pqrstuvwxyz      */
 
2786
};
 
2787
 
 
2788
static int check_permitted_alphabet_1(const void *sptr) {
 
2789
        int *table = permitted_alphabet_table_1;
 
2790
        /* The underlying type is UTF8String */
 
2791
        const UTF8String_t *st = (const UTF8String_t *)sptr;
 
2792
        const uint8_t *ch = st->buf;
 
2793
        const uint8_t *end = ch + st->size;
 
2794
        
 
2795
        for(; ch < end; ch++) {
 
2796
                uint8_t cv = *ch;
 
2797
                if(cv >= 0x80) return -1;
 
2798
                if(!table[cv]) return -1;
 
2799
        }
 
2800
        return 0;
 
2801
}
 
2802
 
 
2803
 
 
2804
/*** <<< CODE [Utf8-3] >>> ***/
 
2805
 
 
2806
int
 
2807
Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2808
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2809
        const Utf8_2_t *st = (const Utf8_2_t *)sptr;
 
2810
        size_t size;
 
2811
        
 
2812
        if(!sptr) {
 
2813
                _ASN_ERRLOG(app_errlog, app_key,
 
2814
                        "%s: value not given (%s:%d)",
 
2815
                        td->name, __FILE__, __LINE__);
 
2816
                return -1;
 
2817
        }
 
2818
        
 
2819
        size = UTF8String_length(st);
 
2820
        if((ssize_t)size < 0) {
 
2821
                _ASN_ERRLOG(app_errlog, app_key,
 
2822
                        "%s: UTF-8: broken encoding (%s:%d)",
 
2823
                        td->name, __FILE__, __LINE__);
 
2824
                return -1;
 
2825
        }
 
2826
        
 
2827
        if((size >= 1 && size <= 2)
 
2828
                 && !check_permitted_alphabet_1(st)) {
 
2829
                /* Constraint check succeeded */
 
2830
                return 0;
 
2831
        } else {
 
2832
                _ASN_ERRLOG(app_errlog, app_key,
 
2833
                        "%s: constraint failed (%s:%d)",
 
2834
                        td->name, __FILE__, __LINE__);
 
2835
                return -1;
 
2836
        }
 
2837
}
 
2838
 
 
2839
/*
 
2840
 * This type is implemented using Utf8_2,
 
2841
 * so here we adjust the DEF accordingly.
 
2842
 */
 
2843
static void
 
2844
Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2845
        td->free_struct    = asn_DEF_Utf8_2.free_struct;
 
2846
        td->print_struct   = asn_DEF_Utf8_2.print_struct;
 
2847
        td->ber_decoder    = asn_DEF_Utf8_2.ber_decoder;
 
2848
        td->der_encoder    = asn_DEF_Utf8_2.der_encoder;
 
2849
        td->xer_decoder    = asn_DEF_Utf8_2.xer_decoder;
 
2850
        td->xer_encoder    = asn_DEF_Utf8_2.xer_encoder;
 
2851
        td->elements       = asn_DEF_Utf8_2.elements;
 
2852
        td->elements_count = asn_DEF_Utf8_2.elements_count;
 
2853
        td->specifics      = asn_DEF_Utf8_2.specifics;
 
2854
}
 
2855
 
 
2856
void
 
2857
Utf8_3_free(asn_TYPE_descriptor_t *td,
 
2858
                void *struct_ptr, int contents_only) {
 
2859
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2860
        td->free_struct(td, struct_ptr, contents_only);
 
2861
}
 
2862
 
 
2863
int
 
2864
Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
2865
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
2866
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2867
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
2868
}
 
2869
 
 
2870
asn_dec_rval_t
 
2871
Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2872
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
2873
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2874
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
2875
}
 
2876
 
 
2877
asn_enc_rval_t
 
2878
Utf8_3_encode_der(asn_TYPE_descriptor_t *td,
 
2879
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
2880
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2881
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2882
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
2883
}
 
2884
 
 
2885
asn_dec_rval_t
 
2886
Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
2887
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
2888
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2889
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
2890
}
 
2891
 
 
2892
asn_enc_rval_t
 
2893
Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
2894
                int ilevel, enum xer_encoder_flags_e flags,
 
2895
                asn_app_consume_bytes_f *cb, void *app_key) {
 
2896
        Utf8_3_1_inherit_TYPE_descriptor(td);
 
2897
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
2898
}
 
2899
 
 
2900
 
 
2901
/*** <<< STAT-DEFS [Utf8-3] >>> ***/
 
2902
 
 
2903
static ber_tlv_tag_t asn_DEF_Utf8_3_1_tags[] = {
 
2904
        (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
 
2905
};
 
2906
asn_TYPE_descriptor_t asn_DEF_Utf8_3 = {
 
2907
        "Utf8-3",
 
2908
        "Utf8-3",
 
2909
        Utf8_3_free,
 
2910
        Utf8_3_print,
 
2911
        Utf8_3_constraint,
 
2912
        Utf8_3_decode_ber,
 
2913
        Utf8_3_encode_der,
 
2914
        Utf8_3_decode_xer,
 
2915
        Utf8_3_encode_xer,
 
2916
        0,      /* Use generic outmost tag fetcher */
 
2917
        asn_DEF_Utf8_3_1_tags,
 
2918
        sizeof(asn_DEF_Utf8_3_1_tags)
 
2919
                /sizeof(asn_DEF_Utf8_3_1_tags[0]), /* 1 */
 
2920
        asn_DEF_Utf8_3_1_tags,  /* Same as above */
 
2921
        sizeof(asn_DEF_Utf8_3_1_tags)
 
2922
                /sizeof(asn_DEF_Utf8_3_1_tags[0]), /* 1 */
 
2923
        0, 0,   /* No members */
 
2924
        0       /* No specifics */
 
2925
};
 
2926
 
 
2927
 
 
2928
/*** <<< INCLUDES [Utf8-2] >>> ***/
 
2929
 
 
2930
#include <Utf8-1.h>
 
2931
 
 
2932
/*** <<< TYPE-DECLS [Utf8-2] >>> ***/
 
2933
 
 
2934
typedef Utf8_1_t         Utf8_2_t;
 
2935
 
 
2936
/*** <<< FUNC-DECLS [Utf8-2] >>> ***/
 
2937
 
 
2938
extern asn_TYPE_descriptor_t asn_DEF_Utf8_2;
 
2939
asn_struct_free_f Utf8_2_free;
 
2940
asn_struct_print_f Utf8_2_print;
 
2941
asn_constr_check_f Utf8_2_constraint;
 
2942
ber_type_decoder_f Utf8_2_decode_ber;
 
2943
der_type_encoder_f Utf8_2_encode_der;
 
2944
xer_type_decoder_f Utf8_2_decode_xer;
 
2945
xer_type_encoder_f Utf8_2_encode_xer;
 
2946
 
 
2947
/*** <<< CODE [Utf8-2] >>> ***/
 
2948
 
 
2949
int
 
2950
Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
2951
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
2952
        const Utf8_1_t *st = (const Utf8_1_t *)sptr;
 
2953
        size_t size;
 
2954
        
 
2955
        if(!sptr) {
 
2956
                _ASN_ERRLOG(app_errlog, app_key,
 
2957
                        "%s: value not given (%s:%d)",
 
2958
                        td->name, __FILE__, __LINE__);
 
2959
                return -1;
 
2960
        }
 
2961
        
 
2962
        size = UTF8String_length(st);
 
2963
        if((ssize_t)size < 0) {
 
2964
                _ASN_ERRLOG(app_errlog, app_key,
 
2965
                        "%s: UTF-8: broken encoding (%s:%d)",
 
2966
                        td->name, __FILE__, __LINE__);
 
2967
                return -1;
 
2968
        }
 
2969
        
 
2970
        if((size >= 1 && size <= 2)) {
 
2971
                /* Constraint check succeeded */
 
2972
                return 0;
 
2973
        } else {
 
2974
                _ASN_ERRLOG(app_errlog, app_key,
 
2975
                        "%s: constraint failed (%s:%d)",
 
2976
                        td->name, __FILE__, __LINE__);
 
2977
                return -1;
 
2978
        }
 
2979
}
 
2980
 
 
2981
/*
 
2982
 * This type is implemented using Utf8_1,
 
2983
 * so here we adjust the DEF accordingly.
 
2984
 */
 
2985
static void
 
2986
Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
2987
        td->free_struct    = asn_DEF_Utf8_1.free_struct;
 
2988
        td->print_struct   = asn_DEF_Utf8_1.print_struct;
 
2989
        td->ber_decoder    = asn_DEF_Utf8_1.ber_decoder;
 
2990
        td->der_encoder    = asn_DEF_Utf8_1.der_encoder;
 
2991
        td->xer_decoder    = asn_DEF_Utf8_1.xer_decoder;
 
2992
        td->xer_encoder    = asn_DEF_Utf8_1.xer_encoder;
 
2993
        td->elements       = asn_DEF_Utf8_1.elements;
 
2994
        td->elements_count = asn_DEF_Utf8_1.elements_count;
 
2995
        td->specifics      = asn_DEF_Utf8_1.specifics;
 
2996
}
 
2997
 
 
2998
void
 
2999
Utf8_2_free(asn_TYPE_descriptor_t *td,
 
3000
                void *struct_ptr, int contents_only) {
 
3001
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3002
        td->free_struct(td, struct_ptr, contents_only);
 
3003
}
 
3004
 
 
3005
int
 
3006
Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
3007
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
3008
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3009
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
3010
}
 
3011
 
 
3012
asn_dec_rval_t
 
3013
Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3014
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
3015
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3016
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
3017
}
 
3018
 
 
3019
asn_enc_rval_t
 
3020
Utf8_2_encode_der(asn_TYPE_descriptor_t *td,
 
3021
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
3022
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3023
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3024
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
3025
}
 
3026
 
 
3027
asn_dec_rval_t
 
3028
Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3029
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
3030
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3031
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
3032
}
 
3033
 
 
3034
asn_enc_rval_t
 
3035
Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
3036
                int ilevel, enum xer_encoder_flags_e flags,
 
3037
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3038
        Utf8_2_1_inherit_TYPE_descriptor(td);
 
3039
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
3040
}
 
3041
 
 
3042
 
 
3043
/*** <<< STAT-DEFS [Utf8-2] >>> ***/
 
3044
 
 
3045
static ber_tlv_tag_t asn_DEF_Utf8_2_1_tags[] = {
 
3046
        (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
 
3047
};
 
3048
asn_TYPE_descriptor_t asn_DEF_Utf8_2 = {
 
3049
        "Utf8-2",
 
3050
        "Utf8-2",
 
3051
        Utf8_2_free,
 
3052
        Utf8_2_print,
 
3053
        Utf8_2_constraint,
 
3054
        Utf8_2_decode_ber,
 
3055
        Utf8_2_encode_der,
 
3056
        Utf8_2_decode_xer,
 
3057
        Utf8_2_encode_xer,
 
3058
        0,      /* Use generic outmost tag fetcher */
 
3059
        asn_DEF_Utf8_2_1_tags,
 
3060
        sizeof(asn_DEF_Utf8_2_1_tags)
 
3061
                /sizeof(asn_DEF_Utf8_2_1_tags[0]), /* 1 */
 
3062
        asn_DEF_Utf8_2_1_tags,  /* Same as above */
 
3063
        sizeof(asn_DEF_Utf8_2_1_tags)
 
3064
                /sizeof(asn_DEF_Utf8_2_1_tags[0]), /* 1 */
 
3065
        0, 0,   /* No members */
 
3066
        0       /* No specifics */
 
3067
};
 
3068
 
 
3069
 
 
3070
/*** <<< INCLUDES [Utf8-1] >>> ***/
 
3071
 
 
3072
#include <UTF8String.h>
 
3073
 
 
3074
/*** <<< TYPE-DECLS [Utf8-1] >>> ***/
 
3075
 
 
3076
typedef UTF8String_t     Utf8_1_t;
 
3077
 
 
3078
/*** <<< FUNC-DECLS [Utf8-1] >>> ***/
 
3079
 
 
3080
extern asn_TYPE_descriptor_t asn_DEF_Utf8_1;
 
3081
asn_struct_free_f Utf8_1_free;
 
3082
asn_struct_print_f Utf8_1_print;
 
3083
asn_constr_check_f Utf8_1_constraint;
 
3084
ber_type_decoder_f Utf8_1_decode_ber;
 
3085
der_type_encoder_f Utf8_1_encode_der;
 
3086
xer_type_decoder_f Utf8_1_decode_xer;
 
3087
xer_type_encoder_f Utf8_1_encode_xer;
 
3088
 
 
3089
/*** <<< CODE [Utf8-1] >>> ***/
 
3090
 
 
3091
int
 
3092
Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
3093
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
3094
        /* Replace with underlying type checker */
 
3095
        td->check_constraints = asn_DEF_UTF8String.check_constraints;
 
3096
        return td->check_constraints(td, sptr, app_errlog, app_key);
 
3097
}
 
3098
 
 
3099
/*
 
3100
 * This type is implemented using UTF8String,
 
3101
 * so here we adjust the DEF accordingly.
 
3102
 */
 
3103
static void
 
3104
Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
3105
        td->free_struct    = asn_DEF_UTF8String.free_struct;
 
3106
        td->print_struct   = asn_DEF_UTF8String.print_struct;
 
3107
        td->ber_decoder    = asn_DEF_UTF8String.ber_decoder;
 
3108
        td->der_encoder    = asn_DEF_UTF8String.der_encoder;
 
3109
        td->xer_decoder    = asn_DEF_UTF8String.xer_decoder;
 
3110
        td->xer_encoder    = asn_DEF_UTF8String.xer_encoder;
 
3111
        td->elements       = asn_DEF_UTF8String.elements;
 
3112
        td->elements_count = asn_DEF_UTF8String.elements_count;
 
3113
        td->specifics      = asn_DEF_UTF8String.specifics;
 
3114
}
 
3115
 
 
3116
void
 
3117
Utf8_1_free(asn_TYPE_descriptor_t *td,
 
3118
                void *struct_ptr, int contents_only) {
 
3119
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3120
        td->free_struct(td, struct_ptr, contents_only);
 
3121
}
 
3122
 
 
3123
int
 
3124
Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
3125
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
3126
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3127
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
3128
}
 
3129
 
 
3130
asn_dec_rval_t
 
3131
Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3132
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
3133
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3134
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
3135
}
 
3136
 
 
3137
asn_enc_rval_t
 
3138
Utf8_1_encode_der(asn_TYPE_descriptor_t *td,
 
3139
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
3140
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3141
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3142
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
3143
}
 
3144
 
 
3145
asn_dec_rval_t
 
3146
Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3147
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
3148
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3149
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
3150
}
 
3151
 
 
3152
asn_enc_rval_t
 
3153
Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
3154
                int ilevel, enum xer_encoder_flags_e flags,
 
3155
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3156
        Utf8_1_1_inherit_TYPE_descriptor(td);
 
3157
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
3158
}
 
3159
 
 
3160
 
 
3161
/*** <<< STAT-DEFS [Utf8-1] >>> ***/
 
3162
 
 
3163
static ber_tlv_tag_t asn_DEF_Utf8_1_1_tags[] = {
 
3164
        (ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
 
3165
};
 
3166
asn_TYPE_descriptor_t asn_DEF_Utf8_1 = {
 
3167
        "Utf8-1",
 
3168
        "Utf8-1",
 
3169
        Utf8_1_free,
 
3170
        Utf8_1_print,
 
3171
        Utf8_1_constraint,
 
3172
        Utf8_1_decode_ber,
 
3173
        Utf8_1_encode_der,
 
3174
        Utf8_1_decode_xer,
 
3175
        Utf8_1_encode_xer,
 
3176
        0,      /* Use generic outmost tag fetcher */
 
3177
        asn_DEF_Utf8_1_1_tags,
 
3178
        sizeof(asn_DEF_Utf8_1_1_tags)
 
3179
                /sizeof(asn_DEF_Utf8_1_1_tags[0]), /* 1 */
 
3180
        asn_DEF_Utf8_1_1_tags,  /* Same as above */
 
3181
        sizeof(asn_DEF_Utf8_1_1_tags)
 
3182
                /sizeof(asn_DEF_Utf8_1_1_tags[0]), /* 1 */
 
3183
        0, 0,   /* No members */
 
3184
        0       /* No specifics */
 
3185
};
 
3186
 
 
3187
 
 
3188
/*** <<< INCLUDES [VisibleIdentifier] >>> ***/
 
3189
 
 
3190
#include <Identifier.h>
 
3191
 
 
3192
/*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/
 
3193
 
 
3194
typedef Identifier_t     VisibleIdentifier_t;
 
3195
 
 
3196
/*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/
 
3197
 
 
3198
extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier;
 
3199
asn_struct_free_f VisibleIdentifier_free;
 
3200
asn_struct_print_f VisibleIdentifier_print;
 
3201
asn_constr_check_f VisibleIdentifier_constraint;
 
3202
ber_type_decoder_f VisibleIdentifier_decode_ber;
 
3203
der_type_encoder_f VisibleIdentifier_encode_der;
 
3204
xer_type_decoder_f VisibleIdentifier_decode_xer;
 
3205
xer_type_encoder_f VisibleIdentifier_encode_xer;
 
3206
 
 
3207
/*** <<< CTABLES [VisibleIdentifier] >>> ***/
 
3208
 
 
3209
static int permitted_alphabet_table_1[256] = {
 
3210
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
3211
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
3212
0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,        /*     $            */
 
3213
1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,        /* 0123456789       */
 
3214
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  ABCDEFGHIJKLMNO */
 
3215
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,        /* PQRSTUVWXYZ    _ */
 
3216
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  abcdefghijklmno */
 
3217
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,        /* pqrstuvwxyz      */
 
3218
};
 
3219
 
 
3220
static int check_permitted_alphabet_1(const void *sptr) {
 
3221
        int *table = permitted_alphabet_table_1;
 
3222
        /* The underlying type is VisibleString */
 
3223
        const VisibleString_t *st = (const VisibleString_t *)sptr;
 
3224
        const uint8_t *ch = st->buf;
 
3225
        const uint8_t *end = ch + st->size;
 
3226
        
 
3227
        for(; ch < end; ch++) {
 
3228
                uint8_t cv = *ch;
 
3229
                if(!table[cv]) return -1;
 
3230
        }
 
3231
        return 0;
 
3232
}
 
3233
 
 
3234
 
 
3235
/*** <<< CODE [VisibleIdentifier] >>> ***/
 
3236
 
 
3237
int
 
3238
VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
3239
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
3240
        const Identifier_t *st = (const Identifier_t *)sptr;
 
3241
        size_t size;
 
3242
        
 
3243
        if(!sptr) {
 
3244
                _ASN_ERRLOG(app_errlog, app_key,
 
3245
                        "%s: value not given (%s:%d)",
 
3246
                        td->name, __FILE__, __LINE__);
 
3247
                return -1;
 
3248
        }
 
3249
        
 
3250
        size = st->size;
 
3251
        
 
3252
        if((size >= 1 && size <= 32)
 
3253
                 && !check_permitted_alphabet_1(st)) {
 
3254
                /* Constraint check succeeded */
 
3255
                return 0;
 
3256
        } else {
 
3257
                _ASN_ERRLOG(app_errlog, app_key,
 
3258
                        "%s: constraint failed (%s:%d)",
 
3259
                        td->name, __FILE__, __LINE__);
 
3260
                return -1;
 
3261
        }
 
3262
}
 
3263
 
 
3264
/*
 
3265
 * This type is implemented using Identifier,
 
3266
 * so here we adjust the DEF accordingly.
 
3267
 */
 
3268
static void
 
3269
VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
3270
        td->free_struct    = asn_DEF_Identifier.free_struct;
 
3271
        td->print_struct   = asn_DEF_Identifier.print_struct;
 
3272
        td->ber_decoder    = asn_DEF_Identifier.ber_decoder;
 
3273
        td->der_encoder    = asn_DEF_Identifier.der_encoder;
 
3274
        td->xer_decoder    = asn_DEF_Identifier.xer_decoder;
 
3275
        td->xer_encoder    = asn_DEF_Identifier.xer_encoder;
 
3276
        td->elements       = asn_DEF_Identifier.elements;
 
3277
        td->elements_count = asn_DEF_Identifier.elements_count;
 
3278
        td->specifics      = asn_DEF_Identifier.specifics;
 
3279
}
 
3280
 
 
3281
void
 
3282
VisibleIdentifier_free(asn_TYPE_descriptor_t *td,
 
3283
                void *struct_ptr, int contents_only) {
 
3284
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3285
        td->free_struct(td, struct_ptr, contents_only);
 
3286
}
 
3287
 
 
3288
int
 
3289
VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
3290
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
3291
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3292
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
3293
}
 
3294
 
 
3295
asn_dec_rval_t
 
3296
VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3297
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
3298
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3299
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
3300
}
 
3301
 
 
3302
asn_enc_rval_t
 
3303
VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td,
 
3304
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
3305
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3306
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3307
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
3308
}
 
3309
 
 
3310
asn_dec_rval_t
 
3311
VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3312
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
3313
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3314
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
3315
}
 
3316
 
 
3317
asn_enc_rval_t
 
3318
VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
3319
                int ilevel, enum xer_encoder_flags_e flags,
 
3320
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3321
        VisibleIdentifier_1_inherit_TYPE_descriptor(td);
 
3322
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
3323
}
 
3324
 
 
3325
 
 
3326
/*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/
 
3327
 
 
3328
static ber_tlv_tag_t asn_DEF_VisibleIdentifier_1_tags[] = {
 
3329
        (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
 
3330
};
 
3331
asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = {
 
3332
        "VisibleIdentifier",
 
3333
        "VisibleIdentifier",
 
3334
        VisibleIdentifier_free,
 
3335
        VisibleIdentifier_print,
 
3336
        VisibleIdentifier_constraint,
 
3337
        VisibleIdentifier_decode_ber,
 
3338
        VisibleIdentifier_encode_der,
 
3339
        VisibleIdentifier_decode_xer,
 
3340
        VisibleIdentifier_encode_xer,
 
3341
        0,      /* Use generic outmost tag fetcher */
 
3342
        asn_DEF_VisibleIdentifier_1_tags,
 
3343
        sizeof(asn_DEF_VisibleIdentifier_1_tags)
 
3344
                /sizeof(asn_DEF_VisibleIdentifier_1_tags[0]), /* 1 */
 
3345
        asn_DEF_VisibleIdentifier_1_tags,       /* Same as above */
 
3346
        sizeof(asn_DEF_VisibleIdentifier_1_tags)
 
3347
                /sizeof(asn_DEF_VisibleIdentifier_1_tags[0]), /* 1 */
 
3348
        0, 0,   /* No members */
 
3349
        0       /* No specifics */
 
3350
};
 
3351
 
 
3352
 
 
3353
/*** <<< INCLUDES [Identifier] >>> ***/
 
3354
 
 
3355
#include <VisibleString.h>
 
3356
 
 
3357
/*** <<< TYPE-DECLS [Identifier] >>> ***/
 
3358
 
 
3359
typedef VisibleString_t  Identifier_t;
 
3360
 
 
3361
/*** <<< FUNC-DECLS [Identifier] >>> ***/
 
3362
 
 
3363
extern asn_TYPE_descriptor_t asn_DEF_Identifier;
 
3364
asn_struct_free_f Identifier_free;
 
3365
asn_struct_print_f Identifier_print;
 
3366
asn_constr_check_f Identifier_constraint;
 
3367
ber_type_decoder_f Identifier_decode_ber;
 
3368
der_type_encoder_f Identifier_encode_der;
 
3369
xer_type_decoder_f Identifier_decode_xer;
 
3370
xer_type_encoder_f Identifier_encode_xer;
 
3371
 
 
3372
/*** <<< CTABLES [Identifier] >>> ***/
 
3373
 
 
3374
static int permitted_alphabet_table_1[256] = {
 
3375
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
3376
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /*                  */
 
3377
0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,        /*     $            */
 
3378
1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,        /* 0123456789       */
 
3379
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  ABCDEFGHIJKLMNO */
 
3380
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,        /* PQRSTUVWXYZ    _ */
 
3381
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,        /*  abcdefghijklmno */
 
3382
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,        /* pqrstuvwxyz      */
 
3383
};
 
3384
 
 
3385
static int check_permitted_alphabet_1(const void *sptr) {
 
3386
        int *table = permitted_alphabet_table_1;
 
3387
        /* The underlying type is VisibleString */
 
3388
        const VisibleString_t *st = (const VisibleString_t *)sptr;
 
3389
        const uint8_t *ch = st->buf;
 
3390
        const uint8_t *end = ch + st->size;
 
3391
        
 
3392
        for(; ch < end; ch++) {
 
3393
                uint8_t cv = *ch;
 
3394
                if(!table[cv]) return -1;
 
3395
        }
 
3396
        return 0;
 
3397
}
 
3398
 
 
3399
 
 
3400
/*** <<< CODE [Identifier] >>> ***/
 
3401
 
 
3402
int
 
3403
Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
 
3404
                        asn_app_consume_bytes_f *app_errlog, void *app_key) {
 
3405
        const VisibleString_t *st = (const VisibleString_t *)sptr;
 
3406
        size_t size;
 
3407
        
 
3408
        if(!sptr) {
 
3409
                _ASN_ERRLOG(app_errlog, app_key,
 
3410
                        "%s: value not given (%s:%d)",
 
3411
                        td->name, __FILE__, __LINE__);
 
3412
                return -1;
 
3413
        }
 
3414
        
 
3415
        size = st->size;
 
3416
        
 
3417
        if((size >= 1 && size <= 32)
 
3418
                 && !check_permitted_alphabet_1(st)) {
 
3419
                /* Constraint check succeeded */
 
3420
                return 0;
 
3421
        } else {
 
3422
                _ASN_ERRLOG(app_errlog, app_key,
 
3423
                        "%s: constraint failed (%s:%d)",
 
3424
                        td->name, __FILE__, __LINE__);
 
3425
                return -1;
 
3426
        }
 
3427
}
 
3428
 
 
3429
/*
 
3430
 * This type is implemented using VisibleString,
 
3431
 * so here we adjust the DEF accordingly.
 
3432
 */
 
3433
static void
 
3434
Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
 
3435
        td->free_struct    = asn_DEF_VisibleString.free_struct;
 
3436
        td->print_struct   = asn_DEF_VisibleString.print_struct;
 
3437
        td->ber_decoder    = asn_DEF_VisibleString.ber_decoder;
 
3438
        td->der_encoder    = asn_DEF_VisibleString.der_encoder;
 
3439
        td->xer_decoder    = asn_DEF_VisibleString.xer_decoder;
 
3440
        td->xer_encoder    = asn_DEF_VisibleString.xer_encoder;
 
3441
        td->elements       = asn_DEF_VisibleString.elements;
 
3442
        td->elements_count = asn_DEF_VisibleString.elements_count;
 
3443
        td->specifics      = asn_DEF_VisibleString.specifics;
 
3444
}
 
3445
 
 
3446
void
 
3447
Identifier_free(asn_TYPE_descriptor_t *td,
 
3448
                void *struct_ptr, int contents_only) {
 
3449
        Identifier_1_inherit_TYPE_descriptor(td);
 
3450
        td->free_struct(td, struct_ptr, contents_only);
 
3451
}
 
3452
 
 
3453
int
 
3454
Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
 
3455
                int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
 
3456
        Identifier_1_inherit_TYPE_descriptor(td);
 
3457
        return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
 
3458
}
 
3459
 
 
3460
asn_dec_rval_t
 
3461
Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3462
                void **structure, const void *bufptr, size_t size, int tag_mode) {
 
3463
        Identifier_1_inherit_TYPE_descriptor(td);
 
3464
        return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
 
3465
}
 
3466
 
 
3467
asn_enc_rval_t
 
3468
Identifier_encode_der(asn_TYPE_descriptor_t *td,
 
3469
                void *structure, int tag_mode, ber_tlv_tag_t tag,
 
3470
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3471
        Identifier_1_inherit_TYPE_descriptor(td);
 
3472
        return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
 
3473
}
 
3474
 
 
3475
asn_dec_rval_t
 
3476
Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
 
3477
                void **structure, const char *opt_mname, const void *bufptr, size_t size) {
 
3478
        Identifier_1_inherit_TYPE_descriptor(td);
 
3479
        return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
 
3480
}
 
3481
 
 
3482
asn_enc_rval_t
 
3483
Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
 
3484
                int ilevel, enum xer_encoder_flags_e flags,
 
3485
                asn_app_consume_bytes_f *cb, void *app_key) {
 
3486
        Identifier_1_inherit_TYPE_descriptor(td);
 
3487
        return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
 
3488
}
 
3489
 
 
3490
 
 
3491
/*** <<< STAT-DEFS [Identifier] >>> ***/
 
3492
 
 
3493
static ber_tlv_tag_t asn_DEF_Identifier_1_tags[] = {
 
3494
        (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))
 
3495
};
 
3496
asn_TYPE_descriptor_t asn_DEF_Identifier = {
 
3497
        "Identifier",
 
3498
        "Identifier",
 
3499
        Identifier_free,
 
3500
        Identifier_print,
 
3501
        Identifier_constraint,
 
3502
        Identifier_decode_ber,
 
3503
        Identifier_encode_der,
 
3504
        Identifier_decode_xer,
 
3505
        Identifier_encode_xer,
 
3506
        0,      /* Use generic outmost tag fetcher */
 
3507
        asn_DEF_Identifier_1_tags,
 
3508
        sizeof(asn_DEF_Identifier_1_tags)
 
3509
                /sizeof(asn_DEF_Identifier_1_tags[0]), /* 1 */
 
3510
        asn_DEF_Identifier_1_tags,      /* Same as above */
 
3511
        sizeof(asn_DEF_Identifier_1_tags)
 
3512
                /sizeof(asn_DEF_Identifier_1_tags[0]), /* 1 */
 
3513
        0, 0,   /* No members */
 
3514
        0       /* No specifics */
 
3515
};
 
3516