Debian Codegraph @

tests/66-ref-simple-OK.asn1.-Pfwide-types

raw
1
2 /*** <<< INCLUDES [T] >>> ***/
3
4 #include "SimpleType.h"
5 #include <asn_SET_OF.h>
6 #include <constr_SET_OF.h>
7
8 /*** <<< TYPE-DECLS [T] >>> ***/
9
10 typedef struct T {
11 A_SET_OF(SimpleType_t) list;
12
13 /* Context for parsing across buffer boundaries */
14 asn_struct_ctx_t _asn_ctx;
15 } T_t;
16
17 /*** <<< FUNC-DECLS [T] >>> ***/
18
19 extern asn_TYPE_descriptor_t asn_DEF_T;
20
21 /*** <<< STAT-DEFS [T] >>> ***/
22
23 static asn_TYPE_member_t asn_MBR_T_1[] = {
24 { ATF_POINTER, 0, 0,
25 .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
26 .tag_mode = 0,
27 .type = &asn_DEF_SimpleType,
28 .memb_constraints = 0, /* Defer constraints checking to the member type */
29 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
30 .default_value = 0,
31 .name = "named"
32 },
33 };
34 static const ber_tlv_tag_t asn_DEF_T_tags_1[] = {
35 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
36 };
37 static asn_SET_OF_specifics_t asn_SPC_T_specs_1 = {
38 sizeof(struct T),
39 offsetof(struct T, _asn_ctx),
40 1, /* XER encoding is XMLValueList */
41 };
42 asn_TYPE_descriptor_t asn_DEF_T = {
43 "T",
44 "T",
45 SET_OF_free,
46 SET_OF_print,
47 SET_OF_constraint,
48 SET_OF_decode_ber,
49 SET_OF_encode_der,
50 SET_OF_decode_xer,
51 SET_OF_encode_xer,
52 0, 0, /* No PER support, use "-gen-PER" to enable */
53 0, /* Use generic outmost tag fetcher */
54 asn_DEF_T_tags_1,
55 sizeof(asn_DEF_T_tags_1)
56 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
57 asn_DEF_T_tags_1, /* Same as above */
58 sizeof(asn_DEF_T_tags_1)
59 /sizeof(asn_DEF_T_tags_1[0]), /* 1 */
60 0, /* No PER visible constraints */
61 asn_MBR_T_1,
62 1, /* Single element */
63 &asn_SPC_T_specs_1 /* Additional specs */
64 };
65
66
67 /*** <<< INCLUDES [SimpleType] >>> ***/
68
69 #include <ENUMERATED.h>
70
71 /*** <<< DEPS [SimpleType] >>> ***/
72
73 typedef enum SimpleType {
74 SimpleType_one = 0,
75 SimpleType_two = 1,
76 SimpleType_three = 2
77 } e_SimpleType;
78
79 /*** <<< TYPE-DECLS [SimpleType] >>> ***/
80
81 typedef ENUMERATED_t SimpleType_t;
82
83 /*** <<< FUNC-DECLS [SimpleType] >>> ***/
84
85 extern asn_TYPE_descriptor_t asn_DEF_SimpleType;
86 asn_struct_free_f SimpleType_free;
87 asn_struct_print_f SimpleType_print;
88 asn_constr_check_f SimpleType_constraint;
89 ber_type_decoder_f SimpleType_decode_ber;
90 der_type_encoder_f SimpleType_encode_der;
91 xer_type_decoder_f SimpleType_decode_xer;
92 xer_type_encoder_f SimpleType_encode_xer;
93
94 /*** <<< CODE [SimpleType] >>> ***/
95
96 int
97 SimpleType_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
98 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
99 /* Replace with underlying type checker */
100 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
101 return td->check_constraints(td, sptr, ctfailcb, app_key);
102 }
103
104 /*
105 * This type is implemented using ENUMERATED,
106 * so here we adjust the DEF accordingly.
107 */
108 static void
109 SimpleType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
110 td->free_struct = asn_DEF_ENUMERATED.free_struct;
111 td->print_struct = asn_DEF_ENUMERATED.print_struct;
112 td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
113 td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder;
114 td->der_encoder = asn_DEF_ENUMERATED.der_encoder;
115 td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder;
116 td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder;
117 td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder;
118 td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder;
119 if(!td->per_constraints)
120 td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
121 td->elements = asn_DEF_ENUMERATED.elements;
122 td->elements_count = asn_DEF_ENUMERATED.elements_count;
123 /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */
124 }
125
126 void
127 SimpleType_free(asn_TYPE_descriptor_t *td,
128 void *struct_ptr, int contents_only) {
129 SimpleType_1_inherit_TYPE_descriptor(td);
130 td->free_struct(td, struct_ptr, contents_only);
131 }
132
133 int
134 SimpleType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
135 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
136 SimpleType_1_inherit_TYPE_descriptor(td);
137 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
138 }
139
140 asn_dec_rval_t
141 SimpleType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
142 void **structure, const void *bufptr, size_t size, int tag_mode) {
143 SimpleType_1_inherit_TYPE_descriptor(td);
144 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
145 }
146
147 asn_enc_rval_t
148 SimpleType_encode_der(asn_TYPE_descriptor_t *td,
149 void *structure, int tag_mode, ber_tlv_tag_t tag,
150 asn_app_consume_bytes_f *cb, void *app_key) {
151 SimpleType_1_inherit_TYPE_descriptor(td);
152 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
153 }
154
155 asn_dec_rval_t
156 SimpleType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
157 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
158 SimpleType_1_inherit_TYPE_descriptor(td);
159 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
160 }
161
162 asn_enc_rval_t
163 SimpleType_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
164 int ilevel, enum xer_encoder_flags_e flags,
165 asn_app_consume_bytes_f *cb, void *app_key) {
166 SimpleType_1_inherit_TYPE_descriptor(td);
167 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
168 }
169
170
171 /*** <<< STAT-DEFS [SimpleType] >>> ***/
172
173 static const asn_INTEGER_enum_map_t asn_MAP_SimpleType_value2enum_1[] = {
174 { 0, 3, "one" },
175 { 1, 3, "two" },
176 { 2, 5, "three" }
177 };
178 static const unsigned int asn_MAP_SimpleType_enum2value_1[] = {
179 0, /* one(0) */
180 2, /* three(2) */
181 1 /* two(1) */
182 };
183 static const asn_INTEGER_specifics_t asn_SPC_SimpleType_specs_1 = {
184 asn_MAP_SimpleType_value2enum_1, /* "tag" => N; sorted by tag */
185 asn_MAP_SimpleType_enum2value_1, /* N => "tag"; sorted by N */
186 3, /* Number of elements in the maps */
187 0, /* Enumeration is not extensible */
188 1, /* Strict enumeration */
189 0, /* Native long size */
190 0
191 };
192 static const ber_tlv_tag_t asn_DEF_SimpleType_tags_1[] = {
193 (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
194 };
195 asn_TYPE_descriptor_t asn_DEF_SimpleType = {
196 "SimpleType",
197 "SimpleType",
198 SimpleType_free,
199 SimpleType_print,
200 SimpleType_constraint,
201 SimpleType_decode_ber,
202 SimpleType_encode_der,
203 SimpleType_decode_xer,
204 SimpleType_encode_xer,
205 0, 0, /* No PER support, use "-gen-PER" to enable */
206 0, /* Use generic outmost tag fetcher */
207 asn_DEF_SimpleType_tags_1,
208 sizeof(asn_DEF_SimpleType_tags_1)
209 /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */
210 asn_DEF_SimpleType_tags_1, /* Same as above */
211 sizeof(asn_DEF_SimpleType_tags_1)
212 /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */
213 0, /* No PER visible constraints */
214 0, 0, /* Defined elsewhere */
215 &asn_SPC_SimpleType_specs_1 /* Additional specs */
216 };
217