blob: b09030016f99d3957e69f9ec0e7a46bceb24e661 [file] [log] [blame]
Lev Walkin171487e2006-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,
Lev Walkin1eded352006-07-13 11:19:01 +000025 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin171487e2006-03-21 07:25:18 +000026 const INTEGER_t *st = (const INTEGER_t *)sptr;
27 long value;
28
29 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +000030 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +000031 "%s: value not given (%s:%d)",
32 td->name, __FILE__, __LINE__);
33 return -1;
34 }
35
36 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +000037 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +000038 "%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 {
Lev Walkin739d9bf2006-07-13 13:28:32 +000047 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +000048 "%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;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +000067 td->uper_encoder = asn_DEF_INTEGER.uper_encoder;
Lev Walkin171487e2006-03-21 07:25:18 +000068 if(!td->per_constraints)
69 td->per_constraints = asn_DEF_INTEGER.per_constraints;
70 td->elements = asn_DEF_INTEGER.elements;
71 td->elements_count = asn_DEF_INTEGER.elements_count;
72 td->specifics = asn_DEF_INTEGER.specifics;
73}
74
75void
76MinMax_16P0_free(asn_TYPE_descriptor_t *td,
77 void *struct_ptr, int contents_only) {
78 MinMax_16P0_1_inherit_TYPE_descriptor(td);
79 td->free_struct(td, struct_ptr, contents_only);
80}
81
82int
83MinMax_16P0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
84 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
85 MinMax_16P0_1_inherit_TYPE_descriptor(td);
86 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
87}
88
89asn_dec_rval_t
90MinMax_16P0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
91 void **structure, const void *bufptr, size_t size, int tag_mode) {
92 MinMax_16P0_1_inherit_TYPE_descriptor(td);
93 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
94}
95
96asn_enc_rval_t
97MinMax_16P0_encode_der(asn_TYPE_descriptor_t *td,
98 void *structure, int tag_mode, ber_tlv_tag_t tag,
99 asn_app_consume_bytes_f *cb, void *app_key) {
100 MinMax_16P0_1_inherit_TYPE_descriptor(td);
101 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
102}
103
104asn_dec_rval_t
105MinMax_16P0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
106 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
107 MinMax_16P0_1_inherit_TYPE_descriptor(td);
108 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
109}
110
111asn_enc_rval_t
112MinMax_16P0_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
113 int ilevel, enum xer_encoder_flags_e flags,
114 asn_app_consume_bytes_f *cb, void *app_key) {
115 MinMax_16P0_1_inherit_TYPE_descriptor(td);
116 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
117}
118
119
120/*** <<< STAT-DEFS [MinMax] >>> ***/
121
122static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = {
123 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
124};
125asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = {
126 "MinMax",
127 "MinMax",
128 MinMax_16P0_free,
129 MinMax_16P0_print,
130 MinMax_16P0_constraint,
131 MinMax_16P0_decode_ber,
132 MinMax_16P0_encode_der,
133 MinMax_16P0_decode_xer,
134 MinMax_16P0_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000135 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin171487e2006-03-21 07:25:18 +0000136 0, /* Use generic outmost tag fetcher */
137 asn_DEF_MinMax_16P0_tags_1,
138 sizeof(asn_DEF_MinMax_16P0_tags_1)
139 /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */
140 asn_DEF_MinMax_16P0_tags_1, /* Same as above */
141 sizeof(asn_DEF_MinMax_16P0_tags_1)
142 /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */
143 0, /* No PER visible constraints */
144 0, 0, /* No members */
145 0 /* No specifics */
146};
147
148
149/*** <<< INCLUDES [ThreePlus] >>> ***/
150
Lev Walkin22b5ed42006-09-13 02:51:20 +0000151#include "MinMax.h"
Lev Walkin171487e2006-03-21 07:25:18 +0000152
153/*** <<< TYPE-DECLS [ThreePlus] >>> ***/
154
155typedef MinMax_16P0_t ThreePlus_t;
156
157/*** <<< FUNC-DECLS [ThreePlus] >>> ***/
158
159extern asn_TYPE_descriptor_t asn_DEF_ThreePlus;
160asn_struct_free_f ThreePlus_free;
161asn_struct_print_f ThreePlus_print;
162asn_constr_check_f ThreePlus_constraint;
163ber_type_decoder_f ThreePlus_decode_ber;
164der_type_encoder_f ThreePlus_encode_der;
165xer_type_decoder_f ThreePlus_decode_xer;
166xer_type_encoder_f ThreePlus_encode_xer;
167
168/*** <<< CODE [ThreePlus] >>> ***/
169
170int
171ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000172 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin171487e2006-03-21 07:25:18 +0000173 const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr;
174 long value;
175
176 if(!sptr) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000177 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +0000178 "%s: value not given (%s:%d)",
179 td->name, __FILE__, __LINE__);
180 return -1;
181 }
182
183 if(asn_INTEGER2long(st, &value)) {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000184 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +0000185 "%s: value too large (%s:%d)",
186 td->name, __FILE__, __LINE__);
187 return -1;
188 }
189
190 if((value >= 3)) {
191 /* Constraint check succeeded */
192 return 0;
193 } else {
Lev Walkin739d9bf2006-07-13 13:28:32 +0000194 _ASN_CTFAIL(app_key, td, sptr,
Lev Walkin171487e2006-03-21 07:25:18 +0000195 "%s: constraint failed (%s:%d)",
196 td->name, __FILE__, __LINE__);
197 return -1;
198 }
199}
200
201/*
202 * This type is implemented using MinMax_16P0,
203 * so here we adjust the DEF accordingly.
204 */
205static void
206ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
207 td->free_struct = asn_DEF_MinMax_16P0.free_struct;
208 td->print_struct = asn_DEF_MinMax_16P0.print_struct;
209 td->ber_decoder = asn_DEF_MinMax_16P0.ber_decoder;
210 td->der_encoder = asn_DEF_MinMax_16P0.der_encoder;
211 td->xer_decoder = asn_DEF_MinMax_16P0.xer_decoder;
212 td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder;
213 td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000214 td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder;
Lev Walkin171487e2006-03-21 07:25:18 +0000215 if(!td->per_constraints)
216 td->per_constraints = asn_DEF_MinMax_16P0.per_constraints;
217 td->elements = asn_DEF_MinMax_16P0.elements;
218 td->elements_count = asn_DEF_MinMax_16P0.elements_count;
219 td->specifics = asn_DEF_MinMax_16P0.specifics;
220}
221
222void
223ThreePlus_free(asn_TYPE_descriptor_t *td,
224 void *struct_ptr, int contents_only) {
225 ThreePlus_1_inherit_TYPE_descriptor(td);
226 td->free_struct(td, struct_ptr, contents_only);
227}
228
229int
230ThreePlus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
231 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
232 ThreePlus_1_inherit_TYPE_descriptor(td);
233 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
234}
235
236asn_dec_rval_t
237ThreePlus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
238 void **structure, const void *bufptr, size_t size, int tag_mode) {
239 ThreePlus_1_inherit_TYPE_descriptor(td);
240 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
241}
242
243asn_enc_rval_t
244ThreePlus_encode_der(asn_TYPE_descriptor_t *td,
245 void *structure, int tag_mode, ber_tlv_tag_t tag,
246 asn_app_consume_bytes_f *cb, void *app_key) {
247 ThreePlus_1_inherit_TYPE_descriptor(td);
248 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
249}
250
251asn_dec_rval_t
252ThreePlus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
253 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
254 ThreePlus_1_inherit_TYPE_descriptor(td);
255 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
256}
257
258asn_enc_rval_t
259ThreePlus_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
260 int ilevel, enum xer_encoder_flags_e flags,
261 asn_app_consume_bytes_f *cb, void *app_key) {
262 ThreePlus_1_inherit_TYPE_descriptor(td);
263 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
264}
265
266
267/*** <<< STAT-DEFS [ThreePlus] >>> ***/
268
269static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = {
270 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
271};
272asn_TYPE_descriptor_t asn_DEF_ThreePlus = {
273 "ThreePlus",
274 "ThreePlus",
275 ThreePlus_free,
276 ThreePlus_print,
277 ThreePlus_constraint,
278 ThreePlus_decode_ber,
279 ThreePlus_encode_der,
280 ThreePlus_decode_xer,
281 ThreePlus_encode_xer,
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000282 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin171487e2006-03-21 07:25:18 +0000283 0, /* Use generic outmost tag fetcher */
284 asn_DEF_ThreePlus_tags_1,
285 sizeof(asn_DEF_ThreePlus_tags_1)
286 /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */
287 asn_DEF_ThreePlus_tags_1, /* Same as above */
288 sizeof(asn_DEF_ThreePlus_tags_1)
289 /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */
290 0, /* No PER visible constraints */
291 0, 0, /* No members */
292 0 /* No specifics */
293};
294