Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
| 8 | typedef INTEGER_t Int1_t; |
| 9 | |
| 10 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 11 | |
| 12 | extern asn_TYPE_descriptor_t asn_DEF_Int1; |
| 13 | asn_struct_free_f Int1_free; |
| 14 | asn_struct_print_f Int1_print; |
| 15 | asn_constr_check_f Int1_constraint; |
| 16 | ber_type_decoder_f Int1_decode_ber; |
| 17 | der_type_encoder_f Int1_encode_der; |
| 18 | xer_type_decoder_f Int1_decode_xer; |
| 19 | xer_type_encoder_f Int1_encode_xer; |
| 20 | per_type_decoder_f Int1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 21 | per_type_encoder_f Int1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 22 | |
| 23 | /*** <<< CODE [Int1] >>> ***/ |
| 24 | |
| 25 | int |
| 26 | Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 27 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 28 | /* Replace with underlying type checker */ |
| 29 | td->check_constraints = asn_DEF_INTEGER.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 30 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | /* |
| 34 | * This type is implemented using INTEGER, |
| 35 | * so here we adjust the DEF accordingly. |
| 36 | */ |
| 37 | static void |
| 38 | Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 39 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 40 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 41 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 42 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 43 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 44 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 45 | td->uper_decoder = asn_DEF_INTEGER.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 46 | td->uper_encoder = asn_DEF_INTEGER.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 47 | if(!td->per_constraints) |
| 48 | td->per_constraints = asn_DEF_INTEGER.per_constraints; |
| 49 | td->elements = asn_DEF_INTEGER.elements; |
| 50 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 51 | td->specifics = asn_DEF_INTEGER.specifics; |
| 52 | } |
| 53 | |
| 54 | void |
| 55 | Int1_free(asn_TYPE_descriptor_t *td, |
| 56 | void *struct_ptr, int contents_only) { |
| 57 | Int1_1_inherit_TYPE_descriptor(td); |
| 58 | td->free_struct(td, struct_ptr, contents_only); |
| 59 | } |
| 60 | |
| 61 | int |
| 62 | Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 63 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 64 | Int1_1_inherit_TYPE_descriptor(td); |
| 65 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 66 | } |
| 67 | |
| 68 | asn_dec_rval_t |
| 69 | Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 70 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 71 | Int1_1_inherit_TYPE_descriptor(td); |
| 72 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 73 | } |
| 74 | |
| 75 | asn_enc_rval_t |
| 76 | Int1_encode_der(asn_TYPE_descriptor_t *td, |
| 77 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 78 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 79 | Int1_1_inherit_TYPE_descriptor(td); |
| 80 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 81 | } |
| 82 | |
| 83 | asn_dec_rval_t |
| 84 | Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 85 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 86 | Int1_1_inherit_TYPE_descriptor(td); |
| 87 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 88 | } |
| 89 | |
| 90 | asn_enc_rval_t |
| 91 | Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 92 | int ilevel, enum xer_encoder_flags_e flags, |
| 93 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 94 | Int1_1_inherit_TYPE_descriptor(td); |
| 95 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 96 | } |
| 97 | |
| 98 | asn_dec_rval_t |
| 99 | Int1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 100 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 101 | Int1_1_inherit_TYPE_descriptor(td); |
| 102 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 103 | } |
| 104 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 105 | asn_enc_rval_t |
| 106 | Int1_encode_uper(asn_TYPE_descriptor_t *td, |
| 107 | asn_per_constraints_t *constraints, |
| 108 | void *structure, asn_per_outp_t *per_out) { |
| 109 | Int1_1_inherit_TYPE_descriptor(td); |
| 110 | return td->uper_encoder(td, constraints, structure, per_out); |
| 111 | } |
| 112 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 113 | |
| 114 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 115 | |
| 116 | static ber_tlv_tag_t asn_DEF_Int1_tags_1[] = { |
| 117 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 118 | }; |
| 119 | asn_TYPE_descriptor_t asn_DEF_Int1 = { |
| 120 | "Int1", |
| 121 | "Int1", |
| 122 | Int1_free, |
| 123 | Int1_print, |
| 124 | Int1_constraint, |
| 125 | Int1_decode_ber, |
| 126 | Int1_encode_der, |
| 127 | Int1_decode_xer, |
| 128 | Int1_encode_xer, |
| 129 | Int1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 130 | Int1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 131 | 0, /* Use generic outmost tag fetcher */ |
| 132 | asn_DEF_Int1_tags_1, |
| 133 | sizeof(asn_DEF_Int1_tags_1) |
| 134 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 135 | asn_DEF_Int1_tags_1, /* Same as above */ |
| 136 | sizeof(asn_DEF_Int1_tags_1) |
| 137 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 138 | 0, /* No PER visible constraints */ |
| 139 | 0, 0, /* No members */ |
| 140 | 0 /* No specifics */ |
| 141 | }; |
| 142 | |
| 143 | |
| 144 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 145 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 146 | #include "Int1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 147 | |
| 148 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 149 | |
| 150 | typedef Int1_t Int2_t; |
| 151 | |
| 152 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 153 | |
| 154 | extern asn_TYPE_descriptor_t asn_DEF_Int2; |
| 155 | asn_struct_free_f Int2_free; |
| 156 | asn_struct_print_f Int2_print; |
| 157 | asn_constr_check_f Int2_constraint; |
| 158 | ber_type_decoder_f Int2_decode_ber; |
| 159 | der_type_encoder_f Int2_encode_der; |
| 160 | xer_type_decoder_f Int2_decode_xer; |
| 161 | xer_type_encoder_f Int2_encode_xer; |
| 162 | per_type_decoder_f Int2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 163 | per_type_encoder_f Int2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 164 | |
| 165 | /*** <<< CODE [Int2] >>> ***/ |
| 166 | |
| 167 | int |
| 168 | Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 169 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 170 | const Int1_t *st = (const Int1_t *)sptr; |
| 171 | long value; |
| 172 | |
| 173 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 174 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 175 | "%s: value not given (%s:%d)", |
| 176 | td->name, __FILE__, __LINE__); |
| 177 | return -1; |
| 178 | } |
| 179 | |
| 180 | /* Check if the sign bit is present */ |
| 181 | value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; |
| 182 | |
| 183 | if((value >= 0)) { |
| 184 | /* Constraint check succeeded */ |
| 185 | return 0; |
| 186 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 187 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 188 | "%s: constraint failed (%s:%d)", |
| 189 | td->name, __FILE__, __LINE__); |
| 190 | return -1; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | /* |
| 195 | * This type is implemented using Int1, |
| 196 | * so here we adjust the DEF accordingly. |
| 197 | */ |
| 198 | static void |
| 199 | Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 200 | td->free_struct = asn_DEF_Int1.free_struct; |
| 201 | td->print_struct = asn_DEF_Int1.print_struct; |
| 202 | td->ber_decoder = asn_DEF_Int1.ber_decoder; |
| 203 | td->der_encoder = asn_DEF_Int1.der_encoder; |
| 204 | td->xer_decoder = asn_DEF_Int1.xer_decoder; |
| 205 | td->xer_encoder = asn_DEF_Int1.xer_encoder; |
| 206 | td->uper_decoder = asn_DEF_Int1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 207 | td->uper_encoder = asn_DEF_Int1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 208 | if(!td->per_constraints) |
| 209 | td->per_constraints = asn_DEF_Int1.per_constraints; |
| 210 | td->elements = asn_DEF_Int1.elements; |
| 211 | td->elements_count = asn_DEF_Int1.elements_count; |
| 212 | td->specifics = asn_DEF_Int1.specifics; |
| 213 | } |
| 214 | |
| 215 | void |
| 216 | Int2_free(asn_TYPE_descriptor_t *td, |
| 217 | void *struct_ptr, int contents_only) { |
| 218 | Int2_1_inherit_TYPE_descriptor(td); |
| 219 | td->free_struct(td, struct_ptr, contents_only); |
| 220 | } |
| 221 | |
| 222 | int |
| 223 | Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 224 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 225 | Int2_1_inherit_TYPE_descriptor(td); |
| 226 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 227 | } |
| 228 | |
| 229 | asn_dec_rval_t |
| 230 | Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 231 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 232 | Int2_1_inherit_TYPE_descriptor(td); |
| 233 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 234 | } |
| 235 | |
| 236 | asn_enc_rval_t |
| 237 | Int2_encode_der(asn_TYPE_descriptor_t *td, |
| 238 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 239 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 240 | Int2_1_inherit_TYPE_descriptor(td); |
| 241 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 242 | } |
| 243 | |
| 244 | asn_dec_rval_t |
| 245 | Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 246 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 247 | Int2_1_inherit_TYPE_descriptor(td); |
| 248 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 249 | } |
| 250 | |
| 251 | asn_enc_rval_t |
| 252 | Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 253 | int ilevel, enum xer_encoder_flags_e flags, |
| 254 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 255 | Int2_1_inherit_TYPE_descriptor(td); |
| 256 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 257 | } |
| 258 | |
| 259 | asn_dec_rval_t |
| 260 | Int2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 261 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 262 | Int2_1_inherit_TYPE_descriptor(td); |
| 263 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 264 | } |
| 265 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 266 | asn_enc_rval_t |
| 267 | Int2_encode_uper(asn_TYPE_descriptor_t *td, |
| 268 | asn_per_constraints_t *constraints, |
| 269 | void *structure, asn_per_outp_t *per_out) { |
| 270 | Int2_1_inherit_TYPE_descriptor(td); |
| 271 | return td->uper_encoder(td, constraints, structure, per_out); |
| 272 | } |
| 273 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 274 | |
| 275 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 276 | |
| 277 | static ber_tlv_tag_t asn_DEF_Int2_tags_1[] = { |
| 278 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 279 | }; |
| 280 | static asn_per_constraints_t asn_PER_Int2_constr_1 = { |
| 281 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (0..MAX) */, |
| 282 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 283 | }; |
| 284 | asn_TYPE_descriptor_t asn_DEF_Int2 = { |
| 285 | "Int2", |
| 286 | "Int2", |
| 287 | Int2_free, |
| 288 | Int2_print, |
| 289 | Int2_constraint, |
| 290 | Int2_decode_ber, |
| 291 | Int2_encode_der, |
| 292 | Int2_decode_xer, |
| 293 | Int2_encode_xer, |
| 294 | Int2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 295 | Int2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 296 | 0, /* Use generic outmost tag fetcher */ |
| 297 | asn_DEF_Int2_tags_1, |
| 298 | sizeof(asn_DEF_Int2_tags_1) |
| 299 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
| 300 | asn_DEF_Int2_tags_1, /* Same as above */ |
| 301 | sizeof(asn_DEF_Int2_tags_1) |
| 302 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
| 303 | &asn_PER_Int2_constr_1, |
| 304 | 0, 0, /* No members */ |
| 305 | 0 /* No specifics */ |
| 306 | }; |
| 307 | |
| 308 | |
| 309 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 310 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 311 | #include "Int2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 312 | |
| 313 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 314 | |
| 315 | typedef Int2_t Int3_t; |
| 316 | |
| 317 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 318 | |
| 319 | extern asn_TYPE_descriptor_t asn_DEF_Int3; |
| 320 | asn_struct_free_f Int3_free; |
| 321 | asn_struct_print_f Int3_print; |
| 322 | asn_constr_check_f Int3_constraint; |
| 323 | ber_type_decoder_f Int3_decode_ber; |
| 324 | der_type_encoder_f Int3_encode_der; |
| 325 | xer_type_decoder_f Int3_decode_xer; |
| 326 | xer_type_encoder_f Int3_encode_xer; |
| 327 | per_type_decoder_f Int3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 328 | per_type_encoder_f Int3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 329 | |
| 330 | /*** <<< CODE [Int3] >>> ***/ |
| 331 | |
| 332 | int |
| 333 | Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 334 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 335 | const Int2_t *st = (const Int2_t *)sptr; |
| 336 | long value; |
| 337 | |
| 338 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 339 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 340 | "%s: value not given (%s:%d)", |
| 341 | td->name, __FILE__, __LINE__); |
| 342 | return -1; |
| 343 | } |
| 344 | |
| 345 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 346 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 347 | "%s: value too large (%s:%d)", |
| 348 | td->name, __FILE__, __LINE__); |
| 349 | return -1; |
| 350 | } |
| 351 | |
| 352 | if((value >= 0 && value <= 10)) { |
| 353 | /* Constraint check succeeded */ |
| 354 | return 0; |
| 355 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 356 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 357 | "%s: constraint failed (%s:%d)", |
| 358 | td->name, __FILE__, __LINE__); |
| 359 | return -1; |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | /* |
| 364 | * This type is implemented using Int2, |
| 365 | * so here we adjust the DEF accordingly. |
| 366 | */ |
| 367 | static void |
| 368 | Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 369 | td->free_struct = asn_DEF_Int2.free_struct; |
| 370 | td->print_struct = asn_DEF_Int2.print_struct; |
| 371 | td->ber_decoder = asn_DEF_Int2.ber_decoder; |
| 372 | td->der_encoder = asn_DEF_Int2.der_encoder; |
| 373 | td->xer_decoder = asn_DEF_Int2.xer_decoder; |
| 374 | td->xer_encoder = asn_DEF_Int2.xer_encoder; |
| 375 | td->uper_decoder = asn_DEF_Int2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 376 | td->uper_encoder = asn_DEF_Int2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 377 | if(!td->per_constraints) |
| 378 | td->per_constraints = asn_DEF_Int2.per_constraints; |
| 379 | td->elements = asn_DEF_Int2.elements; |
| 380 | td->elements_count = asn_DEF_Int2.elements_count; |
| 381 | td->specifics = asn_DEF_Int2.specifics; |
| 382 | } |
| 383 | |
| 384 | void |
| 385 | Int3_free(asn_TYPE_descriptor_t *td, |
| 386 | void *struct_ptr, int contents_only) { |
| 387 | Int3_1_inherit_TYPE_descriptor(td); |
| 388 | td->free_struct(td, struct_ptr, contents_only); |
| 389 | } |
| 390 | |
| 391 | int |
| 392 | Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 393 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 394 | Int3_1_inherit_TYPE_descriptor(td); |
| 395 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 396 | } |
| 397 | |
| 398 | asn_dec_rval_t |
| 399 | Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 400 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 401 | Int3_1_inherit_TYPE_descriptor(td); |
| 402 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 403 | } |
| 404 | |
| 405 | asn_enc_rval_t |
| 406 | Int3_encode_der(asn_TYPE_descriptor_t *td, |
| 407 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 408 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 409 | Int3_1_inherit_TYPE_descriptor(td); |
| 410 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 411 | } |
| 412 | |
| 413 | asn_dec_rval_t |
| 414 | Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 415 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 416 | Int3_1_inherit_TYPE_descriptor(td); |
| 417 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 418 | } |
| 419 | |
| 420 | asn_enc_rval_t |
| 421 | Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 422 | int ilevel, enum xer_encoder_flags_e flags, |
| 423 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 424 | Int3_1_inherit_TYPE_descriptor(td); |
| 425 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 426 | } |
| 427 | |
| 428 | asn_dec_rval_t |
| 429 | Int3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 430 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 431 | Int3_1_inherit_TYPE_descriptor(td); |
| 432 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 433 | } |
| 434 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 435 | asn_enc_rval_t |
| 436 | Int3_encode_uper(asn_TYPE_descriptor_t *td, |
| 437 | asn_per_constraints_t *constraints, |
| 438 | void *structure, asn_per_outp_t *per_out) { |
| 439 | Int3_1_inherit_TYPE_descriptor(td); |
| 440 | return td->uper_encoder(td, constraints, structure, per_out); |
| 441 | } |
| 442 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 443 | |
| 444 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 445 | |
| 446 | static ber_tlv_tag_t asn_DEF_Int3_tags_1[] = { |
| 447 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 448 | }; |
| 449 | static asn_per_constraints_t asn_PER_Int3_constr_1 = { |
| 450 | { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, |
| 451 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 452 | }; |
| 453 | asn_TYPE_descriptor_t asn_DEF_Int3 = { |
| 454 | "Int3", |
| 455 | "Int3", |
| 456 | Int3_free, |
| 457 | Int3_print, |
| 458 | Int3_constraint, |
| 459 | Int3_decode_ber, |
| 460 | Int3_encode_der, |
| 461 | Int3_decode_xer, |
| 462 | Int3_encode_xer, |
| 463 | Int3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 464 | Int3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 465 | 0, /* Use generic outmost tag fetcher */ |
| 466 | asn_DEF_Int3_tags_1, |
| 467 | sizeof(asn_DEF_Int3_tags_1) |
| 468 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
| 469 | asn_DEF_Int3_tags_1, /* Same as above */ |
| 470 | sizeof(asn_DEF_Int3_tags_1) |
| 471 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
| 472 | &asn_PER_Int3_constr_1, |
| 473 | 0, 0, /* No members */ |
| 474 | 0 /* No specifics */ |
| 475 | }; |
| 476 | |
| 477 | |
| 478 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 479 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 480 | #include "Int3.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 481 | |
| 482 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 483 | |
| 484 | typedef Int3_t Int4_t; |
| 485 | |
| 486 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 487 | |
| 488 | extern asn_TYPE_descriptor_t asn_DEF_Int4; |
| 489 | asn_struct_free_f Int4_free; |
| 490 | asn_struct_print_f Int4_print; |
| 491 | asn_constr_check_f Int4_constraint; |
| 492 | ber_type_decoder_f Int4_decode_ber; |
| 493 | der_type_encoder_f Int4_encode_der; |
| 494 | xer_type_decoder_f Int4_decode_xer; |
| 495 | xer_type_encoder_f Int4_encode_xer; |
| 496 | per_type_decoder_f Int4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 497 | per_type_encoder_f Int4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 498 | |
| 499 | /*** <<< CODE [Int4] >>> ***/ |
| 500 | |
| 501 | int |
| 502 | Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 503 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 504 | const Int3_t *st = (const Int3_t *)sptr; |
| 505 | long value; |
| 506 | |
| 507 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 508 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 509 | "%s: value not given (%s:%d)", |
| 510 | td->name, __FILE__, __LINE__); |
| 511 | return -1; |
| 512 | } |
| 513 | |
| 514 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 515 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 516 | "%s: value too large (%s:%d)", |
| 517 | td->name, __FILE__, __LINE__); |
| 518 | return -1; |
| 519 | } |
| 520 | |
| 521 | if((value >= 1 && value <= 10)) { |
| 522 | /* Constraint check succeeded */ |
| 523 | return 0; |
| 524 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 525 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 526 | "%s: constraint failed (%s:%d)", |
| 527 | td->name, __FILE__, __LINE__); |
| 528 | return -1; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | /* |
| 533 | * This type is implemented using Int3, |
| 534 | * so here we adjust the DEF accordingly. |
| 535 | */ |
| 536 | static void |
| 537 | Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 538 | td->free_struct = asn_DEF_Int3.free_struct; |
| 539 | td->print_struct = asn_DEF_Int3.print_struct; |
| 540 | td->ber_decoder = asn_DEF_Int3.ber_decoder; |
| 541 | td->der_encoder = asn_DEF_Int3.der_encoder; |
| 542 | td->xer_decoder = asn_DEF_Int3.xer_decoder; |
| 543 | td->xer_encoder = asn_DEF_Int3.xer_encoder; |
| 544 | td->uper_decoder = asn_DEF_Int3.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 545 | td->uper_encoder = asn_DEF_Int3.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 546 | if(!td->per_constraints) |
| 547 | td->per_constraints = asn_DEF_Int3.per_constraints; |
| 548 | td->elements = asn_DEF_Int3.elements; |
| 549 | td->elements_count = asn_DEF_Int3.elements_count; |
| 550 | td->specifics = asn_DEF_Int3.specifics; |
| 551 | } |
| 552 | |
| 553 | void |
| 554 | Int4_free(asn_TYPE_descriptor_t *td, |
| 555 | void *struct_ptr, int contents_only) { |
| 556 | Int4_1_inherit_TYPE_descriptor(td); |
| 557 | td->free_struct(td, struct_ptr, contents_only); |
| 558 | } |
| 559 | |
| 560 | int |
| 561 | Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 562 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 563 | Int4_1_inherit_TYPE_descriptor(td); |
| 564 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 565 | } |
| 566 | |
| 567 | asn_dec_rval_t |
| 568 | Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 569 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 570 | Int4_1_inherit_TYPE_descriptor(td); |
| 571 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 572 | } |
| 573 | |
| 574 | asn_enc_rval_t |
| 575 | Int4_encode_der(asn_TYPE_descriptor_t *td, |
| 576 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 577 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 578 | Int4_1_inherit_TYPE_descriptor(td); |
| 579 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 580 | } |
| 581 | |
| 582 | asn_dec_rval_t |
| 583 | Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 584 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 585 | Int4_1_inherit_TYPE_descriptor(td); |
| 586 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 587 | } |
| 588 | |
| 589 | asn_enc_rval_t |
| 590 | Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 591 | int ilevel, enum xer_encoder_flags_e flags, |
| 592 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 593 | Int4_1_inherit_TYPE_descriptor(td); |
| 594 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 595 | } |
| 596 | |
| 597 | asn_dec_rval_t |
| 598 | Int4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 599 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 600 | Int4_1_inherit_TYPE_descriptor(td); |
| 601 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 602 | } |
| 603 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 604 | asn_enc_rval_t |
| 605 | Int4_encode_uper(asn_TYPE_descriptor_t *td, |
| 606 | asn_per_constraints_t *constraints, |
| 607 | void *structure, asn_per_outp_t *per_out) { |
| 608 | Int4_1_inherit_TYPE_descriptor(td); |
| 609 | return td->uper_encoder(td, constraints, structure, per_out); |
| 610 | } |
| 611 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 612 | |
| 613 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 614 | |
| 615 | static ber_tlv_tag_t asn_DEF_Int4_tags_1[] = { |
| 616 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 617 | }; |
| 618 | static asn_per_constraints_t asn_PER_Int4_constr_1 = { |
| 619 | { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1, 10 } /* (1..10,...) */, |
| 620 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 621 | }; |
| 622 | asn_TYPE_descriptor_t asn_DEF_Int4 = { |
| 623 | "Int4", |
| 624 | "Int4", |
| 625 | Int4_free, |
| 626 | Int4_print, |
| 627 | Int4_constraint, |
| 628 | Int4_decode_ber, |
| 629 | Int4_encode_der, |
| 630 | Int4_decode_xer, |
| 631 | Int4_encode_xer, |
| 632 | Int4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 633 | Int4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 634 | 0, /* Use generic outmost tag fetcher */ |
| 635 | asn_DEF_Int4_tags_1, |
| 636 | sizeof(asn_DEF_Int4_tags_1) |
| 637 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
| 638 | asn_DEF_Int4_tags_1, /* Same as above */ |
| 639 | sizeof(asn_DEF_Int4_tags_1) |
| 640 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
| 641 | &asn_PER_Int4_constr_1, |
| 642 | 0, 0, /* No members */ |
| 643 | 0 /* No specifics */ |
| 644 | }; |
| 645 | |
| 646 | |
| 647 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 648 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 649 | #include "Int4.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 650 | |
| 651 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 652 | |
| 653 | typedef Int4_t Int5_t; |
| 654 | |
| 655 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 656 | |
| 657 | extern asn_TYPE_descriptor_t asn_DEF_Int5; |
| 658 | asn_struct_free_f Int5_free; |
| 659 | asn_struct_print_f Int5_print; |
| 660 | asn_constr_check_f Int5_constraint; |
| 661 | ber_type_decoder_f Int5_decode_ber; |
| 662 | der_type_encoder_f Int5_encode_der; |
| 663 | xer_type_decoder_f Int5_decode_xer; |
| 664 | xer_type_encoder_f Int5_encode_xer; |
| 665 | per_type_decoder_f Int5_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 666 | per_type_encoder_f Int5_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 667 | |
| 668 | /*** <<< CODE [Int5] >>> ***/ |
| 669 | |
| 670 | int |
| 671 | Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 672 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 673 | const Int4_t *st = (const Int4_t *)sptr; |
| 674 | long value; |
| 675 | |
| 676 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 677 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 678 | "%s: value not given (%s:%d)", |
| 679 | td->name, __FILE__, __LINE__); |
| 680 | return -1; |
| 681 | } |
| 682 | |
| 683 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 684 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 685 | "%s: value too large (%s:%d)", |
| 686 | td->name, __FILE__, __LINE__); |
| 687 | return -1; |
| 688 | } |
| 689 | |
| 690 | if((value == 5)) { |
| 691 | /* Constraint check succeeded */ |
| 692 | return 0; |
| 693 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 694 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 695 | "%s: constraint failed (%s:%d)", |
| 696 | td->name, __FILE__, __LINE__); |
| 697 | return -1; |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | /* |
| 702 | * This type is implemented using Int4, |
| 703 | * so here we adjust the DEF accordingly. |
| 704 | */ |
| 705 | static void |
| 706 | Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 707 | td->free_struct = asn_DEF_Int4.free_struct; |
| 708 | td->print_struct = asn_DEF_Int4.print_struct; |
| 709 | td->ber_decoder = asn_DEF_Int4.ber_decoder; |
| 710 | td->der_encoder = asn_DEF_Int4.der_encoder; |
| 711 | td->xer_decoder = asn_DEF_Int4.xer_decoder; |
| 712 | td->xer_encoder = asn_DEF_Int4.xer_encoder; |
| 713 | td->uper_decoder = asn_DEF_Int4.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 714 | td->uper_encoder = asn_DEF_Int4.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 715 | if(!td->per_constraints) |
| 716 | td->per_constraints = asn_DEF_Int4.per_constraints; |
| 717 | td->elements = asn_DEF_Int4.elements; |
| 718 | td->elements_count = asn_DEF_Int4.elements_count; |
| 719 | td->specifics = asn_DEF_Int4.specifics; |
| 720 | } |
| 721 | |
| 722 | void |
| 723 | Int5_free(asn_TYPE_descriptor_t *td, |
| 724 | void *struct_ptr, int contents_only) { |
| 725 | Int5_1_inherit_TYPE_descriptor(td); |
| 726 | td->free_struct(td, struct_ptr, contents_only); |
| 727 | } |
| 728 | |
| 729 | int |
| 730 | Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 731 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 732 | Int5_1_inherit_TYPE_descriptor(td); |
| 733 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 734 | } |
| 735 | |
| 736 | asn_dec_rval_t |
| 737 | Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 738 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 739 | Int5_1_inherit_TYPE_descriptor(td); |
| 740 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 741 | } |
| 742 | |
| 743 | asn_enc_rval_t |
| 744 | Int5_encode_der(asn_TYPE_descriptor_t *td, |
| 745 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 746 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 747 | Int5_1_inherit_TYPE_descriptor(td); |
| 748 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 749 | } |
| 750 | |
| 751 | asn_dec_rval_t |
| 752 | Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 753 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 754 | Int5_1_inherit_TYPE_descriptor(td); |
| 755 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 756 | } |
| 757 | |
| 758 | asn_enc_rval_t |
| 759 | Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 760 | int ilevel, enum xer_encoder_flags_e flags, |
| 761 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 762 | Int5_1_inherit_TYPE_descriptor(td); |
| 763 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 764 | } |
| 765 | |
| 766 | asn_dec_rval_t |
| 767 | Int5_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 768 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 769 | Int5_1_inherit_TYPE_descriptor(td); |
| 770 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 771 | } |
| 772 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 773 | asn_enc_rval_t |
| 774 | Int5_encode_uper(asn_TYPE_descriptor_t *td, |
| 775 | asn_per_constraints_t *constraints, |
| 776 | void *structure, asn_per_outp_t *per_out) { |
| 777 | Int5_1_inherit_TYPE_descriptor(td); |
| 778 | return td->uper_encoder(td, constraints, structure, per_out); |
| 779 | } |
| 780 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 781 | |
| 782 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 783 | |
| 784 | static ber_tlv_tag_t asn_DEF_Int5_tags_1[] = { |
| 785 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 786 | }; |
| 787 | static asn_per_constraints_t asn_PER_Int5_constr_1 = { |
| 788 | { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, |
| 789 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 790 | }; |
| 791 | asn_TYPE_descriptor_t asn_DEF_Int5 = { |
| 792 | "Int5", |
| 793 | "Int5", |
| 794 | Int5_free, |
| 795 | Int5_print, |
| 796 | Int5_constraint, |
| 797 | Int5_decode_ber, |
| 798 | Int5_encode_der, |
| 799 | Int5_decode_xer, |
| 800 | Int5_encode_xer, |
| 801 | Int5_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 802 | Int5_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 803 | 0, /* Use generic outmost tag fetcher */ |
| 804 | asn_DEF_Int5_tags_1, |
| 805 | sizeof(asn_DEF_Int5_tags_1) |
| 806 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
| 807 | asn_DEF_Int5_tags_1, /* Same as above */ |
| 808 | sizeof(asn_DEF_Int5_tags_1) |
| 809 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
| 810 | &asn_PER_Int5_constr_1, |
| 811 | 0, 0, /* No members */ |
| 812 | 0 /* No specifics */ |
| 813 | }; |
| 814 | |
| 815 | |
| 816 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 817 | |
| 818 | #include <INTEGER.h> |
| 819 | |
| 820 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 821 | |
| 822 | typedef INTEGER_t ExtensibleExtensions_t; |
| 823 | |
| 824 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 825 | |
| 826 | extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; |
| 827 | asn_struct_free_f ExtensibleExtensions_free; |
| 828 | asn_struct_print_f ExtensibleExtensions_print; |
| 829 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 830 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 831 | der_type_encoder_f ExtensibleExtensions_encode_der; |
| 832 | xer_type_decoder_f ExtensibleExtensions_decode_xer; |
| 833 | xer_type_encoder_f ExtensibleExtensions_encode_xer; |
| 834 | per_type_decoder_f ExtensibleExtensions_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 835 | per_type_encoder_f ExtensibleExtensions_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 836 | |
| 837 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 838 | |
| 839 | int |
| 840 | ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 841 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 842 | const INTEGER_t *st = (const INTEGER_t *)sptr; |
| 843 | long value; |
| 844 | |
| 845 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 846 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 847 | "%s: value not given (%s:%d)", |
| 848 | td->name, __FILE__, __LINE__); |
| 849 | return -1; |
| 850 | } |
| 851 | |
| 852 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 853 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 854 | "%s: value too large (%s:%d)", |
| 855 | td->name, __FILE__, __LINE__); |
| 856 | return -1; |
| 857 | } |
| 858 | |
| 859 | if((value >= 1 && value <= 256)) { |
| 860 | /* Constraint check succeeded */ |
| 861 | return 0; |
| 862 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 863 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 864 | "%s: constraint failed (%s:%d)", |
| 865 | td->name, __FILE__, __LINE__); |
| 866 | return -1; |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | /* |
| 871 | * This type is implemented using INTEGER, |
| 872 | * so here we adjust the DEF accordingly. |
| 873 | */ |
| 874 | static void |
| 875 | ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 876 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 877 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 878 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 879 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 880 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 881 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 882 | td->uper_decoder = asn_DEF_INTEGER.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 883 | td->uper_encoder = asn_DEF_INTEGER.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 884 | if(!td->per_constraints) |
| 885 | td->per_constraints = asn_DEF_INTEGER.per_constraints; |
| 886 | td->elements = asn_DEF_INTEGER.elements; |
| 887 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 888 | td->specifics = asn_DEF_INTEGER.specifics; |
| 889 | } |
| 890 | |
| 891 | void |
| 892 | ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, |
| 893 | void *struct_ptr, int contents_only) { |
| 894 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 895 | td->free_struct(td, struct_ptr, contents_only); |
| 896 | } |
| 897 | |
| 898 | int |
| 899 | ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 900 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 901 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 902 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 903 | } |
| 904 | |
| 905 | asn_dec_rval_t |
| 906 | ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 907 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 908 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 909 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 910 | } |
| 911 | |
| 912 | asn_enc_rval_t |
| 913 | ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, |
| 914 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 915 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 916 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 917 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 918 | } |
| 919 | |
| 920 | asn_dec_rval_t |
| 921 | ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 922 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 923 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 924 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 925 | } |
| 926 | |
| 927 | asn_enc_rval_t |
| 928 | ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 929 | int ilevel, enum xer_encoder_flags_e flags, |
| 930 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 931 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 932 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 933 | } |
| 934 | |
| 935 | asn_dec_rval_t |
| 936 | ExtensibleExtensions_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 937 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 938 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 939 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 940 | } |
| 941 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 942 | asn_enc_rval_t |
| 943 | ExtensibleExtensions_encode_uper(asn_TYPE_descriptor_t *td, |
| 944 | asn_per_constraints_t *constraints, |
| 945 | void *structure, asn_per_outp_t *per_out) { |
| 946 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 947 | return td->uper_encoder(td, constraints, structure, per_out); |
| 948 | } |
| 949 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 950 | |
| 951 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 952 | |
| 953 | static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = { |
| 954 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 955 | }; |
| 956 | static asn_per_constraints_t asn_PER_ExtensibleExtensions_constr_1 = { |
| 957 | { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */, |
| 958 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 959 | }; |
| 960 | asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { |
| 961 | "ExtensibleExtensions", |
| 962 | "ExtensibleExtensions", |
| 963 | ExtensibleExtensions_free, |
| 964 | ExtensibleExtensions_print, |
| 965 | ExtensibleExtensions_constraint, |
| 966 | ExtensibleExtensions_decode_ber, |
| 967 | ExtensibleExtensions_encode_der, |
| 968 | ExtensibleExtensions_decode_xer, |
| 969 | ExtensibleExtensions_encode_xer, |
| 970 | ExtensibleExtensions_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 971 | ExtensibleExtensions_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 972 | 0, /* Use generic outmost tag fetcher */ |
| 973 | asn_DEF_ExtensibleExtensions_tags_1, |
| 974 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 975 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
| 976 | asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */ |
| 977 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 978 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
| 979 | &asn_PER_ExtensibleExtensions_constr_1, |
| 980 | 0, 0, /* No members */ |
| 981 | 0 /* No specifics */ |
| 982 | }; |
| 983 | |
| 984 | |
| 985 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 986 | |
| 987 | #include <IA5String.h> |
| 988 | |
| 989 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 990 | |
| 991 | typedef IA5String_t Str1_t; |
| 992 | |
| 993 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 994 | |
| 995 | extern asn_TYPE_descriptor_t asn_DEF_Str1; |
| 996 | asn_struct_free_f Str1_free; |
| 997 | asn_struct_print_f Str1_print; |
| 998 | asn_constr_check_f Str1_constraint; |
| 999 | ber_type_decoder_f Str1_decode_ber; |
| 1000 | der_type_encoder_f Str1_encode_der; |
| 1001 | xer_type_decoder_f Str1_decode_xer; |
| 1002 | xer_type_encoder_f Str1_encode_xer; |
| 1003 | per_type_decoder_f Str1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1004 | per_type_encoder_f Str1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1005 | |
| 1006 | /*** <<< CODE [Str1] >>> ***/ |
| 1007 | |
| 1008 | int |
| 1009 | Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1010 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1011 | /* Replace with underlying type checker */ |
| 1012 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1013 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1014 | } |
| 1015 | |
| 1016 | /* |
| 1017 | * This type is implemented using IA5String, |
| 1018 | * so here we adjust the DEF accordingly. |
| 1019 | */ |
| 1020 | static void |
| 1021 | Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1022 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1023 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1024 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1025 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1026 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1027 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1028 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1029 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1030 | if(!td->per_constraints) |
| 1031 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1032 | td->elements = asn_DEF_IA5String.elements; |
| 1033 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1034 | td->specifics = asn_DEF_IA5String.specifics; |
| 1035 | } |
| 1036 | |
| 1037 | void |
| 1038 | Str1_free(asn_TYPE_descriptor_t *td, |
| 1039 | void *struct_ptr, int contents_only) { |
| 1040 | Str1_1_inherit_TYPE_descriptor(td); |
| 1041 | td->free_struct(td, struct_ptr, contents_only); |
| 1042 | } |
| 1043 | |
| 1044 | int |
| 1045 | Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1046 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1047 | Str1_1_inherit_TYPE_descriptor(td); |
| 1048 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1049 | } |
| 1050 | |
| 1051 | asn_dec_rval_t |
| 1052 | Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1053 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1054 | Str1_1_inherit_TYPE_descriptor(td); |
| 1055 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1056 | } |
| 1057 | |
| 1058 | asn_enc_rval_t |
| 1059 | Str1_encode_der(asn_TYPE_descriptor_t *td, |
| 1060 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1061 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1062 | Str1_1_inherit_TYPE_descriptor(td); |
| 1063 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1064 | } |
| 1065 | |
| 1066 | asn_dec_rval_t |
| 1067 | Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1068 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1069 | Str1_1_inherit_TYPE_descriptor(td); |
| 1070 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1071 | } |
| 1072 | |
| 1073 | asn_enc_rval_t |
| 1074 | Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1075 | int ilevel, enum xer_encoder_flags_e flags, |
| 1076 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1077 | Str1_1_inherit_TYPE_descriptor(td); |
| 1078 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1079 | } |
| 1080 | |
| 1081 | asn_dec_rval_t |
| 1082 | Str1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1083 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1084 | Str1_1_inherit_TYPE_descriptor(td); |
| 1085 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1086 | } |
| 1087 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1088 | asn_enc_rval_t |
| 1089 | Str1_encode_uper(asn_TYPE_descriptor_t *td, |
| 1090 | asn_per_constraints_t *constraints, |
| 1091 | void *structure, asn_per_outp_t *per_out) { |
| 1092 | Str1_1_inherit_TYPE_descriptor(td); |
| 1093 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1094 | } |
| 1095 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1096 | |
| 1097 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 1098 | |
| 1099 | static ber_tlv_tag_t asn_DEF_Str1_tags_1[] = { |
| 1100 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1101 | }; |
| 1102 | asn_TYPE_descriptor_t asn_DEF_Str1 = { |
| 1103 | "Str1", |
| 1104 | "Str1", |
| 1105 | Str1_free, |
| 1106 | Str1_print, |
| 1107 | Str1_constraint, |
| 1108 | Str1_decode_ber, |
| 1109 | Str1_encode_der, |
| 1110 | Str1_decode_xer, |
| 1111 | Str1_encode_xer, |
| 1112 | Str1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1113 | Str1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1114 | 0, /* Use generic outmost tag fetcher */ |
| 1115 | asn_DEF_Str1_tags_1, |
| 1116 | sizeof(asn_DEF_Str1_tags_1) |
| 1117 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 1118 | asn_DEF_Str1_tags_1, /* Same as above */ |
| 1119 | sizeof(asn_DEF_Str1_tags_1) |
| 1120 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 1121 | 0, /* No PER visible constraints */ |
| 1122 | 0, 0, /* No members */ |
| 1123 | 0 /* No specifics */ |
| 1124 | }; |
| 1125 | |
| 1126 | |
| 1127 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 1128 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 1129 | #include "Str1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1130 | |
| 1131 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 1132 | |
| 1133 | typedef Str1_t Str2_t; |
| 1134 | |
| 1135 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 1136 | |
| 1137 | extern asn_TYPE_descriptor_t asn_DEF_Str2; |
| 1138 | asn_struct_free_f Str2_free; |
| 1139 | asn_struct_print_f Str2_print; |
| 1140 | asn_constr_check_f Str2_constraint; |
| 1141 | ber_type_decoder_f Str2_decode_ber; |
| 1142 | der_type_encoder_f Str2_encode_der; |
| 1143 | xer_type_decoder_f Str2_decode_xer; |
| 1144 | xer_type_encoder_f Str2_encode_xer; |
| 1145 | per_type_decoder_f Str2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1146 | per_type_encoder_f Str2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1147 | |
| 1148 | /*** <<< CTABLES [Str2] >>> ***/ |
| 1149 | |
| 1150 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1151 | /* The underlying type is IA5String */ |
| 1152 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1153 | const uint8_t *ch = st->buf; |
| 1154 | const uint8_t *end = ch + st->size; |
| 1155 | |
| 1156 | for(; ch < end; ch++) { |
| 1157 | uint8_t cv = *ch; |
| 1158 | if(!(cv <= 127)) return -1; |
| 1159 | } |
| 1160 | return 0; |
| 1161 | } |
| 1162 | |
| 1163 | |
| 1164 | /*** <<< CODE [Str2] >>> ***/ |
| 1165 | |
| 1166 | int |
| 1167 | Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1168 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1169 | const Str1_t *st = (const Str1_t *)sptr; |
| 1170 | size_t size; |
| 1171 | |
| 1172 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1173 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1174 | "%s: value not given (%s:%d)", |
| 1175 | td->name, __FILE__, __LINE__); |
| 1176 | return -1; |
| 1177 | } |
| 1178 | |
| 1179 | size = st->size; |
| 1180 | |
| 1181 | if(((size <= 20) || (size >= 25 && size <= 30)) |
| 1182 | && !check_permitted_alphabet_1(st)) { |
| 1183 | /* Constraint check succeeded */ |
| 1184 | return 0; |
| 1185 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1186 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1187 | "%s: constraint failed (%s:%d)", |
| 1188 | td->name, __FILE__, __LINE__); |
| 1189 | return -1; |
| 1190 | } |
| 1191 | } |
| 1192 | |
| 1193 | /* |
| 1194 | * This type is implemented using Str1, |
| 1195 | * so here we adjust the DEF accordingly. |
| 1196 | */ |
| 1197 | static void |
| 1198 | Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1199 | td->free_struct = asn_DEF_Str1.free_struct; |
| 1200 | td->print_struct = asn_DEF_Str1.print_struct; |
| 1201 | td->ber_decoder = asn_DEF_Str1.ber_decoder; |
| 1202 | td->der_encoder = asn_DEF_Str1.der_encoder; |
| 1203 | td->xer_decoder = asn_DEF_Str1.xer_decoder; |
| 1204 | td->xer_encoder = asn_DEF_Str1.xer_encoder; |
| 1205 | td->uper_decoder = asn_DEF_Str1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1206 | td->uper_encoder = asn_DEF_Str1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1207 | if(!td->per_constraints) |
| 1208 | td->per_constraints = asn_DEF_Str1.per_constraints; |
| 1209 | td->elements = asn_DEF_Str1.elements; |
| 1210 | td->elements_count = asn_DEF_Str1.elements_count; |
| 1211 | td->specifics = asn_DEF_Str1.specifics; |
| 1212 | } |
| 1213 | |
| 1214 | void |
| 1215 | Str2_free(asn_TYPE_descriptor_t *td, |
| 1216 | void *struct_ptr, int contents_only) { |
| 1217 | Str2_1_inherit_TYPE_descriptor(td); |
| 1218 | td->free_struct(td, struct_ptr, contents_only); |
| 1219 | } |
| 1220 | |
| 1221 | int |
| 1222 | Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1223 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1224 | Str2_1_inherit_TYPE_descriptor(td); |
| 1225 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1226 | } |
| 1227 | |
| 1228 | asn_dec_rval_t |
| 1229 | Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1230 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1231 | Str2_1_inherit_TYPE_descriptor(td); |
| 1232 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1233 | } |
| 1234 | |
| 1235 | asn_enc_rval_t |
| 1236 | Str2_encode_der(asn_TYPE_descriptor_t *td, |
| 1237 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1238 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1239 | Str2_1_inherit_TYPE_descriptor(td); |
| 1240 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1241 | } |
| 1242 | |
| 1243 | asn_dec_rval_t |
| 1244 | Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1245 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1246 | Str2_1_inherit_TYPE_descriptor(td); |
| 1247 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1248 | } |
| 1249 | |
| 1250 | asn_enc_rval_t |
| 1251 | Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1252 | int ilevel, enum xer_encoder_flags_e flags, |
| 1253 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1254 | Str2_1_inherit_TYPE_descriptor(td); |
| 1255 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1256 | } |
| 1257 | |
| 1258 | asn_dec_rval_t |
| 1259 | Str2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1260 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1261 | Str2_1_inherit_TYPE_descriptor(td); |
| 1262 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1263 | } |
| 1264 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1265 | asn_enc_rval_t |
| 1266 | Str2_encode_uper(asn_TYPE_descriptor_t *td, |
| 1267 | asn_per_constraints_t *constraints, |
| 1268 | void *structure, asn_per_outp_t *per_out) { |
| 1269 | Str2_1_inherit_TYPE_descriptor(td); |
| 1270 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1271 | } |
| 1272 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1273 | |
| 1274 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 1275 | |
| 1276 | static ber_tlv_tag_t asn_DEF_Str2_tags_1[] = { |
| 1277 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1278 | }; |
| 1279 | static asn_per_constraints_t asn_PER_Str2_constr_1 = { |
| 1280 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 1281 | { APC_CONSTRAINED, 5, 5, 0, 30 } /* (SIZE(0..30)) */ |
| 1282 | }; |
| 1283 | asn_TYPE_descriptor_t asn_DEF_Str2 = { |
| 1284 | "Str2", |
| 1285 | "Str2", |
| 1286 | Str2_free, |
| 1287 | Str2_print, |
| 1288 | Str2_constraint, |
| 1289 | Str2_decode_ber, |
| 1290 | Str2_encode_der, |
| 1291 | Str2_decode_xer, |
| 1292 | Str2_encode_xer, |
| 1293 | Str2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1294 | Str2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1295 | 0, /* Use generic outmost tag fetcher */ |
| 1296 | asn_DEF_Str2_tags_1, |
| 1297 | sizeof(asn_DEF_Str2_tags_1) |
| 1298 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
| 1299 | asn_DEF_Str2_tags_1, /* Same as above */ |
| 1300 | sizeof(asn_DEF_Str2_tags_1) |
| 1301 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
| 1302 | &asn_PER_Str2_constr_1, |
| 1303 | 0, 0, /* No members */ |
| 1304 | 0 /* No specifics */ |
| 1305 | }; |
| 1306 | |
| 1307 | |
| 1308 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 1309 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 1310 | #include "Str2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1311 | |
| 1312 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 1313 | |
| 1314 | typedef Str2_t Str3_t; |
| 1315 | |
| 1316 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 1317 | |
| 1318 | extern asn_TYPE_descriptor_t asn_DEF_Str3; |
| 1319 | asn_struct_free_f Str3_free; |
| 1320 | asn_struct_print_f Str3_print; |
| 1321 | asn_constr_check_f Str3_constraint; |
| 1322 | ber_type_decoder_f Str3_decode_ber; |
| 1323 | der_type_encoder_f Str3_encode_der; |
| 1324 | xer_type_decoder_f Str3_decode_xer; |
| 1325 | xer_type_encoder_f Str3_encode_xer; |
| 1326 | per_type_decoder_f Str3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1327 | per_type_encoder_f Str3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1328 | |
| 1329 | /*** <<< CTABLES [Str3] >>> ***/ |
| 1330 | |
| 1331 | static int permitted_alphabet_table_1[256] = { |
| 1332 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1333 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1334 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1335 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1336 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 1337 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1338 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 1339 | }; |
| 1340 | |
| 1341 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1342 | int *table = permitted_alphabet_table_1; |
| 1343 | /* The underlying type is IA5String */ |
| 1344 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1345 | const uint8_t *ch = st->buf; |
| 1346 | const uint8_t *end = ch + st->size; |
| 1347 | |
| 1348 | for(; ch < end; ch++) { |
| 1349 | uint8_t cv = *ch; |
| 1350 | if(!table[cv]) return -1; |
| 1351 | } |
| 1352 | return 0; |
| 1353 | } |
| 1354 | |
| 1355 | |
| 1356 | /*** <<< CODE [Str3] >>> ***/ |
| 1357 | |
| 1358 | int |
| 1359 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1360 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1361 | const Str2_t *st = (const Str2_t *)sptr; |
| 1362 | size_t size; |
| 1363 | |
| 1364 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1365 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1366 | "%s: value not given (%s:%d)", |
| 1367 | td->name, __FILE__, __LINE__); |
| 1368 | return -1; |
| 1369 | } |
| 1370 | |
| 1371 | size = st->size; |
| 1372 | |
| 1373 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
| 1374 | && !check_permitted_alphabet_1(st)) { |
| 1375 | /* Constraint check succeeded */ |
| 1376 | return 0; |
| 1377 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1378 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1379 | "%s: constraint failed (%s:%d)", |
| 1380 | td->name, __FILE__, __LINE__); |
| 1381 | return -1; |
| 1382 | } |
| 1383 | } |
| 1384 | |
| 1385 | /* |
| 1386 | * This type is implemented using Str2, |
| 1387 | * so here we adjust the DEF accordingly. |
| 1388 | */ |
| 1389 | static void |
| 1390 | Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1391 | td->free_struct = asn_DEF_Str2.free_struct; |
| 1392 | td->print_struct = asn_DEF_Str2.print_struct; |
| 1393 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 1394 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 1395 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 1396 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
| 1397 | td->uper_decoder = asn_DEF_Str2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1398 | td->uper_encoder = asn_DEF_Str2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1399 | if(!td->per_constraints) |
| 1400 | td->per_constraints = asn_DEF_Str2.per_constraints; |
| 1401 | td->elements = asn_DEF_Str2.elements; |
| 1402 | td->elements_count = asn_DEF_Str2.elements_count; |
| 1403 | td->specifics = asn_DEF_Str2.specifics; |
| 1404 | } |
| 1405 | |
| 1406 | void |
| 1407 | Str3_free(asn_TYPE_descriptor_t *td, |
| 1408 | void *struct_ptr, int contents_only) { |
| 1409 | Str3_1_inherit_TYPE_descriptor(td); |
| 1410 | td->free_struct(td, struct_ptr, contents_only); |
| 1411 | } |
| 1412 | |
| 1413 | int |
| 1414 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1415 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1416 | Str3_1_inherit_TYPE_descriptor(td); |
| 1417 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1418 | } |
| 1419 | |
| 1420 | asn_dec_rval_t |
| 1421 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1422 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1423 | Str3_1_inherit_TYPE_descriptor(td); |
| 1424 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1425 | } |
| 1426 | |
| 1427 | asn_enc_rval_t |
| 1428 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
| 1429 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1430 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1431 | Str3_1_inherit_TYPE_descriptor(td); |
| 1432 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1433 | } |
| 1434 | |
| 1435 | asn_dec_rval_t |
| 1436 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1437 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1438 | Str3_1_inherit_TYPE_descriptor(td); |
| 1439 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1440 | } |
| 1441 | |
| 1442 | asn_enc_rval_t |
| 1443 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1444 | int ilevel, enum xer_encoder_flags_e flags, |
| 1445 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1446 | Str3_1_inherit_TYPE_descriptor(td); |
| 1447 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1448 | } |
| 1449 | |
| 1450 | asn_dec_rval_t |
| 1451 | Str3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1452 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1453 | Str3_1_inherit_TYPE_descriptor(td); |
| 1454 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1455 | } |
| 1456 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1457 | asn_enc_rval_t |
| 1458 | Str3_encode_uper(asn_TYPE_descriptor_t *td, |
| 1459 | asn_per_constraints_t *constraints, |
| 1460 | void *structure, asn_per_outp_t *per_out) { |
| 1461 | Str3_1_inherit_TYPE_descriptor(td); |
| 1462 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1463 | } |
| 1464 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1465 | |
| 1466 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1467 | |
| 1468 | static ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { |
| 1469 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1470 | }; |
| 1471 | static asn_per_constraints_t asn_PER_Str3_constr_1 = { |
| 1472 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 1473 | { APC_CONSTRAINED, 5, 5, 10, 27 } /* (SIZE(10..27)) */ |
| 1474 | }; |
| 1475 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
| 1476 | "Str3", |
| 1477 | "Str3", |
| 1478 | Str3_free, |
| 1479 | Str3_print, |
| 1480 | Str3_constraint, |
| 1481 | Str3_decode_ber, |
| 1482 | Str3_encode_der, |
| 1483 | Str3_decode_xer, |
| 1484 | Str3_encode_xer, |
| 1485 | Str3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1486 | Str3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1487 | 0, /* Use generic outmost tag fetcher */ |
| 1488 | asn_DEF_Str3_tags_1, |
| 1489 | sizeof(asn_DEF_Str3_tags_1) |
| 1490 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1491 | asn_DEF_Str3_tags_1, /* Same as above */ |
| 1492 | sizeof(asn_DEF_Str3_tags_1) |
| 1493 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1494 | &asn_PER_Str3_constr_1, |
| 1495 | 0, 0, /* No members */ |
| 1496 | 0 /* No specifics */ |
| 1497 | }; |
| 1498 | |
| 1499 | |
| 1500 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1501 | |
| 1502 | #include <IA5String.h> |
| 1503 | |
| 1504 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1505 | |
| 1506 | typedef IA5String_t Str4_t; |
| 1507 | |
| 1508 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1509 | |
| 1510 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
| 1511 | asn_struct_free_f Str4_free; |
| 1512 | asn_struct_print_f Str4_print; |
| 1513 | asn_constr_check_f Str4_constraint; |
| 1514 | ber_type_decoder_f Str4_decode_ber; |
| 1515 | der_type_encoder_f Str4_encode_der; |
| 1516 | xer_type_decoder_f Str4_decode_xer; |
| 1517 | xer_type_encoder_f Str4_encode_xer; |
| 1518 | per_type_decoder_f Str4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1519 | per_type_encoder_f Str4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1520 | |
| 1521 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1522 | |
| 1523 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1524 | /* The underlying type is IA5String */ |
| 1525 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1526 | const uint8_t *ch = st->buf; |
| 1527 | const uint8_t *end = ch + st->size; |
| 1528 | |
| 1529 | for(; ch < end; ch++) { |
| 1530 | uint8_t cv = *ch; |
| 1531 | if(!(cv <= 127)) return -1; |
| 1532 | } |
| 1533 | return 0; |
| 1534 | } |
| 1535 | |
| 1536 | |
| 1537 | /*** <<< CODE [Str4] >>> ***/ |
| 1538 | |
| 1539 | int |
| 1540 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1541 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1542 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1543 | |
| 1544 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1545 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1546 | "%s: value not given (%s:%d)", |
| 1547 | td->name, __FILE__, __LINE__); |
| 1548 | return -1; |
| 1549 | } |
| 1550 | |
| 1551 | |
| 1552 | if(!check_permitted_alphabet_1(st)) { |
| 1553 | /* Constraint check succeeded */ |
| 1554 | return 0; |
| 1555 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1556 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1557 | "%s: constraint failed (%s:%d)", |
| 1558 | td->name, __FILE__, __LINE__); |
| 1559 | return -1; |
| 1560 | } |
| 1561 | } |
| 1562 | |
| 1563 | /* |
| 1564 | * This type is implemented using IA5String, |
| 1565 | * so here we adjust the DEF accordingly. |
| 1566 | */ |
| 1567 | static void |
| 1568 | Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1569 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1570 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1571 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1572 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1573 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1574 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1575 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1576 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1577 | if(!td->per_constraints) |
| 1578 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1579 | td->elements = asn_DEF_IA5String.elements; |
| 1580 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1581 | td->specifics = asn_DEF_IA5String.specifics; |
| 1582 | } |
| 1583 | |
| 1584 | void |
| 1585 | Str4_free(asn_TYPE_descriptor_t *td, |
| 1586 | void *struct_ptr, int contents_only) { |
| 1587 | Str4_1_inherit_TYPE_descriptor(td); |
| 1588 | td->free_struct(td, struct_ptr, contents_only); |
| 1589 | } |
| 1590 | |
| 1591 | int |
| 1592 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1593 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1594 | Str4_1_inherit_TYPE_descriptor(td); |
| 1595 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1596 | } |
| 1597 | |
| 1598 | asn_dec_rval_t |
| 1599 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1600 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1601 | Str4_1_inherit_TYPE_descriptor(td); |
| 1602 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1603 | } |
| 1604 | |
| 1605 | asn_enc_rval_t |
| 1606 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
| 1607 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1608 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1609 | Str4_1_inherit_TYPE_descriptor(td); |
| 1610 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1611 | } |
| 1612 | |
| 1613 | asn_dec_rval_t |
| 1614 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1615 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1616 | Str4_1_inherit_TYPE_descriptor(td); |
| 1617 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1618 | } |
| 1619 | |
| 1620 | asn_enc_rval_t |
| 1621 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1622 | int ilevel, enum xer_encoder_flags_e flags, |
| 1623 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1624 | Str4_1_inherit_TYPE_descriptor(td); |
| 1625 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1626 | } |
| 1627 | |
| 1628 | asn_dec_rval_t |
| 1629 | Str4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1630 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1631 | Str4_1_inherit_TYPE_descriptor(td); |
| 1632 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1633 | } |
| 1634 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1635 | asn_enc_rval_t |
| 1636 | Str4_encode_uper(asn_TYPE_descriptor_t *td, |
| 1637 | asn_per_constraints_t *constraints, |
| 1638 | void *structure, asn_per_outp_t *per_out) { |
| 1639 | Str4_1_inherit_TYPE_descriptor(td); |
| 1640 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1641 | } |
| 1642 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1643 | |
| 1644 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1645 | |
| 1646 | static ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { |
| 1647 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1648 | }; |
| 1649 | static asn_per_constraints_t asn_PER_Str4_constr_1 = { |
| 1650 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 1651 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 1652 | }; |
| 1653 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
| 1654 | "Str4", |
| 1655 | "Str4", |
| 1656 | Str4_free, |
| 1657 | Str4_print, |
| 1658 | Str4_constraint, |
| 1659 | Str4_decode_ber, |
| 1660 | Str4_encode_der, |
| 1661 | Str4_decode_xer, |
| 1662 | Str4_encode_xer, |
| 1663 | Str4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1664 | Str4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1665 | 0, /* Use generic outmost tag fetcher */ |
| 1666 | asn_DEF_Str4_tags_1, |
| 1667 | sizeof(asn_DEF_Str4_tags_1) |
| 1668 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1669 | asn_DEF_Str4_tags_1, /* Same as above */ |
| 1670 | sizeof(asn_DEF_Str4_tags_1) |
| 1671 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1672 | &asn_PER_Str4_constr_1, |
| 1673 | 0, 0, /* No members */ |
| 1674 | 0 /* No specifics */ |
| 1675 | }; |
| 1676 | |
| 1677 | |
| 1678 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1679 | |
| 1680 | #include <IA5String.h> |
| 1681 | |
| 1682 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1683 | |
| 1684 | typedef IA5String_t PER_Visible_t; |
| 1685 | |
| 1686 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1687 | |
| 1688 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
| 1689 | asn_struct_free_f PER_Visible_free; |
| 1690 | asn_struct_print_f PER_Visible_print; |
| 1691 | asn_constr_check_f PER_Visible_constraint; |
| 1692 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1693 | der_type_encoder_f PER_Visible_encode_der; |
| 1694 | xer_type_decoder_f PER_Visible_decode_xer; |
| 1695 | xer_type_encoder_f PER_Visible_encode_xer; |
| 1696 | per_type_decoder_f PER_Visible_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1697 | per_type_encoder_f PER_Visible_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1698 | |
| 1699 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1700 | |
| 1701 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1702 | /* The underlying type is IA5String */ |
| 1703 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1704 | const uint8_t *ch = st->buf; |
| 1705 | const uint8_t *end = ch + st->size; |
| 1706 | |
| 1707 | for(; ch < end; ch++) { |
| 1708 | uint8_t cv = *ch; |
| 1709 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 1710 | } |
| 1711 | return 0; |
| 1712 | } |
| 1713 | |
| 1714 | |
| 1715 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1716 | |
| 1717 | int |
| 1718 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1719 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1720 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1721 | |
| 1722 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1723 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1724 | "%s: value not given (%s:%d)", |
| 1725 | td->name, __FILE__, __LINE__); |
| 1726 | return -1; |
| 1727 | } |
| 1728 | |
| 1729 | |
| 1730 | if(!check_permitted_alphabet_1(st)) { |
| 1731 | /* Constraint check succeeded */ |
| 1732 | return 0; |
| 1733 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1734 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1735 | "%s: constraint failed (%s:%d)", |
| 1736 | td->name, __FILE__, __LINE__); |
| 1737 | return -1; |
| 1738 | } |
| 1739 | } |
| 1740 | |
| 1741 | /* |
| 1742 | * This type is implemented using IA5String, |
| 1743 | * so here we adjust the DEF accordingly. |
| 1744 | */ |
| 1745 | static void |
| 1746 | PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1747 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1748 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1749 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1750 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1751 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1752 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1753 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1754 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1755 | if(!td->per_constraints) |
| 1756 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1757 | td->elements = asn_DEF_IA5String.elements; |
| 1758 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1759 | td->specifics = asn_DEF_IA5String.specifics; |
| 1760 | } |
| 1761 | |
| 1762 | void |
| 1763 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
| 1764 | void *struct_ptr, int contents_only) { |
| 1765 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1766 | td->free_struct(td, struct_ptr, contents_only); |
| 1767 | } |
| 1768 | |
| 1769 | int |
| 1770 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1771 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1772 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1773 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1774 | } |
| 1775 | |
| 1776 | asn_dec_rval_t |
| 1777 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1778 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1779 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1780 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1781 | } |
| 1782 | |
| 1783 | asn_enc_rval_t |
| 1784 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
| 1785 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1786 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1787 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1788 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1789 | } |
| 1790 | |
| 1791 | asn_dec_rval_t |
| 1792 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1793 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1794 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1795 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1796 | } |
| 1797 | |
| 1798 | asn_enc_rval_t |
| 1799 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1800 | int ilevel, enum xer_encoder_flags_e flags, |
| 1801 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1802 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1803 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1804 | } |
| 1805 | |
| 1806 | asn_dec_rval_t |
| 1807 | PER_Visible_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1808 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1809 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1810 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1811 | } |
| 1812 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1813 | asn_enc_rval_t |
| 1814 | PER_Visible_encode_uper(asn_TYPE_descriptor_t *td, |
| 1815 | asn_per_constraints_t *constraints, |
| 1816 | void *structure, asn_per_outp_t *per_out) { |
| 1817 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1818 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1819 | } |
| 1820 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1821 | |
| 1822 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1823 | |
| 1824 | static ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { |
| 1825 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1826 | }; |
| 1827 | static asn_per_constraints_t asn_PER_PER_Visible_constr_1 = { |
| 1828 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 1829 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 1830 | }; |
| 1831 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
| 1832 | "PER-Visible", |
| 1833 | "PER-Visible", |
| 1834 | PER_Visible_free, |
| 1835 | PER_Visible_print, |
| 1836 | PER_Visible_constraint, |
| 1837 | PER_Visible_decode_ber, |
| 1838 | PER_Visible_encode_der, |
| 1839 | PER_Visible_decode_xer, |
| 1840 | PER_Visible_encode_xer, |
| 1841 | PER_Visible_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1842 | PER_Visible_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1843 | 0, /* Use generic outmost tag fetcher */ |
| 1844 | asn_DEF_PER_Visible_tags_1, |
| 1845 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1846 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1847 | asn_DEF_PER_Visible_tags_1, /* Same as above */ |
| 1848 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1849 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1850 | &asn_PER_PER_Visible_constr_1, |
| 1851 | 0, 0, /* No members */ |
| 1852 | 0 /* No specifics */ |
| 1853 | }; |
| 1854 | |
| 1855 | |
| 1856 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1857 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 1858 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1859 | |
| 1860 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1861 | |
| 1862 | typedef PER_Visible_t PER_Visible_2_t; |
| 1863 | |
| 1864 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1865 | |
| 1866 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
| 1867 | asn_struct_free_f PER_Visible_2_free; |
| 1868 | asn_struct_print_f PER_Visible_2_print; |
| 1869 | asn_constr_check_f PER_Visible_2_constraint; |
| 1870 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1871 | der_type_encoder_f PER_Visible_2_encode_der; |
| 1872 | xer_type_decoder_f PER_Visible_2_decode_xer; |
| 1873 | xer_type_encoder_f PER_Visible_2_encode_xer; |
| 1874 | per_type_decoder_f PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1875 | per_type_encoder_f PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1876 | |
| 1877 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1878 | |
| 1879 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1880 | /* The underlying type is IA5String */ |
| 1881 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1882 | const uint8_t *ch = st->buf; |
| 1883 | const uint8_t *end = ch + st->size; |
| 1884 | |
| 1885 | for(; ch < end; ch++) { |
| 1886 | uint8_t cv = *ch; |
| 1887 | if(!(cv >= 69 && cv <= 70)) return -1; |
| 1888 | } |
| 1889 | return 0; |
| 1890 | } |
| 1891 | |
| 1892 | |
| 1893 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1894 | |
| 1895 | int |
| 1896 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1897 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1898 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 1899 | |
| 1900 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1901 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1902 | "%s: value not given (%s:%d)", |
| 1903 | td->name, __FILE__, __LINE__); |
| 1904 | return -1; |
| 1905 | } |
| 1906 | |
| 1907 | |
| 1908 | if(!check_permitted_alphabet_1(st)) { |
| 1909 | /* Constraint check succeeded */ |
| 1910 | return 0; |
| 1911 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1912 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1913 | "%s: constraint failed (%s:%d)", |
| 1914 | td->name, __FILE__, __LINE__); |
| 1915 | return -1; |
| 1916 | } |
| 1917 | } |
| 1918 | |
| 1919 | /* |
| 1920 | * This type is implemented using PER_Visible, |
| 1921 | * so here we adjust the DEF accordingly. |
| 1922 | */ |
| 1923 | static void |
| 1924 | PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1925 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1926 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1927 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1928 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1929 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1930 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1931 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1932 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1933 | if(!td->per_constraints) |
| 1934 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 1935 | td->elements = asn_DEF_PER_Visible.elements; |
| 1936 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1937 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 1938 | } |
| 1939 | |
| 1940 | void |
| 1941 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 1942 | void *struct_ptr, int contents_only) { |
| 1943 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1944 | td->free_struct(td, struct_ptr, contents_only); |
| 1945 | } |
| 1946 | |
| 1947 | int |
| 1948 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1949 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1950 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1951 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1952 | } |
| 1953 | |
| 1954 | asn_dec_rval_t |
| 1955 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1956 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1957 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1958 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1959 | } |
| 1960 | |
| 1961 | asn_enc_rval_t |
| 1962 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 1963 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1964 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1965 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1966 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1967 | } |
| 1968 | |
| 1969 | asn_dec_rval_t |
| 1970 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1971 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1972 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1973 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1974 | } |
| 1975 | |
| 1976 | asn_enc_rval_t |
| 1977 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1978 | int ilevel, enum xer_encoder_flags_e flags, |
| 1979 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1980 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1981 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1982 | } |
| 1983 | |
| 1984 | asn_dec_rval_t |
| 1985 | PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1986 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1987 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1988 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1989 | } |
| 1990 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1991 | asn_enc_rval_t |
| 1992 | PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 1993 | asn_per_constraints_t *constraints, |
| 1994 | void *structure, asn_per_outp_t *per_out) { |
| 1995 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1996 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1997 | } |
| 1998 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1999 | |
| 2000 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 2001 | |
| 2002 | static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { |
| 2003 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2004 | }; |
| 2005 | static asn_per_constraints_t asn_PER_PER_Visible_2_constr_1 = { |
| 2006 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2007 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2008 | }; |
| 2009 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
| 2010 | "PER-Visible-2", |
| 2011 | "PER-Visible-2", |
| 2012 | PER_Visible_2_free, |
| 2013 | PER_Visible_2_print, |
| 2014 | PER_Visible_2_constraint, |
| 2015 | PER_Visible_2_decode_ber, |
| 2016 | PER_Visible_2_encode_der, |
| 2017 | PER_Visible_2_decode_xer, |
| 2018 | PER_Visible_2_encode_xer, |
| 2019 | PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2020 | PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2021 | 0, /* Use generic outmost tag fetcher */ |
| 2022 | asn_DEF_PER_Visible_2_tags_1, |
| 2023 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2024 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2025 | asn_DEF_PER_Visible_2_tags_1, /* Same as above */ |
| 2026 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2027 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2028 | &asn_PER_PER_Visible_2_constr_1, |
| 2029 | 0, 0, /* No members */ |
| 2030 | 0 /* No specifics */ |
| 2031 | }; |
| 2032 | |
| 2033 | |
| 2034 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 2035 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2036 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2037 | |
| 2038 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2039 | |
| 2040 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 2041 | |
| 2042 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2043 | |
| 2044 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
| 2045 | asn_struct_free_f Not_PER_Visible_1_free; |
| 2046 | asn_struct_print_f Not_PER_Visible_1_print; |
| 2047 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 2048 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 2049 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
| 2050 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
| 2051 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
| 2052 | per_type_decoder_f Not_PER_Visible_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2053 | per_type_encoder_f Not_PER_Visible_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2054 | |
| 2055 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 2056 | |
| 2057 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2058 | /* The underlying type is IA5String */ |
| 2059 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2060 | const uint8_t *ch = st->buf; |
| 2061 | const uint8_t *end = ch + st->size; |
| 2062 | |
| 2063 | for(; ch < end; ch++) { |
| 2064 | uint8_t cv = *ch; |
| 2065 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 2066 | } |
| 2067 | return 0; |
| 2068 | } |
| 2069 | |
| 2070 | |
| 2071 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 2072 | |
| 2073 | int |
| 2074 | Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2075 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2076 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2077 | |
| 2078 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2079 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2080 | "%s: value not given (%s:%d)", |
| 2081 | td->name, __FILE__, __LINE__); |
| 2082 | return -1; |
| 2083 | } |
| 2084 | |
| 2085 | |
| 2086 | if(!check_permitted_alphabet_1(st)) { |
| 2087 | /* Constraint check succeeded */ |
| 2088 | return 0; |
| 2089 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2090 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2091 | "%s: constraint failed (%s:%d)", |
| 2092 | td->name, __FILE__, __LINE__); |
| 2093 | return -1; |
| 2094 | } |
| 2095 | } |
| 2096 | |
| 2097 | /* |
| 2098 | * This type is implemented using PER_Visible, |
| 2099 | * so here we adjust the DEF accordingly. |
| 2100 | */ |
| 2101 | static void |
| 2102 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2103 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2104 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2105 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2106 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2107 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2108 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2109 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2110 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2111 | if(!td->per_constraints) |
| 2112 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2113 | td->elements = asn_DEF_PER_Visible.elements; |
| 2114 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2115 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2116 | } |
| 2117 | |
| 2118 | void |
| 2119 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
| 2120 | void *struct_ptr, int contents_only) { |
| 2121 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2122 | td->free_struct(td, struct_ptr, contents_only); |
| 2123 | } |
| 2124 | |
| 2125 | int |
| 2126 | Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2127 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2128 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2129 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2130 | } |
| 2131 | |
| 2132 | asn_dec_rval_t |
| 2133 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2134 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2135 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2136 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2137 | } |
| 2138 | |
| 2139 | asn_enc_rval_t |
| 2140 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
| 2141 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2142 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2143 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2144 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2145 | } |
| 2146 | |
| 2147 | asn_dec_rval_t |
| 2148 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2149 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2150 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2151 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2152 | } |
| 2153 | |
| 2154 | asn_enc_rval_t |
| 2155 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2156 | int ilevel, enum xer_encoder_flags_e flags, |
| 2157 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2158 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2159 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2160 | } |
| 2161 | |
| 2162 | asn_dec_rval_t |
| 2163 | Not_PER_Visible_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2164 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2165 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2166 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2167 | } |
| 2168 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2169 | asn_enc_rval_t |
| 2170 | Not_PER_Visible_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 2171 | asn_per_constraints_t *constraints, |
| 2172 | void *structure, asn_per_outp_t *per_out) { |
| 2173 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2174 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2175 | } |
| 2176 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2177 | |
| 2178 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 2179 | |
| 2180 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { |
| 2181 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2182 | }; |
| 2183 | static asn_per_constraints_t asn_PER_Not_PER_Visible_1_constr_1 = { |
| 2184 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2185 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2186 | }; |
| 2187 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
| 2188 | "Not-PER-Visible-1", |
| 2189 | "Not-PER-Visible-1", |
| 2190 | Not_PER_Visible_1_free, |
| 2191 | Not_PER_Visible_1_print, |
| 2192 | Not_PER_Visible_1_constraint, |
| 2193 | Not_PER_Visible_1_decode_ber, |
| 2194 | Not_PER_Visible_1_encode_der, |
| 2195 | Not_PER_Visible_1_decode_xer, |
| 2196 | Not_PER_Visible_1_encode_xer, |
| 2197 | Not_PER_Visible_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2198 | Not_PER_Visible_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2199 | 0, /* Use generic outmost tag fetcher */ |
| 2200 | asn_DEF_Not_PER_Visible_1_tags_1, |
| 2201 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2202 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 2203 | asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ |
| 2204 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2205 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 2206 | &asn_PER_Not_PER_Visible_1_constr_1, |
| 2207 | 0, 0, /* No members */ |
| 2208 | 0 /* No specifics */ |
| 2209 | }; |
| 2210 | |
| 2211 | |
| 2212 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 2213 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2214 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2215 | |
| 2216 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2217 | |
| 2218 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 2219 | |
| 2220 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2221 | |
| 2222 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
| 2223 | asn_struct_free_f Not_PER_Visible_2_free; |
| 2224 | asn_struct_print_f Not_PER_Visible_2_print; |
| 2225 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 2226 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 2227 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
| 2228 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
| 2229 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
| 2230 | per_type_decoder_f Not_PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2231 | per_type_encoder_f Not_PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2232 | |
| 2233 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 2234 | |
| 2235 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2236 | /* The underlying type is IA5String */ |
| 2237 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2238 | const uint8_t *ch = st->buf; |
| 2239 | const uint8_t *end = ch + st->size; |
| 2240 | |
| 2241 | for(; ch < end; ch++) { |
| 2242 | uint8_t cv = *ch; |
| 2243 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2244 | } |
| 2245 | return 0; |
| 2246 | } |
| 2247 | |
| 2248 | |
| 2249 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 2250 | |
| 2251 | int |
| 2252 | Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2253 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2254 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2255 | |
| 2256 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2257 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2258 | "%s: value not given (%s:%d)", |
| 2259 | td->name, __FILE__, __LINE__); |
| 2260 | return -1; |
| 2261 | } |
| 2262 | |
| 2263 | |
| 2264 | if(!check_permitted_alphabet_1(st)) { |
| 2265 | /* Constraint check succeeded */ |
| 2266 | return 0; |
| 2267 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2268 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2269 | "%s: constraint failed (%s:%d)", |
| 2270 | td->name, __FILE__, __LINE__); |
| 2271 | return -1; |
| 2272 | } |
| 2273 | } |
| 2274 | |
| 2275 | /* |
| 2276 | * This type is implemented using PER_Visible, |
| 2277 | * so here we adjust the DEF accordingly. |
| 2278 | */ |
| 2279 | static void |
| 2280 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2281 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2282 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2283 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2284 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2285 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2286 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2287 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2288 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2289 | if(!td->per_constraints) |
| 2290 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2291 | td->elements = asn_DEF_PER_Visible.elements; |
| 2292 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2293 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2294 | } |
| 2295 | |
| 2296 | void |
| 2297 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 2298 | void *struct_ptr, int contents_only) { |
| 2299 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2300 | td->free_struct(td, struct_ptr, contents_only); |
| 2301 | } |
| 2302 | |
| 2303 | int |
| 2304 | Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2305 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2306 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2307 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2308 | } |
| 2309 | |
| 2310 | asn_dec_rval_t |
| 2311 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2312 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2313 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2314 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2315 | } |
| 2316 | |
| 2317 | asn_enc_rval_t |
| 2318 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 2319 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2320 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2321 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2322 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2323 | } |
| 2324 | |
| 2325 | asn_dec_rval_t |
| 2326 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2327 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2328 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2329 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2330 | } |
| 2331 | |
| 2332 | asn_enc_rval_t |
| 2333 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2334 | int ilevel, enum xer_encoder_flags_e flags, |
| 2335 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2336 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2337 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2338 | } |
| 2339 | |
| 2340 | asn_dec_rval_t |
| 2341 | Not_PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2342 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2343 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2344 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2345 | } |
| 2346 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2347 | asn_enc_rval_t |
| 2348 | Not_PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 2349 | asn_per_constraints_t *constraints, |
| 2350 | void *structure, asn_per_outp_t *per_out) { |
| 2351 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2352 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2353 | } |
| 2354 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2355 | |
| 2356 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 2357 | |
| 2358 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { |
| 2359 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2360 | }; |
| 2361 | static asn_per_constraints_t asn_PER_Not_PER_Visible_2_constr_1 = { |
| 2362 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2363 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2364 | }; |
| 2365 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
| 2366 | "Not-PER-Visible-2", |
| 2367 | "Not-PER-Visible-2", |
| 2368 | Not_PER_Visible_2_free, |
| 2369 | Not_PER_Visible_2_print, |
| 2370 | Not_PER_Visible_2_constraint, |
| 2371 | Not_PER_Visible_2_decode_ber, |
| 2372 | Not_PER_Visible_2_encode_der, |
| 2373 | Not_PER_Visible_2_decode_xer, |
| 2374 | Not_PER_Visible_2_encode_xer, |
| 2375 | Not_PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2376 | Not_PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2377 | 0, /* Use generic outmost tag fetcher */ |
| 2378 | asn_DEF_Not_PER_Visible_2_tags_1, |
| 2379 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2380 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2381 | asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ |
| 2382 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2383 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2384 | &asn_PER_Not_PER_Visible_2_constr_1, |
| 2385 | 0, 0, /* No members */ |
| 2386 | 0 /* No specifics */ |
| 2387 | }; |
| 2388 | |
| 2389 | |
| 2390 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 2391 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2392 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2393 | |
| 2394 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2395 | |
| 2396 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 2397 | |
| 2398 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2399 | |
| 2400 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
| 2401 | asn_struct_free_f Not_PER_Visible_3_free; |
| 2402 | asn_struct_print_f Not_PER_Visible_3_print; |
| 2403 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 2404 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 2405 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
| 2406 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
| 2407 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
| 2408 | per_type_decoder_f Not_PER_Visible_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2409 | per_type_encoder_f Not_PER_Visible_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2410 | |
| 2411 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 2412 | |
| 2413 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2414 | /* The underlying type is IA5String */ |
| 2415 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2416 | const uint8_t *ch = st->buf; |
| 2417 | const uint8_t *end = ch + st->size; |
| 2418 | |
| 2419 | for(; ch < end; ch++) { |
| 2420 | uint8_t cv = *ch; |
| 2421 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2422 | } |
| 2423 | return 0; |
| 2424 | } |
| 2425 | |
| 2426 | |
| 2427 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 2428 | |
| 2429 | int |
| 2430 | Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2431 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2432 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2433 | |
| 2434 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2435 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2436 | "%s: value not given (%s:%d)", |
| 2437 | td->name, __FILE__, __LINE__); |
| 2438 | return -1; |
| 2439 | } |
| 2440 | |
| 2441 | |
| 2442 | if(!check_permitted_alphabet_1(st)) { |
| 2443 | /* Constraint check succeeded */ |
| 2444 | return 0; |
| 2445 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2446 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2447 | "%s: constraint failed (%s:%d)", |
| 2448 | td->name, __FILE__, __LINE__); |
| 2449 | return -1; |
| 2450 | } |
| 2451 | } |
| 2452 | |
| 2453 | /* |
| 2454 | * This type is implemented using PER_Visible, |
| 2455 | * so here we adjust the DEF accordingly. |
| 2456 | */ |
| 2457 | static void |
| 2458 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2459 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2460 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2461 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2462 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2463 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2464 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2465 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2466 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2467 | if(!td->per_constraints) |
| 2468 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2469 | td->elements = asn_DEF_PER_Visible.elements; |
| 2470 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2471 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2472 | } |
| 2473 | |
| 2474 | void |
| 2475 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
| 2476 | void *struct_ptr, int contents_only) { |
| 2477 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2478 | td->free_struct(td, struct_ptr, contents_only); |
| 2479 | } |
| 2480 | |
| 2481 | int |
| 2482 | Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2483 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2484 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2485 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2486 | } |
| 2487 | |
| 2488 | asn_dec_rval_t |
| 2489 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2490 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2491 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2492 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2493 | } |
| 2494 | |
| 2495 | asn_enc_rval_t |
| 2496 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
| 2497 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2498 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2499 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2500 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2501 | } |
| 2502 | |
| 2503 | asn_dec_rval_t |
| 2504 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2505 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2506 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2507 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2508 | } |
| 2509 | |
| 2510 | asn_enc_rval_t |
| 2511 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2512 | int ilevel, enum xer_encoder_flags_e flags, |
| 2513 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2514 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2515 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2516 | } |
| 2517 | |
| 2518 | asn_dec_rval_t |
| 2519 | Not_PER_Visible_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2520 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2521 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2522 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2523 | } |
| 2524 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2525 | asn_enc_rval_t |
| 2526 | Not_PER_Visible_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 2527 | asn_per_constraints_t *constraints, |
| 2528 | void *structure, asn_per_outp_t *per_out) { |
| 2529 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2530 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2531 | } |
| 2532 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2533 | |
| 2534 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 2535 | |
| 2536 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { |
| 2537 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2538 | }; |
| 2539 | static asn_per_constraints_t asn_PER_Not_PER_Visible_3_constr_1 = { |
| 2540 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2541 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2542 | }; |
| 2543 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
| 2544 | "Not-PER-Visible-3", |
| 2545 | "Not-PER-Visible-3", |
| 2546 | Not_PER_Visible_3_free, |
| 2547 | Not_PER_Visible_3_print, |
| 2548 | Not_PER_Visible_3_constraint, |
| 2549 | Not_PER_Visible_3_decode_ber, |
| 2550 | Not_PER_Visible_3_encode_der, |
| 2551 | Not_PER_Visible_3_decode_xer, |
| 2552 | Not_PER_Visible_3_encode_xer, |
| 2553 | Not_PER_Visible_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2554 | Not_PER_Visible_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2555 | 0, /* Use generic outmost tag fetcher */ |
| 2556 | asn_DEF_Not_PER_Visible_3_tags_1, |
| 2557 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2558 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2559 | asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ |
| 2560 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2561 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2562 | &asn_PER_Not_PER_Visible_3_constr_1, |
| 2563 | 0, 0, /* No members */ |
| 2564 | 0 /* No specifics */ |
| 2565 | }; |
| 2566 | |
| 2567 | |
| 2568 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 2569 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2570 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2571 | |
| 2572 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2573 | |
| 2574 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 2575 | |
| 2576 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2577 | |
| 2578 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
| 2579 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 2580 | asn_struct_print_f SIZE_but_not_FROM_print; |
| 2581 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 2582 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 2583 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
| 2584 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
| 2585 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
| 2586 | per_type_decoder_f SIZE_but_not_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2587 | per_type_encoder_f SIZE_but_not_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2588 | |
| 2589 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 2590 | |
| 2591 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2592 | /* The underlying type is IA5String */ |
| 2593 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2594 | const uint8_t *ch = st->buf; |
| 2595 | const uint8_t *end = ch + st->size; |
| 2596 | |
| 2597 | for(; ch < end; ch++) { |
| 2598 | uint8_t cv = *ch; |
| 2599 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2600 | } |
| 2601 | return 0; |
| 2602 | } |
| 2603 | |
| 2604 | |
| 2605 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2606 | |
| 2607 | int |
| 2608 | SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2609 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2610 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2611 | size_t size; |
| 2612 | |
| 2613 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2614 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2615 | "%s: value not given (%s:%d)", |
| 2616 | td->name, __FILE__, __LINE__); |
| 2617 | return -1; |
| 2618 | } |
| 2619 | |
| 2620 | size = st->size; |
| 2621 | |
| 2622 | if((size >= 1 && size <= 4) |
| 2623 | && !check_permitted_alphabet_1(st)) { |
| 2624 | /* Constraint check succeeded */ |
| 2625 | return 0; |
| 2626 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2627 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2628 | "%s: constraint failed (%s:%d)", |
| 2629 | td->name, __FILE__, __LINE__); |
| 2630 | return -1; |
| 2631 | } |
| 2632 | } |
| 2633 | |
| 2634 | /* |
| 2635 | * This type is implemented using PER_Visible, |
| 2636 | * so here we adjust the DEF accordingly. |
| 2637 | */ |
| 2638 | static void |
| 2639 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2640 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2641 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2642 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2643 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2644 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2645 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2646 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2647 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2648 | if(!td->per_constraints) |
| 2649 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2650 | td->elements = asn_DEF_PER_Visible.elements; |
| 2651 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2652 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2653 | } |
| 2654 | |
| 2655 | void |
| 2656 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
| 2657 | void *struct_ptr, int contents_only) { |
| 2658 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2659 | td->free_struct(td, struct_ptr, contents_only); |
| 2660 | } |
| 2661 | |
| 2662 | int |
| 2663 | SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2664 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2665 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2666 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2667 | } |
| 2668 | |
| 2669 | asn_dec_rval_t |
| 2670 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2671 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2672 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2673 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2674 | } |
| 2675 | |
| 2676 | asn_enc_rval_t |
| 2677 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2678 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2679 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2680 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2681 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2682 | } |
| 2683 | |
| 2684 | asn_dec_rval_t |
| 2685 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2686 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2687 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2688 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2689 | } |
| 2690 | |
| 2691 | asn_enc_rval_t |
| 2692 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2693 | int ilevel, enum xer_encoder_flags_e flags, |
| 2694 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2695 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2696 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2697 | } |
| 2698 | |
| 2699 | asn_dec_rval_t |
| 2700 | SIZE_but_not_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2701 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2702 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2703 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2704 | } |
| 2705 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2706 | asn_enc_rval_t |
| 2707 | SIZE_but_not_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2708 | asn_per_constraints_t *constraints, |
| 2709 | void *structure, asn_per_outp_t *per_out) { |
| 2710 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2711 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2712 | } |
| 2713 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2714 | |
| 2715 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2716 | |
| 2717 | static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { |
| 2718 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2719 | }; |
| 2720 | static asn_per_constraints_t asn_PER_SIZE_but_not_FROM_constr_1 = { |
| 2721 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2722 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */ |
| 2723 | }; |
| 2724 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
| 2725 | "SIZE-but-not-FROM", |
| 2726 | "SIZE-but-not-FROM", |
| 2727 | SIZE_but_not_FROM_free, |
| 2728 | SIZE_but_not_FROM_print, |
| 2729 | SIZE_but_not_FROM_constraint, |
| 2730 | SIZE_but_not_FROM_decode_ber, |
| 2731 | SIZE_but_not_FROM_encode_der, |
| 2732 | SIZE_but_not_FROM_decode_xer, |
| 2733 | SIZE_but_not_FROM_encode_xer, |
| 2734 | SIZE_but_not_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2735 | SIZE_but_not_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2736 | 0, /* Use generic outmost tag fetcher */ |
| 2737 | asn_DEF_SIZE_but_not_FROM_tags_1, |
| 2738 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2739 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2740 | asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ |
| 2741 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2742 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2743 | &asn_PER_SIZE_but_not_FROM_constr_1, |
| 2744 | 0, 0, /* No members */ |
| 2745 | 0 /* No specifics */ |
| 2746 | }; |
| 2747 | |
| 2748 | |
| 2749 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2750 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2751 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2752 | |
| 2753 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2754 | |
| 2755 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2756 | |
| 2757 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2758 | |
| 2759 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
| 2760 | asn_struct_free_f SIZE_and_FROM_free; |
| 2761 | asn_struct_print_f SIZE_and_FROM_print; |
| 2762 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2763 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2764 | der_type_encoder_f SIZE_and_FROM_encode_der; |
| 2765 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
| 2766 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
| 2767 | per_type_decoder_f SIZE_and_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2768 | per_type_encoder_f SIZE_and_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2769 | |
| 2770 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2771 | |
| 2772 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2773 | /* The underlying type is IA5String */ |
| 2774 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2775 | const uint8_t *ch = st->buf; |
| 2776 | const uint8_t *end = ch + st->size; |
| 2777 | |
| 2778 | for(; ch < end; ch++) { |
| 2779 | uint8_t cv = *ch; |
| 2780 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2781 | } |
| 2782 | return 0; |
| 2783 | } |
| 2784 | |
| 2785 | |
| 2786 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2787 | |
| 2788 | int |
| 2789 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2790 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2791 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2792 | size_t size; |
| 2793 | |
| 2794 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2795 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2796 | "%s: value not given (%s:%d)", |
| 2797 | td->name, __FILE__, __LINE__); |
| 2798 | return -1; |
| 2799 | } |
| 2800 | |
| 2801 | size = st->size; |
| 2802 | |
| 2803 | if((size >= 1 && size <= 4) |
| 2804 | && !check_permitted_alphabet_1(st)) { |
| 2805 | /* Constraint check succeeded */ |
| 2806 | return 0; |
| 2807 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2808 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2809 | "%s: constraint failed (%s:%d)", |
| 2810 | td->name, __FILE__, __LINE__); |
| 2811 | return -1; |
| 2812 | } |
| 2813 | } |
| 2814 | |
| 2815 | /* |
| 2816 | * This type is implemented using PER_Visible, |
| 2817 | * so here we adjust the DEF accordingly. |
| 2818 | */ |
| 2819 | static void |
| 2820 | SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2821 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2822 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2823 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2824 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2825 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2826 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2827 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2828 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2829 | if(!td->per_constraints) |
| 2830 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2831 | td->elements = asn_DEF_PER_Visible.elements; |
| 2832 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2833 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2834 | } |
| 2835 | |
| 2836 | void |
| 2837 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
| 2838 | void *struct_ptr, int contents_only) { |
| 2839 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2840 | td->free_struct(td, struct_ptr, contents_only); |
| 2841 | } |
| 2842 | |
| 2843 | int |
| 2844 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2845 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2846 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2847 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2848 | } |
| 2849 | |
| 2850 | asn_dec_rval_t |
| 2851 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2852 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2853 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2854 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2855 | } |
| 2856 | |
| 2857 | asn_enc_rval_t |
| 2858 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2859 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2860 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2861 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2862 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2863 | } |
| 2864 | |
| 2865 | asn_dec_rval_t |
| 2866 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2867 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2868 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2869 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2870 | } |
| 2871 | |
| 2872 | asn_enc_rval_t |
| 2873 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2874 | int ilevel, enum xer_encoder_flags_e flags, |
| 2875 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2876 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2877 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2878 | } |
| 2879 | |
| 2880 | asn_dec_rval_t |
| 2881 | SIZE_and_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2882 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2883 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2884 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2885 | } |
| 2886 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2887 | asn_enc_rval_t |
| 2888 | SIZE_and_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2889 | asn_per_constraints_t *constraints, |
| 2890 | void *structure, asn_per_outp_t *per_out) { |
| 2891 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2892 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2893 | } |
| 2894 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2895 | |
| 2896 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2897 | |
| 2898 | static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { |
| 2899 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2900 | }; |
| 2901 | static asn_per_constraints_t asn_PER_SIZE_and_FROM_constr_1 = { |
| 2902 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2903 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */ |
| 2904 | }; |
| 2905 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
| 2906 | "SIZE-and-FROM", |
| 2907 | "SIZE-and-FROM", |
| 2908 | SIZE_and_FROM_free, |
| 2909 | SIZE_and_FROM_print, |
| 2910 | SIZE_and_FROM_constraint, |
| 2911 | SIZE_and_FROM_decode_ber, |
| 2912 | SIZE_and_FROM_encode_der, |
| 2913 | SIZE_and_FROM_decode_xer, |
| 2914 | SIZE_and_FROM_encode_xer, |
| 2915 | SIZE_and_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2916 | SIZE_and_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2917 | 0, /* Use generic outmost tag fetcher */ |
| 2918 | asn_DEF_SIZE_and_FROM_tags_1, |
| 2919 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2920 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2921 | asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ |
| 2922 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2923 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2924 | &asn_PER_SIZE_and_FROM_constr_1, |
| 2925 | 0, 0, /* No members */ |
| 2926 | 0 /* No specifics */ |
| 2927 | }; |
| 2928 | |
| 2929 | |
| 2930 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2931 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 2932 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2933 | |
| 2934 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2935 | |
| 2936 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 2937 | |
| 2938 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2939 | |
| 2940 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
| 2941 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 2942 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
| 2943 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 2944 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 2945 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
| 2946 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
| 2947 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
| 2948 | per_type_decoder_f Neither_SIZE_nor_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2949 | per_type_encoder_f Neither_SIZE_nor_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2950 | |
| 2951 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2952 | |
| 2953 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2954 | /* The underlying type is IA5String */ |
| 2955 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2956 | const uint8_t *ch = st->buf; |
| 2957 | const uint8_t *end = ch + st->size; |
| 2958 | |
| 2959 | for(; ch < end; ch++) { |
| 2960 | uint8_t cv = *ch; |
| 2961 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 2962 | } |
| 2963 | return 0; |
| 2964 | } |
| 2965 | |
| 2966 | |
| 2967 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 2968 | |
| 2969 | int |
| 2970 | Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2971 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2972 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2973 | |
| 2974 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2975 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2976 | "%s: value not given (%s:%d)", |
| 2977 | td->name, __FILE__, __LINE__); |
| 2978 | return -1; |
| 2979 | } |
| 2980 | |
| 2981 | |
| 2982 | if(!check_permitted_alphabet_1(st)) { |
| 2983 | /* Constraint check succeeded */ |
| 2984 | return 0; |
| 2985 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2986 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2987 | "%s: constraint failed (%s:%d)", |
| 2988 | td->name, __FILE__, __LINE__); |
| 2989 | return -1; |
| 2990 | } |
| 2991 | } |
| 2992 | |
| 2993 | /* |
| 2994 | * This type is implemented using PER_Visible, |
| 2995 | * so here we adjust the DEF accordingly. |
| 2996 | */ |
| 2997 | static void |
| 2998 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2999 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 3000 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 3001 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 3002 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 3003 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 3004 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 3005 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3006 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3007 | if(!td->per_constraints) |
| 3008 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 3009 | td->elements = asn_DEF_PER_Visible.elements; |
| 3010 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 3011 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 3012 | } |
| 3013 | |
| 3014 | void |
| 3015 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
| 3016 | void *struct_ptr, int contents_only) { |
| 3017 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3018 | td->free_struct(td, struct_ptr, contents_only); |
| 3019 | } |
| 3020 | |
| 3021 | int |
| 3022 | Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3023 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3024 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3025 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3026 | } |
| 3027 | |
| 3028 | asn_dec_rval_t |
| 3029 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3030 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3031 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3032 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3033 | } |
| 3034 | |
| 3035 | asn_enc_rval_t |
| 3036 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 3037 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3038 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3039 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3040 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3041 | } |
| 3042 | |
| 3043 | asn_dec_rval_t |
| 3044 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3045 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3046 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3047 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3048 | } |
| 3049 | |
| 3050 | asn_enc_rval_t |
| 3051 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3052 | int ilevel, enum xer_encoder_flags_e flags, |
| 3053 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3054 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3055 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3056 | } |
| 3057 | |
| 3058 | asn_dec_rval_t |
| 3059 | Neither_SIZE_nor_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3060 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3061 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3062 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3063 | } |
| 3064 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3065 | asn_enc_rval_t |
| 3066 | Neither_SIZE_nor_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 3067 | asn_per_constraints_t *constraints, |
| 3068 | void *structure, asn_per_outp_t *per_out) { |
| 3069 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3070 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3071 | } |
| 3072 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3073 | |
| 3074 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3075 | |
| 3076 | static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { |
| 3077 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 3078 | }; |
| 3079 | static asn_per_constraints_t asn_PER_Neither_SIZE_nor_FROM_constr_1 = { |
| 3080 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3081 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 3082 | }; |
| 3083 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
| 3084 | "Neither-SIZE-nor-FROM", |
| 3085 | "Neither-SIZE-nor-FROM", |
| 3086 | Neither_SIZE_nor_FROM_free, |
| 3087 | Neither_SIZE_nor_FROM_print, |
| 3088 | Neither_SIZE_nor_FROM_constraint, |
| 3089 | Neither_SIZE_nor_FROM_decode_ber, |
| 3090 | Neither_SIZE_nor_FROM_encode_der, |
| 3091 | Neither_SIZE_nor_FROM_decode_xer, |
| 3092 | Neither_SIZE_nor_FROM_encode_xer, |
| 3093 | Neither_SIZE_nor_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3094 | Neither_SIZE_nor_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3095 | 0, /* Use generic outmost tag fetcher */ |
| 3096 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, |
| 3097 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3098 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 3099 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ |
| 3100 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3101 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 3102 | &asn_PER_Neither_SIZE_nor_FROM_constr_1, |
| 3103 | 0, 0, /* No members */ |
| 3104 | 0 /* No specifics */ |
| 3105 | }; |
| 3106 | |
| 3107 | |
| 3108 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 3109 | |
| 3110 | #include <UTF8String.h> |
| 3111 | |
| 3112 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 3113 | |
| 3114 | typedef UTF8String_t Utf8_4_t; |
| 3115 | |
| 3116 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 3117 | |
| 3118 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 3119 | asn_struct_free_f Utf8_4_free; |
| 3120 | asn_struct_print_f Utf8_4_print; |
| 3121 | asn_constr_check_f Utf8_4_constraint; |
| 3122 | ber_type_decoder_f Utf8_4_decode_ber; |
| 3123 | der_type_encoder_f Utf8_4_encode_der; |
| 3124 | xer_type_decoder_f Utf8_4_decode_xer; |
| 3125 | xer_type_encoder_f Utf8_4_encode_xer; |
| 3126 | per_type_decoder_f Utf8_4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3127 | per_type_encoder_f Utf8_4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3128 | |
| 3129 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 3130 | |
| 3131 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3132 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 3133 | return -1; /* Alphabet (sic!) test failed. */ |
| 3134 | |
| 3135 | return 0; |
| 3136 | } |
| 3137 | |
| 3138 | |
| 3139 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 3140 | |
| 3141 | int |
| 3142 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3143 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3144 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3145 | |
| 3146 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3147 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3148 | "%s: value not given (%s:%d)", |
| 3149 | td->name, __FILE__, __LINE__); |
| 3150 | return -1; |
| 3151 | } |
| 3152 | |
| 3153 | |
| 3154 | if(!check_permitted_alphabet_1(st)) { |
| 3155 | /* Constraint check succeeded */ |
| 3156 | return 0; |
| 3157 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3158 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3159 | "%s: constraint failed (%s:%d)", |
| 3160 | td->name, __FILE__, __LINE__); |
| 3161 | return -1; |
| 3162 | } |
| 3163 | } |
| 3164 | |
| 3165 | /* |
| 3166 | * This type is implemented using UTF8String, |
| 3167 | * so here we adjust the DEF accordingly. |
| 3168 | */ |
| 3169 | static void |
| 3170 | Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3171 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3172 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3173 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3174 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3175 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3176 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3177 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3178 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3179 | if(!td->per_constraints) |
| 3180 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3181 | td->elements = asn_DEF_UTF8String.elements; |
| 3182 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3183 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3184 | } |
| 3185 | |
| 3186 | void |
| 3187 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 3188 | void *struct_ptr, int contents_only) { |
| 3189 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3190 | td->free_struct(td, struct_ptr, contents_only); |
| 3191 | } |
| 3192 | |
| 3193 | int |
| 3194 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3195 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3196 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3197 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3198 | } |
| 3199 | |
| 3200 | asn_dec_rval_t |
| 3201 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3202 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3203 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3204 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3205 | } |
| 3206 | |
| 3207 | asn_enc_rval_t |
| 3208 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 3209 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3210 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3211 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3212 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3213 | } |
| 3214 | |
| 3215 | asn_dec_rval_t |
| 3216 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3217 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3218 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3219 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3220 | } |
| 3221 | |
| 3222 | asn_enc_rval_t |
| 3223 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3224 | int ilevel, enum xer_encoder_flags_e flags, |
| 3225 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3226 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3227 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3228 | } |
| 3229 | |
| 3230 | asn_dec_rval_t |
| 3231 | Utf8_4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3232 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3233 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3234 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3235 | } |
| 3236 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3237 | asn_enc_rval_t |
| 3238 | Utf8_4_encode_uper(asn_TYPE_descriptor_t *td, |
| 3239 | asn_per_constraints_t *constraints, |
| 3240 | void *structure, asn_per_outp_t *per_out) { |
| 3241 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3242 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3243 | } |
| 3244 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3245 | |
| 3246 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 3247 | |
| 3248 | static ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { |
| 3249 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3250 | }; |
| 3251 | static asn_per_constraints_t asn_PER_Utf8_4_constr_1 = { |
| 3252 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3253 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3254 | }; |
| 3255 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 3256 | "Utf8-4", |
| 3257 | "Utf8-4", |
| 3258 | Utf8_4_free, |
| 3259 | Utf8_4_print, |
| 3260 | Utf8_4_constraint, |
| 3261 | Utf8_4_decode_ber, |
| 3262 | Utf8_4_encode_der, |
| 3263 | Utf8_4_decode_xer, |
| 3264 | Utf8_4_encode_xer, |
| 3265 | Utf8_4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3266 | Utf8_4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3267 | 0, /* Use generic outmost tag fetcher */ |
| 3268 | asn_DEF_Utf8_4_tags_1, |
| 3269 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3270 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 3271 | asn_DEF_Utf8_4_tags_1, /* Same as above */ |
| 3272 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3273 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 3274 | &asn_PER_Utf8_4_constr_1, |
| 3275 | 0, 0, /* No members */ |
| 3276 | 0 /* No specifics */ |
| 3277 | }; |
| 3278 | |
| 3279 | |
| 3280 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 3281 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 3282 | #include "Utf8-2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3283 | |
| 3284 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 3285 | |
| 3286 | typedef Utf8_2_t Utf8_3_t; |
| 3287 | |
| 3288 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 3289 | |
| 3290 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
| 3291 | asn_struct_free_f Utf8_3_free; |
| 3292 | asn_struct_print_f Utf8_3_print; |
| 3293 | asn_constr_check_f Utf8_3_constraint; |
| 3294 | ber_type_decoder_f Utf8_3_decode_ber; |
| 3295 | der_type_encoder_f Utf8_3_encode_der; |
| 3296 | xer_type_decoder_f Utf8_3_decode_xer; |
| 3297 | xer_type_encoder_f Utf8_3_encode_xer; |
| 3298 | per_type_decoder_f Utf8_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3299 | per_type_encoder_f Utf8_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3300 | |
| 3301 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 3302 | |
| 3303 | static int permitted_alphabet_table_1[128] = { |
| 3304 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3305 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3306 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3307 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3308 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 3309 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 3310 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 3311 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 3312 | }; |
| 3313 | |
| 3314 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3315 | int *table = permitted_alphabet_table_1; |
| 3316 | /* The underlying type is UTF8String */ |
| 3317 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3318 | const uint8_t *ch = st->buf; |
| 3319 | const uint8_t *end = ch + st->size; |
| 3320 | |
| 3321 | for(; ch < end; ch++) { |
| 3322 | uint8_t cv = *ch; |
| 3323 | if(cv >= 0x80) return -1; |
| 3324 | if(!table[cv]) return -1; |
| 3325 | } |
| 3326 | return 0; |
| 3327 | } |
| 3328 | |
| 3329 | |
| 3330 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 3331 | |
| 3332 | int |
| 3333 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3334 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3335 | const Utf8_2_t *st = (const Utf8_2_t *)sptr; |
| 3336 | size_t size; |
| 3337 | |
| 3338 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3339 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3340 | "%s: value not given (%s:%d)", |
| 3341 | td->name, __FILE__, __LINE__); |
| 3342 | return -1; |
| 3343 | } |
| 3344 | |
| 3345 | size = UTF8String_length(st); |
| 3346 | if((ssize_t)size < 0) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3347 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3348 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3349 | td->name, __FILE__, __LINE__); |
| 3350 | return -1; |
| 3351 | } |
| 3352 | |
| 3353 | if((size >= 1 && size <= 2) |
| 3354 | && !check_permitted_alphabet_1(st)) { |
| 3355 | /* Constraint check succeeded */ |
| 3356 | return 0; |
| 3357 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3358 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3359 | "%s: constraint failed (%s:%d)", |
| 3360 | td->name, __FILE__, __LINE__); |
| 3361 | return -1; |
| 3362 | } |
| 3363 | } |
| 3364 | |
| 3365 | /* |
| 3366 | * This type is implemented using Utf8_2, |
| 3367 | * so here we adjust the DEF accordingly. |
| 3368 | */ |
| 3369 | static void |
| 3370 | Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3371 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 3372 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
| 3373 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 3374 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 3375 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 3376 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
| 3377 | td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3378 | td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3379 | if(!td->per_constraints) |
| 3380 | td->per_constraints = asn_DEF_Utf8_2.per_constraints; |
| 3381 | td->elements = asn_DEF_Utf8_2.elements; |
| 3382 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 3383 | td->specifics = asn_DEF_Utf8_2.specifics; |
| 3384 | } |
| 3385 | |
| 3386 | void |
| 3387 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
| 3388 | void *struct_ptr, int contents_only) { |
| 3389 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3390 | td->free_struct(td, struct_ptr, contents_only); |
| 3391 | } |
| 3392 | |
| 3393 | int |
| 3394 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3395 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3396 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3397 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3398 | } |
| 3399 | |
| 3400 | asn_dec_rval_t |
| 3401 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3402 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3403 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3404 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3405 | } |
| 3406 | |
| 3407 | asn_enc_rval_t |
| 3408 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
| 3409 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3410 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3411 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3412 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3413 | } |
| 3414 | |
| 3415 | asn_dec_rval_t |
| 3416 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3417 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3418 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3419 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3420 | } |
| 3421 | |
| 3422 | asn_enc_rval_t |
| 3423 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3424 | int ilevel, enum xer_encoder_flags_e flags, |
| 3425 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3426 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3427 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3428 | } |
| 3429 | |
| 3430 | asn_dec_rval_t |
| 3431 | Utf8_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3432 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3433 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3434 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3435 | } |
| 3436 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3437 | asn_enc_rval_t |
| 3438 | Utf8_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 3439 | asn_per_constraints_t *constraints, |
| 3440 | void *structure, asn_per_outp_t *per_out) { |
| 3441 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3442 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3443 | } |
| 3444 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3445 | |
| 3446 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 3447 | |
| 3448 | static ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { |
| 3449 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3450 | }; |
| 3451 | static asn_per_constraints_t asn_PER_Utf8_3_constr_1 = { |
| 3452 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3453 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3454 | }; |
| 3455 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
| 3456 | "Utf8-3", |
| 3457 | "Utf8-3", |
| 3458 | Utf8_3_free, |
| 3459 | Utf8_3_print, |
| 3460 | Utf8_3_constraint, |
| 3461 | Utf8_3_decode_ber, |
| 3462 | Utf8_3_encode_der, |
| 3463 | Utf8_3_decode_xer, |
| 3464 | Utf8_3_encode_xer, |
| 3465 | Utf8_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3466 | Utf8_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3467 | 0, /* Use generic outmost tag fetcher */ |
| 3468 | asn_DEF_Utf8_3_tags_1, |
| 3469 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3470 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3471 | asn_DEF_Utf8_3_tags_1, /* Same as above */ |
| 3472 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3473 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3474 | &asn_PER_Utf8_3_constr_1, |
| 3475 | 0, 0, /* No members */ |
| 3476 | 0 /* No specifics */ |
| 3477 | }; |
| 3478 | |
| 3479 | |
| 3480 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 3481 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 3482 | #include "Utf8-1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3483 | |
| 3484 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 3485 | |
| 3486 | typedef Utf8_1_t Utf8_2_t; |
| 3487 | |
| 3488 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 3489 | |
| 3490 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
| 3491 | asn_struct_free_f Utf8_2_free; |
| 3492 | asn_struct_print_f Utf8_2_print; |
| 3493 | asn_constr_check_f Utf8_2_constraint; |
| 3494 | ber_type_decoder_f Utf8_2_decode_ber; |
| 3495 | der_type_encoder_f Utf8_2_encode_der; |
| 3496 | xer_type_decoder_f Utf8_2_decode_xer; |
| 3497 | xer_type_encoder_f Utf8_2_encode_xer; |
| 3498 | per_type_decoder_f Utf8_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3499 | per_type_encoder_f Utf8_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3500 | |
| 3501 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 3502 | |
| 3503 | int |
| 3504 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3505 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3506 | const Utf8_1_t *st = (const Utf8_1_t *)sptr; |
| 3507 | size_t size; |
| 3508 | |
| 3509 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3510 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3511 | "%s: value not given (%s:%d)", |
| 3512 | td->name, __FILE__, __LINE__); |
| 3513 | return -1; |
| 3514 | } |
| 3515 | |
| 3516 | size = UTF8String_length(st); |
| 3517 | if((ssize_t)size < 0) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3518 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3519 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3520 | td->name, __FILE__, __LINE__); |
| 3521 | return -1; |
| 3522 | } |
| 3523 | |
| 3524 | if((size >= 1 && size <= 2)) { |
| 3525 | /* Constraint check succeeded */ |
| 3526 | return 0; |
| 3527 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3528 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3529 | "%s: constraint failed (%s:%d)", |
| 3530 | td->name, __FILE__, __LINE__); |
| 3531 | return -1; |
| 3532 | } |
| 3533 | } |
| 3534 | |
| 3535 | /* |
| 3536 | * This type is implemented using Utf8_1, |
| 3537 | * so here we adjust the DEF accordingly. |
| 3538 | */ |
| 3539 | static void |
| 3540 | Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3541 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 3542 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
| 3543 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 3544 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 3545 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 3546 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
| 3547 | td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3548 | td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3549 | if(!td->per_constraints) |
| 3550 | td->per_constraints = asn_DEF_Utf8_1.per_constraints; |
| 3551 | td->elements = asn_DEF_Utf8_1.elements; |
| 3552 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 3553 | td->specifics = asn_DEF_Utf8_1.specifics; |
| 3554 | } |
| 3555 | |
| 3556 | void |
| 3557 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
| 3558 | void *struct_ptr, int contents_only) { |
| 3559 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3560 | td->free_struct(td, struct_ptr, contents_only); |
| 3561 | } |
| 3562 | |
| 3563 | int |
| 3564 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3565 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3566 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3567 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3568 | } |
| 3569 | |
| 3570 | asn_dec_rval_t |
| 3571 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3572 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3573 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3574 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3575 | } |
| 3576 | |
| 3577 | asn_enc_rval_t |
| 3578 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
| 3579 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3580 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3581 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3582 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3583 | } |
| 3584 | |
| 3585 | asn_dec_rval_t |
| 3586 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3587 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3588 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3589 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3590 | } |
| 3591 | |
| 3592 | asn_enc_rval_t |
| 3593 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3594 | int ilevel, enum xer_encoder_flags_e flags, |
| 3595 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3596 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3597 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3598 | } |
| 3599 | |
| 3600 | asn_dec_rval_t |
| 3601 | Utf8_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3602 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3603 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3604 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3605 | } |
| 3606 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3607 | asn_enc_rval_t |
| 3608 | Utf8_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 3609 | asn_per_constraints_t *constraints, |
| 3610 | void *structure, asn_per_outp_t *per_out) { |
| 3611 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3612 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3613 | } |
| 3614 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3615 | |
| 3616 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 3617 | |
| 3618 | static ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { |
| 3619 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3620 | }; |
| 3621 | static asn_per_constraints_t asn_PER_Utf8_2_constr_1 = { |
| 3622 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3623 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3624 | }; |
| 3625 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
| 3626 | "Utf8-2", |
| 3627 | "Utf8-2", |
| 3628 | Utf8_2_free, |
| 3629 | Utf8_2_print, |
| 3630 | Utf8_2_constraint, |
| 3631 | Utf8_2_decode_ber, |
| 3632 | Utf8_2_encode_der, |
| 3633 | Utf8_2_decode_xer, |
| 3634 | Utf8_2_encode_xer, |
| 3635 | Utf8_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3636 | Utf8_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3637 | 0, /* Use generic outmost tag fetcher */ |
| 3638 | asn_DEF_Utf8_2_tags_1, |
| 3639 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3640 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3641 | asn_DEF_Utf8_2_tags_1, /* Same as above */ |
| 3642 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3643 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3644 | &asn_PER_Utf8_2_constr_1, |
| 3645 | 0, 0, /* No members */ |
| 3646 | 0 /* No specifics */ |
| 3647 | }; |
| 3648 | |
| 3649 | |
| 3650 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 3651 | |
| 3652 | #include <UTF8String.h> |
| 3653 | |
| 3654 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 3655 | |
| 3656 | typedef UTF8String_t Utf8_1_t; |
| 3657 | |
| 3658 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 3659 | |
| 3660 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; |
| 3661 | asn_struct_free_f Utf8_1_free; |
| 3662 | asn_struct_print_f Utf8_1_print; |
| 3663 | asn_constr_check_f Utf8_1_constraint; |
| 3664 | ber_type_decoder_f Utf8_1_decode_ber; |
| 3665 | der_type_encoder_f Utf8_1_encode_der; |
| 3666 | xer_type_decoder_f Utf8_1_decode_xer; |
| 3667 | xer_type_encoder_f Utf8_1_encode_xer; |
| 3668 | per_type_decoder_f Utf8_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3669 | per_type_encoder_f Utf8_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3670 | |
| 3671 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 3672 | |
| 3673 | int |
| 3674 | Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3675 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3676 | /* Replace with underlying type checker */ |
| 3677 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3678 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3679 | } |
| 3680 | |
| 3681 | /* |
| 3682 | * This type is implemented using UTF8String, |
| 3683 | * so here we adjust the DEF accordingly. |
| 3684 | */ |
| 3685 | static void |
| 3686 | Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3687 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3688 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3689 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3690 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3691 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3692 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3693 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3694 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3695 | if(!td->per_constraints) |
| 3696 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3697 | td->elements = asn_DEF_UTF8String.elements; |
| 3698 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3699 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3700 | } |
| 3701 | |
| 3702 | void |
| 3703 | Utf8_1_free(asn_TYPE_descriptor_t *td, |
| 3704 | void *struct_ptr, int contents_only) { |
| 3705 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3706 | td->free_struct(td, struct_ptr, contents_only); |
| 3707 | } |
| 3708 | |
| 3709 | int |
| 3710 | Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3711 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3712 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3713 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3714 | } |
| 3715 | |
| 3716 | asn_dec_rval_t |
| 3717 | Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3718 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3719 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3720 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3721 | } |
| 3722 | |
| 3723 | asn_enc_rval_t |
| 3724 | Utf8_1_encode_der(asn_TYPE_descriptor_t *td, |
| 3725 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3726 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3727 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3728 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3729 | } |
| 3730 | |
| 3731 | asn_dec_rval_t |
| 3732 | Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3733 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3734 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3735 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3736 | } |
| 3737 | |
| 3738 | asn_enc_rval_t |
| 3739 | Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3740 | int ilevel, enum xer_encoder_flags_e flags, |
| 3741 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3742 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3743 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3744 | } |
| 3745 | |
| 3746 | asn_dec_rval_t |
| 3747 | Utf8_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3748 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3749 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3750 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3751 | } |
| 3752 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3753 | asn_enc_rval_t |
| 3754 | Utf8_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 3755 | asn_per_constraints_t *constraints, |
| 3756 | void *structure, asn_per_outp_t *per_out) { |
| 3757 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3758 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3759 | } |
| 3760 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3761 | |
| 3762 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 3763 | |
| 3764 | static ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { |
| 3765 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3766 | }; |
| 3767 | asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { |
| 3768 | "Utf8-1", |
| 3769 | "Utf8-1", |
| 3770 | Utf8_1_free, |
| 3771 | Utf8_1_print, |
| 3772 | Utf8_1_constraint, |
| 3773 | Utf8_1_decode_ber, |
| 3774 | Utf8_1_encode_der, |
| 3775 | Utf8_1_decode_xer, |
| 3776 | Utf8_1_encode_xer, |
| 3777 | Utf8_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3778 | Utf8_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3779 | 0, /* Use generic outmost tag fetcher */ |
| 3780 | asn_DEF_Utf8_1_tags_1, |
| 3781 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3782 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3783 | asn_DEF_Utf8_1_tags_1, /* Same as above */ |
| 3784 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3785 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3786 | 0, /* No PER visible constraints */ |
| 3787 | 0, 0, /* No members */ |
| 3788 | 0 /* No specifics */ |
| 3789 | }; |
| 3790 | |
| 3791 | |
| 3792 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 3793 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 3794 | #include "Identifier.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3795 | |
| 3796 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 3797 | |
| 3798 | typedef Identifier_t VisibleIdentifier_t; |
| 3799 | |
| 3800 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 3801 | |
| 3802 | extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; |
| 3803 | asn_struct_free_f VisibleIdentifier_free; |
| 3804 | asn_struct_print_f VisibleIdentifier_print; |
| 3805 | asn_constr_check_f VisibleIdentifier_constraint; |
| 3806 | ber_type_decoder_f VisibleIdentifier_decode_ber; |
| 3807 | der_type_encoder_f VisibleIdentifier_encode_der; |
| 3808 | xer_type_decoder_f VisibleIdentifier_decode_xer; |
| 3809 | xer_type_encoder_f VisibleIdentifier_encode_xer; |
| 3810 | per_type_decoder_f VisibleIdentifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3811 | per_type_encoder_f VisibleIdentifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3812 | |
| 3813 | /*** <<< CTABLES [VisibleIdentifier] >>> ***/ |
| 3814 | |
| 3815 | static int permitted_alphabet_table_1[256] = { |
| 3816 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3817 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3818 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 3819 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 3820 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 3821 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 3822 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 3823 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 3824 | }; |
| 3825 | |
| 3826 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3827 | int *table = permitted_alphabet_table_1; |
| 3828 | /* The underlying type is VisibleString */ |
| 3829 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 3830 | const uint8_t *ch = st->buf; |
| 3831 | const uint8_t *end = ch + st->size; |
| 3832 | |
| 3833 | for(; ch < end; ch++) { |
| 3834 | uint8_t cv = *ch; |
| 3835 | if(!table[cv]) return -1; |
| 3836 | } |
| 3837 | return 0; |
| 3838 | } |
| 3839 | |
| 3840 | |
| 3841 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 3842 | |
| 3843 | int |
| 3844 | VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3845 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3846 | const Identifier_t *st = (const Identifier_t *)sptr; |
| 3847 | size_t size; |
| 3848 | |
| 3849 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3850 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3851 | "%s: value not given (%s:%d)", |
| 3852 | td->name, __FILE__, __LINE__); |
| 3853 | return -1; |
| 3854 | } |
| 3855 | |
| 3856 | size = st->size; |
| 3857 | |
| 3858 | if((size >= 1 && size <= 32) |
| 3859 | && !check_permitted_alphabet_1(st)) { |
| 3860 | /* Constraint check succeeded */ |
| 3861 | return 0; |
| 3862 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3863 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3864 | "%s: constraint failed (%s:%d)", |
| 3865 | td->name, __FILE__, __LINE__); |
| 3866 | return -1; |
| 3867 | } |
| 3868 | } |
| 3869 | |
| 3870 | /* |
| 3871 | * This type is implemented using Identifier, |
| 3872 | * so here we adjust the DEF accordingly. |
| 3873 | */ |
| 3874 | static void |
| 3875 | VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3876 | td->free_struct = asn_DEF_Identifier.free_struct; |
| 3877 | td->print_struct = asn_DEF_Identifier.print_struct; |
| 3878 | td->ber_decoder = asn_DEF_Identifier.ber_decoder; |
| 3879 | td->der_encoder = asn_DEF_Identifier.der_encoder; |
| 3880 | td->xer_decoder = asn_DEF_Identifier.xer_decoder; |
| 3881 | td->xer_encoder = asn_DEF_Identifier.xer_encoder; |
| 3882 | td->uper_decoder = asn_DEF_Identifier.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3883 | td->uper_encoder = asn_DEF_Identifier.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3884 | if(!td->per_constraints) |
| 3885 | td->per_constraints = asn_DEF_Identifier.per_constraints; |
| 3886 | td->elements = asn_DEF_Identifier.elements; |
| 3887 | td->elements_count = asn_DEF_Identifier.elements_count; |
| 3888 | td->specifics = asn_DEF_Identifier.specifics; |
| 3889 | } |
| 3890 | |
| 3891 | void |
| 3892 | VisibleIdentifier_free(asn_TYPE_descriptor_t *td, |
| 3893 | void *struct_ptr, int contents_only) { |
| 3894 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3895 | td->free_struct(td, struct_ptr, contents_only); |
| 3896 | } |
| 3897 | |
| 3898 | int |
| 3899 | VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3900 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3901 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3902 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3903 | } |
| 3904 | |
| 3905 | asn_dec_rval_t |
| 3906 | VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3907 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3908 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3909 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3910 | } |
| 3911 | |
| 3912 | asn_enc_rval_t |
| 3913 | VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, |
| 3914 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3915 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3916 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3917 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3918 | } |
| 3919 | |
| 3920 | asn_dec_rval_t |
| 3921 | VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3922 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3923 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3924 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3925 | } |
| 3926 | |
| 3927 | asn_enc_rval_t |
| 3928 | VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3929 | int ilevel, enum xer_encoder_flags_e flags, |
| 3930 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3931 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3932 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3933 | } |
| 3934 | |
| 3935 | asn_dec_rval_t |
| 3936 | VisibleIdentifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3937 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3938 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3939 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3940 | } |
| 3941 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3942 | asn_enc_rval_t |
| 3943 | VisibleIdentifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 3944 | asn_per_constraints_t *constraints, |
| 3945 | void *structure, asn_per_outp_t *per_out) { |
| 3946 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3947 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3948 | } |
| 3949 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3950 | |
| 3951 | /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ |
| 3952 | |
| 3953 | static ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { |
| 3954 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3955 | }; |
| 3956 | asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { |
| 3957 | "VisibleIdentifier", |
| 3958 | "VisibleIdentifier", |
| 3959 | VisibleIdentifier_free, |
| 3960 | VisibleIdentifier_print, |
| 3961 | VisibleIdentifier_constraint, |
| 3962 | VisibleIdentifier_decode_ber, |
| 3963 | VisibleIdentifier_encode_der, |
| 3964 | VisibleIdentifier_decode_xer, |
| 3965 | VisibleIdentifier_encode_xer, |
| 3966 | VisibleIdentifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3967 | VisibleIdentifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3968 | 0, /* Use generic outmost tag fetcher */ |
| 3969 | asn_DEF_VisibleIdentifier_tags_1, |
| 3970 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3971 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3972 | asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ |
| 3973 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3974 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3975 | 0, /* No PER visible constraints */ |
| 3976 | 0, 0, /* No members */ |
| 3977 | 0 /* No specifics */ |
| 3978 | }; |
| 3979 | |
| 3980 | |
| 3981 | /*** <<< INCLUDES [Sequence] >>> ***/ |
| 3982 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 3983 | #include "Int1.h" |
| 3984 | #include "Int4.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3985 | #include <BOOLEAN.h> |
| 3986 | #include <ENUMERATED.h> |
| 3987 | #include <NULL.h> |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 3988 | #include "Int5.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3989 | #include <constr_SEQUENCE.h> |
| 3990 | |
| 3991 | /*** <<< DEPS [Sequence] >>> ***/ |
| 3992 | |
| 3993 | typedef enum enum_c { |
| 3994 | enum_c_one = 1, |
| 3995 | enum_c_two = 2, |
| 3996 | /* |
| 3997 | * Enumeration is extensible |
| 3998 | */ |
| 3999 | enum_c_three = 3 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4000 | } e_enum_c; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4001 | |
| 4002 | /*** <<< TYPE-DECLS [Sequence] >>> ***/ |
| 4003 | |
| 4004 | typedef struct Sequence { |
| 4005 | Int1_t *int1_c /* DEFAULT 3 */; |
| 4006 | Int4_t int4; |
| 4007 | Int4_t int4_c; |
| 4008 | BOOLEAN_t *bool /* DEFAULT 1 */; |
| 4009 | ENUMERATED_t enum_c; |
| 4010 | NULL_t *null /* OPTIONAL */; |
| 4011 | /* |
| 4012 | * This type is extensible, |
| 4013 | * possible extensions are below. |
| 4014 | */ |
| 4015 | Int5_t *int5_c /* OPTIONAL */; |
| 4016 | |
| 4017 | /* Context for parsing across buffer boundaries */ |
| 4018 | asn_struct_ctx_t _asn_ctx; |
| 4019 | } Sequence_t; |
| 4020 | |
| 4021 | /*** <<< FUNC-DECLS [Sequence] >>> ***/ |
| 4022 | |
| 4023 | /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ |
| 4024 | extern asn_TYPE_descriptor_t asn_DEF_Sequence; |
| 4025 | |
| 4026 | /*** <<< CODE [Sequence] >>> ***/ |
| 4027 | |
| 4028 | static int |
| 4029 | enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4030 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4031 | /* Replace with underlying type checker */ |
| 4032 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4033 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4034 | } |
| 4035 | |
| 4036 | /* |
| 4037 | * This type is implemented using ENUMERATED, |
| 4038 | * so here we adjust the DEF accordingly. |
| 4039 | */ |
| 4040 | static void |
| 4041 | enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4042 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 4043 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 4044 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 4045 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 4046 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 4047 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 4048 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4049 | td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4050 | if(!td->per_constraints) |
| 4051 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 4052 | td->elements = asn_DEF_ENUMERATED.elements; |
| 4053 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 4054 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 4055 | } |
| 4056 | |
| 4057 | static void |
| 4058 | enum_c_6_free(asn_TYPE_descriptor_t *td, |
| 4059 | void *struct_ptr, int contents_only) { |
| 4060 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4061 | td->free_struct(td, struct_ptr, contents_only); |
| 4062 | } |
| 4063 | |
| 4064 | static int |
| 4065 | enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4066 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4067 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4068 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4069 | } |
| 4070 | |
| 4071 | static asn_dec_rval_t |
| 4072 | enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4073 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4074 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4075 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4076 | } |
| 4077 | |
| 4078 | static asn_enc_rval_t |
| 4079 | enum_c_6_encode_der(asn_TYPE_descriptor_t *td, |
| 4080 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4081 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4082 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4083 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4084 | } |
| 4085 | |
| 4086 | static asn_dec_rval_t |
| 4087 | enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4088 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4089 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4090 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4091 | } |
| 4092 | |
| 4093 | static asn_enc_rval_t |
| 4094 | enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4095 | int ilevel, enum xer_encoder_flags_e flags, |
| 4096 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4097 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4098 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4099 | } |
| 4100 | |
| 4101 | static asn_dec_rval_t |
| 4102 | enum_c_6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4103 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4104 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4105 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4106 | } |
| 4107 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4108 | static asn_enc_rval_t |
| 4109 | enum_c_6_encode_uper(asn_TYPE_descriptor_t *td, |
| 4110 | asn_per_constraints_t *constraints, |
| 4111 | void *structure, asn_per_outp_t *per_out) { |
| 4112 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4113 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4114 | } |
| 4115 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4116 | static int |
| 4117 | memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4118 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4119 | const Int1_t *st = (const Int1_t *)sptr; |
| 4120 | long value; |
| 4121 | |
| 4122 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4123 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4124 | "%s: value not given (%s:%d)", |
| 4125 | td->name, __FILE__, __LINE__); |
| 4126 | return -1; |
| 4127 | } |
| 4128 | |
| 4129 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4130 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4131 | "%s: value too large (%s:%d)", |
| 4132 | td->name, __FILE__, __LINE__); |
| 4133 | return -1; |
| 4134 | } |
| 4135 | |
| 4136 | if((value >= -2)) { |
| 4137 | /* Constraint check succeeded */ |
| 4138 | return 0; |
| 4139 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4140 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4141 | "%s: constraint failed (%s:%d)", |
| 4142 | td->name, __FILE__, __LINE__); |
| 4143 | return -1; |
| 4144 | } |
| 4145 | } |
| 4146 | |
| 4147 | static int |
| 4148 | memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4149 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4150 | const Int4_t *st = (const Int4_t *)sptr; |
| 4151 | long value; |
| 4152 | |
| 4153 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4154 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4155 | "%s: value not given (%s:%d)", |
| 4156 | td->name, __FILE__, __LINE__); |
| 4157 | return -1; |
| 4158 | } |
| 4159 | |
| 4160 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4161 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4162 | "%s: value too large (%s:%d)", |
| 4163 | td->name, __FILE__, __LINE__); |
| 4164 | return -1; |
| 4165 | } |
| 4166 | |
| 4167 | if((value >= 5 && value <= 7)) { |
| 4168 | /* Constraint check succeeded */ |
| 4169 | return 0; |
| 4170 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4171 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4172 | "%s: constraint failed (%s:%d)", |
| 4173 | td->name, __FILE__, __LINE__); |
| 4174 | return -1; |
| 4175 | } |
| 4176 | } |
| 4177 | |
| 4178 | static int |
| 4179 | memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4180 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4181 | const Int5_t *st = (const Int5_t *)sptr; |
| 4182 | long value; |
| 4183 | |
| 4184 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4185 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4186 | "%s: value not given (%s:%d)", |
| 4187 | td->name, __FILE__, __LINE__); |
| 4188 | return -1; |
| 4189 | } |
| 4190 | |
| 4191 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4192 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4193 | "%s: value too large (%s:%d)", |
| 4194 | td->name, __FILE__, __LINE__); |
| 4195 | return -1; |
| 4196 | } |
| 4197 | |
| 4198 | if((value == 5)) { |
| 4199 | /* Constraint check succeeded */ |
| 4200 | return 0; |
| 4201 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4202 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4203 | "%s: constraint failed (%s:%d)", |
| 4204 | td->name, __FILE__, __LINE__); |
| 4205 | return -1; |
| 4206 | } |
| 4207 | } |
| 4208 | |
| 4209 | |
| 4210 | /*** <<< STAT-DEFS [Sequence] >>> ***/ |
| 4211 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4212 | static int asn_DFL_2_set_3(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4213 | Int1_t *st = *sptr; |
| 4214 | |
| 4215 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4216 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4217 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4218 | if(!st) return -1; |
| 4219 | } |
| 4220 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4221 | if(set_value) { |
| 4222 | /* Install default value 3 */ |
| 4223 | return asn_long2INTEGER(st, 3); |
| 4224 | } else { |
| 4225 | /* Test default value 3 */ |
| 4226 | long value; |
| 4227 | if(asn_INTEGER2long(st, &value)) |
| 4228 | return -1; |
| 4229 | return (value == 3); |
| 4230 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4231 | } |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4232 | static int asn_DFL_5_set_1(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4233 | BOOLEAN_t *st = *sptr; |
| 4234 | |
| 4235 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4236 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4237 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4238 | if(!st) return -1; |
| 4239 | } |
| 4240 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4241 | if(set_value) { |
| 4242 | /* Install default value 1 */ |
| 4243 | *st = 1; |
| 4244 | return 0; |
| 4245 | } else { |
| 4246 | /* Test default value 1 */ |
| 4247 | return (*st == 1); |
| 4248 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4249 | } |
| 4250 | static asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { |
| 4251 | { 1, 3, "one" }, |
| 4252 | { 2, 3, "two" }, |
| 4253 | { 3, 5, "three" } |
| 4254 | /* This list is extensible */ |
| 4255 | }; |
| 4256 | static unsigned int asn_MAP_enum_c_enum2value_6[] = { |
| 4257 | 0, /* one(1) */ |
| 4258 | 2, /* three(3) */ |
| 4259 | 1 /* two(2) */ |
| 4260 | /* This list is extensible */ |
| 4261 | }; |
| 4262 | static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { |
| 4263 | asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ |
| 4264 | asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ |
| 4265 | 3, /* Number of elements in the maps */ |
| 4266 | 3, /* Extensions before this member */ |
| 4267 | 1 /* Strict enumeration */ |
| 4268 | }; |
| 4269 | static ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { |
| 4270 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4271 | }; |
| 4272 | static asn_per_constraints_t asn_PER_enum_c_constr_6 = { |
| 4273 | { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, |
| 4274 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4275 | }; |
| 4276 | static /* Use -fall-defs-global to expose */ |
| 4277 | asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { |
| 4278 | "enum-c", |
| 4279 | "enum-c", |
| 4280 | enum_c_6_free, |
| 4281 | enum_c_6_print, |
| 4282 | enum_c_6_constraint, |
| 4283 | enum_c_6_decode_ber, |
| 4284 | enum_c_6_encode_der, |
| 4285 | enum_c_6_decode_xer, |
| 4286 | enum_c_6_encode_xer, |
| 4287 | enum_c_6_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4288 | enum_c_6_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4289 | 0, /* Use generic outmost tag fetcher */ |
| 4290 | asn_DEF_enum_c_tags_6, |
| 4291 | sizeof(asn_DEF_enum_c_tags_6) |
| 4292 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 4293 | asn_DEF_enum_c_tags_6, /* Same as above */ |
| 4294 | sizeof(asn_DEF_enum_c_tags_6) |
| 4295 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 4296 | &asn_PER_enum_c_constr_6, |
| 4297 | 0, 0, /* Defined elsewhere */ |
| 4298 | &asn_SPC_enum_c_specs_6 /* Additional specs */ |
| 4299 | }; |
| 4300 | |
| 4301 | static asn_per_constraints_t asn_PER_memb_int1_c_constr_2 = { |
| 4302 | { APC_SEMI_CONSTRAINED, -1, -1, -2, 0 } /* (-2..MAX) */, |
| 4303 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4304 | }; |
| 4305 | static asn_per_constraints_t asn_PER_memb_int4_c_constr_4 = { |
| 4306 | { APC_CONSTRAINED, 2, 2, 5, 7 } /* (5..7) */, |
| 4307 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4308 | }; |
| 4309 | static asn_per_constraints_t asn_PER_memb_enum_c_constr_6 = { |
| 4310 | { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, |
| 4311 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4312 | }; |
| 4313 | static asn_per_constraints_t asn_PER_memb_int5_c_constr_13 = { |
| 4314 | { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, |
| 4315 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4316 | }; |
| 4317 | static asn_TYPE_member_t asn_MBR_Sequence_1[] = { |
| 4318 | { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), |
| 4319 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4320 | .tag_mode = 0, |
| 4321 | .type = &asn_DEF_Int1, |
| 4322 | .memb_constraints = memb_int1_c_constraint_1, |
| 4323 | .per_constraints = &asn_PER_memb_int1_c_constr_2, |
| 4324 | .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ |
| 4325 | .name = "int1-c" |
| 4326 | }, |
| 4327 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), |
| 4328 | .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 4329 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 4330 | .type = &asn_DEF_Int4, |
| 4331 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4332 | .per_constraints = 0, /* No PER visible constraints */ |
| 4333 | .default_value = 0, |
| 4334 | .name = "int4" |
| 4335 | }, |
| 4336 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), |
| 4337 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4338 | .tag_mode = 0, |
| 4339 | .type = &asn_DEF_Int4, |
| 4340 | .memb_constraints = memb_int4_c_constraint_1, |
| 4341 | .per_constraints = &asn_PER_memb_int4_c_constr_4, |
| 4342 | .default_value = 0, |
| 4343 | .name = "int4-c" |
| 4344 | }, |
| 4345 | { ATF_POINTER, 1, offsetof(struct Sequence, bool), |
| 4346 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), |
| 4347 | .tag_mode = 0, |
| 4348 | .type = &asn_DEF_BOOLEAN, |
| 4349 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4350 | .per_constraints = 0, /* No PER visible constraints */ |
| 4351 | .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ |
| 4352 | .name = "bool" |
| 4353 | }, |
| 4354 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), |
| 4355 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), |
| 4356 | .tag_mode = 0, |
| 4357 | .type = &asn_DEF_enum_c_6, |
| 4358 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4359 | .per_constraints = &asn_PER_memb_enum_c_constr_6, |
| 4360 | .default_value = 0, |
| 4361 | .name = "enum-c" |
| 4362 | }, |
| 4363 | { ATF_POINTER, 2, offsetof(struct Sequence, null), |
| 4364 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), |
| 4365 | .tag_mode = 0, |
| 4366 | .type = &asn_DEF_NULL, |
| 4367 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4368 | .per_constraints = 0, /* No PER visible constraints */ |
| 4369 | .default_value = 0, |
| 4370 | .name = "null" |
| 4371 | }, |
| 4372 | { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), |
| 4373 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4374 | .tag_mode = 0, |
| 4375 | .type = &asn_DEF_Int5, |
| 4376 | .memb_constraints = memb_int5_c_constraint_1, |
| 4377 | .per_constraints = &asn_PER_memb_int5_c_constr_13, |
| 4378 | .default_value = 0, |
| 4379 | .name = "int5-c" |
| 4380 | }, |
| 4381 | }; |
| 4382 | static int asn_MAP_Sequence_oms_1[] = { 0, 3, 5, 6 }; |
| 4383 | static ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { |
| 4384 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4385 | }; |
| 4386 | static asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { |
| 4387 | { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool at 59 */ |
| 4388 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c at 56 */ |
| 4389 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c at 58 */ |
| 4390 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c at 62 */ |
| 4391 | { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null at 64 */ |
| 4392 | { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c at 60 */ |
| 4393 | { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 at 57 */ |
| 4394 | }; |
| 4395 | static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { |
| 4396 | sizeof(struct Sequence), |
| 4397 | offsetof(struct Sequence, _asn_ctx), |
| 4398 | asn_MAP_Sequence_tag2el_1, |
| 4399 | 7, /* Count of tags in the map */ |
| 4400 | asn_MAP_Sequence_oms_1, /* Optional members */ |
| 4401 | 3, 1, /* Root/Additions */ |
| 4402 | 5, /* Start extensions */ |
| 4403 | 8 /* Stop extensions */ |
| 4404 | }; |
| 4405 | asn_TYPE_descriptor_t asn_DEF_Sequence = { |
| 4406 | "Sequence", |
| 4407 | "Sequence", |
| 4408 | SEQUENCE_free, |
| 4409 | SEQUENCE_print, |
| 4410 | SEQUENCE_constraint, |
| 4411 | SEQUENCE_decode_ber, |
| 4412 | SEQUENCE_encode_der, |
| 4413 | SEQUENCE_decode_xer, |
| 4414 | SEQUENCE_encode_xer, |
| 4415 | SEQUENCE_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4416 | SEQUENCE_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4417 | 0, /* Use generic outmost tag fetcher */ |
| 4418 | asn_DEF_Sequence_tags_1, |
| 4419 | sizeof(asn_DEF_Sequence_tags_1) |
| 4420 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4421 | asn_DEF_Sequence_tags_1, /* Same as above */ |
| 4422 | sizeof(asn_DEF_Sequence_tags_1) |
| 4423 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4424 | 0, /* No PER visible constraints */ |
| 4425 | asn_MBR_Sequence_1, |
| 4426 | 7, /* Elements count */ |
| 4427 | &asn_SPC_Sequence_specs_1 /* Additional specs */ |
| 4428 | }; |
| 4429 | |
| 4430 | |
| 4431 | /*** <<< INCLUDES [SequenceOf] >>> ***/ |
| 4432 | |
| 4433 | #include <asn_SEQUENCE_OF.h> |
| 4434 | #include <constr_SEQUENCE_OF.h> |
| 4435 | |
| 4436 | /*** <<< FWD-DECLS [SequenceOf] >>> ***/ |
| 4437 | |
| 4438 | struct Sequence; |
| 4439 | |
| 4440 | /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ |
| 4441 | |
| 4442 | typedef struct SequenceOf { |
| 4443 | A_SEQUENCE_OF(struct Sequence) list; |
| 4444 | |
| 4445 | /* Context for parsing across buffer boundaries */ |
| 4446 | asn_struct_ctx_t _asn_ctx; |
| 4447 | } SequenceOf_t; |
| 4448 | |
| 4449 | /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ |
| 4450 | |
| 4451 | extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; |
| 4452 | |
| 4453 | /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ |
| 4454 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame^] | 4455 | #include "Sequence.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4456 | |
| 4457 | /*** <<< STAT-DEFS [SequenceOf] >>> ***/ |
| 4458 | |
| 4459 | static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { |
| 4460 | { ATF_POINTER, 0, 0, |
| 4461 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 4462 | .tag_mode = 0, |
| 4463 | .type = &asn_DEF_Sequence, |
| 4464 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4465 | .per_constraints = 0, /* No PER visible constraints */ |
| 4466 | .default_value = 0, |
| 4467 | .name = "" |
| 4468 | }, |
| 4469 | }; |
| 4470 | static ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { |
| 4471 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4472 | }; |
| 4473 | static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { |
| 4474 | sizeof(struct SequenceOf), |
| 4475 | offsetof(struct SequenceOf, _asn_ctx), |
| 4476 | 0, /* XER encoding is XMLDelimitedItemList */ |
| 4477 | }; |
| 4478 | static asn_per_constraints_t asn_PER_SequenceOf_constr_1 = { |
| 4479 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4480 | { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */ |
| 4481 | }; |
| 4482 | asn_TYPE_descriptor_t asn_DEF_SequenceOf = { |
| 4483 | "SequenceOf", |
| 4484 | "SequenceOf", |
| 4485 | SEQUENCE_OF_free, |
| 4486 | SEQUENCE_OF_print, |
| 4487 | SEQUENCE_OF_constraint, |
| 4488 | SEQUENCE_OF_decode_ber, |
| 4489 | SEQUENCE_OF_encode_der, |
| 4490 | SEQUENCE_OF_decode_xer, |
| 4491 | SEQUENCE_OF_encode_xer, |
| 4492 | SEQUENCE_OF_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4493 | SEQUENCE_OF_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4494 | 0, /* Use generic outmost tag fetcher */ |
| 4495 | asn_DEF_SequenceOf_tags_1, |
| 4496 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4497 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 4498 | asn_DEF_SequenceOf_tags_1, /* Same as above */ |
| 4499 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4500 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 4501 | &asn_PER_SequenceOf_constr_1, |
| 4502 | asn_MBR_SequenceOf_1, |
| 4503 | 1, /* Single element */ |
| 4504 | &asn_SPC_SequenceOf_specs_1 /* Additional specs */ |
| 4505 | }; |
| 4506 | |
| 4507 | |
| 4508 | /*** <<< INCLUDES [Enum0] >>> ***/ |
| 4509 | |
| 4510 | #include <ENUMERATED.h> |
| 4511 | |
| 4512 | /*** <<< DEPS [Enum0] >>> ***/ |
| 4513 | |
| 4514 | typedef enum Enum0 { |
| 4515 | Enum0_one = 0, |
| 4516 | Enum0_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4517 | } e_Enum0; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4518 | |
| 4519 | /*** <<< TYPE-DECLS [Enum0] >>> ***/ |
| 4520 | |
| 4521 | typedef ENUMERATED_t Enum0_t; |
| 4522 | |
| 4523 | /*** <<< FUNC-DECLS [Enum0] >>> ***/ |
| 4524 | |
| 4525 | extern asn_TYPE_descriptor_t asn_DEF_Enum0; |
| 4526 | asn_struct_free_f Enum0_free; |
| 4527 | asn_struct_print_f Enum0_print; |
| 4528 | asn_constr_check_f Enum0_constraint; |
| 4529 | ber_type_decoder_f Enum0_decode_ber; |
| 4530 | der_type_encoder_f Enum0_encode_der; |
| 4531 | xer_type_decoder_f Enum0_decode_xer; |
| 4532 | xer_type_encoder_f Enum0_encode_xer; |
| 4533 | per_type_decoder_f Enum0_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4534 | per_type_encoder_f Enum0_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4535 | |
| 4536 | /*** <<< CODE [Enum0] >>> ***/ |
| 4537 | |
| 4538 | int |
| 4539 | Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4540 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4541 | /* Replace with underlying type checker */ |
| 4542 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4543 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4544 | } |
| 4545 | |
| 4546 | /* |
| 4547 | * This type is implemented using ENUMERATED, |
| 4548 | * so here we adjust the DEF accordingly. |
| 4549 | */ |
| 4550 | static void |
| 4551 | Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4552 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 4553 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 4554 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 4555 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 4556 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 4557 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 4558 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4559 | td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4560 | if(!td->per_constraints) |
| 4561 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 4562 | td->elements = asn_DEF_ENUMERATED.elements; |
| 4563 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 4564 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 4565 | } |
| 4566 | |
| 4567 | void |
| 4568 | Enum0_free(asn_TYPE_descriptor_t *td, |
| 4569 | void *struct_ptr, int contents_only) { |
| 4570 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4571 | td->free_struct(td, struct_ptr, contents_only); |
| 4572 | } |
| 4573 | |
| 4574 | int |
| 4575 | Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4576 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4577 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4578 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4579 | } |
| 4580 | |
| 4581 | asn_dec_rval_t |
| 4582 | Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4583 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4584 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4585 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4586 | } |
| 4587 | |
| 4588 | asn_enc_rval_t |
| 4589 | Enum0_encode_der(asn_TYPE_descriptor_t *td, |
| 4590 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4591 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4592 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4593 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4594 | } |
| 4595 | |
| 4596 | asn_dec_rval_t |
| 4597 | Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4598 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4599 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4600 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4601 | } |
| 4602 | |
| 4603 | asn_enc_rval_t |
| 4604 | Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4605 | int ilevel, enum xer_encoder_flags_e flags, |
| 4606 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4607 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4608 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4609 | } |
| 4610 | |
| 4611 | asn_dec_rval_t |
| 4612 | Enum0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4613 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4614 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4615 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4616 | } |
| 4617 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4618 | asn_enc_rval_t |
| 4619 | Enum0_encode_uper(asn_TYPE_descriptor_t *td, |
| 4620 | asn_per_constraints_t *constraints, |
| 4621 | void *structure, asn_per_outp_t *per_out) { |
| 4622 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4623 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4624 | } |
| 4625 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4626 | |
| 4627 | /*** <<< STAT-DEFS [Enum0] >>> ***/ |
| 4628 | |
| 4629 | static asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { |
| 4630 | { 0, 3, "one" }, |
| 4631 | { 1, 3, "two" } |
| 4632 | }; |
| 4633 | static unsigned int asn_MAP_Enum0_enum2value_1[] = { |
| 4634 | 0, /* one(0) */ |
| 4635 | 1 /* two(1) */ |
| 4636 | }; |
| 4637 | static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { |
| 4638 | asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4639 | asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ |
| 4640 | 2, /* Number of elements in the maps */ |
| 4641 | 0, /* Enumeration is not extensible */ |
| 4642 | 1 /* Strict enumeration */ |
| 4643 | }; |
| 4644 | static ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { |
| 4645 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4646 | }; |
| 4647 | static asn_per_constraints_t asn_PER_Enum0_constr_1 = { |
| 4648 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4649 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4650 | }; |
| 4651 | asn_TYPE_descriptor_t asn_DEF_Enum0 = { |
| 4652 | "Enum0", |
| 4653 | "Enum0", |
| 4654 | Enum0_free, |
| 4655 | Enum0_print, |
| 4656 | Enum0_constraint, |
| 4657 | Enum0_decode_ber, |
| 4658 | Enum0_encode_der, |
| 4659 | Enum0_decode_xer, |
| 4660 | Enum0_encode_xer, |
| 4661 | Enum0_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4662 | Enum0_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4663 | 0, /* Use generic outmost tag fetcher */ |
| 4664 | asn_DEF_Enum0_tags_1, |
| 4665 | sizeof(asn_DEF_Enum0_tags_1) |
| 4666 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4667 | asn_DEF_Enum0_tags_1, /* Same as above */ |
| 4668 | sizeof(asn_DEF_Enum0_tags_1) |
| 4669 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4670 | &asn_PER_Enum0_constr_1, |
| 4671 | 0, 0, /* Defined elsewhere */ |
| 4672 | &asn_SPC_Enum0_specs_1 /* Additional specs */ |
| 4673 | }; |
| 4674 | |
| 4675 | |
| 4676 | /*** <<< INCLUDES [Enum1] >>> ***/ |
| 4677 | |
| 4678 | #include <NativeEnumerated.h> |
| 4679 | |
| 4680 | /*** <<< DEPS [Enum1] >>> ***/ |
| 4681 | |
| 4682 | typedef enum Enum1 { |
| 4683 | Enum1_one = 0, |
| 4684 | Enum1_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4685 | } e_Enum1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4686 | |
| 4687 | /*** <<< TYPE-DECLS [Enum1] >>> ***/ |
| 4688 | |
| 4689 | typedef long Enum1_t; |
| 4690 | |
| 4691 | /*** <<< FUNC-DECLS [Enum1] >>> ***/ |
| 4692 | |
| 4693 | extern asn_TYPE_descriptor_t asn_DEF_Enum1; |
| 4694 | asn_struct_free_f Enum1_free; |
| 4695 | asn_struct_print_f Enum1_print; |
| 4696 | asn_constr_check_f Enum1_constraint; |
| 4697 | ber_type_decoder_f Enum1_decode_ber; |
| 4698 | der_type_encoder_f Enum1_encode_der; |
| 4699 | xer_type_decoder_f Enum1_decode_xer; |
| 4700 | xer_type_encoder_f Enum1_encode_xer; |
| 4701 | per_type_decoder_f Enum1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4702 | per_type_encoder_f Enum1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4703 | |
| 4704 | /*** <<< CODE [Enum1] >>> ***/ |
| 4705 | |
| 4706 | int |
| 4707 | Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4708 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4709 | long value; |
| 4710 | |
| 4711 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4712 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4713 | "%s: value not given (%s:%d)", |
| 4714 | td->name, __FILE__, __LINE__); |
| 4715 | return -1; |
| 4716 | } |
| 4717 | |
| 4718 | value = *(const long *)sptr; |
| 4719 | |
| 4720 | if((value == 0)) { |
| 4721 | /* Constraint check succeeded */ |
| 4722 | return 0; |
| 4723 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4724 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4725 | "%s: constraint failed (%s:%d)", |
| 4726 | td->name, __FILE__, __LINE__); |
| 4727 | return -1; |
| 4728 | } |
| 4729 | } |
| 4730 | |
| 4731 | /* |
| 4732 | * This type is implemented using NativeEnumerated, |
| 4733 | * so here we adjust the DEF accordingly. |
| 4734 | */ |
| 4735 | static void |
| 4736 | Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4737 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4738 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
| 4739 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4740 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4741 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4742 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4743 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4744 | td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4745 | if(!td->per_constraints) |
| 4746 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4747 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4748 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4749 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
| 4750 | } |
| 4751 | |
| 4752 | void |
| 4753 | Enum1_free(asn_TYPE_descriptor_t *td, |
| 4754 | void *struct_ptr, int contents_only) { |
| 4755 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4756 | td->free_struct(td, struct_ptr, contents_only); |
| 4757 | } |
| 4758 | |
| 4759 | int |
| 4760 | Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4761 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4762 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4763 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4764 | } |
| 4765 | |
| 4766 | asn_dec_rval_t |
| 4767 | Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4768 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4769 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4770 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4771 | } |
| 4772 | |
| 4773 | asn_enc_rval_t |
| 4774 | Enum1_encode_der(asn_TYPE_descriptor_t *td, |
| 4775 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4776 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4777 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4778 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4779 | } |
| 4780 | |
| 4781 | asn_dec_rval_t |
| 4782 | Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4783 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4784 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4785 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4786 | } |
| 4787 | |
| 4788 | asn_enc_rval_t |
| 4789 | Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4790 | int ilevel, enum xer_encoder_flags_e flags, |
| 4791 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4792 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4793 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4794 | } |
| 4795 | |
| 4796 | asn_dec_rval_t |
| 4797 | Enum1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4798 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4799 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4800 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4801 | } |
| 4802 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4803 | asn_enc_rval_t |
| 4804 | Enum1_encode_uper(asn_TYPE_descriptor_t *td, |
| 4805 | asn_per_constraints_t *constraints, |
| 4806 | void *structure, asn_per_outp_t *per_out) { |
| 4807 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4808 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4809 | } |
| 4810 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4811 | |
| 4812 | /*** <<< STAT-DEFS [Enum1] >>> ***/ |
| 4813 | |
| 4814 | static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { |
| 4815 | { 0, 3, "one" }, |
| 4816 | { 1, 3, "two" } |
| 4817 | }; |
| 4818 | static unsigned int asn_MAP_Enum1_enum2value_1[] = { |
| 4819 | 0, /* one(0) */ |
| 4820 | 1 /* two(1) */ |
| 4821 | }; |
| 4822 | static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { |
| 4823 | asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4824 | asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ |
| 4825 | 2, /* Number of elements in the maps */ |
| 4826 | 0, /* Enumeration is not extensible */ |
| 4827 | 1 /* Strict enumeration */ |
| 4828 | }; |
| 4829 | static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { |
| 4830 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4831 | }; |
| 4832 | static asn_per_constraints_t asn_PER_Enum1_constr_1 = { |
| 4833 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4834 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4835 | }; |
| 4836 | asn_TYPE_descriptor_t asn_DEF_Enum1 = { |
| 4837 | "Enum1", |
| 4838 | "Enum1", |
| 4839 | Enum1_free, |
| 4840 | Enum1_print, |
| 4841 | Enum1_constraint, |
| 4842 | Enum1_decode_ber, |
| 4843 | Enum1_encode_der, |
| 4844 | Enum1_decode_xer, |
| 4845 | Enum1_encode_xer, |
| 4846 | Enum1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4847 | Enum1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4848 | 0, /* Use generic outmost tag fetcher */ |
| 4849 | asn_DEF_Enum1_tags_1, |
| 4850 | sizeof(asn_DEF_Enum1_tags_1) |
| 4851 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4852 | asn_DEF_Enum1_tags_1, /* Same as above */ |
| 4853 | sizeof(asn_DEF_Enum1_tags_1) |
| 4854 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4855 | &asn_PER_Enum1_constr_1, |
| 4856 | 0, 0, /* Defined elsewhere */ |
| 4857 | &asn_SPC_Enum1_specs_1 /* Additional specs */ |
| 4858 | }; |
| 4859 | |
| 4860 | |
| 4861 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 4862 | |
| 4863 | #include <VisibleString.h> |
| 4864 | |
| 4865 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 4866 | |
| 4867 | typedef VisibleString_t Identifier_t; |
| 4868 | |
| 4869 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 4870 | |
| 4871 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
| 4872 | asn_struct_free_f Identifier_free; |
| 4873 | asn_struct_print_f Identifier_print; |
| 4874 | asn_constr_check_f Identifier_constraint; |
| 4875 | ber_type_decoder_f Identifier_decode_ber; |
| 4876 | der_type_encoder_f Identifier_encode_der; |
| 4877 | xer_type_decoder_f Identifier_decode_xer; |
| 4878 | xer_type_encoder_f Identifier_encode_xer; |
| 4879 | per_type_decoder_f Identifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4880 | per_type_encoder_f Identifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4881 | |
| 4882 | /*** <<< CTABLES [Identifier] >>> ***/ |
| 4883 | |
| 4884 | static int permitted_alphabet_table_1[256] = { |
| 4885 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 4886 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 4887 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 4888 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 4889 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 4890 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 4891 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 4892 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 4893 | }; |
| 4894 | |
| 4895 | static int check_permitted_alphabet_1(const void *sptr) { |
| 4896 | int *table = permitted_alphabet_table_1; |
| 4897 | /* The underlying type is VisibleString */ |
| 4898 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 4899 | const uint8_t *ch = st->buf; |
| 4900 | const uint8_t *end = ch + st->size; |
| 4901 | |
| 4902 | for(; ch < end; ch++) { |
| 4903 | uint8_t cv = *ch; |
| 4904 | if(!table[cv]) return -1; |
| 4905 | } |
| 4906 | return 0; |
| 4907 | } |
| 4908 | |
| 4909 | |
| 4910 | /*** <<< CODE [Identifier] >>> ***/ |
| 4911 | |
| 4912 | int |
| 4913 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4914 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4915 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 4916 | size_t size; |
| 4917 | |
| 4918 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4919 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4920 | "%s: value not given (%s:%d)", |
| 4921 | td->name, __FILE__, __LINE__); |
| 4922 | return -1; |
| 4923 | } |
| 4924 | |
| 4925 | size = st->size; |
| 4926 | |
| 4927 | if((size >= 1 && size <= 32) |
| 4928 | && !check_permitted_alphabet_1(st)) { |
| 4929 | /* Constraint check succeeded */ |
| 4930 | return 0; |
| 4931 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4932 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4933 | "%s: constraint failed (%s:%d)", |
| 4934 | td->name, __FILE__, __LINE__); |
| 4935 | return -1; |
| 4936 | } |
| 4937 | } |
| 4938 | |
| 4939 | /* |
| 4940 | * This type is implemented using VisibleString, |
| 4941 | * so here we adjust the DEF accordingly. |
| 4942 | */ |
| 4943 | static void |
| 4944 | Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4945 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 4946 | td->print_struct = asn_DEF_VisibleString.print_struct; |
| 4947 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 4948 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 4949 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 4950 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
| 4951 | td->uper_decoder = asn_DEF_VisibleString.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4952 | td->uper_encoder = asn_DEF_VisibleString.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4953 | if(!td->per_constraints) |
| 4954 | td->per_constraints = asn_DEF_VisibleString.per_constraints; |
| 4955 | td->elements = asn_DEF_VisibleString.elements; |
| 4956 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 4957 | td->specifics = asn_DEF_VisibleString.specifics; |
| 4958 | } |
| 4959 | |
| 4960 | void |
| 4961 | Identifier_free(asn_TYPE_descriptor_t *td, |
| 4962 | void *struct_ptr, int contents_only) { |
| 4963 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4964 | td->free_struct(td, struct_ptr, contents_only); |
| 4965 | } |
| 4966 | |
| 4967 | int |
| 4968 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4969 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4970 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4971 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4972 | } |
| 4973 | |
| 4974 | asn_dec_rval_t |
| 4975 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4976 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4977 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4978 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4979 | } |
| 4980 | |
| 4981 | asn_enc_rval_t |
| 4982 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
| 4983 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4984 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4985 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4986 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4987 | } |
| 4988 | |
| 4989 | asn_dec_rval_t |
| 4990 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4991 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4992 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4993 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4994 | } |
| 4995 | |
| 4996 | asn_enc_rval_t |
| 4997 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4998 | int ilevel, enum xer_encoder_flags_e flags, |
| 4999 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 5000 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5001 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 5002 | } |
| 5003 | |
| 5004 | asn_dec_rval_t |
| 5005 | Identifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5006 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 5007 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5008 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 5009 | } |
| 5010 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5011 | asn_enc_rval_t |
| 5012 | Identifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 5013 | asn_per_constraints_t *constraints, |
| 5014 | void *structure, asn_per_outp_t *per_out) { |
| 5015 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5016 | return td->uper_encoder(td, constraints, structure, per_out); |
| 5017 | } |
| 5018 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5019 | |
| 5020 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 5021 | |
| 5022 | static ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { |
| 5023 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 5024 | }; |
| 5025 | static asn_per_constraints_t asn_PER_Identifier_constr_1 = { |
| 5026 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 5027 | { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */ |
| 5028 | }; |
| 5029 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
| 5030 | "Identifier", |
| 5031 | "Identifier", |
| 5032 | Identifier_free, |
| 5033 | Identifier_print, |
| 5034 | Identifier_constraint, |
| 5035 | Identifier_decode_ber, |
| 5036 | Identifier_encode_der, |
| 5037 | Identifier_decode_xer, |
| 5038 | Identifier_encode_xer, |
| 5039 | Identifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5040 | Identifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5041 | 0, /* Use generic outmost tag fetcher */ |
| 5042 | asn_DEF_Identifier_tags_1, |
| 5043 | sizeof(asn_DEF_Identifier_tags_1) |
| 5044 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 5045 | asn_DEF_Identifier_tags_1, /* Same as above */ |
| 5046 | sizeof(asn_DEF_Identifier_tags_1) |
| 5047 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 5048 | &asn_PER_Identifier_constr_1, |
| 5049 | 0, 0, /* No members */ |
| 5050 | 0 /* No specifics */ |
| 5051 | }; |
| 5052 | |