blob: ee5a50425fdb0f372c2e35a5af7209d68b74ecf9 [file] [log] [blame]
vlm7c8aa5e2006-03-21 07:25:18 +00001
2/*** <<< INCLUDES [MinMax] >>> ***/
3
4#include <INTEGER.h>
5
6/*** <<< TYPE-DECLS [MinMax] >>> ***/
7
8typedef INTEGER_t MinMax_16P0_t;
9
10/*** <<< FUNC-DECLS [MinMax] >>> ***/
11
12extern asn_TYPE_descriptor_t asn_DEF_MinMax_16P0;
13asn_struct_free_f MinMax_16P0_free;
14asn_struct_print_f MinMax_16P0_print;
15asn_constr_check_f MinMax_16P0_constraint;
16ber_type_decoder_f MinMax_16P0_decode_ber;
17der_type_encoder_f MinMax_16P0_encode_der;
18xer_type_decoder_f MinMax_16P0_decode_xer;
19xer_type_encoder_f MinMax_16P0_encode_xer;
20
21/*** <<< CODE [MinMax] >>> ***/
22
23int
24MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
25 asn_app_consume_bytes_f *app_errlog, void *app_key) {
26 const INTEGER_t *st = (const INTEGER_t *)sptr;
27 long value;
28
29 if(!sptr) {
30 _ASN_ERRLOG(app_errlog, app_key,
31 "%s: value not given (%s:%d)",
32 td->name, __FILE__, __LINE__);
33 return -1;
34 }
35
36 if(asn_INTEGER2long(st, &value)) {
37 _ASN_ERRLOG(app_errlog, app_key,
38 "%s: value too large (%s:%d)",
39 td->name, __FILE__, __LINE__);
40 return -1;
41 }
42
43 if((value >= 3)) {
44 /* Constraint check succeeded */
45 return 0;
46 } else {
47 _ASN_ERRLOG(app_errlog, app_key,
48 "%s: constraint failed (%s:%d)",
49 td->name, __FILE__, __LINE__);
50 return -1;
51 }
52}
53
54/*
55 * This type is implemented using INTEGER,
56 * so here we adjust the DEF accordingly.
57 */
58static void
59MinMax_16P0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
60 td->free_struct = asn_DEF_INTEGER.free_struct;
61 td->print_struct = asn_DEF_INTEGER.print_struct;
62 td->ber_decoder = asn_DEF_INTEGER.ber_decoder;
63 td->der_encoder = asn_DEF_INTEGER.der_encoder;
64 td->xer_decoder = asn_DEF_INTEGER.xer_decoder;
65 td->xer_encoder = asn_DEF_INTEGER.xer_encoder;
66 td->uper_decoder = asn_DEF_INTEGER.uper_decoder;
67 if(!td->per_constraints)
68 td->per_constraints = asn_DEF_INTEGER.per_constraints;
69 td->elements = asn_DEF_INTEGER.elements;
70 td->elements_count = asn_DEF_INTEGER.elements_count;
71 td->specifics = asn_DEF_INTEGER.specifics;
72}
73
74void
75MinMax_16P0_free(asn_TYPE_descriptor_t *td,
76 void *struct_ptr, int contents_only) {
77 MinMax_16P0_1_inherit_TYPE_descriptor(td);
78 td->free_struct(td, struct_ptr, contents_only);
79}
80
81int
82MinMax_16P0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
83 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
84 MinMax_16P0_1_inherit_TYPE_descriptor(td);
85 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
86}
87
88asn_dec_rval_t
89MinMax_16P0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
90 void **structure, const void *bufptr, size_t size, int tag_mode) {
91 MinMax_16P0_1_inherit_TYPE_descriptor(td);
92 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
93}
94
95asn_enc_rval_t
96MinMax_16P0_encode_der(asn_TYPE_descriptor_t *td,
97 void *structure, int tag_mode, ber_tlv_tag_t tag,
98 asn_app_consume_bytes_f *cb, void *app_key) {
99 MinMax_16P0_1_inherit_TYPE_descriptor(td);
100 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
101}
102
103asn_dec_rval_t
104MinMax_16P0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
105 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
106 MinMax_16P0_1_inherit_TYPE_descriptor(td);
107 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
108}
109
110asn_enc_rval_t
111MinMax_16P0_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
112 int ilevel, enum xer_encoder_flags_e flags,
113 asn_app_consume_bytes_f *cb, void *app_key) {
114 MinMax_16P0_1_inherit_TYPE_descriptor(td);
115 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
116}
117
118
119/*** <<< STAT-DEFS [MinMax] >>> ***/
120
121static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = {
122 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
123};
124asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = {
125 "MinMax",
126 "MinMax",
127 MinMax_16P0_free,
128 MinMax_16P0_print,
129 MinMax_16P0_constraint,
130 MinMax_16P0_decode_ber,
131 MinMax_16P0_encode_der,
132 MinMax_16P0_decode_xer,
133 MinMax_16P0_encode_xer,
134 0, /* No PER decoder, -gen-PER to enable */
135 0, /* Use generic outmost tag fetcher */
136 asn_DEF_MinMax_16P0_tags_1,
137 sizeof(asn_DEF_MinMax_16P0_tags_1)
138 /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */
139 asn_DEF_MinMax_16P0_tags_1, /* Same as above */
140 sizeof(asn_DEF_MinMax_16P0_tags_1)
141 /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */
142 0, /* No PER visible constraints */
143 0, 0, /* No members */
144 0 /* No specifics */
145};
146
147
148/*** <<< INCLUDES [ThreePlus] >>> ***/
149
150#include <MinMax.h>
151
152/*** <<< TYPE-DECLS [ThreePlus] >>> ***/
153
154typedef MinMax_16P0_t ThreePlus_t;
155
156/*** <<< FUNC-DECLS [ThreePlus] >>> ***/
157
158extern asn_TYPE_descriptor_t asn_DEF_ThreePlus;
159asn_struct_free_f ThreePlus_free;
160asn_struct_print_f ThreePlus_print;
161asn_constr_check_f ThreePlus_constraint;
162ber_type_decoder_f ThreePlus_decode_ber;
163der_type_encoder_f ThreePlus_encode_der;
164xer_type_decoder_f ThreePlus_decode_xer;
165xer_type_encoder_f ThreePlus_encode_xer;
166
167/*** <<< CODE [ThreePlus] >>> ***/
168
169int
170ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
171 asn_app_consume_bytes_f *app_errlog, void *app_key) {
172 const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr;
173 long value;
174
175 if(!sptr) {
176 _ASN_ERRLOG(app_errlog, app_key,
177 "%s: value not given (%s:%d)",
178 td->name, __FILE__, __LINE__);
179 return -1;
180 }
181
182 if(asn_INTEGER2long(st, &value)) {
183 _ASN_ERRLOG(app_errlog, app_key,
184 "%s: value too large (%s:%d)",
185 td->name, __FILE__, __LINE__);
186 return -1;
187 }
188
189 if((value >= 3)) {
190 /* Constraint check succeeded */
191 return 0;
192 } else {
193 _ASN_ERRLOG(app_errlog, app_key,
194 "%s: constraint failed (%s:%d)",
195 td->name, __FILE__, __LINE__);
196 return -1;
197 }
198}
199
200/*
201 * This type is implemented using MinMax_16P0,
202 * so here we adjust the DEF accordingly.
203 */
204static void
205ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
206 td->free_struct = asn_DEF_MinMax_16P0.free_struct;
207 td->print_struct = asn_DEF_MinMax_16P0.print_struct;
208 td->ber_decoder = asn_DEF_MinMax_16P0.ber_decoder;
209 td->der_encoder = asn_DEF_MinMax_16P0.der_encoder;
210 td->xer_decoder = asn_DEF_MinMax_16P0.xer_decoder;
211 td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder;
212 td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder;
213 if(!td->per_constraints)
214 td->per_constraints = asn_DEF_MinMax_16P0.per_constraints;
215 td->elements = asn_DEF_MinMax_16P0.elements;
216 td->elements_count = asn_DEF_MinMax_16P0.elements_count;
217 td->specifics = asn_DEF_MinMax_16P0.specifics;
218}
219
220void
221ThreePlus_free(asn_TYPE_descriptor_t *td,
222 void *struct_ptr, int contents_only) {
223 ThreePlus_1_inherit_TYPE_descriptor(td);
224 td->free_struct(td, struct_ptr, contents_only);
225}
226
227int
228ThreePlus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
229 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
230 ThreePlus_1_inherit_TYPE_descriptor(td);
231 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
232}
233
234asn_dec_rval_t
235ThreePlus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
236 void **structure, const void *bufptr, size_t size, int tag_mode) {
237 ThreePlus_1_inherit_TYPE_descriptor(td);
238 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
239}
240
241asn_enc_rval_t
242ThreePlus_encode_der(asn_TYPE_descriptor_t *td,
243 void *structure, int tag_mode, ber_tlv_tag_t tag,
244 asn_app_consume_bytes_f *cb, void *app_key) {
245 ThreePlus_1_inherit_TYPE_descriptor(td);
246 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
247}
248
249asn_dec_rval_t
250ThreePlus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
251 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
252 ThreePlus_1_inherit_TYPE_descriptor(td);
253 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
254}
255
256asn_enc_rval_t
257ThreePlus_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
258 int ilevel, enum xer_encoder_flags_e flags,
259 asn_app_consume_bytes_f *cb, void *app_key) {
260 ThreePlus_1_inherit_TYPE_descriptor(td);
261 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
262}
263
264
265/*** <<< STAT-DEFS [ThreePlus] >>> ***/
266
267static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = {
268 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
269};
270asn_TYPE_descriptor_t asn_DEF_ThreePlus = {
271 "ThreePlus",
272 "ThreePlus",
273 ThreePlus_free,
274 ThreePlus_print,
275 ThreePlus_constraint,
276 ThreePlus_decode_ber,
277 ThreePlus_encode_der,
278 ThreePlus_decode_xer,
279 ThreePlus_encode_xer,
280 0, /* No PER decoder, -gen-PER to enable */
281 0, /* Use generic outmost tag fetcher */
282 asn_DEF_ThreePlus_tags_1,
283 sizeof(asn_DEF_ThreePlus_tags_1)
284 /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */
285 asn_DEF_ThreePlus_tags_1, /* Same as above */
286 sizeof(asn_DEF_ThreePlus_tags_1)
287 /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */
288 0, /* No PER visible constraints */
289 0, 0, /* No members */
290 0 /* No specifics */
291};
292