vlm | 7c8aa5e | 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, |
vlm | af68ef5 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 25 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
vlm | 7c8aa5e | 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) { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 30 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 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)) { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 37 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 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 { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 47 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 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; |
| 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; |
vlm | b1b193e | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 67 | td->uper_encoder = asn_DEF_INTEGER.uper_encoder; |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 68 | 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 | |
| 75 | void |
| 76 | MinMax_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 | |
| 82 | int |
| 83 | MinMax_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 | |
| 89 | asn_dec_rval_t |
| 90 | MinMax_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 | |
| 96 | asn_enc_rval_t |
| 97 | MinMax_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 | |
| 104 | asn_dec_rval_t |
| 105 | MinMax_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 | |
| 111 | asn_enc_rval_t |
| 112 | MinMax_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 | |
| 122 | static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { |
| 123 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 124 | }; |
| 125 | asn_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, |
vlm | b1b193e | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 135 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 136 | 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 | |
vlm | ea22677 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 151 | #include "MinMax.h" |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 152 | |
| 153 | /*** <<< TYPE-DECLS [ThreePlus] >>> ***/ |
| 154 | |
| 155 | typedef MinMax_16P0_t ThreePlus_t; |
| 156 | |
| 157 | /*** <<< FUNC-DECLS [ThreePlus] >>> ***/ |
| 158 | |
| 159 | extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; |
| 160 | asn_struct_free_f ThreePlus_free; |
| 161 | asn_struct_print_f ThreePlus_print; |
| 162 | asn_constr_check_f ThreePlus_constraint; |
| 163 | ber_type_decoder_f ThreePlus_decode_ber; |
| 164 | der_type_encoder_f ThreePlus_encode_der; |
| 165 | xer_type_decoder_f ThreePlus_decode_xer; |
| 166 | xer_type_encoder_f ThreePlus_encode_xer; |
| 167 | |
| 168 | /*** <<< CODE [ThreePlus] >>> ***/ |
| 169 | |
| 170 | int |
| 171 | ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | af68ef5 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 172 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 173 | const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; |
| 174 | long value; |
| 175 | |
| 176 | if(!sptr) { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 177 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 178 | "%s: value not given (%s:%d)", |
| 179 | td->name, __FILE__, __LINE__); |
| 180 | return -1; |
| 181 | } |
| 182 | |
| 183 | if(asn_INTEGER2long(st, &value)) { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 184 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 185 | "%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 { |
vlm | d4ae41c | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 194 | _ASN_CTFAIL(app_key, td, sptr, |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 195 | "%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 | */ |
| 205 | static void |
| 206 | ThreePlus_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; |
vlm | b1b193e | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 214 | td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder; |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 215 | 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 | |
| 222 | void |
| 223 | ThreePlus_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 | |
| 229 | int |
| 230 | ThreePlus_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 | |
| 236 | asn_dec_rval_t |
| 237 | ThreePlus_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 | |
| 243 | asn_enc_rval_t |
| 244 | ThreePlus_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 | |
| 251 | asn_dec_rval_t |
| 252 | ThreePlus_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 | |
| 258 | asn_enc_rval_t |
| 259 | ThreePlus_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 | |
| 269 | static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { |
| 270 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 271 | }; |
| 272 | asn_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, |
vlm | b1b193e | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 282 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
vlm | 7c8aa5e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 283 | 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 | |