Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
| 8 | |
| 9 | typedef INTEGER_t Int1_t; |
| 10 | |
| 11 | |
| 12 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 13 | |
| 14 | extern asn1_TYPE_descriptor_t asn1_DEF_Int1; |
| 15 | asn_constr_check_f Int1_constraint; |
| 16 | ber_type_decoder_f Int1_decode_ber; |
| 17 | der_type_encoder_f Int1_encode_der; |
| 18 | asn_struct_print_f Int1_print; |
| 19 | asn_struct_free_f Int1_free; |
| 20 | |
| 21 | /*** <<< CODE [Int1] >>> ***/ |
| 22 | |
| 23 | int |
| 24 | Int1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 25 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 26 | |
| 27 | /* Make the underlying type checker permanent */ |
| 28 | td->check_constraints = asn1_DEF_INTEGER.check_constraints; |
| 29 | return td->check_constraints |
| 30 | (td, sptr, app_errlog, app_key); |
| 31 | } |
| 32 | |
| 33 | /* |
| 34 | * This type is implemented using INTEGER, |
| 35 | * so adjust the DEF appropriately. |
| 36 | */ |
| 37 | static void |
| 38 | Int1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 39 | td->ber_decoder = asn1_DEF_INTEGER.ber_decoder; |
| 40 | td->der_encoder = asn1_DEF_INTEGER.der_encoder; |
| 41 | td->free_struct = asn1_DEF_INTEGER.free_struct; |
| 42 | td->print_struct = asn1_DEF_INTEGER.print_struct; |
| 43 | td->last_tag_form = asn1_DEF_INTEGER.last_tag_form; |
| 44 | td->elements = asn1_DEF_INTEGER.elements; |
| 45 | td->elements_count = asn1_DEF_INTEGER.elements_count; |
| 46 | td->specifics = asn1_DEF_INTEGER.specifics; |
| 47 | } |
| 48 | |
| 49 | ber_dec_rval_t |
| 50 | Int1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 51 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 52 | Int1_inherit_TYPE_descriptor(td); |
| 53 | return td->ber_decoder(td, structure, |
| 54 | bufptr, size, tag_mode); |
| 55 | } |
| 56 | |
| 57 | der_enc_rval_t |
| 58 | Int1_encode_der(asn1_TYPE_descriptor_t *td, |
| 59 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 60 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 61 | Int1_inherit_TYPE_descriptor(td); |
| 62 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 63 | } |
| 64 | |
| 65 | int |
| 66 | Int1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 67 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 68 | Int1_inherit_TYPE_descriptor(td); |
| 69 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 70 | } |
| 71 | |
| 72 | void |
| 73 | Int1_free(asn1_TYPE_descriptor_t *td, |
| 74 | void *struct_ptr, int contents_only) { |
| 75 | Int1_inherit_TYPE_descriptor(td); |
| 76 | td->free_struct(td, struct_ptr, contents_only); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 81 | |
| 82 | static ber_tlv_tag_t asn1_DEF_Int1_tags[] = { |
| 83 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 84 | }; |
| 85 | asn1_TYPE_descriptor_t asn1_DEF_Int1 = { |
| 86 | "Int1", |
| 87 | Int1_constraint, |
| 88 | Int1_decode_ber, |
| 89 | Int1_encode_der, |
| 90 | Int1_print, |
| 91 | Int1_free, |
| 92 | 0, /* Use generic outmost tag fetcher */ |
| 93 | asn1_DEF_Int1_tags, |
| 94 | sizeof(asn1_DEF_Int1_tags) |
| 95 | /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */ |
| 96 | 1, /* Tags to skip */ |
| 97 | -0, /* Unknown yet */ |
| 98 | 0, 0, /* No members */ |
| 99 | 0 /* No specifics */ |
| 100 | }; |
| 101 | |
| 102 | |
| 103 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 104 | |
| 105 | #include <Int1.h> |
| 106 | |
| 107 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 108 | |
| 109 | |
| 110 | typedef Int1_t Int2_t; |
| 111 | |
| 112 | |
| 113 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 114 | |
| 115 | extern asn1_TYPE_descriptor_t asn1_DEF_Int2; |
| 116 | asn_constr_check_f Int2_constraint; |
| 117 | ber_type_decoder_f Int2_decode_ber; |
| 118 | der_type_encoder_f Int2_encode_der; |
| 119 | asn_struct_print_f Int2_print; |
| 120 | asn_struct_free_f Int2_free; |
| 121 | |
| 122 | /*** <<< CODE [Int2] >>> ***/ |
| 123 | |
| 124 | int |
| 125 | Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 126 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 127 | |
| 128 | const Int2_t *st = sptr; |
| 129 | long value; |
| 130 | |
| 131 | if(!sptr) { |
| 132 | _ASN_ERRLOG(app_errlog, app_key, |
| 133 | "%s: value not given", td->name); |
| 134 | return -1; |
| 135 | } |
| 136 | |
| 137 | if(asn1_INTEGER2long(st, &value)) { |
| 138 | _ASN_ERRLOG(app_errlog, app_key, |
| 139 | "%s: value too large", td->name); |
| 140 | return -1; |
| 141 | } |
| 142 | |
| 143 | if((value >= 0)) { |
| 144 | /* Constraint check succeeded */ |
| 145 | return 1; |
| 146 | } else { |
| 147 | _ASN_ERRLOG(app_errlog, app_key, |
| 148 | "%s: constraint failed", td->name); |
| 149 | return -1; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * This type is implemented using Int1, |
| 155 | * so adjust the DEF appropriately. |
| 156 | */ |
| 157 | static void |
| 158 | Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 159 | td->ber_decoder = asn1_DEF_Int1.ber_decoder; |
| 160 | td->der_encoder = asn1_DEF_Int1.der_encoder; |
| 161 | td->free_struct = asn1_DEF_Int1.free_struct; |
| 162 | td->print_struct = asn1_DEF_Int1.print_struct; |
| 163 | td->last_tag_form = asn1_DEF_Int1.last_tag_form; |
| 164 | td->elements = asn1_DEF_Int1.elements; |
| 165 | td->elements_count = asn1_DEF_Int1.elements_count; |
| 166 | td->specifics = asn1_DEF_Int1.specifics; |
| 167 | } |
| 168 | |
| 169 | ber_dec_rval_t |
| 170 | Int2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 171 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 172 | Int2_inherit_TYPE_descriptor(td); |
| 173 | return td->ber_decoder(td, structure, |
| 174 | bufptr, size, tag_mode); |
| 175 | } |
| 176 | |
| 177 | der_enc_rval_t |
| 178 | Int2_encode_der(asn1_TYPE_descriptor_t *td, |
| 179 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 180 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 181 | Int2_inherit_TYPE_descriptor(td); |
| 182 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 183 | } |
| 184 | |
| 185 | int |
| 186 | Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 187 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 188 | Int2_inherit_TYPE_descriptor(td); |
| 189 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 190 | } |
| 191 | |
| 192 | void |
| 193 | Int2_free(asn1_TYPE_descriptor_t *td, |
| 194 | void *struct_ptr, int contents_only) { |
| 195 | Int2_inherit_TYPE_descriptor(td); |
| 196 | td->free_struct(td, struct_ptr, contents_only); |
| 197 | } |
| 198 | |
| 199 | |
| 200 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 201 | |
| 202 | static ber_tlv_tag_t asn1_DEF_Int2_tags[] = { |
| 203 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 204 | }; |
| 205 | asn1_TYPE_descriptor_t asn1_DEF_Int2 = { |
| 206 | "Int2", |
| 207 | Int2_constraint, |
| 208 | Int2_decode_ber, |
| 209 | Int2_encode_der, |
| 210 | Int2_print, |
| 211 | Int2_free, |
| 212 | 0, /* Use generic outmost tag fetcher */ |
| 213 | asn1_DEF_Int2_tags, |
| 214 | sizeof(asn1_DEF_Int2_tags) |
| 215 | /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */ |
| 216 | 1, /* Tags to skip */ |
| 217 | -0, /* Unknown yet */ |
| 218 | 0, 0, /* No members */ |
| 219 | 0 /* No specifics */ |
| 220 | }; |
| 221 | |
| 222 | |
| 223 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 224 | |
| 225 | #include <Int2.h> |
| 226 | |
| 227 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 228 | |
| 229 | |
| 230 | typedef Int2_t Int3_t; |
| 231 | |
| 232 | |
| 233 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 234 | |
| 235 | extern asn1_TYPE_descriptor_t asn1_DEF_Int3; |
| 236 | asn_constr_check_f Int3_constraint; |
| 237 | ber_type_decoder_f Int3_decode_ber; |
| 238 | der_type_encoder_f Int3_encode_der; |
| 239 | asn_struct_print_f Int3_print; |
| 240 | asn_struct_free_f Int3_free; |
| 241 | |
| 242 | /*** <<< CODE [Int3] >>> ***/ |
| 243 | |
| 244 | int |
| 245 | Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 246 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 247 | |
| 248 | const Int3_t *st = sptr; |
| 249 | long value; |
| 250 | |
| 251 | if(!sptr) { |
| 252 | _ASN_ERRLOG(app_errlog, app_key, |
| 253 | "%s: value not given", td->name); |
| 254 | return -1; |
| 255 | } |
| 256 | |
| 257 | if(asn1_INTEGER2long(st, &value)) { |
| 258 | _ASN_ERRLOG(app_errlog, app_key, |
| 259 | "%s: value too large", td->name); |
| 260 | return -1; |
| 261 | } |
| 262 | |
| 263 | if((value >= 0 && value <= 10)) { |
| 264 | /* Constraint check succeeded */ |
| 265 | return 1; |
| 266 | } else { |
| 267 | _ASN_ERRLOG(app_errlog, app_key, |
| 268 | "%s: constraint failed", td->name); |
| 269 | return -1; |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | /* |
| 274 | * This type is implemented using Int2, |
| 275 | * so adjust the DEF appropriately. |
| 276 | */ |
| 277 | static void |
| 278 | Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 279 | td->ber_decoder = asn1_DEF_Int2.ber_decoder; |
| 280 | td->der_encoder = asn1_DEF_Int2.der_encoder; |
| 281 | td->free_struct = asn1_DEF_Int2.free_struct; |
| 282 | td->print_struct = asn1_DEF_Int2.print_struct; |
| 283 | td->last_tag_form = asn1_DEF_Int2.last_tag_form; |
| 284 | td->elements = asn1_DEF_Int2.elements; |
| 285 | td->elements_count = asn1_DEF_Int2.elements_count; |
| 286 | td->specifics = asn1_DEF_Int2.specifics; |
| 287 | } |
| 288 | |
| 289 | ber_dec_rval_t |
| 290 | Int3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 291 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 292 | Int3_inherit_TYPE_descriptor(td); |
| 293 | return td->ber_decoder(td, structure, |
| 294 | bufptr, size, tag_mode); |
| 295 | } |
| 296 | |
| 297 | der_enc_rval_t |
| 298 | Int3_encode_der(asn1_TYPE_descriptor_t *td, |
| 299 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 300 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 301 | Int3_inherit_TYPE_descriptor(td); |
| 302 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 303 | } |
| 304 | |
| 305 | int |
| 306 | Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 307 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 308 | Int3_inherit_TYPE_descriptor(td); |
| 309 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 310 | } |
| 311 | |
| 312 | void |
| 313 | Int3_free(asn1_TYPE_descriptor_t *td, |
| 314 | void *struct_ptr, int contents_only) { |
| 315 | Int3_inherit_TYPE_descriptor(td); |
| 316 | td->free_struct(td, struct_ptr, contents_only); |
| 317 | } |
| 318 | |
| 319 | |
| 320 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 321 | |
| 322 | static ber_tlv_tag_t asn1_DEF_Int3_tags[] = { |
| 323 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 324 | }; |
| 325 | asn1_TYPE_descriptor_t asn1_DEF_Int3 = { |
| 326 | "Int3", |
| 327 | Int3_constraint, |
| 328 | Int3_decode_ber, |
| 329 | Int3_encode_der, |
| 330 | Int3_print, |
| 331 | Int3_free, |
| 332 | 0, /* Use generic outmost tag fetcher */ |
| 333 | asn1_DEF_Int3_tags, |
| 334 | sizeof(asn1_DEF_Int3_tags) |
| 335 | /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */ |
| 336 | 1, /* Tags to skip */ |
| 337 | -0, /* Unknown yet */ |
| 338 | 0, 0, /* No members */ |
| 339 | 0 /* No specifics */ |
| 340 | }; |
| 341 | |
| 342 | |
| 343 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 344 | |
| 345 | #include <Int3.h> |
| 346 | |
| 347 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 348 | |
| 349 | |
| 350 | typedef Int3_t Int4_t; |
| 351 | |
| 352 | |
| 353 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 354 | |
| 355 | extern asn1_TYPE_descriptor_t asn1_DEF_Int4; |
| 356 | asn_constr_check_f Int4_constraint; |
| 357 | ber_type_decoder_f Int4_decode_ber; |
| 358 | der_type_encoder_f Int4_encode_der; |
| 359 | asn_struct_print_f Int4_print; |
| 360 | asn_struct_free_f Int4_free; |
| 361 | |
| 362 | /*** <<< CODE [Int4] >>> ***/ |
| 363 | |
| 364 | int |
| 365 | Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 366 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 367 | |
| 368 | const Int4_t *st = sptr; |
| 369 | |
| 370 | if(!sptr) { |
| 371 | _ASN_ERRLOG(app_errlog, app_key, |
| 372 | "%s: value not given", td->name); |
| 373 | return -1; |
| 374 | } |
| 375 | |
| 376 | |
| 377 | if(1 /* No applicable constraints whatsoever */) { |
| 378 | /* Nothing is here. See below */ |
| 379 | } |
| 380 | |
| 381 | /* Make the underlying type checker permanent */ |
| 382 | td->check_constraints = asn1_DEF_Int3.check_constraints; |
| 383 | return td->check_constraints |
| 384 | (td, sptr, app_errlog, app_key); |
| 385 | } |
| 386 | |
| 387 | /* |
| 388 | * This type is implemented using Int3, |
| 389 | * so adjust the DEF appropriately. |
| 390 | */ |
| 391 | static void |
| 392 | Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 393 | td->ber_decoder = asn1_DEF_Int3.ber_decoder; |
| 394 | td->der_encoder = asn1_DEF_Int3.der_encoder; |
| 395 | td->free_struct = asn1_DEF_Int3.free_struct; |
| 396 | td->print_struct = asn1_DEF_Int3.print_struct; |
| 397 | td->last_tag_form = asn1_DEF_Int3.last_tag_form; |
| 398 | td->elements = asn1_DEF_Int3.elements; |
| 399 | td->elements_count = asn1_DEF_Int3.elements_count; |
| 400 | td->specifics = asn1_DEF_Int3.specifics; |
| 401 | } |
| 402 | |
| 403 | ber_dec_rval_t |
| 404 | Int4_decode_ber(asn1_TYPE_descriptor_t *td, |
| 405 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 406 | Int4_inherit_TYPE_descriptor(td); |
| 407 | return td->ber_decoder(td, structure, |
| 408 | bufptr, size, tag_mode); |
| 409 | } |
| 410 | |
| 411 | der_enc_rval_t |
| 412 | Int4_encode_der(asn1_TYPE_descriptor_t *td, |
| 413 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 414 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 415 | Int4_inherit_TYPE_descriptor(td); |
| 416 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 417 | } |
| 418 | |
| 419 | int |
| 420 | Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 421 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 422 | Int4_inherit_TYPE_descriptor(td); |
| 423 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 424 | } |
| 425 | |
| 426 | void |
| 427 | Int4_free(asn1_TYPE_descriptor_t *td, |
| 428 | void *struct_ptr, int contents_only) { |
| 429 | Int4_inherit_TYPE_descriptor(td); |
| 430 | td->free_struct(td, struct_ptr, contents_only); |
| 431 | } |
| 432 | |
| 433 | |
| 434 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 435 | |
| 436 | static ber_tlv_tag_t asn1_DEF_Int4_tags[] = { |
| 437 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 438 | }; |
| 439 | asn1_TYPE_descriptor_t asn1_DEF_Int4 = { |
| 440 | "Int4", |
| 441 | Int4_constraint, |
| 442 | Int4_decode_ber, |
| 443 | Int4_encode_der, |
| 444 | Int4_print, |
| 445 | Int4_free, |
| 446 | 0, /* Use generic outmost tag fetcher */ |
| 447 | asn1_DEF_Int4_tags, |
| 448 | sizeof(asn1_DEF_Int4_tags) |
| 449 | /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */ |
| 450 | 1, /* Tags to skip */ |
| 451 | -0, /* Unknown yet */ |
| 452 | 0, 0, /* No members */ |
| 453 | 0 /* No specifics */ |
| 454 | }; |
| 455 | |
| 456 | |
| 457 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 458 | |
| 459 | #include <Int4.h> |
| 460 | |
| 461 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 462 | |
| 463 | |
| 464 | typedef Int4_t Int5_t; |
| 465 | |
| 466 | |
| 467 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 468 | |
| 469 | extern asn1_TYPE_descriptor_t asn1_DEF_Int5; |
| 470 | asn_constr_check_f Int5_constraint; |
| 471 | ber_type_decoder_f Int5_decode_ber; |
| 472 | der_type_encoder_f Int5_encode_der; |
| 473 | asn_struct_print_f Int5_print; |
| 474 | asn_struct_free_f Int5_free; |
| 475 | |
| 476 | /*** <<< CODE [Int5] >>> ***/ |
| 477 | |
| 478 | int |
| 479 | Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 480 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 481 | |
| 482 | const Int5_t *st = sptr; |
| 483 | long value; |
| 484 | |
| 485 | if(!sptr) { |
| 486 | _ASN_ERRLOG(app_errlog, app_key, |
| 487 | "%s: value not given", td->name); |
| 488 | return -1; |
| 489 | } |
| 490 | |
| 491 | if(asn1_INTEGER2long(st, &value)) { |
| 492 | _ASN_ERRLOG(app_errlog, app_key, |
| 493 | "%s: value too large", td->name); |
| 494 | return -1; |
| 495 | } |
| 496 | |
| 497 | if((value == 5)) { |
| 498 | /* Constraint check succeeded */ |
| 499 | return 1; |
| 500 | } else { |
| 501 | _ASN_ERRLOG(app_errlog, app_key, |
| 502 | "%s: constraint failed", td->name); |
| 503 | return -1; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | /* |
| 508 | * This type is implemented using Int4, |
| 509 | * so adjust the DEF appropriately. |
| 510 | */ |
| 511 | static void |
| 512 | Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 513 | td->ber_decoder = asn1_DEF_Int4.ber_decoder; |
| 514 | td->der_encoder = asn1_DEF_Int4.der_encoder; |
| 515 | td->free_struct = asn1_DEF_Int4.free_struct; |
| 516 | td->print_struct = asn1_DEF_Int4.print_struct; |
| 517 | td->last_tag_form = asn1_DEF_Int4.last_tag_form; |
| 518 | td->elements = asn1_DEF_Int4.elements; |
| 519 | td->elements_count = asn1_DEF_Int4.elements_count; |
| 520 | td->specifics = asn1_DEF_Int4.specifics; |
| 521 | } |
| 522 | |
| 523 | ber_dec_rval_t |
| 524 | Int5_decode_ber(asn1_TYPE_descriptor_t *td, |
| 525 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 526 | Int5_inherit_TYPE_descriptor(td); |
| 527 | return td->ber_decoder(td, structure, |
| 528 | bufptr, size, tag_mode); |
| 529 | } |
| 530 | |
| 531 | der_enc_rval_t |
| 532 | Int5_encode_der(asn1_TYPE_descriptor_t *td, |
| 533 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 534 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 535 | Int5_inherit_TYPE_descriptor(td); |
| 536 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 537 | } |
| 538 | |
| 539 | int |
| 540 | Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 541 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 542 | Int5_inherit_TYPE_descriptor(td); |
| 543 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 544 | } |
| 545 | |
| 546 | void |
| 547 | Int5_free(asn1_TYPE_descriptor_t *td, |
| 548 | void *struct_ptr, int contents_only) { |
| 549 | Int5_inherit_TYPE_descriptor(td); |
| 550 | td->free_struct(td, struct_ptr, contents_only); |
| 551 | } |
| 552 | |
| 553 | |
| 554 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 555 | |
| 556 | static ber_tlv_tag_t asn1_DEF_Int5_tags[] = { |
| 557 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 558 | }; |
| 559 | asn1_TYPE_descriptor_t asn1_DEF_Int5 = { |
| 560 | "Int5", |
| 561 | Int5_constraint, |
| 562 | Int5_decode_ber, |
| 563 | Int5_encode_der, |
| 564 | Int5_print, |
| 565 | Int5_free, |
| 566 | 0, /* Use generic outmost tag fetcher */ |
| 567 | asn1_DEF_Int5_tags, |
| 568 | sizeof(asn1_DEF_Int5_tags) |
| 569 | /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */ |
| 570 | 1, /* Tags to skip */ |
| 571 | -0, /* Unknown yet */ |
| 572 | 0, 0, /* No members */ |
| 573 | 0 /* No specifics */ |
| 574 | }; |
| 575 | |
| 576 | |
| 577 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 578 | |
| 579 | #include <INTEGER.h> |
| 580 | |
| 581 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 582 | |
| 583 | |
| 584 | typedef INTEGER_t ExtensibleExtensions_t; |
| 585 | |
| 586 | |
| 587 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 588 | |
| 589 | extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions; |
| 590 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 591 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 592 | der_type_encoder_f ExtensibleExtensions_encode_der; |
| 593 | asn_struct_print_f ExtensibleExtensions_print; |
| 594 | asn_struct_free_f ExtensibleExtensions_free; |
| 595 | |
| 596 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 597 | |
| 598 | int |
| 599 | ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 600 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 601 | |
| 602 | const ExtensibleExtensions_t *st = sptr; |
| 603 | |
| 604 | if(!sptr) { |
| 605 | _ASN_ERRLOG(app_errlog, app_key, |
| 606 | "%s: value not given", td->name); |
| 607 | return -1; |
| 608 | } |
| 609 | |
| 610 | |
| 611 | if(1 /* No applicable constraints whatsoever */) { |
| 612 | /* Nothing is here. See below */ |
| 613 | } |
| 614 | |
| 615 | /* Make the underlying type checker permanent */ |
| 616 | td->check_constraints = asn1_DEF_INTEGER.check_constraints; |
| 617 | return td->check_constraints |
| 618 | (td, sptr, app_errlog, app_key); |
| 619 | } |
| 620 | |
| 621 | /* |
| 622 | * This type is implemented using INTEGER, |
| 623 | * so adjust the DEF appropriately. |
| 624 | */ |
| 625 | static void |
| 626 | ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 627 | td->ber_decoder = asn1_DEF_INTEGER.ber_decoder; |
| 628 | td->der_encoder = asn1_DEF_INTEGER.der_encoder; |
| 629 | td->free_struct = asn1_DEF_INTEGER.free_struct; |
| 630 | td->print_struct = asn1_DEF_INTEGER.print_struct; |
| 631 | td->last_tag_form = asn1_DEF_INTEGER.last_tag_form; |
| 632 | td->elements = asn1_DEF_INTEGER.elements; |
| 633 | td->elements_count = asn1_DEF_INTEGER.elements_count; |
| 634 | td->specifics = asn1_DEF_INTEGER.specifics; |
| 635 | } |
| 636 | |
| 637 | ber_dec_rval_t |
| 638 | ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td, |
| 639 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 640 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 641 | return td->ber_decoder(td, structure, |
| 642 | bufptr, size, tag_mode); |
| 643 | } |
| 644 | |
| 645 | der_enc_rval_t |
| 646 | ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td, |
| 647 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 648 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 649 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 650 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 651 | } |
| 652 | |
| 653 | int |
| 654 | ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 655 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 656 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 657 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 658 | } |
| 659 | |
| 660 | void |
| 661 | ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td, |
| 662 | void *struct_ptr, int contents_only) { |
| 663 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 664 | td->free_struct(td, struct_ptr, contents_only); |
| 665 | } |
| 666 | |
| 667 | |
| 668 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 669 | |
| 670 | static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = { |
| 671 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 672 | }; |
| 673 | asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = { |
| 674 | "ExtensibleExtensions", |
| 675 | ExtensibleExtensions_constraint, |
| 676 | ExtensibleExtensions_decode_ber, |
| 677 | ExtensibleExtensions_encode_der, |
| 678 | ExtensibleExtensions_print, |
| 679 | ExtensibleExtensions_free, |
| 680 | 0, /* Use generic outmost tag fetcher */ |
| 681 | asn1_DEF_ExtensibleExtensions_tags, |
| 682 | sizeof(asn1_DEF_ExtensibleExtensions_tags) |
| 683 | /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */ |
| 684 | 1, /* Tags to skip */ |
| 685 | -0, /* Unknown yet */ |
| 686 | 0, 0, /* No members */ |
| 687 | 0 /* No specifics */ |
| 688 | }; |
| 689 | |
| 690 | |
| 691 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 692 | |
| 693 | #include <IA5String.h> |
| 694 | |
| 695 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 696 | |
| 697 | |
| 698 | typedef IA5String_t Str1_t; |
| 699 | |
| 700 | |
| 701 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 702 | |
| 703 | extern asn1_TYPE_descriptor_t asn1_DEF_Str1; |
| 704 | asn_constr_check_f Str1_constraint; |
| 705 | ber_type_decoder_f Str1_decode_ber; |
| 706 | der_type_encoder_f Str1_encode_der; |
| 707 | asn_struct_print_f Str1_print; |
| 708 | asn_struct_free_f Str1_free; |
| 709 | |
| 710 | /*** <<< CODE [Str1] >>> ***/ |
| 711 | |
| 712 | int |
| 713 | Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 714 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 715 | |
| 716 | /* Make the underlying type checker permanent */ |
| 717 | td->check_constraints = asn1_DEF_IA5String.check_constraints; |
| 718 | return td->check_constraints |
| 719 | (td, sptr, app_errlog, app_key); |
| 720 | } |
| 721 | |
| 722 | /* |
| 723 | * This type is implemented using IA5String, |
| 724 | * so adjust the DEF appropriately. |
| 725 | */ |
| 726 | static void |
| 727 | Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 728 | td->ber_decoder = asn1_DEF_IA5String.ber_decoder; |
| 729 | td->der_encoder = asn1_DEF_IA5String.der_encoder; |
| 730 | td->free_struct = asn1_DEF_IA5String.free_struct; |
| 731 | td->print_struct = asn1_DEF_IA5String.print_struct; |
| 732 | td->last_tag_form = asn1_DEF_IA5String.last_tag_form; |
| 733 | td->elements = asn1_DEF_IA5String.elements; |
| 734 | td->elements_count = asn1_DEF_IA5String.elements_count; |
| 735 | td->specifics = asn1_DEF_IA5String.specifics; |
| 736 | } |
| 737 | |
| 738 | ber_dec_rval_t |
| 739 | Str1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 740 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 741 | Str1_inherit_TYPE_descriptor(td); |
| 742 | return td->ber_decoder(td, structure, |
| 743 | bufptr, size, tag_mode); |
| 744 | } |
| 745 | |
| 746 | der_enc_rval_t |
| 747 | Str1_encode_der(asn1_TYPE_descriptor_t *td, |
| 748 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 749 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 750 | Str1_inherit_TYPE_descriptor(td); |
| 751 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 752 | } |
| 753 | |
| 754 | int |
| 755 | Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 756 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 757 | Str1_inherit_TYPE_descriptor(td); |
| 758 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 759 | } |
| 760 | |
| 761 | void |
| 762 | Str1_free(asn1_TYPE_descriptor_t *td, |
| 763 | void *struct_ptr, int contents_only) { |
| 764 | Str1_inherit_TYPE_descriptor(td); |
| 765 | td->free_struct(td, struct_ptr, contents_only); |
| 766 | } |
| 767 | |
| 768 | |
| 769 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 770 | |
| 771 | static ber_tlv_tag_t asn1_DEF_Str1_tags[] = { |
| 772 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 773 | }; |
| 774 | asn1_TYPE_descriptor_t asn1_DEF_Str1 = { |
| 775 | "Str1", |
| 776 | Str1_constraint, |
| 777 | Str1_decode_ber, |
| 778 | Str1_encode_der, |
| 779 | Str1_print, |
| 780 | Str1_free, |
| 781 | 0, /* Use generic outmost tag fetcher */ |
| 782 | asn1_DEF_Str1_tags, |
| 783 | sizeof(asn1_DEF_Str1_tags) |
| 784 | /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */ |
| 785 | 1, /* Tags to skip */ |
| 786 | -0, /* Unknown yet */ |
| 787 | 0, 0, /* No members */ |
| 788 | 0 /* No specifics */ |
| 789 | }; |
| 790 | |
| 791 | |
| 792 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 793 | |
| 794 | #include <Str1.h> |
| 795 | |
| 796 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 797 | |
| 798 | |
| 799 | typedef Str1_t Str2_t; |
| 800 | |
| 801 | |
| 802 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 803 | |
| 804 | extern asn1_TYPE_descriptor_t asn1_DEF_Str2; |
| 805 | asn_constr_check_f Str2_constraint; |
| 806 | ber_type_decoder_f Str2_decode_ber; |
| 807 | der_type_encoder_f Str2_encode_der; |
| 808 | asn_struct_print_f Str2_print; |
| 809 | asn_struct_free_f Str2_free; |
| 810 | |
| 811 | /*** <<< CTABLES [Str2] >>> ***/ |
| 812 | |
| 813 | static int check_permitted_alphabet_1(const void *sptr) { |
| 814 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 815 | const Str1_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 816 | uint8_t *ch = st->buf; |
| 817 | uint8_t *end = ch + st->size; |
| 818 | |
| 819 | for(; ch < end; ch++) { |
| 820 | uint8_t cv = *ch; |
| 821 | if(!(cv <= 127)) return 0; |
| 822 | } |
| 823 | return 1; |
| 824 | } |
| 825 | |
| 826 | |
| 827 | /*** <<< CODE [Str2] >>> ***/ |
| 828 | |
| 829 | int |
| 830 | Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 831 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 832 | |
| 833 | const Str2_t *st = sptr; |
| 834 | size_t size; |
| 835 | |
| 836 | if(!sptr) { |
| 837 | _ASN_ERRLOG(app_errlog, app_key, |
| 838 | "%s: value not given", td->name); |
| 839 | return -1; |
| 840 | } |
| 841 | |
| 842 | size = st->size; |
| 843 | |
| 844 | if(((size <= 20) || (size >= 25 && size <= 30)) |
| 845 | && check_permitted_alphabet_1(sptr)) { |
| 846 | /* Constraint check succeeded */ |
| 847 | return 1; |
| 848 | } else { |
| 849 | _ASN_ERRLOG(app_errlog, app_key, |
| 850 | "%s: constraint failed", td->name); |
| 851 | return -1; |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | /* |
| 856 | * This type is implemented using Str1, |
| 857 | * so adjust the DEF appropriately. |
| 858 | */ |
| 859 | static void |
| 860 | Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 861 | td->ber_decoder = asn1_DEF_Str1.ber_decoder; |
| 862 | td->der_encoder = asn1_DEF_Str1.der_encoder; |
| 863 | td->free_struct = asn1_DEF_Str1.free_struct; |
| 864 | td->print_struct = asn1_DEF_Str1.print_struct; |
| 865 | td->last_tag_form = asn1_DEF_Str1.last_tag_form; |
| 866 | td->elements = asn1_DEF_Str1.elements; |
| 867 | td->elements_count = asn1_DEF_Str1.elements_count; |
| 868 | td->specifics = asn1_DEF_Str1.specifics; |
| 869 | } |
| 870 | |
| 871 | ber_dec_rval_t |
| 872 | Str2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 873 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 874 | Str2_inherit_TYPE_descriptor(td); |
| 875 | return td->ber_decoder(td, structure, |
| 876 | bufptr, size, tag_mode); |
| 877 | } |
| 878 | |
| 879 | der_enc_rval_t |
| 880 | Str2_encode_der(asn1_TYPE_descriptor_t *td, |
| 881 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 882 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 883 | Str2_inherit_TYPE_descriptor(td); |
| 884 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 885 | } |
| 886 | |
| 887 | int |
| 888 | Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 889 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 890 | Str2_inherit_TYPE_descriptor(td); |
| 891 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 892 | } |
| 893 | |
| 894 | void |
| 895 | Str2_free(asn1_TYPE_descriptor_t *td, |
| 896 | void *struct_ptr, int contents_only) { |
| 897 | Str2_inherit_TYPE_descriptor(td); |
| 898 | td->free_struct(td, struct_ptr, contents_only); |
| 899 | } |
| 900 | |
| 901 | |
| 902 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 903 | |
| 904 | static ber_tlv_tag_t asn1_DEF_Str2_tags[] = { |
| 905 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 906 | }; |
| 907 | asn1_TYPE_descriptor_t asn1_DEF_Str2 = { |
| 908 | "Str2", |
| 909 | Str2_constraint, |
| 910 | Str2_decode_ber, |
| 911 | Str2_encode_der, |
| 912 | Str2_print, |
| 913 | Str2_free, |
| 914 | 0, /* Use generic outmost tag fetcher */ |
| 915 | asn1_DEF_Str2_tags, |
| 916 | sizeof(asn1_DEF_Str2_tags) |
| 917 | /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */ |
| 918 | 1, /* Tags to skip */ |
| 919 | -0, /* Unknown yet */ |
| 920 | 0, 0, /* No members */ |
| 921 | 0 /* No specifics */ |
| 922 | }; |
| 923 | |
| 924 | |
| 925 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 926 | |
| 927 | #include <Str2.h> |
| 928 | |
| 929 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 930 | |
| 931 | |
| 932 | typedef Str2_t Str3_t; |
| 933 | |
| 934 | |
| 935 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 936 | |
| 937 | extern asn1_TYPE_descriptor_t asn1_DEF_Str3; |
| 938 | asn_constr_check_f Str3_constraint; |
| 939 | ber_type_decoder_f Str3_decode_ber; |
| 940 | der_type_encoder_f Str3_encode_der; |
| 941 | asn_struct_print_f Str3_print; |
| 942 | asn_struct_free_f Str3_free; |
| 943 | |
| 944 | /*** <<< CTABLES [Str3] >>> ***/ |
| 945 | |
| 946 | static int permitted_alphabet_table_2[256] = { |
| 947 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 948 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 949 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 950 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 951 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 952 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 953 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 954 | }; |
| 955 | |
| 956 | static int check_permitted_alphabet_2(const void *sptr) { |
| 957 | int *table = permitted_alphabet_table_2; |
| 958 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 959 | const Str2_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 960 | uint8_t *ch = st->buf; |
| 961 | uint8_t *end = ch + st->size; |
| 962 | |
| 963 | for(; ch < end; ch++) { |
| 964 | uint8_t cv = *ch; |
| 965 | if(!table[cv]) return 0; |
| 966 | } |
| 967 | return 1; |
| 968 | } |
| 969 | |
| 970 | |
| 971 | /*** <<< CODE [Str3] >>> ***/ |
| 972 | |
| 973 | int |
| 974 | Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 975 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 976 | |
| 977 | const Str3_t *st = sptr; |
| 978 | size_t size; |
| 979 | |
| 980 | if(!sptr) { |
| 981 | _ASN_ERRLOG(app_errlog, app_key, |
| 982 | "%s: value not given", td->name); |
| 983 | return -1; |
| 984 | } |
| 985 | |
| 986 | size = st->size; |
| 987 | |
| 988 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
| 989 | && check_permitted_alphabet_2(sptr)) { |
| 990 | /* Constraint check succeeded */ |
| 991 | return 1; |
| 992 | } else { |
| 993 | _ASN_ERRLOG(app_errlog, app_key, |
| 994 | "%s: constraint failed", td->name); |
| 995 | return -1; |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | /* |
| 1000 | * This type is implemented using Str2, |
| 1001 | * so adjust the DEF appropriately. |
| 1002 | */ |
| 1003 | static void |
| 1004 | Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1005 | td->ber_decoder = asn1_DEF_Str2.ber_decoder; |
| 1006 | td->der_encoder = asn1_DEF_Str2.der_encoder; |
| 1007 | td->free_struct = asn1_DEF_Str2.free_struct; |
| 1008 | td->print_struct = asn1_DEF_Str2.print_struct; |
| 1009 | td->last_tag_form = asn1_DEF_Str2.last_tag_form; |
| 1010 | td->elements = asn1_DEF_Str2.elements; |
| 1011 | td->elements_count = asn1_DEF_Str2.elements_count; |
| 1012 | td->specifics = asn1_DEF_Str2.specifics; |
| 1013 | } |
| 1014 | |
| 1015 | ber_dec_rval_t |
| 1016 | Str3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1017 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1018 | Str3_inherit_TYPE_descriptor(td); |
| 1019 | return td->ber_decoder(td, structure, |
| 1020 | bufptr, size, tag_mode); |
| 1021 | } |
| 1022 | |
| 1023 | der_enc_rval_t |
| 1024 | Str3_encode_der(asn1_TYPE_descriptor_t *td, |
| 1025 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1026 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1027 | Str3_inherit_TYPE_descriptor(td); |
| 1028 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1029 | } |
| 1030 | |
| 1031 | int |
| 1032 | Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1033 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1034 | Str3_inherit_TYPE_descriptor(td); |
| 1035 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1036 | } |
| 1037 | |
| 1038 | void |
| 1039 | Str3_free(asn1_TYPE_descriptor_t *td, |
| 1040 | void *struct_ptr, int contents_only) { |
| 1041 | Str3_inherit_TYPE_descriptor(td); |
| 1042 | td->free_struct(td, struct_ptr, contents_only); |
| 1043 | } |
| 1044 | |
| 1045 | |
| 1046 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1047 | |
| 1048 | static ber_tlv_tag_t asn1_DEF_Str3_tags[] = { |
| 1049 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1050 | }; |
| 1051 | asn1_TYPE_descriptor_t asn1_DEF_Str3 = { |
| 1052 | "Str3", |
| 1053 | Str3_constraint, |
| 1054 | Str3_decode_ber, |
| 1055 | Str3_encode_der, |
| 1056 | Str3_print, |
| 1057 | Str3_free, |
| 1058 | 0, /* Use generic outmost tag fetcher */ |
| 1059 | asn1_DEF_Str3_tags, |
| 1060 | sizeof(asn1_DEF_Str3_tags) |
| 1061 | /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */ |
| 1062 | 1, /* Tags to skip */ |
| 1063 | -0, /* Unknown yet */ |
| 1064 | 0, 0, /* No members */ |
| 1065 | 0 /* No specifics */ |
| 1066 | }; |
| 1067 | |
| 1068 | |
| 1069 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1070 | |
| 1071 | #include <IA5String.h> |
| 1072 | |
| 1073 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1074 | |
| 1075 | |
| 1076 | typedef IA5String_t PER_Visible_t; |
| 1077 | |
| 1078 | |
| 1079 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1080 | |
| 1081 | extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible; |
| 1082 | asn_constr_check_f PER_Visible_constraint; |
| 1083 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1084 | der_type_encoder_f PER_Visible_encode_der; |
| 1085 | asn_struct_print_f PER_Visible_print; |
| 1086 | asn_struct_free_f PER_Visible_free; |
| 1087 | |
| 1088 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1089 | |
| 1090 | static int check_permitted_alphabet_3(const void *sptr) { |
| 1091 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1092 | const IA5String_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1093 | uint8_t *ch = st->buf; |
| 1094 | uint8_t *end = ch + st->size; |
| 1095 | |
| 1096 | for(; ch < end; ch++) { |
| 1097 | uint8_t cv = *ch; |
| 1098 | if(!(cv >= 65 && cv <= 70)) return 0; |
| 1099 | } |
| 1100 | return 1; |
| 1101 | } |
| 1102 | |
| 1103 | |
| 1104 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1105 | |
| 1106 | int |
| 1107 | PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1108 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1109 | |
| 1110 | const PER_Visible_t *st = sptr; |
| 1111 | |
| 1112 | if(!sptr) { |
| 1113 | _ASN_ERRLOG(app_errlog, app_key, |
| 1114 | "%s: value not given", td->name); |
| 1115 | return -1; |
| 1116 | } |
| 1117 | |
| 1118 | |
| 1119 | if(check_permitted_alphabet_3(sptr)) { |
| 1120 | /* Constraint check succeeded */ |
| 1121 | return 1; |
| 1122 | } else { |
| 1123 | _ASN_ERRLOG(app_errlog, app_key, |
| 1124 | "%s: constraint failed", td->name); |
| 1125 | return -1; |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | /* |
| 1130 | * This type is implemented using IA5String, |
| 1131 | * so adjust the DEF appropriately. |
| 1132 | */ |
| 1133 | static void |
| 1134 | PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1135 | td->ber_decoder = asn1_DEF_IA5String.ber_decoder; |
| 1136 | td->der_encoder = asn1_DEF_IA5String.der_encoder; |
| 1137 | td->free_struct = asn1_DEF_IA5String.free_struct; |
| 1138 | td->print_struct = asn1_DEF_IA5String.print_struct; |
| 1139 | td->last_tag_form = asn1_DEF_IA5String.last_tag_form; |
| 1140 | td->elements = asn1_DEF_IA5String.elements; |
| 1141 | td->elements_count = asn1_DEF_IA5String.elements_count; |
| 1142 | td->specifics = asn1_DEF_IA5String.specifics; |
| 1143 | } |
| 1144 | |
| 1145 | ber_dec_rval_t |
| 1146 | PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1147 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1148 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1149 | return td->ber_decoder(td, structure, |
| 1150 | bufptr, size, tag_mode); |
| 1151 | } |
| 1152 | |
| 1153 | der_enc_rval_t |
| 1154 | PER_Visible_encode_der(asn1_TYPE_descriptor_t *td, |
| 1155 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1156 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1157 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1158 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1159 | } |
| 1160 | |
| 1161 | int |
| 1162 | PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1163 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1164 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1165 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1166 | } |
| 1167 | |
| 1168 | void |
| 1169 | PER_Visible_free(asn1_TYPE_descriptor_t *td, |
| 1170 | void *struct_ptr, int contents_only) { |
| 1171 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1172 | td->free_struct(td, struct_ptr, contents_only); |
| 1173 | } |
| 1174 | |
| 1175 | |
| 1176 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1177 | |
| 1178 | static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = { |
| 1179 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1180 | }; |
| 1181 | asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = { |
| 1182 | "PER-Visible", |
| 1183 | PER_Visible_constraint, |
| 1184 | PER_Visible_decode_ber, |
| 1185 | PER_Visible_encode_der, |
| 1186 | PER_Visible_print, |
| 1187 | PER_Visible_free, |
| 1188 | 0, /* Use generic outmost tag fetcher */ |
| 1189 | asn1_DEF_PER_Visible_tags, |
| 1190 | sizeof(asn1_DEF_PER_Visible_tags) |
| 1191 | /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */ |
| 1192 | 1, /* Tags to skip */ |
| 1193 | -0, /* Unknown yet */ |
| 1194 | 0, 0, /* No members */ |
| 1195 | 0 /* No specifics */ |
| 1196 | }; |
| 1197 | |
| 1198 | |
| 1199 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1200 | |
| 1201 | #include <PER-Visible.h> |
| 1202 | |
| 1203 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1204 | |
| 1205 | |
| 1206 | typedef PER_Visible_t PER_Visible_2_t; |
| 1207 | |
| 1208 | |
| 1209 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1210 | |
| 1211 | extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2; |
| 1212 | asn_constr_check_f PER_Visible_2_constraint; |
| 1213 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1214 | der_type_encoder_f PER_Visible_2_encode_der; |
| 1215 | asn_struct_print_f PER_Visible_2_print; |
| 1216 | asn_struct_free_f PER_Visible_2_free; |
| 1217 | |
| 1218 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1219 | |
| 1220 | static int check_permitted_alphabet_4(const void *sptr) { |
| 1221 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1222 | const PER_Visible_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1223 | uint8_t *ch = st->buf; |
| 1224 | uint8_t *end = ch + st->size; |
| 1225 | |
| 1226 | for(; ch < end; ch++) { |
| 1227 | uint8_t cv = *ch; |
| 1228 | if(!(cv >= 69 && cv <= 70)) return 0; |
| 1229 | } |
| 1230 | return 1; |
| 1231 | } |
| 1232 | |
| 1233 | |
| 1234 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1235 | |
| 1236 | int |
| 1237 | PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1238 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1239 | |
| 1240 | const PER_Visible_2_t *st = sptr; |
| 1241 | |
| 1242 | if(!sptr) { |
| 1243 | _ASN_ERRLOG(app_errlog, app_key, |
| 1244 | "%s: value not given", td->name); |
| 1245 | return -1; |
| 1246 | } |
| 1247 | |
| 1248 | |
| 1249 | if(check_permitted_alphabet_4(sptr)) { |
| 1250 | /* Constraint check succeeded */ |
| 1251 | return 1; |
| 1252 | } else { |
| 1253 | _ASN_ERRLOG(app_errlog, app_key, |
| 1254 | "%s: constraint failed", td->name); |
| 1255 | return -1; |
| 1256 | } |
| 1257 | } |
| 1258 | |
| 1259 | /* |
| 1260 | * This type is implemented using PER_Visible, |
| 1261 | * so adjust the DEF appropriately. |
| 1262 | */ |
| 1263 | static void |
| 1264 | PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1265 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1266 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1267 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1268 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1269 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1270 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1271 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1272 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1273 | } |
| 1274 | |
| 1275 | ber_dec_rval_t |
| 1276 | PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1277 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1278 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1279 | return td->ber_decoder(td, structure, |
| 1280 | bufptr, size, tag_mode); |
| 1281 | } |
| 1282 | |
| 1283 | der_enc_rval_t |
| 1284 | PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 1285 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1286 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1287 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1288 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1289 | } |
| 1290 | |
| 1291 | int |
| 1292 | PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1293 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1294 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1295 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1296 | } |
| 1297 | |
| 1298 | void |
| 1299 | PER_Visible_2_free(asn1_TYPE_descriptor_t *td, |
| 1300 | void *struct_ptr, int contents_only) { |
| 1301 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1302 | td->free_struct(td, struct_ptr, contents_only); |
| 1303 | } |
| 1304 | |
| 1305 | |
| 1306 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 1307 | |
| 1308 | static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = { |
| 1309 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1310 | }; |
| 1311 | asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = { |
| 1312 | "PER-Visible-2", |
| 1313 | PER_Visible_2_constraint, |
| 1314 | PER_Visible_2_decode_ber, |
| 1315 | PER_Visible_2_encode_der, |
| 1316 | PER_Visible_2_print, |
| 1317 | PER_Visible_2_free, |
| 1318 | 0, /* Use generic outmost tag fetcher */ |
| 1319 | asn1_DEF_PER_Visible_2_tags, |
| 1320 | sizeof(asn1_DEF_PER_Visible_2_tags) |
| 1321 | /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */ |
| 1322 | 1, /* Tags to skip */ |
| 1323 | -0, /* Unknown yet */ |
| 1324 | 0, 0, /* No members */ |
| 1325 | 0 /* No specifics */ |
| 1326 | }; |
| 1327 | |
| 1328 | |
| 1329 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 1330 | |
| 1331 | #include <PER-Visible.h> |
| 1332 | |
| 1333 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1334 | |
| 1335 | |
| 1336 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 1337 | |
| 1338 | |
| 1339 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1340 | |
| 1341 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1; |
| 1342 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 1343 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 1344 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
| 1345 | asn_struct_print_f Not_PER_Visible_1_print; |
| 1346 | asn_struct_free_f Not_PER_Visible_1_free; |
| 1347 | |
| 1348 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 1349 | |
| 1350 | static int check_permitted_alphabet_5(const void *sptr) { |
| 1351 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1352 | const PER_Visible_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1353 | uint8_t *ch = st->buf; |
| 1354 | uint8_t *end = ch + st->size; |
| 1355 | |
| 1356 | for(; ch < end; ch++) { |
| 1357 | uint8_t cv = *ch; |
| 1358 | if(!(cv >= 65 && cv <= 70)) return 0; |
| 1359 | } |
| 1360 | return 1; |
| 1361 | } |
| 1362 | |
| 1363 | |
| 1364 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 1365 | |
| 1366 | int |
| 1367 | Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1368 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1369 | |
| 1370 | const Not_PER_Visible_1_t *st = sptr; |
| 1371 | |
| 1372 | if(!sptr) { |
| 1373 | _ASN_ERRLOG(app_errlog, app_key, |
| 1374 | "%s: value not given", td->name); |
| 1375 | return -1; |
| 1376 | } |
| 1377 | |
| 1378 | |
| 1379 | if(check_permitted_alphabet_5(sptr)) { |
| 1380 | /* Constraint check succeeded */ |
| 1381 | return 1; |
| 1382 | } else { |
| 1383 | _ASN_ERRLOG(app_errlog, app_key, |
| 1384 | "%s: constraint failed", td->name); |
| 1385 | return -1; |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | /* |
| 1390 | * This type is implemented using PER_Visible, |
| 1391 | * so adjust the DEF appropriately. |
| 1392 | */ |
| 1393 | static void |
| 1394 | Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1395 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1396 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1397 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1398 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1399 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1400 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1401 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1402 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1403 | } |
| 1404 | |
| 1405 | ber_dec_rval_t |
| 1406 | Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1407 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1408 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1409 | return td->ber_decoder(td, structure, |
| 1410 | bufptr, size, tag_mode); |
| 1411 | } |
| 1412 | |
| 1413 | der_enc_rval_t |
| 1414 | Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td, |
| 1415 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1416 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1417 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1418 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1419 | } |
| 1420 | |
| 1421 | int |
| 1422 | Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1423 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1424 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1425 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1426 | } |
| 1427 | |
| 1428 | void |
| 1429 | Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td, |
| 1430 | void *struct_ptr, int contents_only) { |
| 1431 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1432 | td->free_struct(td, struct_ptr, contents_only); |
| 1433 | } |
| 1434 | |
| 1435 | |
| 1436 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 1437 | |
| 1438 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = { |
| 1439 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1440 | }; |
| 1441 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = { |
| 1442 | "Not-PER-Visible-1", |
| 1443 | Not_PER_Visible_1_constraint, |
| 1444 | Not_PER_Visible_1_decode_ber, |
| 1445 | Not_PER_Visible_1_encode_der, |
| 1446 | Not_PER_Visible_1_print, |
| 1447 | Not_PER_Visible_1_free, |
| 1448 | 0, /* Use generic outmost tag fetcher */ |
| 1449 | asn1_DEF_Not_PER_Visible_1_tags, |
| 1450 | sizeof(asn1_DEF_Not_PER_Visible_1_tags) |
| 1451 | /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */ |
| 1452 | 1, /* Tags to skip */ |
| 1453 | -0, /* Unknown yet */ |
| 1454 | 0, 0, /* No members */ |
| 1455 | 0 /* No specifics */ |
| 1456 | }; |
| 1457 | |
| 1458 | |
| 1459 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 1460 | |
| 1461 | #include <PER-Visible.h> |
| 1462 | |
| 1463 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1464 | |
| 1465 | |
| 1466 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 1467 | |
| 1468 | |
| 1469 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1470 | |
| 1471 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2; |
| 1472 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 1473 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 1474 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
| 1475 | asn_struct_print_f Not_PER_Visible_2_print; |
| 1476 | asn_struct_free_f Not_PER_Visible_2_free; |
| 1477 | |
| 1478 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 1479 | |
| 1480 | int |
| 1481 | Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1482 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1483 | |
| 1484 | const Not_PER_Visible_2_t *st = sptr; |
| 1485 | |
| 1486 | if(!sptr) { |
| 1487 | _ASN_ERRLOG(app_errlog, app_key, |
| 1488 | "%s: value not given", td->name); |
| 1489 | return -1; |
| 1490 | } |
| 1491 | |
| 1492 | |
| 1493 | if(1 /* No applicable constraints whatsoever */) { |
| 1494 | /* Nothing is here. See below */ |
| 1495 | } |
| 1496 | |
| 1497 | /* Make the underlying type checker permanent */ |
| 1498 | td->check_constraints = asn1_DEF_PER_Visible.check_constraints; |
| 1499 | return td->check_constraints |
| 1500 | (td, sptr, app_errlog, app_key); |
| 1501 | } |
| 1502 | |
| 1503 | /* |
| 1504 | * This type is implemented using PER_Visible, |
| 1505 | * so adjust the DEF appropriately. |
| 1506 | */ |
| 1507 | static void |
| 1508 | Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1509 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1510 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1511 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1512 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1513 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1514 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1515 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1516 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1517 | } |
| 1518 | |
| 1519 | ber_dec_rval_t |
| 1520 | Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1521 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1522 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1523 | return td->ber_decoder(td, structure, |
| 1524 | bufptr, size, tag_mode); |
| 1525 | } |
| 1526 | |
| 1527 | der_enc_rval_t |
| 1528 | Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 1529 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1530 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1531 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1532 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1533 | } |
| 1534 | |
| 1535 | int |
| 1536 | Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1537 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1538 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1539 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1540 | } |
| 1541 | |
| 1542 | void |
| 1543 | Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td, |
| 1544 | void *struct_ptr, int contents_only) { |
| 1545 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1546 | td->free_struct(td, struct_ptr, contents_only); |
| 1547 | } |
| 1548 | |
| 1549 | |
| 1550 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 1551 | |
| 1552 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = { |
| 1553 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1554 | }; |
| 1555 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = { |
| 1556 | "Not-PER-Visible-2", |
| 1557 | Not_PER_Visible_2_constraint, |
| 1558 | Not_PER_Visible_2_decode_ber, |
| 1559 | Not_PER_Visible_2_encode_der, |
| 1560 | Not_PER_Visible_2_print, |
| 1561 | Not_PER_Visible_2_free, |
| 1562 | 0, /* Use generic outmost tag fetcher */ |
| 1563 | asn1_DEF_Not_PER_Visible_2_tags, |
| 1564 | sizeof(asn1_DEF_Not_PER_Visible_2_tags) |
| 1565 | /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */ |
| 1566 | 1, /* Tags to skip */ |
| 1567 | -0, /* Unknown yet */ |
| 1568 | 0, 0, /* No members */ |
| 1569 | 0 /* No specifics */ |
| 1570 | }; |
| 1571 | |
| 1572 | |
| 1573 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 1574 | |
| 1575 | #include <PER-Visible.h> |
| 1576 | |
| 1577 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1578 | |
| 1579 | |
| 1580 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 1581 | |
| 1582 | |
| 1583 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1584 | |
| 1585 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3; |
| 1586 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 1587 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 1588 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
| 1589 | asn_struct_print_f Not_PER_Visible_3_print; |
| 1590 | asn_struct_free_f Not_PER_Visible_3_free; |
| 1591 | |
| 1592 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 1593 | |
| 1594 | int |
| 1595 | Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1596 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1597 | |
| 1598 | const Not_PER_Visible_3_t *st = sptr; |
| 1599 | |
| 1600 | if(!sptr) { |
| 1601 | _ASN_ERRLOG(app_errlog, app_key, |
| 1602 | "%s: value not given", td->name); |
| 1603 | return -1; |
| 1604 | } |
| 1605 | |
| 1606 | |
| 1607 | if(1 /* No applicable constraints whatsoever */) { |
| 1608 | /* Nothing is here. See below */ |
| 1609 | } |
| 1610 | |
| 1611 | /* Make the underlying type checker permanent */ |
| 1612 | td->check_constraints = asn1_DEF_PER_Visible.check_constraints; |
| 1613 | return td->check_constraints |
| 1614 | (td, sptr, app_errlog, app_key); |
| 1615 | } |
| 1616 | |
| 1617 | /* |
| 1618 | * This type is implemented using PER_Visible, |
| 1619 | * so adjust the DEF appropriately. |
| 1620 | */ |
| 1621 | static void |
| 1622 | Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1623 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1624 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1625 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1626 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1627 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1628 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1629 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1630 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1631 | } |
| 1632 | |
| 1633 | ber_dec_rval_t |
| 1634 | Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1635 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1636 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1637 | return td->ber_decoder(td, structure, |
| 1638 | bufptr, size, tag_mode); |
| 1639 | } |
| 1640 | |
| 1641 | der_enc_rval_t |
| 1642 | Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td, |
| 1643 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1644 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1645 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1646 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1647 | } |
| 1648 | |
| 1649 | int |
| 1650 | Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1651 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1652 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1653 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1654 | } |
| 1655 | |
| 1656 | void |
| 1657 | Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td, |
| 1658 | void *struct_ptr, int contents_only) { |
| 1659 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1660 | td->free_struct(td, struct_ptr, contents_only); |
| 1661 | } |
| 1662 | |
| 1663 | |
| 1664 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 1665 | |
| 1666 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = { |
| 1667 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1668 | }; |
| 1669 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = { |
| 1670 | "Not-PER-Visible-3", |
| 1671 | Not_PER_Visible_3_constraint, |
| 1672 | Not_PER_Visible_3_decode_ber, |
| 1673 | Not_PER_Visible_3_encode_der, |
| 1674 | Not_PER_Visible_3_print, |
| 1675 | Not_PER_Visible_3_free, |
| 1676 | 0, /* Use generic outmost tag fetcher */ |
| 1677 | asn1_DEF_Not_PER_Visible_3_tags, |
| 1678 | sizeof(asn1_DEF_Not_PER_Visible_3_tags) |
| 1679 | /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */ |
| 1680 | 1, /* Tags to skip */ |
| 1681 | -0, /* Unknown yet */ |
| 1682 | 0, 0, /* No members */ |
| 1683 | 0 /* No specifics */ |
| 1684 | }; |
| 1685 | |
| 1686 | |
| 1687 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 1688 | |
| 1689 | #include <PER-Visible.h> |
| 1690 | |
| 1691 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1692 | |
| 1693 | |
| 1694 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 1695 | |
| 1696 | |
| 1697 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1698 | |
| 1699 | extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM; |
| 1700 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 1701 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 1702 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
| 1703 | asn_struct_print_f SIZE_but_not_FROM_print; |
| 1704 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 1705 | |
| 1706 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 1707 | |
| 1708 | static int check_permitted_alphabet_6(const void *sptr) { |
| 1709 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1710 | const PER_Visible_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1711 | uint8_t *ch = st->buf; |
| 1712 | uint8_t *end = ch + st->size; |
| 1713 | |
| 1714 | for(; ch < end; ch++) { |
| 1715 | uint8_t cv = *ch; |
| 1716 | if(!(cv >= 65 && cv <= 70)) return 0; |
| 1717 | } |
| 1718 | return 1; |
| 1719 | } |
| 1720 | |
| 1721 | |
| 1722 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 1723 | |
| 1724 | int |
| 1725 | SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1726 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1727 | |
| 1728 | const SIZE_but_not_FROM_t *st = sptr; |
| 1729 | size_t size; |
| 1730 | |
| 1731 | if(!sptr) { |
| 1732 | _ASN_ERRLOG(app_errlog, app_key, |
| 1733 | "%s: value not given", td->name); |
| 1734 | return -1; |
| 1735 | } |
| 1736 | |
| 1737 | size = st->size; |
| 1738 | |
| 1739 | if((size >= 1 && size <= 4) |
| 1740 | && check_permitted_alphabet_6(sptr)) { |
| 1741 | /* Constraint check succeeded */ |
| 1742 | return 1; |
| 1743 | } else { |
| 1744 | _ASN_ERRLOG(app_errlog, app_key, |
| 1745 | "%s: constraint failed", td->name); |
| 1746 | return -1; |
| 1747 | } |
| 1748 | } |
| 1749 | |
| 1750 | /* |
| 1751 | * This type is implemented using PER_Visible, |
| 1752 | * so adjust the DEF appropriately. |
| 1753 | */ |
| 1754 | static void |
| 1755 | SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1756 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1757 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1758 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1759 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1760 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1761 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1762 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1763 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1764 | } |
| 1765 | |
| 1766 | ber_dec_rval_t |
| 1767 | SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1768 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1769 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1770 | return td->ber_decoder(td, structure, |
| 1771 | bufptr, size, tag_mode); |
| 1772 | } |
| 1773 | |
| 1774 | der_enc_rval_t |
| 1775 | SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 1776 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1777 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1778 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1779 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1780 | } |
| 1781 | |
| 1782 | int |
| 1783 | SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1784 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1785 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1786 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1787 | } |
| 1788 | |
| 1789 | void |
| 1790 | SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td, |
| 1791 | void *struct_ptr, int contents_only) { |
| 1792 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1793 | td->free_struct(td, struct_ptr, contents_only); |
| 1794 | } |
| 1795 | |
| 1796 | |
| 1797 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 1798 | |
| 1799 | static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = { |
| 1800 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1801 | }; |
| 1802 | asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = { |
| 1803 | "SIZE-but-not-FROM", |
| 1804 | SIZE_but_not_FROM_constraint, |
| 1805 | SIZE_but_not_FROM_decode_ber, |
| 1806 | SIZE_but_not_FROM_encode_der, |
| 1807 | SIZE_but_not_FROM_print, |
| 1808 | SIZE_but_not_FROM_free, |
| 1809 | 0, /* Use generic outmost tag fetcher */ |
| 1810 | asn1_DEF_SIZE_but_not_FROM_tags, |
| 1811 | sizeof(asn1_DEF_SIZE_but_not_FROM_tags) |
| 1812 | /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */ |
| 1813 | 1, /* Tags to skip */ |
| 1814 | -0, /* Unknown yet */ |
| 1815 | 0, 0, /* No members */ |
| 1816 | 0 /* No specifics */ |
| 1817 | }; |
| 1818 | |
| 1819 | |
| 1820 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 1821 | |
| 1822 | #include <PER-Visible.h> |
| 1823 | |
| 1824 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 1825 | |
| 1826 | |
| 1827 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 1828 | |
| 1829 | |
| 1830 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 1831 | |
| 1832 | extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM; |
| 1833 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 1834 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 1835 | der_type_encoder_f SIZE_and_FROM_encode_der; |
| 1836 | asn_struct_print_f SIZE_and_FROM_print; |
| 1837 | asn_struct_free_f SIZE_and_FROM_free; |
| 1838 | |
| 1839 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 1840 | |
| 1841 | static int check_permitted_alphabet_7(const void *sptr) { |
| 1842 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1843 | const PER_Visible_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1844 | uint8_t *ch = st->buf; |
| 1845 | uint8_t *end = ch + st->size; |
| 1846 | |
| 1847 | for(; ch < end; ch++) { |
| 1848 | uint8_t cv = *ch; |
| 1849 | if(!(cv >= 65 && cv <= 68)) return 0; |
| 1850 | } |
| 1851 | return 1; |
| 1852 | } |
| 1853 | |
| 1854 | |
| 1855 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 1856 | |
| 1857 | int |
| 1858 | SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1859 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1860 | |
| 1861 | const SIZE_and_FROM_t *st = sptr; |
| 1862 | size_t size; |
| 1863 | |
| 1864 | if(!sptr) { |
| 1865 | _ASN_ERRLOG(app_errlog, app_key, |
| 1866 | "%s: value not given", td->name); |
| 1867 | return -1; |
| 1868 | } |
| 1869 | |
| 1870 | size = st->size; |
| 1871 | |
| 1872 | if((size >= 1 && size <= 4) |
| 1873 | && check_permitted_alphabet_7(sptr)) { |
| 1874 | /* Constraint check succeeded */ |
| 1875 | return 1; |
| 1876 | } else { |
| 1877 | _ASN_ERRLOG(app_errlog, app_key, |
| 1878 | "%s: constraint failed", td->name); |
| 1879 | return -1; |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | /* |
| 1884 | * This type is implemented using PER_Visible, |
| 1885 | * so adjust the DEF appropriately. |
| 1886 | */ |
| 1887 | static void |
| 1888 | SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1889 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1890 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1891 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1892 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1893 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1894 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1895 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1896 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1897 | } |
| 1898 | |
| 1899 | ber_dec_rval_t |
| 1900 | SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1901 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1902 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1903 | return td->ber_decoder(td, structure, |
| 1904 | bufptr, size, tag_mode); |
| 1905 | } |
| 1906 | |
| 1907 | der_enc_rval_t |
| 1908 | SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 1909 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1910 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1911 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1912 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1913 | } |
| 1914 | |
| 1915 | int |
| 1916 | SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1917 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1918 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1919 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1920 | } |
| 1921 | |
| 1922 | void |
| 1923 | SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td, |
| 1924 | void *struct_ptr, int contents_only) { |
| 1925 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1926 | td->free_struct(td, struct_ptr, contents_only); |
| 1927 | } |
| 1928 | |
| 1929 | |
| 1930 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 1931 | |
| 1932 | static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = { |
| 1933 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1934 | }; |
| 1935 | asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = { |
| 1936 | "SIZE-and-FROM", |
| 1937 | SIZE_and_FROM_constraint, |
| 1938 | SIZE_and_FROM_decode_ber, |
| 1939 | SIZE_and_FROM_encode_der, |
| 1940 | SIZE_and_FROM_print, |
| 1941 | SIZE_and_FROM_free, |
| 1942 | 0, /* Use generic outmost tag fetcher */ |
| 1943 | asn1_DEF_SIZE_and_FROM_tags, |
| 1944 | sizeof(asn1_DEF_SIZE_and_FROM_tags) |
| 1945 | /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */ |
| 1946 | 1, /* Tags to skip */ |
| 1947 | -0, /* Unknown yet */ |
| 1948 | 0, 0, /* No members */ |
| 1949 | 0 /* No specifics */ |
| 1950 | }; |
| 1951 | |
| 1952 | |
| 1953 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 1954 | |
| 1955 | #include <PER-Visible.h> |
| 1956 | |
| 1957 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 1958 | |
| 1959 | |
| 1960 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 1961 | |
| 1962 | |
| 1963 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 1964 | |
| 1965 | extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM; |
| 1966 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 1967 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 1968 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
| 1969 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
| 1970 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 1971 | |
| 1972 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 1973 | |
| 1974 | static int check_permitted_alphabet_8(const void *sptr) { |
| 1975 | /* The underlying type is IA5String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 1976 | const PER_Visible_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1977 | uint8_t *ch = st->buf; |
| 1978 | uint8_t *end = ch + st->size; |
| 1979 | |
| 1980 | for(; ch < end; ch++) { |
| 1981 | uint8_t cv = *ch; |
| 1982 | if(!(cv >= 65 && cv <= 70)) return 0; |
| 1983 | } |
| 1984 | return 1; |
| 1985 | } |
| 1986 | |
| 1987 | |
| 1988 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 1989 | |
| 1990 | int |
| 1991 | Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1992 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1993 | |
| 1994 | const Neither_SIZE_nor_FROM_t *st = sptr; |
| 1995 | |
| 1996 | if(!sptr) { |
| 1997 | _ASN_ERRLOG(app_errlog, app_key, |
| 1998 | "%s: value not given", td->name); |
| 1999 | return -1; |
| 2000 | } |
| 2001 | |
| 2002 | |
| 2003 | if(check_permitted_alphabet_8(sptr)) { |
| 2004 | /* Constraint check succeeded */ |
| 2005 | return 1; |
| 2006 | } else { |
| 2007 | _ASN_ERRLOG(app_errlog, app_key, |
| 2008 | "%s: constraint failed", td->name); |
| 2009 | return -1; |
| 2010 | } |
| 2011 | } |
| 2012 | |
| 2013 | /* |
| 2014 | * This type is implemented using PER_Visible, |
| 2015 | * so adjust the DEF appropriately. |
| 2016 | */ |
| 2017 | static void |
| 2018 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2019 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 2020 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 2021 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 2022 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 2023 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 2024 | td->elements = asn1_DEF_PER_Visible.elements; |
| 2025 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 2026 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 2027 | } |
| 2028 | |
| 2029 | ber_dec_rval_t |
| 2030 | Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2031 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2032 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2033 | return td->ber_decoder(td, structure, |
| 2034 | bufptr, size, tag_mode); |
| 2035 | } |
| 2036 | |
| 2037 | der_enc_rval_t |
| 2038 | Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 2039 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2040 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2041 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2042 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2043 | } |
| 2044 | |
| 2045 | int |
| 2046 | Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2047 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2048 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2049 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2050 | } |
| 2051 | |
| 2052 | void |
| 2053 | Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td, |
| 2054 | void *struct_ptr, int contents_only) { |
| 2055 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2056 | td->free_struct(td, struct_ptr, contents_only); |
| 2057 | } |
| 2058 | |
| 2059 | |
| 2060 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2061 | |
| 2062 | static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = { |
| 2063 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2064 | }; |
| 2065 | asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = { |
| 2066 | "Neither-SIZE-nor-FROM", |
| 2067 | Neither_SIZE_nor_FROM_constraint, |
| 2068 | Neither_SIZE_nor_FROM_decode_ber, |
| 2069 | Neither_SIZE_nor_FROM_encode_der, |
| 2070 | Neither_SIZE_nor_FROM_print, |
| 2071 | Neither_SIZE_nor_FROM_free, |
| 2072 | 0, /* Use generic outmost tag fetcher */ |
| 2073 | asn1_DEF_Neither_SIZE_nor_FROM_tags, |
| 2074 | sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags) |
| 2075 | /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */ |
| 2076 | 1, /* Tags to skip */ |
| 2077 | -0, /* Unknown yet */ |
| 2078 | 0, 0, /* No members */ |
| 2079 | 0 /* No specifics */ |
| 2080 | }; |
| 2081 | |
| 2082 | |
| 2083 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 2084 | |
| 2085 | #include <Utf8-2.h> |
| 2086 | |
| 2087 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 2088 | |
| 2089 | |
| 2090 | typedef Utf8_2_t Utf8_3_t; |
| 2091 | |
| 2092 | |
| 2093 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 2094 | |
| 2095 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3; |
| 2096 | asn_constr_check_f Utf8_3_constraint; |
| 2097 | ber_type_decoder_f Utf8_3_decode_ber; |
| 2098 | der_type_encoder_f Utf8_3_encode_der; |
| 2099 | asn_struct_print_f Utf8_3_print; |
| 2100 | asn_struct_free_f Utf8_3_free; |
| 2101 | |
| 2102 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 2103 | |
| 2104 | static int permitted_alphabet_table_9[128] = { |
| 2105 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2106 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2107 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2108 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2109 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2110 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 2111 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2112 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2113 | }; |
| 2114 | |
| 2115 | static int check_permitted_alphabet_9(const void *sptr) { |
| 2116 | int *table = permitted_alphabet_table_9; |
| 2117 | /* The underlying type is UTF8String */ |
Lev Walkin | d1e5494 | 2004-08-21 07:34:17 +0000 | [diff] [blame^] | 2118 | const Utf8_2_t *st = sptr; |
Lev Walkin | 006de1c | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2119 | uint8_t *ch = st->buf; |
| 2120 | uint8_t *end = ch + st->size; |
| 2121 | |
| 2122 | for(; ch < end; ch++) { |
| 2123 | uint8_t cv = *ch; |
| 2124 | if(cv >= 0x80) return 0; |
| 2125 | if(!table[cv]) return 0; |
| 2126 | } |
| 2127 | return 1; |
| 2128 | } |
| 2129 | |
| 2130 | |
| 2131 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 2132 | |
| 2133 | int |
| 2134 | Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2135 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2136 | |
| 2137 | const Utf8_3_t *st = sptr; |
| 2138 | size_t size; |
| 2139 | |
| 2140 | if(!sptr) { |
| 2141 | _ASN_ERRLOG(app_errlog, app_key, |
| 2142 | "%s: value not given", td->name); |
| 2143 | return -1; |
| 2144 | } |
| 2145 | |
| 2146 | size = UTF8String_length(st, td->name, app_errlog, app_key); |
| 2147 | if(size == (size_t)-1) return -1; |
| 2148 | |
| 2149 | if((size >= 1 && size <= 2) |
| 2150 | && check_permitted_alphabet_9(sptr)) { |
| 2151 | /* Constraint check succeeded */ |
| 2152 | return 1; |
| 2153 | } else { |
| 2154 | _ASN_ERRLOG(app_errlog, app_key, |
| 2155 | "%s: constraint failed", td->name); |
| 2156 | return -1; |
| 2157 | } |
| 2158 | } |
| 2159 | |
| 2160 | /* |
| 2161 | * This type is implemented using Utf8_2, |
| 2162 | * so adjust the DEF appropriately. |
| 2163 | */ |
| 2164 | static void |
| 2165 | Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2166 | td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder; |
| 2167 | td->der_encoder = asn1_DEF_Utf8_2.der_encoder; |
| 2168 | td->free_struct = asn1_DEF_Utf8_2.free_struct; |
| 2169 | td->print_struct = asn1_DEF_Utf8_2.print_struct; |
| 2170 | td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form; |
| 2171 | td->elements = asn1_DEF_Utf8_2.elements; |
| 2172 | td->elements_count = asn1_DEF_Utf8_2.elements_count; |
| 2173 | td->specifics = asn1_DEF_Utf8_2.specifics; |
| 2174 | } |
| 2175 | |
| 2176 | ber_dec_rval_t |
| 2177 | Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2178 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2179 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2180 | return td->ber_decoder(td, structure, |
| 2181 | bufptr, size, tag_mode); |
| 2182 | } |
| 2183 | |
| 2184 | der_enc_rval_t |
| 2185 | Utf8_3_encode_der(asn1_TYPE_descriptor_t *td, |
| 2186 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2187 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2188 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2189 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2190 | } |
| 2191 | |
| 2192 | int |
| 2193 | Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2194 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2195 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2196 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2197 | } |
| 2198 | |
| 2199 | void |
| 2200 | Utf8_3_free(asn1_TYPE_descriptor_t *td, |
| 2201 | void *struct_ptr, int contents_only) { |
| 2202 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2203 | td->free_struct(td, struct_ptr, contents_only); |
| 2204 | } |
| 2205 | |
| 2206 | |
| 2207 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 2208 | |
| 2209 | static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = { |
| 2210 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2211 | }; |
| 2212 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = { |
| 2213 | "Utf8-3", |
| 2214 | Utf8_3_constraint, |
| 2215 | Utf8_3_decode_ber, |
| 2216 | Utf8_3_encode_der, |
| 2217 | Utf8_3_print, |
| 2218 | Utf8_3_free, |
| 2219 | 0, /* Use generic outmost tag fetcher */ |
| 2220 | asn1_DEF_Utf8_3_tags, |
| 2221 | sizeof(asn1_DEF_Utf8_3_tags) |
| 2222 | /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */ |
| 2223 | 1, /* Tags to skip */ |
| 2224 | -0, /* Unknown yet */ |
| 2225 | 0, 0, /* No members */ |
| 2226 | 0 /* No specifics */ |
| 2227 | }; |
| 2228 | |
| 2229 | |
| 2230 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 2231 | |
| 2232 | #include <Utf8-1.h> |
| 2233 | |
| 2234 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 2235 | |
| 2236 | |
| 2237 | typedef Utf8_1_t Utf8_2_t; |
| 2238 | |
| 2239 | |
| 2240 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 2241 | |
| 2242 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2; |
| 2243 | asn_constr_check_f Utf8_2_constraint; |
| 2244 | ber_type_decoder_f Utf8_2_decode_ber; |
| 2245 | der_type_encoder_f Utf8_2_encode_der; |
| 2246 | asn_struct_print_f Utf8_2_print; |
| 2247 | asn_struct_free_f Utf8_2_free; |
| 2248 | |
| 2249 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 2250 | |
| 2251 | int |
| 2252 | Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2253 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2254 | |
| 2255 | const Utf8_2_t *st = sptr; |
| 2256 | size_t size; |
| 2257 | |
| 2258 | if(!sptr) { |
| 2259 | _ASN_ERRLOG(app_errlog, app_key, |
| 2260 | "%s: value not given", td->name); |
| 2261 | return -1; |
| 2262 | } |
| 2263 | |
| 2264 | size = UTF8String_length(st, td->name, app_errlog, app_key); |
| 2265 | if(size == (size_t)-1) return -1; |
| 2266 | |
| 2267 | if((size >= 1 && size <= 2)) { |
| 2268 | /* Constraint check succeeded */ |
| 2269 | return 1; |
| 2270 | } else { |
| 2271 | _ASN_ERRLOG(app_errlog, app_key, |
| 2272 | "%s: constraint failed", td->name); |
| 2273 | return -1; |
| 2274 | } |
| 2275 | } |
| 2276 | |
| 2277 | /* |
| 2278 | * This type is implemented using Utf8_1, |
| 2279 | * so adjust the DEF appropriately. |
| 2280 | */ |
| 2281 | static void |
| 2282 | Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2283 | td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder; |
| 2284 | td->der_encoder = asn1_DEF_Utf8_1.der_encoder; |
| 2285 | td->free_struct = asn1_DEF_Utf8_1.free_struct; |
| 2286 | td->print_struct = asn1_DEF_Utf8_1.print_struct; |
| 2287 | td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form; |
| 2288 | td->elements = asn1_DEF_Utf8_1.elements; |
| 2289 | td->elements_count = asn1_DEF_Utf8_1.elements_count; |
| 2290 | td->specifics = asn1_DEF_Utf8_1.specifics; |
| 2291 | } |
| 2292 | |
| 2293 | ber_dec_rval_t |
| 2294 | Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2295 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2296 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2297 | return td->ber_decoder(td, structure, |
| 2298 | bufptr, size, tag_mode); |
| 2299 | } |
| 2300 | |
| 2301 | der_enc_rval_t |
| 2302 | Utf8_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 2303 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2304 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2305 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2306 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2307 | } |
| 2308 | |
| 2309 | int |
| 2310 | Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2311 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2312 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2313 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2314 | } |
| 2315 | |
| 2316 | void |
| 2317 | Utf8_2_free(asn1_TYPE_descriptor_t *td, |
| 2318 | void *struct_ptr, int contents_only) { |
| 2319 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2320 | td->free_struct(td, struct_ptr, contents_only); |
| 2321 | } |
| 2322 | |
| 2323 | |
| 2324 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 2325 | |
| 2326 | static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = { |
| 2327 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2328 | }; |
| 2329 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = { |
| 2330 | "Utf8-2", |
| 2331 | Utf8_2_constraint, |
| 2332 | Utf8_2_decode_ber, |
| 2333 | Utf8_2_encode_der, |
| 2334 | Utf8_2_print, |
| 2335 | Utf8_2_free, |
| 2336 | 0, /* Use generic outmost tag fetcher */ |
| 2337 | asn1_DEF_Utf8_2_tags, |
| 2338 | sizeof(asn1_DEF_Utf8_2_tags) |
| 2339 | /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */ |
| 2340 | 1, /* Tags to skip */ |
| 2341 | -0, /* Unknown yet */ |
| 2342 | 0, 0, /* No members */ |
| 2343 | 0 /* No specifics */ |
| 2344 | }; |
| 2345 | |
| 2346 | |
| 2347 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 2348 | |
| 2349 | #include <UTF8String.h> |
| 2350 | |
| 2351 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 2352 | |
| 2353 | |
| 2354 | typedef UTF8String_t Utf8_1_t; |
| 2355 | |
| 2356 | |
| 2357 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 2358 | |
| 2359 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1; |
| 2360 | asn_constr_check_f Utf8_1_constraint; |
| 2361 | ber_type_decoder_f Utf8_1_decode_ber; |
| 2362 | der_type_encoder_f Utf8_1_encode_der; |
| 2363 | asn_struct_print_f Utf8_1_print; |
| 2364 | asn_struct_free_f Utf8_1_free; |
| 2365 | |
| 2366 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 2367 | |
| 2368 | int |
| 2369 | Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2370 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2371 | |
| 2372 | /* Make the underlying type checker permanent */ |
| 2373 | td->check_constraints = asn1_DEF_UTF8String.check_constraints; |
| 2374 | return td->check_constraints |
| 2375 | (td, sptr, app_errlog, app_key); |
| 2376 | } |
| 2377 | |
| 2378 | /* |
| 2379 | * This type is implemented using UTF8String, |
| 2380 | * so adjust the DEF appropriately. |
| 2381 | */ |
| 2382 | static void |
| 2383 | Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2384 | td->ber_decoder = asn1_DEF_UTF8String.ber_decoder; |
| 2385 | td->der_encoder = asn1_DEF_UTF8String.der_encoder; |
| 2386 | td->free_struct = asn1_DEF_UTF8String.free_struct; |
| 2387 | td->print_struct = asn1_DEF_UTF8String.print_struct; |
| 2388 | td->last_tag_form = asn1_DEF_UTF8String.last_tag_form; |
| 2389 | td->elements = asn1_DEF_UTF8String.elements; |
| 2390 | td->elements_count = asn1_DEF_UTF8String.elements_count; |
| 2391 | td->specifics = asn1_DEF_UTF8String.specifics; |
| 2392 | } |
| 2393 | |
| 2394 | ber_dec_rval_t |
| 2395 | Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2396 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2397 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2398 | return td->ber_decoder(td, structure, |
| 2399 | bufptr, size, tag_mode); |
| 2400 | } |
| 2401 | |
| 2402 | der_enc_rval_t |
| 2403 | Utf8_1_encode_der(asn1_TYPE_descriptor_t *td, |
| 2404 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2405 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2406 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2407 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2408 | } |
| 2409 | |
| 2410 | int |
| 2411 | Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2412 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2413 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2414 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2415 | } |
| 2416 | |
| 2417 | void |
| 2418 | Utf8_1_free(asn1_TYPE_descriptor_t *td, |
| 2419 | void *struct_ptr, int contents_only) { |
| 2420 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2421 | td->free_struct(td, struct_ptr, contents_only); |
| 2422 | } |
| 2423 | |
| 2424 | |
| 2425 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 2426 | |
| 2427 | static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = { |
| 2428 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 2429 | }; |
| 2430 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = { |
| 2431 | "Utf8-1", |
| 2432 | Utf8_1_constraint, |
| 2433 | Utf8_1_decode_ber, |
| 2434 | Utf8_1_encode_der, |
| 2435 | Utf8_1_print, |
| 2436 | Utf8_1_free, |
| 2437 | 0, /* Use generic outmost tag fetcher */ |
| 2438 | asn1_DEF_Utf8_1_tags, |
| 2439 | sizeof(asn1_DEF_Utf8_1_tags) |
| 2440 | /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */ |
| 2441 | 1, /* Tags to skip */ |
| 2442 | -0, /* Unknown yet */ |
| 2443 | 0, 0, /* No members */ |
| 2444 | 0 /* No specifics */ |
| 2445 | }; |
| 2446 | |