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 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 1280 | { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 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] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 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, 2, 3, 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, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1339 | }; |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 1340 | static int permitted_alphabet_code2value_1[6] = { |
| 1341 | 65,66,67,100,101,102,}; |
| 1342 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1343 | |
| 1344 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1345 | int *table = permitted_alphabet_table_1; |
| 1346 | /* The underlying type is IA5String */ |
| 1347 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1348 | const uint8_t *ch = st->buf; |
| 1349 | const uint8_t *end = ch + st->size; |
| 1350 | |
| 1351 | for(; ch < end; ch++) { |
| 1352 | uint8_t cv = *ch; |
| 1353 | if(!table[cv]) return -1; |
| 1354 | } |
| 1355 | return 0; |
| 1356 | } |
| 1357 | |
| 1358 | |
| 1359 | /*** <<< CODE [Str3] >>> ***/ |
| 1360 | |
| 1361 | int |
| 1362 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1363 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1364 | const Str2_t *st = (const Str2_t *)sptr; |
| 1365 | size_t size; |
| 1366 | |
| 1367 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1368 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1369 | "%s: value not given (%s:%d)", |
| 1370 | td->name, __FILE__, __LINE__); |
| 1371 | return -1; |
| 1372 | } |
| 1373 | |
| 1374 | size = st->size; |
| 1375 | |
| 1376 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
| 1377 | && !check_permitted_alphabet_1(st)) { |
| 1378 | /* Constraint check succeeded */ |
| 1379 | return 0; |
| 1380 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1381 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1382 | "%s: constraint failed (%s:%d)", |
| 1383 | td->name, __FILE__, __LINE__); |
| 1384 | return -1; |
| 1385 | } |
| 1386 | } |
| 1387 | |
| 1388 | /* |
| 1389 | * This type is implemented using Str2, |
| 1390 | * so here we adjust the DEF accordingly. |
| 1391 | */ |
| 1392 | static void |
| 1393 | Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1394 | td->free_struct = asn_DEF_Str2.free_struct; |
| 1395 | td->print_struct = asn_DEF_Str2.print_struct; |
| 1396 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 1397 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 1398 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 1399 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
| 1400 | td->uper_decoder = asn_DEF_Str2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1401 | td->uper_encoder = asn_DEF_Str2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1402 | if(!td->per_constraints) |
| 1403 | td->per_constraints = asn_DEF_Str2.per_constraints; |
| 1404 | td->elements = asn_DEF_Str2.elements; |
| 1405 | td->elements_count = asn_DEF_Str2.elements_count; |
| 1406 | td->specifics = asn_DEF_Str2.specifics; |
| 1407 | } |
| 1408 | |
| 1409 | void |
| 1410 | Str3_free(asn_TYPE_descriptor_t *td, |
| 1411 | void *struct_ptr, int contents_only) { |
| 1412 | Str3_1_inherit_TYPE_descriptor(td); |
| 1413 | td->free_struct(td, struct_ptr, contents_only); |
| 1414 | } |
| 1415 | |
| 1416 | int |
| 1417 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1418 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1419 | Str3_1_inherit_TYPE_descriptor(td); |
| 1420 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1421 | } |
| 1422 | |
| 1423 | asn_dec_rval_t |
| 1424 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1425 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1426 | Str3_1_inherit_TYPE_descriptor(td); |
| 1427 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1428 | } |
| 1429 | |
| 1430 | asn_enc_rval_t |
| 1431 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
| 1432 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1433 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1434 | Str3_1_inherit_TYPE_descriptor(td); |
| 1435 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1436 | } |
| 1437 | |
| 1438 | asn_dec_rval_t |
| 1439 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1440 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1441 | Str3_1_inherit_TYPE_descriptor(td); |
| 1442 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1443 | } |
| 1444 | |
| 1445 | asn_enc_rval_t |
| 1446 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1447 | int ilevel, enum xer_encoder_flags_e flags, |
| 1448 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1449 | Str3_1_inherit_TYPE_descriptor(td); |
| 1450 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1451 | } |
| 1452 | |
| 1453 | asn_dec_rval_t |
| 1454 | Str3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1455 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1456 | Str3_1_inherit_TYPE_descriptor(td); |
| 1457 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1458 | } |
| 1459 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1460 | asn_enc_rval_t |
| 1461 | Str3_encode_uper(asn_TYPE_descriptor_t *td, |
| 1462 | asn_per_constraints_t *constraints, |
| 1463 | void *structure, asn_per_outp_t *per_out) { |
| 1464 | Str3_1_inherit_TYPE_descriptor(td); |
| 1465 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1466 | } |
| 1467 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1468 | |
| 1469 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1470 | |
| 1471 | static ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { |
| 1472 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1473 | }; |
| 1474 | static asn_per_constraints_t asn_PER_Str3_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 1475 | { APC_CONSTRAINED, 6, 6, 65, 102 } /* (65..102) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1476 | { APC_CONSTRAINED, 5, 5, 10, 27 } /* (SIZE(10..27)) */ |
| 1477 | }; |
| 1478 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
| 1479 | "Str3", |
| 1480 | "Str3", |
| 1481 | Str3_free, |
| 1482 | Str3_print, |
| 1483 | Str3_constraint, |
| 1484 | Str3_decode_ber, |
| 1485 | Str3_encode_der, |
| 1486 | Str3_decode_xer, |
| 1487 | Str3_encode_xer, |
| 1488 | Str3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1489 | Str3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1490 | 0, /* Use generic outmost tag fetcher */ |
| 1491 | asn_DEF_Str3_tags_1, |
| 1492 | sizeof(asn_DEF_Str3_tags_1) |
| 1493 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1494 | asn_DEF_Str3_tags_1, /* Same as above */ |
| 1495 | sizeof(asn_DEF_Str3_tags_1) |
| 1496 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1497 | &asn_PER_Str3_constr_1, |
| 1498 | 0, 0, /* No members */ |
| 1499 | 0 /* No specifics */ |
| 1500 | }; |
| 1501 | |
| 1502 | |
| 1503 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1504 | |
| 1505 | #include <IA5String.h> |
| 1506 | |
| 1507 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1508 | |
| 1509 | typedef IA5String_t Str4_t; |
| 1510 | |
| 1511 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1512 | |
| 1513 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
| 1514 | asn_struct_free_f Str4_free; |
| 1515 | asn_struct_print_f Str4_print; |
| 1516 | asn_constr_check_f Str4_constraint; |
| 1517 | ber_type_decoder_f Str4_decode_ber; |
| 1518 | der_type_encoder_f Str4_encode_der; |
| 1519 | xer_type_decoder_f Str4_decode_xer; |
| 1520 | xer_type_encoder_f Str4_encode_xer; |
| 1521 | per_type_decoder_f Str4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1522 | per_type_encoder_f Str4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1523 | |
| 1524 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1525 | |
| 1526 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1527 | /* The underlying type is IA5String */ |
| 1528 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1529 | const uint8_t *ch = st->buf; |
| 1530 | const uint8_t *end = ch + st->size; |
| 1531 | |
| 1532 | for(; ch < end; ch++) { |
| 1533 | uint8_t cv = *ch; |
| 1534 | if(!(cv <= 127)) return -1; |
| 1535 | } |
| 1536 | return 0; |
| 1537 | } |
| 1538 | |
| 1539 | |
| 1540 | /*** <<< CODE [Str4] >>> ***/ |
| 1541 | |
| 1542 | int |
| 1543 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1544 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1545 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1546 | |
| 1547 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1548 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1549 | "%s: value not given (%s:%d)", |
| 1550 | td->name, __FILE__, __LINE__); |
| 1551 | return -1; |
| 1552 | } |
| 1553 | |
| 1554 | |
| 1555 | if(!check_permitted_alphabet_1(st)) { |
| 1556 | /* Constraint check succeeded */ |
| 1557 | return 0; |
| 1558 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1559 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1560 | "%s: constraint failed (%s:%d)", |
| 1561 | td->name, __FILE__, __LINE__); |
| 1562 | return -1; |
| 1563 | } |
| 1564 | } |
| 1565 | |
| 1566 | /* |
| 1567 | * This type is implemented using IA5String, |
| 1568 | * so here we adjust the DEF accordingly. |
| 1569 | */ |
| 1570 | static void |
| 1571 | Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1572 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1573 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1574 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1575 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1576 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1577 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1578 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1579 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1580 | if(!td->per_constraints) |
| 1581 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1582 | td->elements = asn_DEF_IA5String.elements; |
| 1583 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1584 | td->specifics = asn_DEF_IA5String.specifics; |
| 1585 | } |
| 1586 | |
| 1587 | void |
| 1588 | Str4_free(asn_TYPE_descriptor_t *td, |
| 1589 | void *struct_ptr, int contents_only) { |
| 1590 | Str4_1_inherit_TYPE_descriptor(td); |
| 1591 | td->free_struct(td, struct_ptr, contents_only); |
| 1592 | } |
| 1593 | |
| 1594 | int |
| 1595 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1596 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1597 | Str4_1_inherit_TYPE_descriptor(td); |
| 1598 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1599 | } |
| 1600 | |
| 1601 | asn_dec_rval_t |
| 1602 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1603 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1604 | Str4_1_inherit_TYPE_descriptor(td); |
| 1605 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1606 | } |
| 1607 | |
| 1608 | asn_enc_rval_t |
| 1609 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
| 1610 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1611 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1612 | Str4_1_inherit_TYPE_descriptor(td); |
| 1613 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1614 | } |
| 1615 | |
| 1616 | asn_dec_rval_t |
| 1617 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1618 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1619 | Str4_1_inherit_TYPE_descriptor(td); |
| 1620 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1621 | } |
| 1622 | |
| 1623 | asn_enc_rval_t |
| 1624 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1625 | int ilevel, enum xer_encoder_flags_e flags, |
| 1626 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1627 | Str4_1_inherit_TYPE_descriptor(td); |
| 1628 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1629 | } |
| 1630 | |
| 1631 | asn_dec_rval_t |
| 1632 | Str4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1633 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1634 | Str4_1_inherit_TYPE_descriptor(td); |
| 1635 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1636 | } |
| 1637 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1638 | asn_enc_rval_t |
| 1639 | Str4_encode_uper(asn_TYPE_descriptor_t *td, |
| 1640 | asn_per_constraints_t *constraints, |
| 1641 | void *structure, asn_per_outp_t *per_out) { |
| 1642 | Str4_1_inherit_TYPE_descriptor(td); |
| 1643 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1644 | } |
| 1645 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1646 | |
| 1647 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1648 | |
| 1649 | static ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { |
| 1650 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1651 | }; |
| 1652 | static asn_per_constraints_t asn_PER_Str4_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 1653 | { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1654 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 1655 | }; |
| 1656 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
| 1657 | "Str4", |
| 1658 | "Str4", |
| 1659 | Str4_free, |
| 1660 | Str4_print, |
| 1661 | Str4_constraint, |
| 1662 | Str4_decode_ber, |
| 1663 | Str4_encode_der, |
| 1664 | Str4_decode_xer, |
| 1665 | Str4_encode_xer, |
| 1666 | Str4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1667 | Str4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1668 | 0, /* Use generic outmost tag fetcher */ |
| 1669 | asn_DEF_Str4_tags_1, |
| 1670 | sizeof(asn_DEF_Str4_tags_1) |
| 1671 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1672 | asn_DEF_Str4_tags_1, /* Same as above */ |
| 1673 | sizeof(asn_DEF_Str4_tags_1) |
| 1674 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1675 | &asn_PER_Str4_constr_1, |
| 1676 | 0, 0, /* No members */ |
| 1677 | 0 /* No specifics */ |
| 1678 | }; |
| 1679 | |
| 1680 | |
| 1681 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1682 | |
| 1683 | #include <IA5String.h> |
| 1684 | |
| 1685 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1686 | |
| 1687 | typedef IA5String_t PER_Visible_t; |
| 1688 | |
| 1689 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1690 | |
| 1691 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
| 1692 | asn_struct_free_f PER_Visible_free; |
| 1693 | asn_struct_print_f PER_Visible_print; |
| 1694 | asn_constr_check_f PER_Visible_constraint; |
| 1695 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1696 | der_type_encoder_f PER_Visible_encode_der; |
| 1697 | xer_type_decoder_f PER_Visible_decode_xer; |
| 1698 | xer_type_encoder_f PER_Visible_encode_xer; |
| 1699 | per_type_decoder_f PER_Visible_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1700 | per_type_encoder_f PER_Visible_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1701 | |
| 1702 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1703 | |
| 1704 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1705 | /* The underlying type is IA5String */ |
| 1706 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1707 | const uint8_t *ch = st->buf; |
| 1708 | const uint8_t *end = ch + st->size; |
| 1709 | |
| 1710 | for(; ch < end; ch++) { |
| 1711 | uint8_t cv = *ch; |
| 1712 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 1713 | } |
| 1714 | return 0; |
| 1715 | } |
| 1716 | |
| 1717 | |
| 1718 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1719 | |
| 1720 | int |
| 1721 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1722 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1723 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1724 | |
| 1725 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1726 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1727 | "%s: value not given (%s:%d)", |
| 1728 | td->name, __FILE__, __LINE__); |
| 1729 | return -1; |
| 1730 | } |
| 1731 | |
| 1732 | |
| 1733 | if(!check_permitted_alphabet_1(st)) { |
| 1734 | /* Constraint check succeeded */ |
| 1735 | return 0; |
| 1736 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1737 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1738 | "%s: constraint failed (%s:%d)", |
| 1739 | td->name, __FILE__, __LINE__); |
| 1740 | return -1; |
| 1741 | } |
| 1742 | } |
| 1743 | |
| 1744 | /* |
| 1745 | * This type is implemented using IA5String, |
| 1746 | * so here we adjust the DEF accordingly. |
| 1747 | */ |
| 1748 | static void |
| 1749 | PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1750 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1751 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1752 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1753 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1754 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1755 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1756 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1757 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1758 | if(!td->per_constraints) |
| 1759 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1760 | td->elements = asn_DEF_IA5String.elements; |
| 1761 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1762 | td->specifics = asn_DEF_IA5String.specifics; |
| 1763 | } |
| 1764 | |
| 1765 | void |
| 1766 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
| 1767 | void *struct_ptr, int contents_only) { |
| 1768 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1769 | td->free_struct(td, struct_ptr, contents_only); |
| 1770 | } |
| 1771 | |
| 1772 | int |
| 1773 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1774 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1775 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1776 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1777 | } |
| 1778 | |
| 1779 | asn_dec_rval_t |
| 1780 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1781 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1782 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1783 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1784 | } |
| 1785 | |
| 1786 | asn_enc_rval_t |
| 1787 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
| 1788 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1789 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1790 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1791 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1792 | } |
| 1793 | |
| 1794 | asn_dec_rval_t |
| 1795 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1796 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1797 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1798 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1799 | } |
| 1800 | |
| 1801 | asn_enc_rval_t |
| 1802 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1803 | int ilevel, enum xer_encoder_flags_e flags, |
| 1804 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1805 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1806 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1807 | } |
| 1808 | |
| 1809 | asn_dec_rval_t |
| 1810 | PER_Visible_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1811 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1812 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1813 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1814 | } |
| 1815 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1816 | asn_enc_rval_t |
| 1817 | PER_Visible_encode_uper(asn_TYPE_descriptor_t *td, |
| 1818 | asn_per_constraints_t *constraints, |
| 1819 | void *structure, asn_per_outp_t *per_out) { |
| 1820 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1821 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1822 | } |
| 1823 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1824 | |
| 1825 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1826 | |
| 1827 | static ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { |
| 1828 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1829 | }; |
| 1830 | static asn_per_constraints_t asn_PER_PER_Visible_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 1831 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1832 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 1833 | }; |
| 1834 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
| 1835 | "PER-Visible", |
| 1836 | "PER-Visible", |
| 1837 | PER_Visible_free, |
| 1838 | PER_Visible_print, |
| 1839 | PER_Visible_constraint, |
| 1840 | PER_Visible_decode_ber, |
| 1841 | PER_Visible_encode_der, |
| 1842 | PER_Visible_decode_xer, |
| 1843 | PER_Visible_encode_xer, |
| 1844 | PER_Visible_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1845 | PER_Visible_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1846 | 0, /* Use generic outmost tag fetcher */ |
| 1847 | asn_DEF_PER_Visible_tags_1, |
| 1848 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1849 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1850 | asn_DEF_PER_Visible_tags_1, /* Same as above */ |
| 1851 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1852 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1853 | &asn_PER_PER_Visible_constr_1, |
| 1854 | 0, 0, /* No members */ |
| 1855 | 0 /* No specifics */ |
| 1856 | }; |
| 1857 | |
| 1858 | |
| 1859 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1860 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 1861 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1862 | |
| 1863 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1864 | |
| 1865 | typedef PER_Visible_t PER_Visible_2_t; |
| 1866 | |
| 1867 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1868 | |
| 1869 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
| 1870 | asn_struct_free_f PER_Visible_2_free; |
| 1871 | asn_struct_print_f PER_Visible_2_print; |
| 1872 | asn_constr_check_f PER_Visible_2_constraint; |
| 1873 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1874 | der_type_encoder_f PER_Visible_2_encode_der; |
| 1875 | xer_type_decoder_f PER_Visible_2_decode_xer; |
| 1876 | xer_type_encoder_f PER_Visible_2_encode_xer; |
| 1877 | per_type_decoder_f PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1878 | per_type_encoder_f PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1879 | |
| 1880 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1881 | |
| 1882 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1883 | /* The underlying type is IA5String */ |
| 1884 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1885 | const uint8_t *ch = st->buf; |
| 1886 | const uint8_t *end = ch + st->size; |
| 1887 | |
| 1888 | for(; ch < end; ch++) { |
| 1889 | uint8_t cv = *ch; |
| 1890 | if(!(cv >= 69 && cv <= 70)) return -1; |
| 1891 | } |
| 1892 | return 0; |
| 1893 | } |
| 1894 | |
| 1895 | |
| 1896 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1897 | |
| 1898 | int |
| 1899 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1900 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1901 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 1902 | |
| 1903 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1904 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1905 | "%s: value not given (%s:%d)", |
| 1906 | td->name, __FILE__, __LINE__); |
| 1907 | return -1; |
| 1908 | } |
| 1909 | |
| 1910 | |
| 1911 | if(!check_permitted_alphabet_1(st)) { |
| 1912 | /* Constraint check succeeded */ |
| 1913 | return 0; |
| 1914 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 1915 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1916 | "%s: constraint failed (%s:%d)", |
| 1917 | td->name, __FILE__, __LINE__); |
| 1918 | return -1; |
| 1919 | } |
| 1920 | } |
| 1921 | |
| 1922 | /* |
| 1923 | * This type is implemented using PER_Visible, |
| 1924 | * so here we adjust the DEF accordingly. |
| 1925 | */ |
| 1926 | static void |
| 1927 | PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1928 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1929 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1930 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1931 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1932 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1933 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1934 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1935 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1936 | if(!td->per_constraints) |
| 1937 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 1938 | td->elements = asn_DEF_PER_Visible.elements; |
| 1939 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1940 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 1941 | } |
| 1942 | |
| 1943 | void |
| 1944 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 1945 | void *struct_ptr, int contents_only) { |
| 1946 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1947 | td->free_struct(td, struct_ptr, contents_only); |
| 1948 | } |
| 1949 | |
| 1950 | int |
| 1951 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1952 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1953 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1954 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1955 | } |
| 1956 | |
| 1957 | asn_dec_rval_t |
| 1958 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1959 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1960 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1961 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1962 | } |
| 1963 | |
| 1964 | asn_enc_rval_t |
| 1965 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 1966 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1967 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1968 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1969 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1970 | } |
| 1971 | |
| 1972 | asn_dec_rval_t |
| 1973 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1974 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1975 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1976 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1977 | } |
| 1978 | |
| 1979 | asn_enc_rval_t |
| 1980 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1981 | int ilevel, enum xer_encoder_flags_e flags, |
| 1982 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1983 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1984 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1985 | } |
| 1986 | |
| 1987 | asn_dec_rval_t |
| 1988 | PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1989 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1990 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1991 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1992 | } |
| 1993 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1994 | asn_enc_rval_t |
| 1995 | PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 1996 | asn_per_constraints_t *constraints, |
| 1997 | void *structure, asn_per_outp_t *per_out) { |
| 1998 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1999 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2000 | } |
| 2001 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2002 | |
| 2003 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 2004 | |
| 2005 | static ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { |
| 2006 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2007 | }; |
| 2008 | static asn_per_constraints_t asn_PER_PER_Visible_2_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 2009 | { APC_CONSTRAINED, 1, 1, 69, 70 } /* (69..70) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2010 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2011 | }; |
| 2012 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
| 2013 | "PER-Visible-2", |
| 2014 | "PER-Visible-2", |
| 2015 | PER_Visible_2_free, |
| 2016 | PER_Visible_2_print, |
| 2017 | PER_Visible_2_constraint, |
| 2018 | PER_Visible_2_decode_ber, |
| 2019 | PER_Visible_2_encode_der, |
| 2020 | PER_Visible_2_decode_xer, |
| 2021 | PER_Visible_2_encode_xer, |
| 2022 | PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2023 | PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2024 | 0, /* Use generic outmost tag fetcher */ |
| 2025 | asn_DEF_PER_Visible_2_tags_1, |
| 2026 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2027 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2028 | asn_DEF_PER_Visible_2_tags_1, /* Same as above */ |
| 2029 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2030 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2031 | &asn_PER_PER_Visible_2_constr_1, |
| 2032 | 0, 0, /* No members */ |
| 2033 | 0 /* No specifics */ |
| 2034 | }; |
| 2035 | |
| 2036 | |
| 2037 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 2038 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2039 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2040 | |
| 2041 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2042 | |
| 2043 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 2044 | |
| 2045 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2046 | |
| 2047 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
| 2048 | asn_struct_free_f Not_PER_Visible_1_free; |
| 2049 | asn_struct_print_f Not_PER_Visible_1_print; |
| 2050 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 2051 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 2052 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
| 2053 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
| 2054 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
| 2055 | per_type_decoder_f Not_PER_Visible_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2056 | per_type_encoder_f Not_PER_Visible_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2057 | |
| 2058 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 2059 | |
| 2060 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2061 | /* The underlying type is IA5String */ |
| 2062 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2063 | const uint8_t *ch = st->buf; |
| 2064 | const uint8_t *end = ch + st->size; |
| 2065 | |
| 2066 | for(; ch < end; ch++) { |
| 2067 | uint8_t cv = *ch; |
| 2068 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 2069 | } |
| 2070 | return 0; |
| 2071 | } |
| 2072 | |
| 2073 | |
| 2074 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 2075 | |
| 2076 | int |
| 2077 | 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] | 2078 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2079 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2080 | |
| 2081 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2082 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2083 | "%s: value not given (%s:%d)", |
| 2084 | td->name, __FILE__, __LINE__); |
| 2085 | return -1; |
| 2086 | } |
| 2087 | |
| 2088 | |
| 2089 | if(!check_permitted_alphabet_1(st)) { |
| 2090 | /* Constraint check succeeded */ |
| 2091 | return 0; |
| 2092 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2093 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2094 | "%s: constraint failed (%s:%d)", |
| 2095 | td->name, __FILE__, __LINE__); |
| 2096 | return -1; |
| 2097 | } |
| 2098 | } |
| 2099 | |
| 2100 | /* |
| 2101 | * This type is implemented using PER_Visible, |
| 2102 | * so here we adjust the DEF accordingly. |
| 2103 | */ |
| 2104 | static void |
| 2105 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2106 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2107 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2108 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2109 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2110 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2111 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2112 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2113 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2114 | if(!td->per_constraints) |
| 2115 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2116 | td->elements = asn_DEF_PER_Visible.elements; |
| 2117 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2118 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2119 | } |
| 2120 | |
| 2121 | void |
| 2122 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
| 2123 | void *struct_ptr, int contents_only) { |
| 2124 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2125 | td->free_struct(td, struct_ptr, contents_only); |
| 2126 | } |
| 2127 | |
| 2128 | int |
| 2129 | Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2130 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2131 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2132 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2133 | } |
| 2134 | |
| 2135 | asn_dec_rval_t |
| 2136 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2137 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2138 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2139 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2140 | } |
| 2141 | |
| 2142 | asn_enc_rval_t |
| 2143 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
| 2144 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2145 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2146 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2147 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2148 | } |
| 2149 | |
| 2150 | asn_dec_rval_t |
| 2151 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2152 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2153 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2154 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2155 | } |
| 2156 | |
| 2157 | asn_enc_rval_t |
| 2158 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2159 | int ilevel, enum xer_encoder_flags_e flags, |
| 2160 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2161 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2162 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2163 | } |
| 2164 | |
| 2165 | asn_dec_rval_t |
| 2166 | Not_PER_Visible_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2167 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2168 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2169 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2170 | } |
| 2171 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2172 | asn_enc_rval_t |
| 2173 | Not_PER_Visible_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 2174 | asn_per_constraints_t *constraints, |
| 2175 | void *structure, asn_per_outp_t *per_out) { |
| 2176 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2177 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2178 | } |
| 2179 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2180 | |
| 2181 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 2182 | |
| 2183 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { |
| 2184 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2185 | }; |
| 2186 | static asn_per_constraints_t asn_PER_Not_PER_Visible_1_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 2187 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2188 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2189 | }; |
| 2190 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
| 2191 | "Not-PER-Visible-1", |
| 2192 | "Not-PER-Visible-1", |
| 2193 | Not_PER_Visible_1_free, |
| 2194 | Not_PER_Visible_1_print, |
| 2195 | Not_PER_Visible_1_constraint, |
| 2196 | Not_PER_Visible_1_decode_ber, |
| 2197 | Not_PER_Visible_1_encode_der, |
| 2198 | Not_PER_Visible_1_decode_xer, |
| 2199 | Not_PER_Visible_1_encode_xer, |
| 2200 | Not_PER_Visible_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2201 | Not_PER_Visible_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2202 | 0, /* Use generic outmost tag fetcher */ |
| 2203 | asn_DEF_Not_PER_Visible_1_tags_1, |
| 2204 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2205 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 2206 | asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ |
| 2207 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2208 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 2209 | &asn_PER_Not_PER_Visible_1_constr_1, |
| 2210 | 0, 0, /* No members */ |
| 2211 | 0 /* No specifics */ |
| 2212 | }; |
| 2213 | |
| 2214 | |
| 2215 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 2216 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2217 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2218 | |
| 2219 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2220 | |
| 2221 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 2222 | |
| 2223 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2224 | |
| 2225 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
| 2226 | asn_struct_free_f Not_PER_Visible_2_free; |
| 2227 | asn_struct_print_f Not_PER_Visible_2_print; |
| 2228 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 2229 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 2230 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
| 2231 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
| 2232 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
| 2233 | per_type_decoder_f Not_PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2234 | per_type_encoder_f Not_PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2235 | |
| 2236 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 2237 | |
| 2238 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2239 | /* The underlying type is IA5String */ |
| 2240 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2241 | const uint8_t *ch = st->buf; |
| 2242 | const uint8_t *end = ch + st->size; |
| 2243 | |
| 2244 | for(; ch < end; ch++) { |
| 2245 | uint8_t cv = *ch; |
| 2246 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2247 | } |
| 2248 | return 0; |
| 2249 | } |
| 2250 | |
| 2251 | |
| 2252 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 2253 | |
| 2254 | int |
| 2255 | 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] | 2256 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2257 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2258 | |
| 2259 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2260 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2261 | "%s: value not given (%s:%d)", |
| 2262 | td->name, __FILE__, __LINE__); |
| 2263 | return -1; |
| 2264 | } |
| 2265 | |
| 2266 | |
| 2267 | if(!check_permitted_alphabet_1(st)) { |
| 2268 | /* Constraint check succeeded */ |
| 2269 | return 0; |
| 2270 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2271 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2272 | "%s: constraint failed (%s:%d)", |
| 2273 | td->name, __FILE__, __LINE__); |
| 2274 | return -1; |
| 2275 | } |
| 2276 | } |
| 2277 | |
| 2278 | /* |
| 2279 | * This type is implemented using PER_Visible, |
| 2280 | * so here we adjust the DEF accordingly. |
| 2281 | */ |
| 2282 | static void |
| 2283 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2284 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2285 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2286 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2287 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2288 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2289 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2290 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2291 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2292 | if(!td->per_constraints) |
| 2293 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2294 | td->elements = asn_DEF_PER_Visible.elements; |
| 2295 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2296 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2297 | } |
| 2298 | |
| 2299 | void |
| 2300 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 2301 | void *struct_ptr, int contents_only) { |
| 2302 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2303 | td->free_struct(td, struct_ptr, contents_only); |
| 2304 | } |
| 2305 | |
| 2306 | int |
| 2307 | Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2308 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2309 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2310 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2311 | } |
| 2312 | |
| 2313 | asn_dec_rval_t |
| 2314 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2315 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2316 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2317 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2318 | } |
| 2319 | |
| 2320 | asn_enc_rval_t |
| 2321 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 2322 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2323 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2324 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2325 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2326 | } |
| 2327 | |
| 2328 | asn_dec_rval_t |
| 2329 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2330 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2331 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2332 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2333 | } |
| 2334 | |
| 2335 | asn_enc_rval_t |
| 2336 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2337 | int ilevel, enum xer_encoder_flags_e flags, |
| 2338 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2339 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2340 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2341 | } |
| 2342 | |
| 2343 | asn_dec_rval_t |
| 2344 | Not_PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2345 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2346 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2347 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2348 | } |
| 2349 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2350 | asn_enc_rval_t |
| 2351 | Not_PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 2352 | asn_per_constraints_t *constraints, |
| 2353 | void *structure, asn_per_outp_t *per_out) { |
| 2354 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2355 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2356 | } |
| 2357 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2358 | |
| 2359 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 2360 | |
| 2361 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { |
| 2362 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2363 | }; |
| 2364 | static asn_per_constraints_t asn_PER_Not_PER_Visible_2_constr_1 = { |
| 2365 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2366 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2367 | }; |
| 2368 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
| 2369 | "Not-PER-Visible-2", |
| 2370 | "Not-PER-Visible-2", |
| 2371 | Not_PER_Visible_2_free, |
| 2372 | Not_PER_Visible_2_print, |
| 2373 | Not_PER_Visible_2_constraint, |
| 2374 | Not_PER_Visible_2_decode_ber, |
| 2375 | Not_PER_Visible_2_encode_der, |
| 2376 | Not_PER_Visible_2_decode_xer, |
| 2377 | Not_PER_Visible_2_encode_xer, |
| 2378 | Not_PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2379 | Not_PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2380 | 0, /* Use generic outmost tag fetcher */ |
| 2381 | asn_DEF_Not_PER_Visible_2_tags_1, |
| 2382 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2383 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2384 | asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ |
| 2385 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2386 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2387 | &asn_PER_Not_PER_Visible_2_constr_1, |
| 2388 | 0, 0, /* No members */ |
| 2389 | 0 /* No specifics */ |
| 2390 | }; |
| 2391 | |
| 2392 | |
| 2393 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 2394 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2395 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2396 | |
| 2397 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2398 | |
| 2399 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 2400 | |
| 2401 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2402 | |
| 2403 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
| 2404 | asn_struct_free_f Not_PER_Visible_3_free; |
| 2405 | asn_struct_print_f Not_PER_Visible_3_print; |
| 2406 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 2407 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 2408 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
| 2409 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
| 2410 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
| 2411 | per_type_decoder_f Not_PER_Visible_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2412 | per_type_encoder_f Not_PER_Visible_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2413 | |
| 2414 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 2415 | |
| 2416 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2417 | /* The underlying type is IA5String */ |
| 2418 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2419 | const uint8_t *ch = st->buf; |
| 2420 | const uint8_t *end = ch + st->size; |
| 2421 | |
| 2422 | for(; ch < end; ch++) { |
| 2423 | uint8_t cv = *ch; |
| 2424 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2425 | } |
| 2426 | return 0; |
| 2427 | } |
| 2428 | |
| 2429 | |
| 2430 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 2431 | |
| 2432 | int |
| 2433 | 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] | 2434 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2435 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2436 | |
| 2437 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2438 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2439 | "%s: value not given (%s:%d)", |
| 2440 | td->name, __FILE__, __LINE__); |
| 2441 | return -1; |
| 2442 | } |
| 2443 | |
| 2444 | |
| 2445 | if(!check_permitted_alphabet_1(st)) { |
| 2446 | /* Constraint check succeeded */ |
| 2447 | return 0; |
| 2448 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2449 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2450 | "%s: constraint failed (%s:%d)", |
| 2451 | td->name, __FILE__, __LINE__); |
| 2452 | return -1; |
| 2453 | } |
| 2454 | } |
| 2455 | |
| 2456 | /* |
| 2457 | * This type is implemented using PER_Visible, |
| 2458 | * so here we adjust the DEF accordingly. |
| 2459 | */ |
| 2460 | static void |
| 2461 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2462 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2463 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2464 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2465 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2466 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2467 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2468 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2469 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2470 | if(!td->per_constraints) |
| 2471 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2472 | td->elements = asn_DEF_PER_Visible.elements; |
| 2473 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2474 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2475 | } |
| 2476 | |
| 2477 | void |
| 2478 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
| 2479 | void *struct_ptr, int contents_only) { |
| 2480 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2481 | td->free_struct(td, struct_ptr, contents_only); |
| 2482 | } |
| 2483 | |
| 2484 | int |
| 2485 | Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2486 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2487 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2488 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2489 | } |
| 2490 | |
| 2491 | asn_dec_rval_t |
| 2492 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2493 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2494 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2495 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2496 | } |
| 2497 | |
| 2498 | asn_enc_rval_t |
| 2499 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
| 2500 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2501 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2502 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2503 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2504 | } |
| 2505 | |
| 2506 | asn_dec_rval_t |
| 2507 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2508 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2509 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2510 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2511 | } |
| 2512 | |
| 2513 | asn_enc_rval_t |
| 2514 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2515 | int ilevel, enum xer_encoder_flags_e flags, |
| 2516 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2517 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2518 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2519 | } |
| 2520 | |
| 2521 | asn_dec_rval_t |
| 2522 | Not_PER_Visible_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2523 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2524 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2525 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2526 | } |
| 2527 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2528 | asn_enc_rval_t |
| 2529 | Not_PER_Visible_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 2530 | asn_per_constraints_t *constraints, |
| 2531 | void *structure, asn_per_outp_t *per_out) { |
| 2532 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2533 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2534 | } |
| 2535 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2536 | |
| 2537 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 2538 | |
| 2539 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { |
| 2540 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2541 | }; |
| 2542 | static asn_per_constraints_t asn_PER_Not_PER_Visible_3_constr_1 = { |
| 2543 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2544 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 2545 | }; |
| 2546 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
| 2547 | "Not-PER-Visible-3", |
| 2548 | "Not-PER-Visible-3", |
| 2549 | Not_PER_Visible_3_free, |
| 2550 | Not_PER_Visible_3_print, |
| 2551 | Not_PER_Visible_3_constraint, |
| 2552 | Not_PER_Visible_3_decode_ber, |
| 2553 | Not_PER_Visible_3_encode_der, |
| 2554 | Not_PER_Visible_3_decode_xer, |
| 2555 | Not_PER_Visible_3_encode_xer, |
| 2556 | Not_PER_Visible_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2557 | Not_PER_Visible_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2558 | 0, /* Use generic outmost tag fetcher */ |
| 2559 | asn_DEF_Not_PER_Visible_3_tags_1, |
| 2560 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2561 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2562 | asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ |
| 2563 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2564 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2565 | &asn_PER_Not_PER_Visible_3_constr_1, |
| 2566 | 0, 0, /* No members */ |
| 2567 | 0 /* No specifics */ |
| 2568 | }; |
| 2569 | |
| 2570 | |
| 2571 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 2572 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2573 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2574 | |
| 2575 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2576 | |
| 2577 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 2578 | |
| 2579 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2580 | |
| 2581 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
| 2582 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 2583 | asn_struct_print_f SIZE_but_not_FROM_print; |
| 2584 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 2585 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 2586 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
| 2587 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
| 2588 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
| 2589 | per_type_decoder_f SIZE_but_not_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2590 | per_type_encoder_f SIZE_but_not_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2591 | |
| 2592 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 2593 | |
| 2594 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2595 | /* The underlying type is IA5String */ |
| 2596 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2597 | const uint8_t *ch = st->buf; |
| 2598 | const uint8_t *end = ch + st->size; |
| 2599 | |
| 2600 | for(; ch < end; ch++) { |
| 2601 | uint8_t cv = *ch; |
| 2602 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2603 | } |
| 2604 | return 0; |
| 2605 | } |
| 2606 | |
| 2607 | |
| 2608 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2609 | |
| 2610 | int |
| 2611 | 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] | 2612 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2613 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2614 | size_t size; |
| 2615 | |
| 2616 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2617 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2618 | "%s: value not given (%s:%d)", |
| 2619 | td->name, __FILE__, __LINE__); |
| 2620 | return -1; |
| 2621 | } |
| 2622 | |
| 2623 | size = st->size; |
| 2624 | |
| 2625 | if((size >= 1 && size <= 4) |
| 2626 | && !check_permitted_alphabet_1(st)) { |
| 2627 | /* Constraint check succeeded */ |
| 2628 | return 0; |
| 2629 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2630 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2631 | "%s: constraint failed (%s:%d)", |
| 2632 | td->name, __FILE__, __LINE__); |
| 2633 | return -1; |
| 2634 | } |
| 2635 | } |
| 2636 | |
| 2637 | /* |
| 2638 | * This type is implemented using PER_Visible, |
| 2639 | * so here we adjust the DEF accordingly. |
| 2640 | */ |
| 2641 | static void |
| 2642 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2643 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2644 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2645 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2646 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2647 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2648 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2649 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2650 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2651 | if(!td->per_constraints) |
| 2652 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2653 | td->elements = asn_DEF_PER_Visible.elements; |
| 2654 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2655 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2656 | } |
| 2657 | |
| 2658 | void |
| 2659 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
| 2660 | void *struct_ptr, int contents_only) { |
| 2661 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2662 | td->free_struct(td, struct_ptr, contents_only); |
| 2663 | } |
| 2664 | |
| 2665 | int |
| 2666 | SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2667 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2668 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2669 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2670 | } |
| 2671 | |
| 2672 | asn_dec_rval_t |
| 2673 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2674 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2675 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2676 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2677 | } |
| 2678 | |
| 2679 | asn_enc_rval_t |
| 2680 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2681 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2682 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2683 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2684 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2685 | } |
| 2686 | |
| 2687 | asn_dec_rval_t |
| 2688 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2689 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2690 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2691 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2692 | } |
| 2693 | |
| 2694 | asn_enc_rval_t |
| 2695 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2696 | int ilevel, enum xer_encoder_flags_e flags, |
| 2697 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2698 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2699 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2700 | } |
| 2701 | |
| 2702 | asn_dec_rval_t |
| 2703 | SIZE_but_not_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2704 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2705 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2706 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2707 | } |
| 2708 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2709 | asn_enc_rval_t |
| 2710 | SIZE_but_not_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2711 | asn_per_constraints_t *constraints, |
| 2712 | void *structure, asn_per_outp_t *per_out) { |
| 2713 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2714 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2715 | } |
| 2716 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2717 | |
| 2718 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2719 | |
| 2720 | static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { |
| 2721 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2722 | }; |
| 2723 | static asn_per_constraints_t asn_PER_SIZE_but_not_FROM_constr_1 = { |
| 2724 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2725 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */ |
| 2726 | }; |
| 2727 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
| 2728 | "SIZE-but-not-FROM", |
| 2729 | "SIZE-but-not-FROM", |
| 2730 | SIZE_but_not_FROM_free, |
| 2731 | SIZE_but_not_FROM_print, |
| 2732 | SIZE_but_not_FROM_constraint, |
| 2733 | SIZE_but_not_FROM_decode_ber, |
| 2734 | SIZE_but_not_FROM_encode_der, |
| 2735 | SIZE_but_not_FROM_decode_xer, |
| 2736 | SIZE_but_not_FROM_encode_xer, |
| 2737 | SIZE_but_not_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2738 | SIZE_but_not_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2739 | 0, /* Use generic outmost tag fetcher */ |
| 2740 | asn_DEF_SIZE_but_not_FROM_tags_1, |
| 2741 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2742 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2743 | asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ |
| 2744 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2745 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2746 | &asn_PER_SIZE_but_not_FROM_constr_1, |
| 2747 | 0, 0, /* No members */ |
| 2748 | 0 /* No specifics */ |
| 2749 | }; |
| 2750 | |
| 2751 | |
| 2752 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2753 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2754 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2755 | |
| 2756 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2757 | |
| 2758 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2759 | |
| 2760 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2761 | |
| 2762 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
| 2763 | asn_struct_free_f SIZE_and_FROM_free; |
| 2764 | asn_struct_print_f SIZE_and_FROM_print; |
| 2765 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2766 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2767 | der_type_encoder_f SIZE_and_FROM_encode_der; |
| 2768 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
| 2769 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
| 2770 | per_type_decoder_f SIZE_and_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2771 | per_type_encoder_f SIZE_and_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2772 | |
| 2773 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2774 | |
| 2775 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2776 | /* The underlying type is IA5String */ |
| 2777 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2778 | const uint8_t *ch = st->buf; |
| 2779 | const uint8_t *end = ch + st->size; |
| 2780 | |
| 2781 | for(; ch < end; ch++) { |
| 2782 | uint8_t cv = *ch; |
| 2783 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2784 | } |
| 2785 | return 0; |
| 2786 | } |
| 2787 | |
| 2788 | |
| 2789 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2790 | |
| 2791 | int |
| 2792 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2793 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2794 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2795 | size_t size; |
| 2796 | |
| 2797 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2798 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2799 | "%s: value not given (%s:%d)", |
| 2800 | td->name, __FILE__, __LINE__); |
| 2801 | return -1; |
| 2802 | } |
| 2803 | |
| 2804 | size = st->size; |
| 2805 | |
| 2806 | if((size >= 1 && size <= 4) |
| 2807 | && !check_permitted_alphabet_1(st)) { |
| 2808 | /* Constraint check succeeded */ |
| 2809 | return 0; |
| 2810 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2811 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2812 | "%s: constraint failed (%s:%d)", |
| 2813 | td->name, __FILE__, __LINE__); |
| 2814 | return -1; |
| 2815 | } |
| 2816 | } |
| 2817 | |
| 2818 | /* |
| 2819 | * This type is implemented using PER_Visible, |
| 2820 | * so here we adjust the DEF accordingly. |
| 2821 | */ |
| 2822 | static void |
| 2823 | SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2824 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2825 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2826 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2827 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2828 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2829 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2830 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2831 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2832 | if(!td->per_constraints) |
| 2833 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2834 | td->elements = asn_DEF_PER_Visible.elements; |
| 2835 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2836 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2837 | } |
| 2838 | |
| 2839 | void |
| 2840 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
| 2841 | void *struct_ptr, int contents_only) { |
| 2842 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2843 | td->free_struct(td, struct_ptr, contents_only); |
| 2844 | } |
| 2845 | |
| 2846 | int |
| 2847 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2848 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2849 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2850 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2851 | } |
| 2852 | |
| 2853 | asn_dec_rval_t |
| 2854 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2855 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2856 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2857 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2858 | } |
| 2859 | |
| 2860 | asn_enc_rval_t |
| 2861 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2862 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2863 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2864 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2865 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2866 | } |
| 2867 | |
| 2868 | asn_dec_rval_t |
| 2869 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2870 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2871 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2872 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2873 | } |
| 2874 | |
| 2875 | asn_enc_rval_t |
| 2876 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2877 | int ilevel, enum xer_encoder_flags_e flags, |
| 2878 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2879 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2880 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2881 | } |
| 2882 | |
| 2883 | asn_dec_rval_t |
| 2884 | SIZE_and_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2885 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2886 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2887 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2888 | } |
| 2889 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2890 | asn_enc_rval_t |
| 2891 | SIZE_and_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2892 | asn_per_constraints_t *constraints, |
| 2893 | void *structure, asn_per_outp_t *per_out) { |
| 2894 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2895 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2896 | } |
| 2897 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2898 | |
| 2899 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2900 | |
| 2901 | static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { |
| 2902 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2903 | }; |
| 2904 | static asn_per_constraints_t asn_PER_SIZE_and_FROM_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 2905 | { APC_CONSTRAINED, 2, 2, 65, 68 } /* (65..68) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2906 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */ |
| 2907 | }; |
| 2908 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
| 2909 | "SIZE-and-FROM", |
| 2910 | "SIZE-and-FROM", |
| 2911 | SIZE_and_FROM_free, |
| 2912 | SIZE_and_FROM_print, |
| 2913 | SIZE_and_FROM_constraint, |
| 2914 | SIZE_and_FROM_decode_ber, |
| 2915 | SIZE_and_FROM_encode_der, |
| 2916 | SIZE_and_FROM_decode_xer, |
| 2917 | SIZE_and_FROM_encode_xer, |
| 2918 | SIZE_and_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2919 | SIZE_and_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2920 | 0, /* Use generic outmost tag fetcher */ |
| 2921 | asn_DEF_SIZE_and_FROM_tags_1, |
| 2922 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2923 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2924 | asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ |
| 2925 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2926 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2927 | &asn_PER_SIZE_and_FROM_constr_1, |
| 2928 | 0, 0, /* No members */ |
| 2929 | 0 /* No specifics */ |
| 2930 | }; |
| 2931 | |
| 2932 | |
| 2933 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2934 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2935 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2936 | |
| 2937 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2938 | |
| 2939 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 2940 | |
| 2941 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2942 | |
| 2943 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
| 2944 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 2945 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
| 2946 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 2947 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 2948 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
| 2949 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
| 2950 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
| 2951 | per_type_decoder_f Neither_SIZE_nor_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2952 | per_type_encoder_f Neither_SIZE_nor_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2953 | |
| 2954 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2955 | |
| 2956 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2957 | /* The underlying type is IA5String */ |
| 2958 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2959 | const uint8_t *ch = st->buf; |
| 2960 | const uint8_t *end = ch + st->size; |
| 2961 | |
| 2962 | for(; ch < end; ch++) { |
| 2963 | uint8_t cv = *ch; |
| 2964 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 2965 | } |
| 2966 | return 0; |
| 2967 | } |
| 2968 | |
| 2969 | |
| 2970 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 2971 | |
| 2972 | int |
| 2973 | 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] | 2974 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2975 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2976 | |
| 2977 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2978 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2979 | "%s: value not given (%s:%d)", |
| 2980 | td->name, __FILE__, __LINE__); |
| 2981 | return -1; |
| 2982 | } |
| 2983 | |
| 2984 | |
| 2985 | if(!check_permitted_alphabet_1(st)) { |
| 2986 | /* Constraint check succeeded */ |
| 2987 | return 0; |
| 2988 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 2989 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2990 | "%s: constraint failed (%s:%d)", |
| 2991 | td->name, __FILE__, __LINE__); |
| 2992 | return -1; |
| 2993 | } |
| 2994 | } |
| 2995 | |
| 2996 | /* |
| 2997 | * This type is implemented using PER_Visible, |
| 2998 | * so here we adjust the DEF accordingly. |
| 2999 | */ |
| 3000 | static void |
| 3001 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3002 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 3003 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 3004 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 3005 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 3006 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 3007 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 3008 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3009 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3010 | if(!td->per_constraints) |
| 3011 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 3012 | td->elements = asn_DEF_PER_Visible.elements; |
| 3013 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 3014 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 3015 | } |
| 3016 | |
| 3017 | void |
| 3018 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
| 3019 | void *struct_ptr, int contents_only) { |
| 3020 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3021 | td->free_struct(td, struct_ptr, contents_only); |
| 3022 | } |
| 3023 | |
| 3024 | int |
| 3025 | Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3026 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3027 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3028 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3029 | } |
| 3030 | |
| 3031 | asn_dec_rval_t |
| 3032 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3033 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3034 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3035 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3036 | } |
| 3037 | |
| 3038 | asn_enc_rval_t |
| 3039 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 3040 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3041 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3042 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3043 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3044 | } |
| 3045 | |
| 3046 | asn_dec_rval_t |
| 3047 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3048 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3049 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3050 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3051 | } |
| 3052 | |
| 3053 | asn_enc_rval_t |
| 3054 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3055 | int ilevel, enum xer_encoder_flags_e flags, |
| 3056 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3057 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3058 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3059 | } |
| 3060 | |
| 3061 | asn_dec_rval_t |
| 3062 | Neither_SIZE_nor_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3063 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3064 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3065 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3066 | } |
| 3067 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3068 | asn_enc_rval_t |
| 3069 | Neither_SIZE_nor_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 3070 | asn_per_constraints_t *constraints, |
| 3071 | void *structure, asn_per_outp_t *per_out) { |
| 3072 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3073 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3074 | } |
| 3075 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3076 | |
| 3077 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3078 | |
| 3079 | static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { |
| 3080 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 3081 | }; |
| 3082 | static asn_per_constraints_t asn_PER_Neither_SIZE_nor_FROM_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 3083 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3084 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */ |
| 3085 | }; |
| 3086 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
| 3087 | "Neither-SIZE-nor-FROM", |
| 3088 | "Neither-SIZE-nor-FROM", |
| 3089 | Neither_SIZE_nor_FROM_free, |
| 3090 | Neither_SIZE_nor_FROM_print, |
| 3091 | Neither_SIZE_nor_FROM_constraint, |
| 3092 | Neither_SIZE_nor_FROM_decode_ber, |
| 3093 | Neither_SIZE_nor_FROM_encode_der, |
| 3094 | Neither_SIZE_nor_FROM_decode_xer, |
| 3095 | Neither_SIZE_nor_FROM_encode_xer, |
| 3096 | Neither_SIZE_nor_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3097 | Neither_SIZE_nor_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3098 | 0, /* Use generic outmost tag fetcher */ |
| 3099 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, |
| 3100 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3101 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 3102 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ |
| 3103 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3104 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 3105 | &asn_PER_Neither_SIZE_nor_FROM_constr_1, |
| 3106 | 0, 0, /* No members */ |
| 3107 | 0 /* No specifics */ |
| 3108 | }; |
| 3109 | |
| 3110 | |
| 3111 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 3112 | |
| 3113 | #include <UTF8String.h> |
| 3114 | |
| 3115 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 3116 | |
| 3117 | typedef UTF8String_t Utf8_4_t; |
| 3118 | |
| 3119 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 3120 | |
| 3121 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 3122 | asn_struct_free_f Utf8_4_free; |
| 3123 | asn_struct_print_f Utf8_4_print; |
| 3124 | asn_constr_check_f Utf8_4_constraint; |
| 3125 | ber_type_decoder_f Utf8_4_decode_ber; |
| 3126 | der_type_encoder_f Utf8_4_encode_der; |
| 3127 | xer_type_decoder_f Utf8_4_decode_xer; |
| 3128 | xer_type_encoder_f Utf8_4_encode_xer; |
| 3129 | per_type_decoder_f Utf8_4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3130 | per_type_encoder_f Utf8_4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3131 | |
| 3132 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 3133 | |
| 3134 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3135 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 3136 | return -1; /* Alphabet (sic!) test failed. */ |
| 3137 | |
| 3138 | return 0; |
| 3139 | } |
| 3140 | |
| 3141 | |
| 3142 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 3143 | |
| 3144 | int |
| 3145 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3146 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3147 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3148 | |
| 3149 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3150 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3151 | "%s: value not given (%s:%d)", |
| 3152 | td->name, __FILE__, __LINE__); |
| 3153 | return -1; |
| 3154 | } |
| 3155 | |
| 3156 | |
| 3157 | if(!check_permitted_alphabet_1(st)) { |
| 3158 | /* Constraint check succeeded */ |
| 3159 | return 0; |
| 3160 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3161 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3162 | "%s: constraint failed (%s:%d)", |
| 3163 | td->name, __FILE__, __LINE__); |
| 3164 | return -1; |
| 3165 | } |
| 3166 | } |
| 3167 | |
| 3168 | /* |
| 3169 | * This type is implemented using UTF8String, |
| 3170 | * so here we adjust the DEF accordingly. |
| 3171 | */ |
| 3172 | static void |
| 3173 | Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3174 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3175 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3176 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3177 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3178 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3179 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3180 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3181 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3182 | if(!td->per_constraints) |
| 3183 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3184 | td->elements = asn_DEF_UTF8String.elements; |
| 3185 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3186 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3187 | } |
| 3188 | |
| 3189 | void |
| 3190 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 3191 | void *struct_ptr, int contents_only) { |
| 3192 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3193 | td->free_struct(td, struct_ptr, contents_only); |
| 3194 | } |
| 3195 | |
| 3196 | int |
| 3197 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3198 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3199 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3200 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3201 | } |
| 3202 | |
| 3203 | asn_dec_rval_t |
| 3204 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3205 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3206 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3207 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3208 | } |
| 3209 | |
| 3210 | asn_enc_rval_t |
| 3211 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 3212 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3213 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3214 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3215 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3216 | } |
| 3217 | |
| 3218 | asn_dec_rval_t |
| 3219 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3220 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3221 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3222 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3223 | } |
| 3224 | |
| 3225 | asn_enc_rval_t |
| 3226 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3227 | int ilevel, enum xer_encoder_flags_e flags, |
| 3228 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3229 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3230 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3231 | } |
| 3232 | |
| 3233 | asn_dec_rval_t |
| 3234 | Utf8_4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3235 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3236 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3237 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3238 | } |
| 3239 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3240 | asn_enc_rval_t |
| 3241 | Utf8_4_encode_uper(asn_TYPE_descriptor_t *td, |
| 3242 | asn_per_constraints_t *constraints, |
| 3243 | void *structure, asn_per_outp_t *per_out) { |
| 3244 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3245 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3246 | } |
| 3247 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3248 | |
| 3249 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 3250 | |
| 3251 | static ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { |
| 3252 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3253 | }; |
| 3254 | static asn_per_constraints_t asn_PER_Utf8_4_constr_1 = { |
| 3255 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3256 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3257 | }; |
| 3258 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 3259 | "Utf8-4", |
| 3260 | "Utf8-4", |
| 3261 | Utf8_4_free, |
| 3262 | Utf8_4_print, |
| 3263 | Utf8_4_constraint, |
| 3264 | Utf8_4_decode_ber, |
| 3265 | Utf8_4_encode_der, |
| 3266 | Utf8_4_decode_xer, |
| 3267 | Utf8_4_encode_xer, |
| 3268 | Utf8_4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3269 | Utf8_4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3270 | 0, /* Use generic outmost tag fetcher */ |
| 3271 | asn_DEF_Utf8_4_tags_1, |
| 3272 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3273 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 3274 | asn_DEF_Utf8_4_tags_1, /* Same as above */ |
| 3275 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3276 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 3277 | &asn_PER_Utf8_4_constr_1, |
| 3278 | 0, 0, /* No members */ |
| 3279 | 0 /* No specifics */ |
| 3280 | }; |
| 3281 | |
| 3282 | |
| 3283 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 3284 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3285 | #include "Utf8-2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3286 | |
| 3287 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 3288 | |
| 3289 | typedef Utf8_2_t Utf8_3_t; |
| 3290 | |
| 3291 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 3292 | |
| 3293 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
| 3294 | asn_struct_free_f Utf8_3_free; |
| 3295 | asn_struct_print_f Utf8_3_print; |
| 3296 | asn_constr_check_f Utf8_3_constraint; |
| 3297 | ber_type_decoder_f Utf8_3_decode_ber; |
| 3298 | der_type_encoder_f Utf8_3_encode_der; |
| 3299 | xer_type_decoder_f Utf8_3_decode_xer; |
| 3300 | xer_type_encoder_f Utf8_3_encode_xer; |
| 3301 | per_type_decoder_f Utf8_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3302 | per_type_encoder_f Utf8_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3303 | |
| 3304 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 3305 | |
| 3306 | static int permitted_alphabet_table_1[128] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 3307 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3308 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3309 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3310 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3311 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */ |
| 3312 | 16,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ |
| 3313 | 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */ |
| 3314 | 42,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3315 | }; |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 3316 | static int permitted_alphabet_code2value_1[52] = { |
| 3317 | 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80, |
| 3318 | 81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102, |
| 3319 | 103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118, |
| 3320 | 119,120,121,122,}; |
| 3321 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3322 | |
| 3323 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3324 | int *table = permitted_alphabet_table_1; |
| 3325 | /* The underlying type is UTF8String */ |
| 3326 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3327 | const uint8_t *ch = st->buf; |
| 3328 | const uint8_t *end = ch + st->size; |
| 3329 | |
| 3330 | for(; ch < end; ch++) { |
| 3331 | uint8_t cv = *ch; |
| 3332 | if(cv >= 0x80) return -1; |
| 3333 | if(!table[cv]) return -1; |
| 3334 | } |
| 3335 | return 0; |
| 3336 | } |
| 3337 | |
| 3338 | |
| 3339 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 3340 | |
| 3341 | int |
| 3342 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3343 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3344 | const Utf8_2_t *st = (const Utf8_2_t *)sptr; |
| 3345 | size_t size; |
| 3346 | |
| 3347 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3348 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3349 | "%s: value not given (%s:%d)", |
| 3350 | td->name, __FILE__, __LINE__); |
| 3351 | return -1; |
| 3352 | } |
| 3353 | |
| 3354 | size = UTF8String_length(st); |
| 3355 | if((ssize_t)size < 0) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3356 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3357 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3358 | td->name, __FILE__, __LINE__); |
| 3359 | return -1; |
| 3360 | } |
| 3361 | |
| 3362 | if((size >= 1 && size <= 2) |
| 3363 | && !check_permitted_alphabet_1(st)) { |
| 3364 | /* Constraint check succeeded */ |
| 3365 | return 0; |
| 3366 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3367 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3368 | "%s: constraint failed (%s:%d)", |
| 3369 | td->name, __FILE__, __LINE__); |
| 3370 | return -1; |
| 3371 | } |
| 3372 | } |
| 3373 | |
| 3374 | /* |
| 3375 | * This type is implemented using Utf8_2, |
| 3376 | * so here we adjust the DEF accordingly. |
| 3377 | */ |
| 3378 | static void |
| 3379 | Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3380 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 3381 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
| 3382 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 3383 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 3384 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 3385 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
| 3386 | td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3387 | td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3388 | if(!td->per_constraints) |
| 3389 | td->per_constraints = asn_DEF_Utf8_2.per_constraints; |
| 3390 | td->elements = asn_DEF_Utf8_2.elements; |
| 3391 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 3392 | td->specifics = asn_DEF_Utf8_2.specifics; |
| 3393 | } |
| 3394 | |
| 3395 | void |
| 3396 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
| 3397 | void *struct_ptr, int contents_only) { |
| 3398 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3399 | td->free_struct(td, struct_ptr, contents_only); |
| 3400 | } |
| 3401 | |
| 3402 | int |
| 3403 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3404 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3405 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3406 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3407 | } |
| 3408 | |
| 3409 | asn_dec_rval_t |
| 3410 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3411 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3412 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3413 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3414 | } |
| 3415 | |
| 3416 | asn_enc_rval_t |
| 3417 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
| 3418 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3419 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3420 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3421 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3422 | } |
| 3423 | |
| 3424 | asn_dec_rval_t |
| 3425 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3426 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3427 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3428 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3429 | } |
| 3430 | |
| 3431 | asn_enc_rval_t |
| 3432 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3433 | int ilevel, enum xer_encoder_flags_e flags, |
| 3434 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3435 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3436 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3437 | } |
| 3438 | |
| 3439 | asn_dec_rval_t |
| 3440 | Utf8_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3441 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3442 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3443 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3444 | } |
| 3445 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3446 | asn_enc_rval_t |
| 3447 | Utf8_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 3448 | asn_per_constraints_t *constraints, |
| 3449 | void *structure, asn_per_outp_t *per_out) { |
| 3450 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3451 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3452 | } |
| 3453 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3454 | |
| 3455 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 3456 | |
| 3457 | static ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { |
| 3458 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3459 | }; |
| 3460 | static asn_per_constraints_t asn_PER_Utf8_3_constr_1 = { |
| 3461 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3462 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3463 | }; |
| 3464 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
| 3465 | "Utf8-3", |
| 3466 | "Utf8-3", |
| 3467 | Utf8_3_free, |
| 3468 | Utf8_3_print, |
| 3469 | Utf8_3_constraint, |
| 3470 | Utf8_3_decode_ber, |
| 3471 | Utf8_3_encode_der, |
| 3472 | Utf8_3_decode_xer, |
| 3473 | Utf8_3_encode_xer, |
| 3474 | Utf8_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3475 | Utf8_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3476 | 0, /* Use generic outmost tag fetcher */ |
| 3477 | asn_DEF_Utf8_3_tags_1, |
| 3478 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3479 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3480 | asn_DEF_Utf8_3_tags_1, /* Same as above */ |
| 3481 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3482 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3483 | &asn_PER_Utf8_3_constr_1, |
| 3484 | 0, 0, /* No members */ |
| 3485 | 0 /* No specifics */ |
| 3486 | }; |
| 3487 | |
| 3488 | |
| 3489 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 3490 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3491 | #include "Utf8-1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3492 | |
| 3493 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 3494 | |
| 3495 | typedef Utf8_1_t Utf8_2_t; |
| 3496 | |
| 3497 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 3498 | |
| 3499 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
| 3500 | asn_struct_free_f Utf8_2_free; |
| 3501 | asn_struct_print_f Utf8_2_print; |
| 3502 | asn_constr_check_f Utf8_2_constraint; |
| 3503 | ber_type_decoder_f Utf8_2_decode_ber; |
| 3504 | der_type_encoder_f Utf8_2_encode_der; |
| 3505 | xer_type_decoder_f Utf8_2_decode_xer; |
| 3506 | xer_type_encoder_f Utf8_2_encode_xer; |
| 3507 | per_type_decoder_f Utf8_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3508 | per_type_encoder_f Utf8_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3509 | |
| 3510 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 3511 | |
| 3512 | int |
| 3513 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3514 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3515 | const Utf8_1_t *st = (const Utf8_1_t *)sptr; |
| 3516 | size_t size; |
| 3517 | |
| 3518 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3519 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3520 | "%s: value not given (%s:%d)", |
| 3521 | td->name, __FILE__, __LINE__); |
| 3522 | return -1; |
| 3523 | } |
| 3524 | |
| 3525 | size = UTF8String_length(st); |
| 3526 | if((ssize_t)size < 0) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3527 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3528 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3529 | td->name, __FILE__, __LINE__); |
| 3530 | return -1; |
| 3531 | } |
| 3532 | |
| 3533 | if((size >= 1 && size <= 2)) { |
| 3534 | /* Constraint check succeeded */ |
| 3535 | return 0; |
| 3536 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3537 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3538 | "%s: constraint failed (%s:%d)", |
| 3539 | td->name, __FILE__, __LINE__); |
| 3540 | return -1; |
| 3541 | } |
| 3542 | } |
| 3543 | |
| 3544 | /* |
| 3545 | * This type is implemented using Utf8_1, |
| 3546 | * so here we adjust the DEF accordingly. |
| 3547 | */ |
| 3548 | static void |
| 3549 | Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3550 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 3551 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
| 3552 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 3553 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 3554 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 3555 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
| 3556 | td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3557 | td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3558 | if(!td->per_constraints) |
| 3559 | td->per_constraints = asn_DEF_Utf8_1.per_constraints; |
| 3560 | td->elements = asn_DEF_Utf8_1.elements; |
| 3561 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 3562 | td->specifics = asn_DEF_Utf8_1.specifics; |
| 3563 | } |
| 3564 | |
| 3565 | void |
| 3566 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
| 3567 | void *struct_ptr, int contents_only) { |
| 3568 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3569 | td->free_struct(td, struct_ptr, contents_only); |
| 3570 | } |
| 3571 | |
| 3572 | int |
| 3573 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3574 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3575 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3576 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3577 | } |
| 3578 | |
| 3579 | asn_dec_rval_t |
| 3580 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3581 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3582 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3583 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3584 | } |
| 3585 | |
| 3586 | asn_enc_rval_t |
| 3587 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
| 3588 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3589 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3590 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3591 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3592 | } |
| 3593 | |
| 3594 | asn_dec_rval_t |
| 3595 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3596 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3597 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3598 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3599 | } |
| 3600 | |
| 3601 | asn_enc_rval_t |
| 3602 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3603 | int ilevel, enum xer_encoder_flags_e flags, |
| 3604 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3605 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3606 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3607 | } |
| 3608 | |
| 3609 | asn_dec_rval_t |
| 3610 | Utf8_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3611 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3612 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3613 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3614 | } |
| 3615 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3616 | asn_enc_rval_t |
| 3617 | Utf8_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 3618 | asn_per_constraints_t *constraints, |
| 3619 | void *structure, asn_per_outp_t *per_out) { |
| 3620 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3621 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3622 | } |
| 3623 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3624 | |
| 3625 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 3626 | |
| 3627 | static ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { |
| 3628 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3629 | }; |
| 3630 | static asn_per_constraints_t asn_PER_Utf8_2_constr_1 = { |
| 3631 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3632 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 3633 | }; |
| 3634 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
| 3635 | "Utf8-2", |
| 3636 | "Utf8-2", |
| 3637 | Utf8_2_free, |
| 3638 | Utf8_2_print, |
| 3639 | Utf8_2_constraint, |
| 3640 | Utf8_2_decode_ber, |
| 3641 | Utf8_2_encode_der, |
| 3642 | Utf8_2_decode_xer, |
| 3643 | Utf8_2_encode_xer, |
| 3644 | Utf8_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3645 | Utf8_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3646 | 0, /* Use generic outmost tag fetcher */ |
| 3647 | asn_DEF_Utf8_2_tags_1, |
| 3648 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3649 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3650 | asn_DEF_Utf8_2_tags_1, /* Same as above */ |
| 3651 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3652 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3653 | &asn_PER_Utf8_2_constr_1, |
| 3654 | 0, 0, /* No members */ |
| 3655 | 0 /* No specifics */ |
| 3656 | }; |
| 3657 | |
| 3658 | |
| 3659 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 3660 | |
| 3661 | #include <UTF8String.h> |
| 3662 | |
| 3663 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 3664 | |
| 3665 | typedef UTF8String_t Utf8_1_t; |
| 3666 | |
| 3667 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 3668 | |
| 3669 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; |
| 3670 | asn_struct_free_f Utf8_1_free; |
| 3671 | asn_struct_print_f Utf8_1_print; |
| 3672 | asn_constr_check_f Utf8_1_constraint; |
| 3673 | ber_type_decoder_f Utf8_1_decode_ber; |
| 3674 | der_type_encoder_f Utf8_1_encode_der; |
| 3675 | xer_type_decoder_f Utf8_1_decode_xer; |
| 3676 | xer_type_encoder_f Utf8_1_encode_xer; |
| 3677 | per_type_decoder_f Utf8_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3678 | per_type_encoder_f Utf8_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3679 | |
| 3680 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 3681 | |
| 3682 | int |
| 3683 | Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3684 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3685 | /* Replace with underlying type checker */ |
| 3686 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3687 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3688 | } |
| 3689 | |
| 3690 | /* |
| 3691 | * This type is implemented using UTF8String, |
| 3692 | * so here we adjust the DEF accordingly. |
| 3693 | */ |
| 3694 | static void |
| 3695 | Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3696 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3697 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3698 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3699 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3700 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3701 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3702 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3703 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3704 | if(!td->per_constraints) |
| 3705 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3706 | td->elements = asn_DEF_UTF8String.elements; |
| 3707 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3708 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3709 | } |
| 3710 | |
| 3711 | void |
| 3712 | Utf8_1_free(asn_TYPE_descriptor_t *td, |
| 3713 | void *struct_ptr, int contents_only) { |
| 3714 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3715 | td->free_struct(td, struct_ptr, contents_only); |
| 3716 | } |
| 3717 | |
| 3718 | int |
| 3719 | Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3720 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3721 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3722 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3723 | } |
| 3724 | |
| 3725 | asn_dec_rval_t |
| 3726 | Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3727 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3728 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3729 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3730 | } |
| 3731 | |
| 3732 | asn_enc_rval_t |
| 3733 | Utf8_1_encode_der(asn_TYPE_descriptor_t *td, |
| 3734 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3735 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3736 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3737 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3738 | } |
| 3739 | |
| 3740 | asn_dec_rval_t |
| 3741 | Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3742 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3743 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3744 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3745 | } |
| 3746 | |
| 3747 | asn_enc_rval_t |
| 3748 | Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3749 | int ilevel, enum xer_encoder_flags_e flags, |
| 3750 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3751 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3752 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3753 | } |
| 3754 | |
| 3755 | asn_dec_rval_t |
| 3756 | Utf8_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3757 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3758 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3759 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3760 | } |
| 3761 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3762 | asn_enc_rval_t |
| 3763 | Utf8_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 3764 | asn_per_constraints_t *constraints, |
| 3765 | void *structure, asn_per_outp_t *per_out) { |
| 3766 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3767 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3768 | } |
| 3769 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3770 | |
| 3771 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 3772 | |
| 3773 | static ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { |
| 3774 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3775 | }; |
| 3776 | asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { |
| 3777 | "Utf8-1", |
| 3778 | "Utf8-1", |
| 3779 | Utf8_1_free, |
| 3780 | Utf8_1_print, |
| 3781 | Utf8_1_constraint, |
| 3782 | Utf8_1_decode_ber, |
| 3783 | Utf8_1_encode_der, |
| 3784 | Utf8_1_decode_xer, |
| 3785 | Utf8_1_encode_xer, |
| 3786 | Utf8_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3787 | Utf8_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3788 | 0, /* Use generic outmost tag fetcher */ |
| 3789 | asn_DEF_Utf8_1_tags_1, |
| 3790 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3791 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3792 | asn_DEF_Utf8_1_tags_1, /* Same as above */ |
| 3793 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3794 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3795 | 0, /* No PER visible constraints */ |
| 3796 | 0, 0, /* No members */ |
| 3797 | 0 /* No specifics */ |
| 3798 | }; |
| 3799 | |
| 3800 | |
| 3801 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 3802 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3803 | #include "Identifier.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3804 | |
| 3805 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 3806 | |
| 3807 | typedef Identifier_t VisibleIdentifier_t; |
| 3808 | |
| 3809 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 3810 | |
| 3811 | extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; |
| 3812 | asn_struct_free_f VisibleIdentifier_free; |
| 3813 | asn_struct_print_f VisibleIdentifier_print; |
| 3814 | asn_constr_check_f VisibleIdentifier_constraint; |
| 3815 | ber_type_decoder_f VisibleIdentifier_decode_ber; |
| 3816 | der_type_encoder_f VisibleIdentifier_encode_der; |
| 3817 | xer_type_decoder_f VisibleIdentifier_decode_xer; |
| 3818 | xer_type_encoder_f VisibleIdentifier_encode_xer; |
| 3819 | per_type_decoder_f VisibleIdentifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3820 | per_type_encoder_f VisibleIdentifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3821 | |
| 3822 | /*** <<< CTABLES [VisibleIdentifier] >>> ***/ |
| 3823 | |
| 3824 | static int permitted_alphabet_table_1[256] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 3825 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3826 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3827 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ |
| 3828 | 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ |
| 3829 | 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ |
| 3830 | 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ |
| 3831 | 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ |
| 3832 | 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3833 | }; |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 3834 | static int permitted_alphabet_code2value_1[64] = { |
| 3835 | 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, |
| 3836 | 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, |
| 3837 | 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, |
| 3838 | 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, |
| 3839 | }; |
| 3840 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3841 | |
| 3842 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3843 | int *table = permitted_alphabet_table_1; |
| 3844 | /* The underlying type is VisibleString */ |
| 3845 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 3846 | const uint8_t *ch = st->buf; |
| 3847 | const uint8_t *end = ch + st->size; |
| 3848 | |
| 3849 | for(; ch < end; ch++) { |
| 3850 | uint8_t cv = *ch; |
| 3851 | if(!table[cv]) return -1; |
| 3852 | } |
| 3853 | return 0; |
| 3854 | } |
| 3855 | |
| 3856 | |
| 3857 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 3858 | |
| 3859 | int |
| 3860 | VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3861 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3862 | const Identifier_t *st = (const Identifier_t *)sptr; |
| 3863 | size_t size; |
| 3864 | |
| 3865 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3866 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3867 | "%s: value not given (%s:%d)", |
| 3868 | td->name, __FILE__, __LINE__); |
| 3869 | return -1; |
| 3870 | } |
| 3871 | |
| 3872 | size = st->size; |
| 3873 | |
| 3874 | if((size >= 1 && size <= 32) |
| 3875 | && !check_permitted_alphabet_1(st)) { |
| 3876 | /* Constraint check succeeded */ |
| 3877 | return 0; |
| 3878 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 3879 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3880 | "%s: constraint failed (%s:%d)", |
| 3881 | td->name, __FILE__, __LINE__); |
| 3882 | return -1; |
| 3883 | } |
| 3884 | } |
| 3885 | |
| 3886 | /* |
| 3887 | * This type is implemented using Identifier, |
| 3888 | * so here we adjust the DEF accordingly. |
| 3889 | */ |
| 3890 | static void |
| 3891 | VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3892 | td->free_struct = asn_DEF_Identifier.free_struct; |
| 3893 | td->print_struct = asn_DEF_Identifier.print_struct; |
| 3894 | td->ber_decoder = asn_DEF_Identifier.ber_decoder; |
| 3895 | td->der_encoder = asn_DEF_Identifier.der_encoder; |
| 3896 | td->xer_decoder = asn_DEF_Identifier.xer_decoder; |
| 3897 | td->xer_encoder = asn_DEF_Identifier.xer_encoder; |
| 3898 | td->uper_decoder = asn_DEF_Identifier.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3899 | td->uper_encoder = asn_DEF_Identifier.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3900 | if(!td->per_constraints) |
| 3901 | td->per_constraints = asn_DEF_Identifier.per_constraints; |
| 3902 | td->elements = asn_DEF_Identifier.elements; |
| 3903 | td->elements_count = asn_DEF_Identifier.elements_count; |
| 3904 | td->specifics = asn_DEF_Identifier.specifics; |
| 3905 | } |
| 3906 | |
| 3907 | void |
| 3908 | VisibleIdentifier_free(asn_TYPE_descriptor_t *td, |
| 3909 | void *struct_ptr, int contents_only) { |
| 3910 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3911 | td->free_struct(td, struct_ptr, contents_only); |
| 3912 | } |
| 3913 | |
| 3914 | int |
| 3915 | VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3916 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3917 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3918 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3919 | } |
| 3920 | |
| 3921 | asn_dec_rval_t |
| 3922 | VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3923 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3924 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3925 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3926 | } |
| 3927 | |
| 3928 | asn_enc_rval_t |
| 3929 | VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, |
| 3930 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3931 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3932 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3933 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3934 | } |
| 3935 | |
| 3936 | asn_dec_rval_t |
| 3937 | VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3938 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3939 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3940 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3941 | } |
| 3942 | |
| 3943 | asn_enc_rval_t |
| 3944 | VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3945 | int ilevel, enum xer_encoder_flags_e flags, |
| 3946 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3947 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3948 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3949 | } |
| 3950 | |
| 3951 | asn_dec_rval_t |
| 3952 | VisibleIdentifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3953 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3954 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3955 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3956 | } |
| 3957 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3958 | asn_enc_rval_t |
| 3959 | VisibleIdentifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 3960 | asn_per_constraints_t *constraints, |
| 3961 | void *structure, asn_per_outp_t *per_out) { |
| 3962 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3963 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3964 | } |
| 3965 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3966 | |
| 3967 | /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ |
| 3968 | |
| 3969 | static ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { |
| 3970 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3971 | }; |
| 3972 | asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { |
| 3973 | "VisibleIdentifier", |
| 3974 | "VisibleIdentifier", |
| 3975 | VisibleIdentifier_free, |
| 3976 | VisibleIdentifier_print, |
| 3977 | VisibleIdentifier_constraint, |
| 3978 | VisibleIdentifier_decode_ber, |
| 3979 | VisibleIdentifier_encode_der, |
| 3980 | VisibleIdentifier_decode_xer, |
| 3981 | VisibleIdentifier_encode_xer, |
| 3982 | VisibleIdentifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3983 | VisibleIdentifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3984 | 0, /* Use generic outmost tag fetcher */ |
| 3985 | asn_DEF_VisibleIdentifier_tags_1, |
| 3986 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3987 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3988 | asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ |
| 3989 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 3990 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 3991 | 0, /* No PER visible constraints */ |
| 3992 | 0, 0, /* No members */ |
| 3993 | 0 /* No specifics */ |
| 3994 | }; |
| 3995 | |
| 3996 | |
| 3997 | /*** <<< INCLUDES [Sequence] >>> ***/ |
| 3998 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3999 | #include "Int1.h" |
| 4000 | #include "Int4.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4001 | #include <BOOLEAN.h> |
| 4002 | #include <ENUMERATED.h> |
| 4003 | #include <NULL.h> |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 4004 | #include "Int5.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4005 | #include <constr_SEQUENCE.h> |
| 4006 | |
| 4007 | /*** <<< DEPS [Sequence] >>> ***/ |
| 4008 | |
| 4009 | typedef enum enum_c { |
| 4010 | enum_c_one = 1, |
| 4011 | enum_c_two = 2, |
| 4012 | /* |
| 4013 | * Enumeration is extensible |
| 4014 | */ |
| 4015 | enum_c_three = 3 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4016 | } e_enum_c; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4017 | |
| 4018 | /*** <<< TYPE-DECLS [Sequence] >>> ***/ |
| 4019 | |
| 4020 | typedef struct Sequence { |
| 4021 | Int1_t *int1_c /* DEFAULT 3 */; |
| 4022 | Int4_t int4; |
| 4023 | Int4_t int4_c; |
| 4024 | BOOLEAN_t *bool /* DEFAULT 1 */; |
| 4025 | ENUMERATED_t enum_c; |
| 4026 | NULL_t *null /* OPTIONAL */; |
| 4027 | /* |
| 4028 | * This type is extensible, |
| 4029 | * possible extensions are below. |
| 4030 | */ |
| 4031 | Int5_t *int5_c /* OPTIONAL */; |
| 4032 | |
| 4033 | /* Context for parsing across buffer boundaries */ |
| 4034 | asn_struct_ctx_t _asn_ctx; |
| 4035 | } Sequence_t; |
| 4036 | |
| 4037 | /*** <<< FUNC-DECLS [Sequence] >>> ***/ |
| 4038 | |
| 4039 | /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ |
| 4040 | extern asn_TYPE_descriptor_t asn_DEF_Sequence; |
| 4041 | |
| 4042 | /*** <<< CODE [Sequence] >>> ***/ |
| 4043 | |
| 4044 | static int |
| 4045 | enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4046 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4047 | /* Replace with underlying type checker */ |
| 4048 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4049 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4050 | } |
| 4051 | |
| 4052 | /* |
| 4053 | * This type is implemented using ENUMERATED, |
| 4054 | * so here we adjust the DEF accordingly. |
| 4055 | */ |
| 4056 | static void |
| 4057 | enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4058 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 4059 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 4060 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 4061 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 4062 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 4063 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 4064 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4065 | td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4066 | if(!td->per_constraints) |
| 4067 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 4068 | td->elements = asn_DEF_ENUMERATED.elements; |
| 4069 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 4070 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 4071 | } |
| 4072 | |
| 4073 | static void |
| 4074 | enum_c_6_free(asn_TYPE_descriptor_t *td, |
| 4075 | void *struct_ptr, int contents_only) { |
| 4076 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4077 | td->free_struct(td, struct_ptr, contents_only); |
| 4078 | } |
| 4079 | |
| 4080 | static int |
| 4081 | enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4082 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4083 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4084 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4085 | } |
| 4086 | |
| 4087 | static asn_dec_rval_t |
| 4088 | enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4089 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4090 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4091 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4092 | } |
| 4093 | |
| 4094 | static asn_enc_rval_t |
| 4095 | enum_c_6_encode_der(asn_TYPE_descriptor_t *td, |
| 4096 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4097 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4098 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4099 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4100 | } |
| 4101 | |
| 4102 | static asn_dec_rval_t |
| 4103 | enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4104 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4105 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4106 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4107 | } |
| 4108 | |
| 4109 | static asn_enc_rval_t |
| 4110 | enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4111 | int ilevel, enum xer_encoder_flags_e flags, |
| 4112 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4113 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4114 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4115 | } |
| 4116 | |
| 4117 | static asn_dec_rval_t |
| 4118 | enum_c_6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4119 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4120 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4121 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4122 | } |
| 4123 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4124 | static asn_enc_rval_t |
| 4125 | enum_c_6_encode_uper(asn_TYPE_descriptor_t *td, |
| 4126 | asn_per_constraints_t *constraints, |
| 4127 | void *structure, asn_per_outp_t *per_out) { |
| 4128 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4129 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4130 | } |
| 4131 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4132 | static int |
| 4133 | 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] | 4134 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4135 | const Int1_t *st = (const Int1_t *)sptr; |
| 4136 | long value; |
| 4137 | |
| 4138 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4139 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4140 | "%s: value not given (%s:%d)", |
| 4141 | td->name, __FILE__, __LINE__); |
| 4142 | return -1; |
| 4143 | } |
| 4144 | |
| 4145 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4146 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4147 | "%s: value too large (%s:%d)", |
| 4148 | td->name, __FILE__, __LINE__); |
| 4149 | return -1; |
| 4150 | } |
| 4151 | |
| 4152 | if((value >= -2)) { |
| 4153 | /* Constraint check succeeded */ |
| 4154 | return 0; |
| 4155 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4156 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4157 | "%s: constraint failed (%s:%d)", |
| 4158 | td->name, __FILE__, __LINE__); |
| 4159 | return -1; |
| 4160 | } |
| 4161 | } |
| 4162 | |
| 4163 | static int |
| 4164 | 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] | 4165 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4166 | const Int4_t *st = (const Int4_t *)sptr; |
| 4167 | long value; |
| 4168 | |
| 4169 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4170 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4171 | "%s: value not given (%s:%d)", |
| 4172 | td->name, __FILE__, __LINE__); |
| 4173 | return -1; |
| 4174 | } |
| 4175 | |
| 4176 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4177 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4178 | "%s: value too large (%s:%d)", |
| 4179 | td->name, __FILE__, __LINE__); |
| 4180 | return -1; |
| 4181 | } |
| 4182 | |
| 4183 | if((value >= 5 && value <= 7)) { |
| 4184 | /* Constraint check succeeded */ |
| 4185 | return 0; |
| 4186 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4187 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4188 | "%s: constraint failed (%s:%d)", |
| 4189 | td->name, __FILE__, __LINE__); |
| 4190 | return -1; |
| 4191 | } |
| 4192 | } |
| 4193 | |
| 4194 | static int |
| 4195 | 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] | 4196 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4197 | const Int5_t *st = (const Int5_t *)sptr; |
| 4198 | long value; |
| 4199 | |
| 4200 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4201 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4202 | "%s: value not given (%s:%d)", |
| 4203 | td->name, __FILE__, __LINE__); |
| 4204 | return -1; |
| 4205 | } |
| 4206 | |
| 4207 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4208 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4209 | "%s: value too large (%s:%d)", |
| 4210 | td->name, __FILE__, __LINE__); |
| 4211 | return -1; |
| 4212 | } |
| 4213 | |
| 4214 | if((value == 5)) { |
| 4215 | /* Constraint check succeeded */ |
| 4216 | return 0; |
| 4217 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4218 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4219 | "%s: constraint failed (%s:%d)", |
| 4220 | td->name, __FILE__, __LINE__); |
| 4221 | return -1; |
| 4222 | } |
| 4223 | } |
| 4224 | |
| 4225 | |
| 4226 | /*** <<< STAT-DEFS [Sequence] >>> ***/ |
| 4227 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4228 | static int asn_DFL_2_set_3(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4229 | Int1_t *st = *sptr; |
| 4230 | |
| 4231 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4232 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4233 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4234 | if(!st) return -1; |
| 4235 | } |
| 4236 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4237 | if(set_value) { |
| 4238 | /* Install default value 3 */ |
| 4239 | return asn_long2INTEGER(st, 3); |
| 4240 | } else { |
| 4241 | /* Test default value 3 */ |
| 4242 | long value; |
| 4243 | if(asn_INTEGER2long(st, &value)) |
| 4244 | return -1; |
| 4245 | return (value == 3); |
| 4246 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4247 | } |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4248 | static int asn_DFL_5_set_1(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4249 | BOOLEAN_t *st = *sptr; |
| 4250 | |
| 4251 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4252 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4253 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4254 | if(!st) return -1; |
| 4255 | } |
| 4256 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4257 | if(set_value) { |
| 4258 | /* Install default value 1 */ |
| 4259 | *st = 1; |
| 4260 | return 0; |
| 4261 | } else { |
| 4262 | /* Test default value 1 */ |
| 4263 | return (*st == 1); |
| 4264 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4265 | } |
| 4266 | static asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { |
| 4267 | { 1, 3, "one" }, |
| 4268 | { 2, 3, "two" }, |
| 4269 | { 3, 5, "three" } |
| 4270 | /* This list is extensible */ |
| 4271 | }; |
| 4272 | static unsigned int asn_MAP_enum_c_enum2value_6[] = { |
| 4273 | 0, /* one(1) */ |
| 4274 | 2, /* three(3) */ |
| 4275 | 1 /* two(2) */ |
| 4276 | /* This list is extensible */ |
| 4277 | }; |
| 4278 | static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { |
| 4279 | asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ |
| 4280 | asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ |
| 4281 | 3, /* Number of elements in the maps */ |
| 4282 | 3, /* Extensions before this member */ |
| 4283 | 1 /* Strict enumeration */ |
| 4284 | }; |
| 4285 | static ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { |
| 4286 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4287 | }; |
| 4288 | static asn_per_constraints_t asn_PER_enum_c_constr_6 = { |
| 4289 | { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, |
| 4290 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4291 | }; |
| 4292 | static /* Use -fall-defs-global to expose */ |
| 4293 | asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { |
| 4294 | "enum-c", |
| 4295 | "enum-c", |
| 4296 | enum_c_6_free, |
| 4297 | enum_c_6_print, |
| 4298 | enum_c_6_constraint, |
| 4299 | enum_c_6_decode_ber, |
| 4300 | enum_c_6_encode_der, |
| 4301 | enum_c_6_decode_xer, |
| 4302 | enum_c_6_encode_xer, |
| 4303 | enum_c_6_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4304 | enum_c_6_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4305 | 0, /* Use generic outmost tag fetcher */ |
| 4306 | asn_DEF_enum_c_tags_6, |
| 4307 | sizeof(asn_DEF_enum_c_tags_6) |
| 4308 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 4309 | asn_DEF_enum_c_tags_6, /* Same as above */ |
| 4310 | sizeof(asn_DEF_enum_c_tags_6) |
| 4311 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 4312 | &asn_PER_enum_c_constr_6, |
| 4313 | 0, 0, /* Defined elsewhere */ |
| 4314 | &asn_SPC_enum_c_specs_6 /* Additional specs */ |
| 4315 | }; |
| 4316 | |
| 4317 | static asn_per_constraints_t asn_PER_memb_int1_c_constr_2 = { |
| 4318 | { APC_SEMI_CONSTRAINED, -1, -1, -2, 0 } /* (-2..MAX) */, |
| 4319 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4320 | }; |
| 4321 | static asn_per_constraints_t asn_PER_memb_int4_c_constr_4 = { |
| 4322 | { APC_CONSTRAINED, 2, 2, 5, 7 } /* (5..7) */, |
| 4323 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4324 | }; |
| 4325 | static asn_per_constraints_t asn_PER_memb_enum_c_constr_6 = { |
| 4326 | { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, |
| 4327 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4328 | }; |
| 4329 | static asn_per_constraints_t asn_PER_memb_int5_c_constr_13 = { |
| 4330 | { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, |
| 4331 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4332 | }; |
| 4333 | static asn_TYPE_member_t asn_MBR_Sequence_1[] = { |
| 4334 | { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), |
| 4335 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4336 | .tag_mode = 0, |
| 4337 | .type = &asn_DEF_Int1, |
| 4338 | .memb_constraints = memb_int1_c_constraint_1, |
| 4339 | .per_constraints = &asn_PER_memb_int1_c_constr_2, |
| 4340 | .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ |
| 4341 | .name = "int1-c" |
| 4342 | }, |
| 4343 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), |
| 4344 | .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 4345 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 4346 | .type = &asn_DEF_Int4, |
| 4347 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4348 | .per_constraints = 0, /* No PER visible constraints */ |
| 4349 | .default_value = 0, |
| 4350 | .name = "int4" |
| 4351 | }, |
| 4352 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), |
| 4353 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4354 | .tag_mode = 0, |
| 4355 | .type = &asn_DEF_Int4, |
| 4356 | .memb_constraints = memb_int4_c_constraint_1, |
| 4357 | .per_constraints = &asn_PER_memb_int4_c_constr_4, |
| 4358 | .default_value = 0, |
| 4359 | .name = "int4-c" |
| 4360 | }, |
| 4361 | { ATF_POINTER, 1, offsetof(struct Sequence, bool), |
| 4362 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), |
| 4363 | .tag_mode = 0, |
| 4364 | .type = &asn_DEF_BOOLEAN, |
| 4365 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4366 | .per_constraints = 0, /* No PER visible constraints */ |
| 4367 | .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ |
| 4368 | .name = "bool" |
| 4369 | }, |
| 4370 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), |
| 4371 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), |
| 4372 | .tag_mode = 0, |
| 4373 | .type = &asn_DEF_enum_c_6, |
| 4374 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4375 | .per_constraints = &asn_PER_memb_enum_c_constr_6, |
| 4376 | .default_value = 0, |
| 4377 | .name = "enum-c" |
| 4378 | }, |
| 4379 | { ATF_POINTER, 2, offsetof(struct Sequence, null), |
| 4380 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), |
| 4381 | .tag_mode = 0, |
| 4382 | .type = &asn_DEF_NULL, |
| 4383 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4384 | .per_constraints = 0, /* No PER visible constraints */ |
| 4385 | .default_value = 0, |
| 4386 | .name = "null" |
| 4387 | }, |
| 4388 | { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), |
| 4389 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4390 | .tag_mode = 0, |
| 4391 | .type = &asn_DEF_Int5, |
| 4392 | .memb_constraints = memb_int5_c_constraint_1, |
| 4393 | .per_constraints = &asn_PER_memb_int5_c_constr_13, |
| 4394 | .default_value = 0, |
| 4395 | .name = "int5-c" |
| 4396 | }, |
| 4397 | }; |
| 4398 | static int asn_MAP_Sequence_oms_1[] = { 0, 3, 5, 6 }; |
| 4399 | static ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { |
| 4400 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4401 | }; |
| 4402 | static asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { |
| 4403 | { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool at 59 */ |
| 4404 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c at 56 */ |
| 4405 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c at 58 */ |
| 4406 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c at 62 */ |
| 4407 | { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null at 64 */ |
| 4408 | { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c at 60 */ |
| 4409 | { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 at 57 */ |
| 4410 | }; |
| 4411 | static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { |
| 4412 | sizeof(struct Sequence), |
| 4413 | offsetof(struct Sequence, _asn_ctx), |
| 4414 | asn_MAP_Sequence_tag2el_1, |
| 4415 | 7, /* Count of tags in the map */ |
| 4416 | asn_MAP_Sequence_oms_1, /* Optional members */ |
| 4417 | 3, 1, /* Root/Additions */ |
| 4418 | 5, /* Start extensions */ |
| 4419 | 8 /* Stop extensions */ |
| 4420 | }; |
| 4421 | asn_TYPE_descriptor_t asn_DEF_Sequence = { |
| 4422 | "Sequence", |
| 4423 | "Sequence", |
| 4424 | SEQUENCE_free, |
| 4425 | SEQUENCE_print, |
| 4426 | SEQUENCE_constraint, |
| 4427 | SEQUENCE_decode_ber, |
| 4428 | SEQUENCE_encode_der, |
| 4429 | SEQUENCE_decode_xer, |
| 4430 | SEQUENCE_encode_xer, |
| 4431 | SEQUENCE_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4432 | SEQUENCE_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4433 | 0, /* Use generic outmost tag fetcher */ |
| 4434 | asn_DEF_Sequence_tags_1, |
| 4435 | sizeof(asn_DEF_Sequence_tags_1) |
| 4436 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4437 | asn_DEF_Sequence_tags_1, /* Same as above */ |
| 4438 | sizeof(asn_DEF_Sequence_tags_1) |
| 4439 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4440 | 0, /* No PER visible constraints */ |
| 4441 | asn_MBR_Sequence_1, |
| 4442 | 7, /* Elements count */ |
| 4443 | &asn_SPC_Sequence_specs_1 /* Additional specs */ |
| 4444 | }; |
| 4445 | |
| 4446 | |
| 4447 | /*** <<< INCLUDES [SequenceOf] >>> ***/ |
| 4448 | |
| 4449 | #include <asn_SEQUENCE_OF.h> |
| 4450 | #include <constr_SEQUENCE_OF.h> |
| 4451 | |
| 4452 | /*** <<< FWD-DECLS [SequenceOf] >>> ***/ |
| 4453 | |
| 4454 | struct Sequence; |
| 4455 | |
| 4456 | /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ |
| 4457 | |
| 4458 | typedef struct SequenceOf { |
| 4459 | A_SEQUENCE_OF(struct Sequence) list; |
| 4460 | |
| 4461 | /* Context for parsing across buffer boundaries */ |
| 4462 | asn_struct_ctx_t _asn_ctx; |
| 4463 | } SequenceOf_t; |
| 4464 | |
| 4465 | /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ |
| 4466 | |
| 4467 | extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; |
| 4468 | |
| 4469 | /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ |
| 4470 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 4471 | #include "Sequence.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4472 | |
| 4473 | /*** <<< STAT-DEFS [SequenceOf] >>> ***/ |
| 4474 | |
| 4475 | static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { |
| 4476 | { ATF_POINTER, 0, 0, |
| 4477 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 4478 | .tag_mode = 0, |
| 4479 | .type = &asn_DEF_Sequence, |
| 4480 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4481 | .per_constraints = 0, /* No PER visible constraints */ |
| 4482 | .default_value = 0, |
| 4483 | .name = "" |
| 4484 | }, |
| 4485 | }; |
| 4486 | static ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { |
| 4487 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4488 | }; |
| 4489 | static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { |
| 4490 | sizeof(struct SequenceOf), |
| 4491 | offsetof(struct SequenceOf, _asn_ctx), |
| 4492 | 0, /* XER encoding is XMLDelimitedItemList */ |
| 4493 | }; |
| 4494 | static asn_per_constraints_t asn_PER_SequenceOf_constr_1 = { |
| 4495 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4496 | { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */ |
| 4497 | }; |
| 4498 | asn_TYPE_descriptor_t asn_DEF_SequenceOf = { |
| 4499 | "SequenceOf", |
| 4500 | "SequenceOf", |
| 4501 | SEQUENCE_OF_free, |
| 4502 | SEQUENCE_OF_print, |
| 4503 | SEQUENCE_OF_constraint, |
| 4504 | SEQUENCE_OF_decode_ber, |
| 4505 | SEQUENCE_OF_encode_der, |
| 4506 | SEQUENCE_OF_decode_xer, |
| 4507 | SEQUENCE_OF_encode_xer, |
| 4508 | SEQUENCE_OF_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4509 | SEQUENCE_OF_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4510 | 0, /* Use generic outmost tag fetcher */ |
| 4511 | asn_DEF_SequenceOf_tags_1, |
| 4512 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4513 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 4514 | asn_DEF_SequenceOf_tags_1, /* Same as above */ |
| 4515 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4516 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 4517 | &asn_PER_SequenceOf_constr_1, |
| 4518 | asn_MBR_SequenceOf_1, |
| 4519 | 1, /* Single element */ |
| 4520 | &asn_SPC_SequenceOf_specs_1 /* Additional specs */ |
| 4521 | }; |
| 4522 | |
| 4523 | |
| 4524 | /*** <<< INCLUDES [Enum0] >>> ***/ |
| 4525 | |
| 4526 | #include <ENUMERATED.h> |
| 4527 | |
| 4528 | /*** <<< DEPS [Enum0] >>> ***/ |
| 4529 | |
| 4530 | typedef enum Enum0 { |
| 4531 | Enum0_one = 0, |
| 4532 | Enum0_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4533 | } e_Enum0; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4534 | |
| 4535 | /*** <<< TYPE-DECLS [Enum0] >>> ***/ |
| 4536 | |
| 4537 | typedef ENUMERATED_t Enum0_t; |
| 4538 | |
| 4539 | /*** <<< FUNC-DECLS [Enum0] >>> ***/ |
| 4540 | |
| 4541 | extern asn_TYPE_descriptor_t asn_DEF_Enum0; |
| 4542 | asn_struct_free_f Enum0_free; |
| 4543 | asn_struct_print_f Enum0_print; |
| 4544 | asn_constr_check_f Enum0_constraint; |
| 4545 | ber_type_decoder_f Enum0_decode_ber; |
| 4546 | der_type_encoder_f Enum0_encode_der; |
| 4547 | xer_type_decoder_f Enum0_decode_xer; |
| 4548 | xer_type_encoder_f Enum0_encode_xer; |
| 4549 | per_type_decoder_f Enum0_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4550 | per_type_encoder_f Enum0_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4551 | |
| 4552 | /*** <<< CODE [Enum0] >>> ***/ |
| 4553 | |
| 4554 | int |
| 4555 | Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4556 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4557 | /* Replace with underlying type checker */ |
| 4558 | td->check_constraints = asn_DEF_ENUMERATED.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4559 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4560 | } |
| 4561 | |
| 4562 | /* |
| 4563 | * This type is implemented using ENUMERATED, |
| 4564 | * so here we adjust the DEF accordingly. |
| 4565 | */ |
| 4566 | static void |
| 4567 | Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4568 | td->free_struct = asn_DEF_ENUMERATED.free_struct; |
| 4569 | td->print_struct = asn_DEF_ENUMERATED.print_struct; |
| 4570 | td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; |
| 4571 | td->der_encoder = asn_DEF_ENUMERATED.der_encoder; |
| 4572 | td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; |
| 4573 | td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; |
| 4574 | td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4575 | td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4576 | if(!td->per_constraints) |
| 4577 | td->per_constraints = asn_DEF_ENUMERATED.per_constraints; |
| 4578 | td->elements = asn_DEF_ENUMERATED.elements; |
| 4579 | td->elements_count = asn_DEF_ENUMERATED.elements_count; |
| 4580 | /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ |
| 4581 | } |
| 4582 | |
| 4583 | void |
| 4584 | Enum0_free(asn_TYPE_descriptor_t *td, |
| 4585 | void *struct_ptr, int contents_only) { |
| 4586 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4587 | td->free_struct(td, struct_ptr, contents_only); |
| 4588 | } |
| 4589 | |
| 4590 | int |
| 4591 | Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4592 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4593 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4594 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4595 | } |
| 4596 | |
| 4597 | asn_dec_rval_t |
| 4598 | Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4599 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4600 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4601 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4602 | } |
| 4603 | |
| 4604 | asn_enc_rval_t |
| 4605 | Enum0_encode_der(asn_TYPE_descriptor_t *td, |
| 4606 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4607 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4608 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4609 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4610 | } |
| 4611 | |
| 4612 | asn_dec_rval_t |
| 4613 | Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4614 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4615 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4616 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4617 | } |
| 4618 | |
| 4619 | asn_enc_rval_t |
| 4620 | Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4621 | int ilevel, enum xer_encoder_flags_e flags, |
| 4622 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4623 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4624 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4625 | } |
| 4626 | |
| 4627 | asn_dec_rval_t |
| 4628 | Enum0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4629 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4630 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4631 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4632 | } |
| 4633 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4634 | asn_enc_rval_t |
| 4635 | Enum0_encode_uper(asn_TYPE_descriptor_t *td, |
| 4636 | asn_per_constraints_t *constraints, |
| 4637 | void *structure, asn_per_outp_t *per_out) { |
| 4638 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4639 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4640 | } |
| 4641 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4642 | |
| 4643 | /*** <<< STAT-DEFS [Enum0] >>> ***/ |
| 4644 | |
| 4645 | static asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { |
| 4646 | { 0, 3, "one" }, |
| 4647 | { 1, 3, "two" } |
| 4648 | }; |
| 4649 | static unsigned int asn_MAP_Enum0_enum2value_1[] = { |
| 4650 | 0, /* one(0) */ |
| 4651 | 1 /* two(1) */ |
| 4652 | }; |
| 4653 | static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { |
| 4654 | asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4655 | asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ |
| 4656 | 2, /* Number of elements in the maps */ |
| 4657 | 0, /* Enumeration is not extensible */ |
| 4658 | 1 /* Strict enumeration */ |
| 4659 | }; |
| 4660 | static ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { |
| 4661 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4662 | }; |
| 4663 | static asn_per_constraints_t asn_PER_Enum0_constr_1 = { |
| 4664 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4665 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4666 | }; |
| 4667 | asn_TYPE_descriptor_t asn_DEF_Enum0 = { |
| 4668 | "Enum0", |
| 4669 | "Enum0", |
| 4670 | Enum0_free, |
| 4671 | Enum0_print, |
| 4672 | Enum0_constraint, |
| 4673 | Enum0_decode_ber, |
| 4674 | Enum0_encode_der, |
| 4675 | Enum0_decode_xer, |
| 4676 | Enum0_encode_xer, |
| 4677 | Enum0_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4678 | Enum0_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4679 | 0, /* Use generic outmost tag fetcher */ |
| 4680 | asn_DEF_Enum0_tags_1, |
| 4681 | sizeof(asn_DEF_Enum0_tags_1) |
| 4682 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4683 | asn_DEF_Enum0_tags_1, /* Same as above */ |
| 4684 | sizeof(asn_DEF_Enum0_tags_1) |
| 4685 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4686 | &asn_PER_Enum0_constr_1, |
| 4687 | 0, 0, /* Defined elsewhere */ |
| 4688 | &asn_SPC_Enum0_specs_1 /* Additional specs */ |
| 4689 | }; |
| 4690 | |
| 4691 | |
| 4692 | /*** <<< INCLUDES [Enum1] >>> ***/ |
| 4693 | |
| 4694 | #include <NativeEnumerated.h> |
| 4695 | |
| 4696 | /*** <<< DEPS [Enum1] >>> ***/ |
| 4697 | |
| 4698 | typedef enum Enum1 { |
| 4699 | Enum1_one = 0, |
| 4700 | Enum1_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4701 | } e_Enum1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4702 | |
| 4703 | /*** <<< TYPE-DECLS [Enum1] >>> ***/ |
| 4704 | |
| 4705 | typedef long Enum1_t; |
| 4706 | |
| 4707 | /*** <<< FUNC-DECLS [Enum1] >>> ***/ |
| 4708 | |
| 4709 | extern asn_TYPE_descriptor_t asn_DEF_Enum1; |
| 4710 | asn_struct_free_f Enum1_free; |
| 4711 | asn_struct_print_f Enum1_print; |
| 4712 | asn_constr_check_f Enum1_constraint; |
| 4713 | ber_type_decoder_f Enum1_decode_ber; |
| 4714 | der_type_encoder_f Enum1_encode_der; |
| 4715 | xer_type_decoder_f Enum1_decode_xer; |
| 4716 | xer_type_encoder_f Enum1_encode_xer; |
| 4717 | per_type_decoder_f Enum1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4718 | per_type_encoder_f Enum1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4719 | |
| 4720 | /*** <<< CODE [Enum1] >>> ***/ |
| 4721 | |
| 4722 | int |
| 4723 | Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4724 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4725 | long value; |
| 4726 | |
| 4727 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4728 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4729 | "%s: value not given (%s:%d)", |
| 4730 | td->name, __FILE__, __LINE__); |
| 4731 | return -1; |
| 4732 | } |
| 4733 | |
| 4734 | value = *(const long *)sptr; |
| 4735 | |
| 4736 | if((value == 0)) { |
| 4737 | /* Constraint check succeeded */ |
| 4738 | return 0; |
| 4739 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4740 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4741 | "%s: constraint failed (%s:%d)", |
| 4742 | td->name, __FILE__, __LINE__); |
| 4743 | return -1; |
| 4744 | } |
| 4745 | } |
| 4746 | |
| 4747 | /* |
| 4748 | * This type is implemented using NativeEnumerated, |
| 4749 | * so here we adjust the DEF accordingly. |
| 4750 | */ |
| 4751 | static void |
| 4752 | Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4753 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4754 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
| 4755 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4756 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4757 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4758 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4759 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4760 | td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4761 | if(!td->per_constraints) |
| 4762 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4763 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4764 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4765 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
| 4766 | } |
| 4767 | |
| 4768 | void |
| 4769 | Enum1_free(asn_TYPE_descriptor_t *td, |
| 4770 | void *struct_ptr, int contents_only) { |
| 4771 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4772 | td->free_struct(td, struct_ptr, contents_only); |
| 4773 | } |
| 4774 | |
| 4775 | int |
| 4776 | Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4777 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4778 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4779 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4780 | } |
| 4781 | |
| 4782 | asn_dec_rval_t |
| 4783 | Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4784 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4785 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4786 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4787 | } |
| 4788 | |
| 4789 | asn_enc_rval_t |
| 4790 | Enum1_encode_der(asn_TYPE_descriptor_t *td, |
| 4791 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4792 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4793 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4794 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4795 | } |
| 4796 | |
| 4797 | asn_dec_rval_t |
| 4798 | Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4799 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4800 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4801 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4802 | } |
| 4803 | |
| 4804 | asn_enc_rval_t |
| 4805 | Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4806 | int ilevel, enum xer_encoder_flags_e flags, |
| 4807 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4808 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4809 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4810 | } |
| 4811 | |
| 4812 | asn_dec_rval_t |
| 4813 | Enum1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4814 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4815 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4816 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4817 | } |
| 4818 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4819 | asn_enc_rval_t |
| 4820 | Enum1_encode_uper(asn_TYPE_descriptor_t *td, |
| 4821 | asn_per_constraints_t *constraints, |
| 4822 | void *structure, asn_per_outp_t *per_out) { |
| 4823 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4824 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4825 | } |
| 4826 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4827 | |
| 4828 | /*** <<< STAT-DEFS [Enum1] >>> ***/ |
| 4829 | |
| 4830 | static asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { |
| 4831 | { 0, 3, "one" }, |
| 4832 | { 1, 3, "two" } |
| 4833 | }; |
| 4834 | static unsigned int asn_MAP_Enum1_enum2value_1[] = { |
| 4835 | 0, /* one(0) */ |
| 4836 | 1 /* two(1) */ |
| 4837 | }; |
| 4838 | static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { |
| 4839 | asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4840 | asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ |
| 4841 | 2, /* Number of elements in the maps */ |
| 4842 | 0, /* Enumeration is not extensible */ |
| 4843 | 1 /* Strict enumeration */ |
| 4844 | }; |
| 4845 | static ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { |
| 4846 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4847 | }; |
| 4848 | static asn_per_constraints_t asn_PER_Enum1_constr_1 = { |
| 4849 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4850 | { APC_UNCONSTRAINED, -1, -1, 0, 0 } |
| 4851 | }; |
| 4852 | asn_TYPE_descriptor_t asn_DEF_Enum1 = { |
| 4853 | "Enum1", |
| 4854 | "Enum1", |
| 4855 | Enum1_free, |
| 4856 | Enum1_print, |
| 4857 | Enum1_constraint, |
| 4858 | Enum1_decode_ber, |
| 4859 | Enum1_encode_der, |
| 4860 | Enum1_decode_xer, |
| 4861 | Enum1_encode_xer, |
| 4862 | Enum1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4863 | Enum1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4864 | 0, /* Use generic outmost tag fetcher */ |
| 4865 | asn_DEF_Enum1_tags_1, |
| 4866 | sizeof(asn_DEF_Enum1_tags_1) |
| 4867 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4868 | asn_DEF_Enum1_tags_1, /* Same as above */ |
| 4869 | sizeof(asn_DEF_Enum1_tags_1) |
| 4870 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4871 | &asn_PER_Enum1_constr_1, |
| 4872 | 0, 0, /* Defined elsewhere */ |
| 4873 | &asn_SPC_Enum1_specs_1 /* Additional specs */ |
| 4874 | }; |
| 4875 | |
| 4876 | |
| 4877 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 4878 | |
| 4879 | #include <VisibleString.h> |
| 4880 | |
| 4881 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 4882 | |
| 4883 | typedef VisibleString_t Identifier_t; |
| 4884 | |
| 4885 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 4886 | |
| 4887 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
| 4888 | asn_struct_free_f Identifier_free; |
| 4889 | asn_struct_print_f Identifier_print; |
| 4890 | asn_constr_check_f Identifier_constraint; |
| 4891 | ber_type_decoder_f Identifier_decode_ber; |
| 4892 | der_type_encoder_f Identifier_encode_der; |
| 4893 | xer_type_decoder_f Identifier_decode_xer; |
| 4894 | xer_type_encoder_f Identifier_encode_xer; |
| 4895 | per_type_decoder_f Identifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4896 | per_type_encoder_f Identifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4897 | |
| 4898 | /*** <<< CTABLES [Identifier] >>> ***/ |
| 4899 | |
| 4900 | static int permitted_alphabet_table_1[256] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 4901 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 4902 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 4903 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ |
| 4904 | 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ |
| 4905 | 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ |
| 4906 | 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ |
| 4907 | 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ |
| 4908 | 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4909 | }; |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 4910 | static int permitted_alphabet_code2value_1[64] = { |
| 4911 | 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, |
| 4912 | 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, |
| 4913 | 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, |
| 4914 | 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, |
| 4915 | }; |
| 4916 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4917 | |
| 4918 | static int check_permitted_alphabet_1(const void *sptr) { |
| 4919 | int *table = permitted_alphabet_table_1; |
| 4920 | /* The underlying type is VisibleString */ |
| 4921 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 4922 | const uint8_t *ch = st->buf; |
| 4923 | const uint8_t *end = ch + st->size; |
| 4924 | |
| 4925 | for(; ch < end; ch++) { |
| 4926 | uint8_t cv = *ch; |
| 4927 | if(!table[cv]) return -1; |
| 4928 | } |
| 4929 | return 0; |
| 4930 | } |
| 4931 | |
| 4932 | |
| 4933 | /*** <<< CODE [Identifier] >>> ***/ |
| 4934 | |
| 4935 | int |
| 4936 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4937 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4938 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 4939 | size_t size; |
| 4940 | |
| 4941 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4942 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4943 | "%s: value not given (%s:%d)", |
| 4944 | td->name, __FILE__, __LINE__); |
| 4945 | return -1; |
| 4946 | } |
| 4947 | |
| 4948 | size = st->size; |
| 4949 | |
| 4950 | if((size >= 1 && size <= 32) |
| 4951 | && !check_permitted_alphabet_1(st)) { |
| 4952 | /* Constraint check succeeded */ |
| 4953 | return 0; |
| 4954 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 4955 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4956 | "%s: constraint failed (%s:%d)", |
| 4957 | td->name, __FILE__, __LINE__); |
| 4958 | return -1; |
| 4959 | } |
| 4960 | } |
| 4961 | |
| 4962 | /* |
| 4963 | * This type is implemented using VisibleString, |
| 4964 | * so here we adjust the DEF accordingly. |
| 4965 | */ |
| 4966 | static void |
| 4967 | Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4968 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 4969 | td->print_struct = asn_DEF_VisibleString.print_struct; |
| 4970 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 4971 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 4972 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 4973 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
| 4974 | td->uper_decoder = asn_DEF_VisibleString.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4975 | td->uper_encoder = asn_DEF_VisibleString.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4976 | if(!td->per_constraints) |
| 4977 | td->per_constraints = asn_DEF_VisibleString.per_constraints; |
| 4978 | td->elements = asn_DEF_VisibleString.elements; |
| 4979 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 4980 | td->specifics = asn_DEF_VisibleString.specifics; |
| 4981 | } |
| 4982 | |
| 4983 | void |
| 4984 | Identifier_free(asn_TYPE_descriptor_t *td, |
| 4985 | void *struct_ptr, int contents_only) { |
| 4986 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4987 | td->free_struct(td, struct_ptr, contents_only); |
| 4988 | } |
| 4989 | |
| 4990 | int |
| 4991 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4992 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4993 | Identifier_1_inherit_TYPE_descriptor(td); |
| 4994 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4995 | } |
| 4996 | |
| 4997 | asn_dec_rval_t |
| 4998 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4999 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 5000 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5001 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 5002 | } |
| 5003 | |
| 5004 | asn_enc_rval_t |
| 5005 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
| 5006 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 5007 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 5008 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5009 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 5010 | } |
| 5011 | |
| 5012 | asn_dec_rval_t |
| 5013 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5014 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 5015 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5016 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 5017 | } |
| 5018 | |
| 5019 | asn_enc_rval_t |
| 5020 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 5021 | int ilevel, enum xer_encoder_flags_e flags, |
| 5022 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 5023 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5024 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 5025 | } |
| 5026 | |
| 5027 | asn_dec_rval_t |
| 5028 | Identifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5029 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 5030 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5031 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 5032 | } |
| 5033 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5034 | asn_enc_rval_t |
| 5035 | Identifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 5036 | asn_per_constraints_t *constraints, |
| 5037 | void *structure, asn_per_outp_t *per_out) { |
| 5038 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5039 | return td->uper_encoder(td, constraints, structure, per_out); |
| 5040 | } |
| 5041 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5042 | |
| 5043 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 5044 | |
| 5045 | static ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { |
| 5046 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 5047 | }; |
| 5048 | static asn_per_constraints_t asn_PER_Identifier_constr_1 = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame^] | 5049 | { APC_CONSTRAINED, 7, 7, 36, 122 } /* (36..122) */, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5050 | { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */ |
| 5051 | }; |
| 5052 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
| 5053 | "Identifier", |
| 5054 | "Identifier", |
| 5055 | Identifier_free, |
| 5056 | Identifier_print, |
| 5057 | Identifier_constraint, |
| 5058 | Identifier_decode_ber, |
| 5059 | Identifier_encode_der, |
| 5060 | Identifier_decode_xer, |
| 5061 | Identifier_encode_xer, |
| 5062 | Identifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5063 | Identifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5064 | 0, /* Use generic outmost tag fetcher */ |
| 5065 | asn_DEF_Identifier_tags_1, |
| 5066 | sizeof(asn_DEF_Identifier_tags_1) |
| 5067 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 5068 | asn_DEF_Identifier_tags_1, /* Same as above */ |
| 5069 | sizeof(asn_DEF_Identifier_tags_1) |
| 5070 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 5071 | &asn_PER_Identifier_constr_1, |
| 5072 | 0, 0, /* No members */ |
| 5073 | 0 /* No specifics */ |
| 5074 | }; |
| 5075 | |