blob: 4dbed5f69b7b90f78fb01138dfa2dcf4ea3c04ea [file] [log] [blame]
Harald Welte3aa901d2018-08-13 18:32:36 +02001/*
2 * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
3 * From ASN.1 module "RSPRO"
4 * found in "../../asn1/RSPRO.asn"
5 */
6
7#include <osmocom/rspro/ComponentName.h>
8
9static int check_permitted_alphabet_1(const void *sptr) {
10 /* The underlying type is IA5String */
11 const IA5String_t *st = (const IA5String_t *)sptr;
12 const uint8_t *ch = st->buf;
13 const uint8_t *end = ch + st->size;
14
15 for(; ch < end; ch++) {
16 uint8_t cv = *ch;
17 if(!(cv <= 127l)) return -1;
18 }
19 return 0;
20}
21
22int
23ComponentName_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
24 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
25 const IA5String_t *st = (const IA5String_t *)sptr;
26 size_t size;
27
28 if(!sptr) {
29 _ASN_CTFAIL(app_key, td, sptr,
30 "%s: value not given (%s:%d)",
31 td->name, __FILE__, __LINE__);
32 return -1;
33 }
34
35 size = st->size;
36
37 if((size >= 1l && size <= 32l)
38 && !check_permitted_alphabet_1(st)) {
39 /* Constraint check succeeded */
40 return 0;
41 } else {
42 _ASN_CTFAIL(app_key, td, sptr,
43 "%s: constraint failed (%s:%d)",
44 td->name, __FILE__, __LINE__);
45 return -1;
46 }
47}
48
49/*
50 * This type is implemented using IA5String,
51 * so here we adjust the DEF accordingly.
52 */
53static void
54ComponentName_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
55 td->free_struct = asn_DEF_IA5String.free_struct;
56 td->print_struct = asn_DEF_IA5String.print_struct;
57 td->check_constraints = asn_DEF_IA5String.check_constraints;
58 td->ber_decoder = asn_DEF_IA5String.ber_decoder;
59 td->der_encoder = asn_DEF_IA5String.der_encoder;
60 td->xer_decoder = asn_DEF_IA5String.xer_decoder;
61 td->xer_encoder = asn_DEF_IA5String.xer_encoder;
62 td->uper_decoder = asn_DEF_IA5String.uper_decoder;
63 td->uper_encoder = asn_DEF_IA5String.uper_encoder;
64 td->aper_decoder = asn_DEF_IA5String.aper_decoder;
65 td->aper_encoder = asn_DEF_IA5String.aper_encoder;
66 if(!td->per_constraints)
67 td->per_constraints = asn_DEF_IA5String.per_constraints;
68 td->elements = asn_DEF_IA5String.elements;
69 td->elements_count = asn_DEF_IA5String.elements_count;
70 td->specifics = asn_DEF_IA5String.specifics;
71}
72
73void
74ComponentName_free(asn_TYPE_descriptor_t *td,
75 void *struct_ptr, int contents_only) {
76 ComponentName_1_inherit_TYPE_descriptor(td);
77 td->free_struct(td, struct_ptr, contents_only);
78}
79
80int
81ComponentName_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
82 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
83 ComponentName_1_inherit_TYPE_descriptor(td);
84 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
85}
86
87asn_dec_rval_t
88ComponentName_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
89 void **structure, const void *bufptr, size_t size, int tag_mode) {
90 ComponentName_1_inherit_TYPE_descriptor(td);
91 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
92}
93
94asn_enc_rval_t
95ComponentName_encode_der(asn_TYPE_descriptor_t *td,
96 void *structure, int tag_mode, ber_tlv_tag_t tag,
97 asn_app_consume_bytes_f *cb, void *app_key) {
98 ComponentName_1_inherit_TYPE_descriptor(td);
99 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
100}
101
102asn_dec_rval_t
103ComponentName_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
104 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
105 ComponentName_1_inherit_TYPE_descriptor(td);
106 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
107}
108
109asn_enc_rval_t
110ComponentName_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
111 int ilevel, enum xer_encoder_flags_e flags,
112 asn_app_consume_bytes_f *cb, void *app_key) {
113 ComponentName_1_inherit_TYPE_descriptor(td);
114 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
115}
116
117static const ber_tlv_tag_t asn_DEF_ComponentName_tags_1[] = {
118 (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))
119};
120asn_TYPE_descriptor_t asn_DEF_ComponentName = {
121 "ComponentName",
122 "ComponentName",
123 ComponentName_free,
124 ComponentName_print,
125 ComponentName_constraint,
126 ComponentName_decode_ber,
127 ComponentName_encode_der,
128 ComponentName_decode_xer,
129 ComponentName_encode_xer,
130 0, 0, /* No UPER support, use "-gen-PER" to enable */
131 0, 0, /* No APER support, use "-gen-PER" to enable */
132 0, /* Use generic outmost tag fetcher */
133 asn_DEF_ComponentName_tags_1,
134 sizeof(asn_DEF_ComponentName_tags_1)
135 /sizeof(asn_DEF_ComponentName_tags_1[0]), /* 1 */
136 asn_DEF_ComponentName_tags_1, /* Same as above */
137 sizeof(asn_DEF_ComponentName_tags_1)
138 /sizeof(asn_DEF_ComponentName_tags_1[0]), /* 1 */
139 0, /* No PER visible constraints */
140 0, 0, /* No members */
141 0 /* No specifics */
142};
143