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, |
| 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 | */ |
| 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; |
| 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 | |
| 74 | void |
| 75 | MinMax_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 | |
| 81 | int |
| 82 | MinMax_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 | |
| 88 | asn_dec_rval_t |
| 89 | MinMax_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 | |
| 95 | asn_enc_rval_t |
| 96 | MinMax_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 | |
| 103 | asn_dec_rval_t |
| 104 | MinMax_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 | |
| 110 | asn_enc_rval_t |
| 111 | MinMax_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 | |
| 121 | static ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { |
| 122 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 123 | }; |
| 124 | asn_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 | |
| 154 | typedef MinMax_16P0_t ThreePlus_t; |
| 155 | |
| 156 | /*** <<< FUNC-DECLS [ThreePlus] >>> ***/ |
| 157 | |
| 158 | extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; |
| 159 | asn_struct_free_f ThreePlus_free; |
| 160 | asn_struct_print_f ThreePlus_print; |
| 161 | asn_constr_check_f ThreePlus_constraint; |
| 162 | ber_type_decoder_f ThreePlus_decode_ber; |
| 163 | der_type_encoder_f ThreePlus_encode_der; |
| 164 | xer_type_decoder_f ThreePlus_decode_xer; |
| 165 | xer_type_encoder_f ThreePlus_encode_xer; |
| 166 | |
| 167 | /*** <<< CODE [ThreePlus] >>> ***/ |
| 168 | |
| 169 | int |
| 170 | ThreePlus_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 | */ |
| 204 | static void |
| 205 | ThreePlus_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 | |
| 220 | void |
| 221 | ThreePlus_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 | |
| 227 | int |
| 228 | ThreePlus_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 | |
| 234 | asn_dec_rval_t |
| 235 | ThreePlus_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 | |
| 241 | asn_enc_rval_t |
| 242 | ThreePlus_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 | |
| 249 | asn_dec_rval_t |
| 250 | ThreePlus_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 | |
| 256 | asn_enc_rval_t |
| 257 | ThreePlus_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 | |
| 267 | static ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { |
| 268 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 269 | }; |
| 270 | asn_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 | |