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