vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [T1] >>> ***/ |
| 3 | |
| 4 | #include <T2.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [T1] >>> ***/ |
| 7 | |
| 8 | |
| 9 | typedef T2_t T1_t; |
| 10 | |
| 11 | /*** <<< FUNC-DECLS [T1] >>> ***/ |
| 12 | |
| 13 | extern asn1_TYPE_descriptor_t asn1_DEF_T1; |
| 14 | asn_constr_check_f T1_constraint; |
| 15 | ber_type_decoder_f T1_decode_ber; |
| 16 | der_type_encoder_f T1_encode_der; |
| 17 | asn_struct_print_f T1_print; |
| 18 | asn_struct_free_f T1_free; |
| 19 | |
| 20 | /*** <<< CODE [T1] >>> ***/ |
| 21 | |
| 22 | int |
| 23 | T1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 24 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 25 | |
| 26 | /* Make the underlying type checker permanent */ |
| 27 | td->check_constraints = asn1_DEF_T2.check_constraints; |
| 28 | return td->check_constraints |
| 29 | (td, sptr, app_errlog, app_key); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | * This type is implemented using T2, |
| 34 | * so adjust the DEF appropriately. |
| 35 | */ |
| 36 | static void |
| 37 | T1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 38 | td->ber_decoder = asn1_DEF_T2.ber_decoder; |
| 39 | td->der_encoder = asn1_DEF_T2.der_encoder; |
| 40 | td->free_struct = asn1_DEF_T2.free_struct; |
| 41 | td->print_struct = asn1_DEF_T2.print_struct; |
| 42 | td->last_tag_form = asn1_DEF_T2.last_tag_form; |
| 43 | td->elements = asn1_DEF_T2.elements; |
| 44 | td->elements_count = asn1_DEF_T2.elements_count; |
| 45 | td->specifics = asn1_DEF_T2.specifics; |
| 46 | } |
| 47 | |
| 48 | ber_dec_rval_t |
| 49 | T1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 50 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 51 | T1_inherit_TYPE_descriptor(td); |
| 52 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 53 | } |
| 54 | |
| 55 | der_enc_rval_t |
| 56 | T1_encode_der(asn1_TYPE_descriptor_t *td, |
| 57 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 58 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 59 | T1_inherit_TYPE_descriptor(td); |
| 60 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 61 | } |
| 62 | |
| 63 | int |
| 64 | T1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 65 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 66 | T1_inherit_TYPE_descriptor(td); |
| 67 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 68 | } |
| 69 | |
| 70 | void |
| 71 | T1_free(asn1_TYPE_descriptor_t *td, |
| 72 | void *struct_ptr, int contents_only) { |
| 73 | T1_inherit_TYPE_descriptor(td); |
| 74 | td->free_struct(td, struct_ptr, contents_only); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | /*** <<< STAT-DEFS [T1] >>> ***/ |
| 79 | |
| 80 | static ber_tlv_tag_t asn1_DEF_T1_tags[] = { |
| 81 | (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 82 | (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 83 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 84 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)) |
| 85 | }; |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 86 | static ber_tlv_tag_t asn1_DEF_T1_all_tags[] = { |
| 87 | (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 88 | (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 89 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 90 | (ASN_TAG_CLASS_CONTEXT | (5 << 2)), |
| 91 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)), |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 92 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 93 | }; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 94 | asn1_TYPE_descriptor_t asn1_DEF_T1 = { |
| 95 | "T1", |
| 96 | T1_constraint, |
| 97 | T1_decode_ber, |
| 98 | T1_encode_der, |
| 99 | T1_print, |
| 100 | T1_free, |
| 101 | 0, /* Use generic outmost tag fetcher */ |
| 102 | asn1_DEF_T1_tags, |
| 103 | sizeof(asn1_DEF_T1_tags) |
| 104 | /sizeof(asn1_DEF_T1_tags[0]), /* 4 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 105 | asn1_DEF_T1_all_tags, |
| 106 | sizeof(asn1_DEF_T1_all_tags) |
| 107 | /sizeof(asn1_DEF_T1_all_tags[0]), /* 6 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 108 | -0, /* Unknown yet */ |
| 109 | 0, 0, /* No members */ |
| 110 | 0 /* No specifics */ |
| 111 | }; |
| 112 | |
| 113 | |
| 114 | /*** <<< INCLUDES [T2] >>> ***/ |
| 115 | |
| 116 | #include <T3.h> |
| 117 | |
| 118 | /*** <<< TYPE-DECLS [T2] >>> ***/ |
| 119 | |
| 120 | |
| 121 | typedef T3_t T2_t; |
| 122 | |
| 123 | /*** <<< FUNC-DECLS [T2] >>> ***/ |
| 124 | |
| 125 | extern asn1_TYPE_descriptor_t asn1_DEF_T2; |
| 126 | asn_constr_check_f T2_constraint; |
| 127 | ber_type_decoder_f T2_decode_ber; |
| 128 | der_type_encoder_f T2_encode_der; |
| 129 | asn_struct_print_f T2_print; |
| 130 | asn_struct_free_f T2_free; |
| 131 | |
| 132 | /*** <<< CODE [T2] >>> ***/ |
| 133 | |
| 134 | int |
| 135 | T2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 136 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 137 | |
| 138 | /* Make the underlying type checker permanent */ |
| 139 | td->check_constraints = asn1_DEF_T3.check_constraints; |
| 140 | return td->check_constraints |
| 141 | (td, sptr, app_errlog, app_key); |
| 142 | } |
| 143 | |
| 144 | /* |
| 145 | * This type is implemented using T3, |
| 146 | * so adjust the DEF appropriately. |
| 147 | */ |
| 148 | static void |
| 149 | T2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 150 | td->ber_decoder = asn1_DEF_T3.ber_decoder; |
| 151 | td->der_encoder = asn1_DEF_T3.der_encoder; |
| 152 | td->free_struct = asn1_DEF_T3.free_struct; |
| 153 | td->print_struct = asn1_DEF_T3.print_struct; |
| 154 | td->last_tag_form = asn1_DEF_T3.last_tag_form; |
| 155 | td->elements = asn1_DEF_T3.elements; |
| 156 | td->elements_count = asn1_DEF_T3.elements_count; |
| 157 | td->specifics = asn1_DEF_T3.specifics; |
| 158 | } |
| 159 | |
| 160 | ber_dec_rval_t |
| 161 | T2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 162 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 163 | T2_inherit_TYPE_descriptor(td); |
| 164 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 165 | } |
| 166 | |
| 167 | der_enc_rval_t |
| 168 | T2_encode_der(asn1_TYPE_descriptor_t *td, |
| 169 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 170 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 171 | T2_inherit_TYPE_descriptor(td); |
| 172 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 173 | } |
| 174 | |
| 175 | int |
| 176 | T2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 177 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 178 | T2_inherit_TYPE_descriptor(td); |
| 179 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 180 | } |
| 181 | |
| 182 | void |
| 183 | T2_free(asn1_TYPE_descriptor_t *td, |
| 184 | void *struct_ptr, int contents_only) { |
| 185 | T2_inherit_TYPE_descriptor(td); |
| 186 | td->free_struct(td, struct_ptr, contents_only); |
| 187 | } |
| 188 | |
| 189 | |
| 190 | /*** <<< STAT-DEFS [T2] >>> ***/ |
| 191 | |
| 192 | static ber_tlv_tag_t asn1_DEF_T2_tags[] = { |
| 193 | (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 194 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 195 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)) |
| 196 | }; |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 197 | static ber_tlv_tag_t asn1_DEF_T2_all_tags[] = { |
| 198 | (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 199 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 200 | (ASN_TAG_CLASS_CONTEXT | (5 << 2)), |
| 201 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)), |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 202 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 203 | }; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 204 | asn1_TYPE_descriptor_t asn1_DEF_T2 = { |
| 205 | "T2", |
| 206 | T2_constraint, |
| 207 | T2_decode_ber, |
| 208 | T2_encode_der, |
| 209 | T2_print, |
| 210 | T2_free, |
| 211 | 0, /* Use generic outmost tag fetcher */ |
| 212 | asn1_DEF_T2_tags, |
| 213 | sizeof(asn1_DEF_T2_tags) |
| 214 | /sizeof(asn1_DEF_T2_tags[0]), /* 3 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 215 | asn1_DEF_T2_all_tags, |
| 216 | sizeof(asn1_DEF_T2_all_tags) |
| 217 | /sizeof(asn1_DEF_T2_all_tags[0]), /* 5 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 218 | -0, /* Unknown yet */ |
| 219 | 0, 0, /* No members */ |
| 220 | 0 /* No specifics */ |
| 221 | }; |
| 222 | |
| 223 | |
| 224 | /*** <<< INCLUDES [T3] >>> ***/ |
| 225 | |
| 226 | #include <T4.h> |
| 227 | |
| 228 | /*** <<< TYPE-DECLS [T3] >>> ***/ |
| 229 | |
| 230 | |
| 231 | typedef T4_t T3_t; |
| 232 | |
| 233 | /*** <<< FUNC-DECLS [T3] >>> ***/ |
| 234 | |
| 235 | extern asn1_TYPE_descriptor_t asn1_DEF_T3; |
| 236 | asn_constr_check_f T3_constraint; |
| 237 | ber_type_decoder_f T3_decode_ber; |
| 238 | der_type_encoder_f T3_encode_der; |
| 239 | asn_struct_print_f T3_print; |
| 240 | asn_struct_free_f T3_free; |
| 241 | |
| 242 | /*** <<< CODE [T3] >>> ***/ |
| 243 | |
| 244 | int |
| 245 | T3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 246 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 247 | |
| 248 | /* Make the underlying type checker permanent */ |
| 249 | td->check_constraints = asn1_DEF_T4.check_constraints; |
| 250 | return td->check_constraints |
| 251 | (td, sptr, app_errlog, app_key); |
| 252 | } |
| 253 | |
| 254 | /* |
| 255 | * This type is implemented using T4, |
| 256 | * so adjust the DEF appropriately. |
| 257 | */ |
| 258 | static void |
| 259 | T3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 260 | td->ber_decoder = asn1_DEF_T4.ber_decoder; |
| 261 | td->der_encoder = asn1_DEF_T4.der_encoder; |
| 262 | td->free_struct = asn1_DEF_T4.free_struct; |
| 263 | td->print_struct = asn1_DEF_T4.print_struct; |
| 264 | td->last_tag_form = asn1_DEF_T4.last_tag_form; |
| 265 | td->elements = asn1_DEF_T4.elements; |
| 266 | td->elements_count = asn1_DEF_T4.elements_count; |
| 267 | td->specifics = asn1_DEF_T4.specifics; |
| 268 | } |
| 269 | |
| 270 | ber_dec_rval_t |
| 271 | T3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 272 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 273 | T3_inherit_TYPE_descriptor(td); |
| 274 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 275 | } |
| 276 | |
| 277 | der_enc_rval_t |
| 278 | T3_encode_der(asn1_TYPE_descriptor_t *td, |
| 279 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 280 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 281 | T3_inherit_TYPE_descriptor(td); |
| 282 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 283 | } |
| 284 | |
| 285 | int |
| 286 | T3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 287 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 288 | T3_inherit_TYPE_descriptor(td); |
| 289 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 290 | } |
| 291 | |
| 292 | void |
| 293 | T3_free(asn1_TYPE_descriptor_t *td, |
| 294 | void *struct_ptr, int contents_only) { |
| 295 | T3_inherit_TYPE_descriptor(td); |
| 296 | td->free_struct(td, struct_ptr, contents_only); |
| 297 | } |
| 298 | |
| 299 | |
| 300 | /*** <<< STAT-DEFS [T3] >>> ***/ |
| 301 | |
| 302 | static ber_tlv_tag_t asn1_DEF_T3_tags[] = { |
| 303 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 304 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)) |
| 305 | }; |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 306 | static ber_tlv_tag_t asn1_DEF_T3_all_tags[] = { |
| 307 | (ASN_TAG_CLASS_CONTEXT | (4 << 2)), |
| 308 | (ASN_TAG_CLASS_CONTEXT | (5 << 2)), |
| 309 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)), |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 310 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 311 | }; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 312 | asn1_TYPE_descriptor_t asn1_DEF_T3 = { |
| 313 | "T3", |
| 314 | T3_constraint, |
| 315 | T3_decode_ber, |
| 316 | T3_encode_der, |
| 317 | T3_print, |
| 318 | T3_free, |
| 319 | 0, /* Use generic outmost tag fetcher */ |
| 320 | asn1_DEF_T3_tags, |
| 321 | sizeof(asn1_DEF_T3_tags) |
| 322 | /sizeof(asn1_DEF_T3_tags[0]), /* 2 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 323 | asn1_DEF_T3_all_tags, |
| 324 | sizeof(asn1_DEF_T3_all_tags) |
| 325 | /sizeof(asn1_DEF_T3_all_tags[0]), /* 4 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 326 | -0, /* Unknown yet */ |
| 327 | 0, 0, /* No members */ |
| 328 | 0 /* No specifics */ |
| 329 | }; |
| 330 | |
| 331 | |
| 332 | /*** <<< INCLUDES [T4] >>> ***/ |
| 333 | |
| 334 | #include <T5.h> |
| 335 | |
| 336 | /*** <<< TYPE-DECLS [T4] >>> ***/ |
| 337 | |
| 338 | |
| 339 | typedef T5_t T4_t; |
| 340 | |
| 341 | /*** <<< FUNC-DECLS [T4] >>> ***/ |
| 342 | |
| 343 | extern asn1_TYPE_descriptor_t asn1_DEF_T4; |
| 344 | asn_constr_check_f T4_constraint; |
| 345 | ber_type_decoder_f T4_decode_ber; |
| 346 | der_type_encoder_f T4_encode_der; |
| 347 | asn_struct_print_f T4_print; |
| 348 | asn_struct_free_f T4_free; |
| 349 | |
| 350 | /*** <<< CODE [T4] >>> ***/ |
| 351 | |
| 352 | int |
| 353 | T4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 354 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 355 | |
| 356 | /* Make the underlying type checker permanent */ |
| 357 | td->check_constraints = asn1_DEF_T5.check_constraints; |
| 358 | return td->check_constraints |
| 359 | (td, sptr, app_errlog, app_key); |
| 360 | } |
| 361 | |
| 362 | /* |
| 363 | * This type is implemented using T5, |
| 364 | * so adjust the DEF appropriately. |
| 365 | */ |
| 366 | static void |
| 367 | T4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 368 | td->ber_decoder = asn1_DEF_T5.ber_decoder; |
| 369 | td->der_encoder = asn1_DEF_T5.der_encoder; |
| 370 | td->free_struct = asn1_DEF_T5.free_struct; |
| 371 | td->print_struct = asn1_DEF_T5.print_struct; |
| 372 | td->last_tag_form = asn1_DEF_T5.last_tag_form; |
| 373 | td->elements = asn1_DEF_T5.elements; |
| 374 | td->elements_count = asn1_DEF_T5.elements_count; |
| 375 | td->specifics = asn1_DEF_T5.specifics; |
| 376 | } |
| 377 | |
| 378 | ber_dec_rval_t |
| 379 | T4_decode_ber(asn1_TYPE_descriptor_t *td, |
| 380 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 381 | T4_inherit_TYPE_descriptor(td); |
| 382 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 383 | } |
| 384 | |
| 385 | der_enc_rval_t |
| 386 | T4_encode_der(asn1_TYPE_descriptor_t *td, |
| 387 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 388 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 389 | T4_inherit_TYPE_descriptor(td); |
| 390 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 391 | } |
| 392 | |
| 393 | int |
| 394 | T4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 395 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 396 | T4_inherit_TYPE_descriptor(td); |
| 397 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 398 | } |
| 399 | |
| 400 | void |
| 401 | T4_free(asn1_TYPE_descriptor_t *td, |
| 402 | void *struct_ptr, int contents_only) { |
| 403 | T4_inherit_TYPE_descriptor(td); |
| 404 | td->free_struct(td, struct_ptr, contents_only); |
| 405 | } |
| 406 | |
| 407 | |
| 408 | /*** <<< STAT-DEFS [T4] >>> ***/ |
| 409 | |
| 410 | static ber_tlv_tag_t asn1_DEF_T4_tags[] = { |
| 411 | (ASN_TAG_CLASS_CONTEXT | (5 << 2)), |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 412 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)), |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 413 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 414 | }; |
| 415 | asn1_TYPE_descriptor_t asn1_DEF_T4 = { |
| 416 | "T4", |
| 417 | T4_constraint, |
| 418 | T4_decode_ber, |
| 419 | T4_encode_der, |
| 420 | T4_print, |
| 421 | T4_free, |
| 422 | 0, /* Use generic outmost tag fetcher */ |
| 423 | asn1_DEF_T4_tags, |
| 424 | sizeof(asn1_DEF_T4_tags) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 425 | /sizeof(asn1_DEF_T4_tags[0]) - 1, /* 2 */ |
| 426 | asn1_DEF_T4_tags, /* Same as above */ |
| 427 | sizeof(asn1_DEF_T4_tags) |
| 428 | /sizeof(asn1_DEF_T4_tags[0]), /* 3 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 429 | -0, /* Unknown yet */ |
| 430 | 0, 0, /* No members */ |
| 431 | 0 /* No specifics */ |
| 432 | }; |
| 433 | |
| 434 | |
| 435 | /*** <<< INCLUDES [T5] >>> ***/ |
| 436 | |
| 437 | #include <T6.h> |
| 438 | |
| 439 | /*** <<< TYPE-DECLS [T5] >>> ***/ |
| 440 | |
| 441 | |
| 442 | typedef T6_t T5_t; |
| 443 | |
| 444 | /*** <<< FUNC-DECLS [T5] >>> ***/ |
| 445 | |
| 446 | extern asn1_TYPE_descriptor_t asn1_DEF_T5; |
| 447 | asn_constr_check_f T5_constraint; |
| 448 | ber_type_decoder_f T5_decode_ber; |
| 449 | der_type_encoder_f T5_encode_der; |
| 450 | asn_struct_print_f T5_print; |
| 451 | asn_struct_free_f T5_free; |
| 452 | |
| 453 | /*** <<< CODE [T5] >>> ***/ |
| 454 | |
| 455 | int |
| 456 | T5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 457 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 458 | |
| 459 | /* Make the underlying type checker permanent */ |
| 460 | td->check_constraints = asn1_DEF_T6.check_constraints; |
| 461 | return td->check_constraints |
| 462 | (td, sptr, app_errlog, app_key); |
| 463 | } |
| 464 | |
| 465 | /* |
| 466 | * This type is implemented using T6, |
| 467 | * so adjust the DEF appropriately. |
| 468 | */ |
| 469 | static void |
| 470 | T5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 471 | td->ber_decoder = asn1_DEF_T6.ber_decoder; |
| 472 | td->der_encoder = asn1_DEF_T6.der_encoder; |
| 473 | td->free_struct = asn1_DEF_T6.free_struct; |
| 474 | td->print_struct = asn1_DEF_T6.print_struct; |
| 475 | td->last_tag_form = asn1_DEF_T6.last_tag_form; |
| 476 | td->elements = asn1_DEF_T6.elements; |
| 477 | td->elements_count = asn1_DEF_T6.elements_count; |
| 478 | td->specifics = asn1_DEF_T6.specifics; |
| 479 | } |
| 480 | |
| 481 | ber_dec_rval_t |
| 482 | T5_decode_ber(asn1_TYPE_descriptor_t *td, |
| 483 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 484 | T5_inherit_TYPE_descriptor(td); |
| 485 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 486 | } |
| 487 | |
| 488 | der_enc_rval_t |
| 489 | T5_encode_der(asn1_TYPE_descriptor_t *td, |
| 490 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 491 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 492 | T5_inherit_TYPE_descriptor(td); |
| 493 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 494 | } |
| 495 | |
| 496 | int |
| 497 | T5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 498 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 499 | T5_inherit_TYPE_descriptor(td); |
| 500 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 501 | } |
| 502 | |
| 503 | void |
| 504 | T5_free(asn1_TYPE_descriptor_t *td, |
| 505 | void *struct_ptr, int contents_only) { |
| 506 | T5_inherit_TYPE_descriptor(td); |
| 507 | td->free_struct(td, struct_ptr, contents_only); |
| 508 | } |
| 509 | |
| 510 | |
| 511 | /*** <<< STAT-DEFS [T5] >>> ***/ |
| 512 | |
| 513 | static ber_tlv_tag_t asn1_DEF_T5_tags[] = { |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 514 | (ASN_TAG_CLASS_CONTEXT | (6 << 2)), |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 515 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 516 | }; |
| 517 | asn1_TYPE_descriptor_t asn1_DEF_T5 = { |
| 518 | "T5", |
| 519 | T5_constraint, |
| 520 | T5_decode_ber, |
| 521 | T5_encode_der, |
| 522 | T5_print, |
| 523 | T5_free, |
| 524 | 0, /* Use generic outmost tag fetcher */ |
| 525 | asn1_DEF_T5_tags, |
| 526 | sizeof(asn1_DEF_T5_tags) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 527 | /sizeof(asn1_DEF_T5_tags[0]) - 1, /* 1 */ |
| 528 | asn1_DEF_T5_tags, /* Same as above */ |
| 529 | sizeof(asn1_DEF_T5_tags) |
| 530 | /sizeof(asn1_DEF_T5_tags[0]), /* 2 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 531 | -0, /* Unknown yet */ |
| 532 | 0, 0, /* No members */ |
| 533 | 0 /* No specifics */ |
| 534 | }; |
| 535 | |
| 536 | |
| 537 | /*** <<< INCLUDES [T6] >>> ***/ |
| 538 | |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 539 | #include <REAL.h> |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 540 | |
| 541 | /*** <<< TYPE-DECLS [T6] >>> ***/ |
| 542 | |
| 543 | |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 544 | typedef REAL_t T6_t; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 545 | |
| 546 | /*** <<< FUNC-DECLS [T6] >>> ***/ |
| 547 | |
| 548 | extern asn1_TYPE_descriptor_t asn1_DEF_T6; |
| 549 | asn_constr_check_f T6_constraint; |
| 550 | ber_type_decoder_f T6_decode_ber; |
| 551 | der_type_encoder_f T6_encode_der; |
| 552 | asn_struct_print_f T6_print; |
| 553 | asn_struct_free_f T6_free; |
| 554 | |
| 555 | /*** <<< CODE [T6] >>> ***/ |
| 556 | |
| 557 | int |
| 558 | T6_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 559 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 560 | |
| 561 | /* Make the underlying type checker permanent */ |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 562 | td->check_constraints = asn1_DEF_REAL.check_constraints; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 563 | return td->check_constraints |
| 564 | (td, sptr, app_errlog, app_key); |
| 565 | } |
| 566 | |
| 567 | /* |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 568 | * This type is implemented using REAL, |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 569 | * so adjust the DEF appropriately. |
| 570 | */ |
| 571 | static void |
| 572 | T6_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 573 | td->ber_decoder = asn1_DEF_REAL.ber_decoder; |
| 574 | td->der_encoder = asn1_DEF_REAL.der_encoder; |
| 575 | td->free_struct = asn1_DEF_REAL.free_struct; |
| 576 | td->print_struct = asn1_DEF_REAL.print_struct; |
| 577 | td->last_tag_form = asn1_DEF_REAL.last_tag_form; |
| 578 | td->elements = asn1_DEF_REAL.elements; |
| 579 | td->elements_count = asn1_DEF_REAL.elements_count; |
| 580 | td->specifics = asn1_DEF_REAL.specifics; |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | ber_dec_rval_t |
| 584 | T6_decode_ber(asn1_TYPE_descriptor_t *td, |
| 585 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 586 | T6_inherit_TYPE_descriptor(td); |
| 587 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 588 | } |
| 589 | |
| 590 | der_enc_rval_t |
| 591 | T6_encode_der(asn1_TYPE_descriptor_t *td, |
| 592 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 593 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 594 | T6_inherit_TYPE_descriptor(td); |
| 595 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 596 | } |
| 597 | |
| 598 | int |
| 599 | T6_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 600 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 601 | T6_inherit_TYPE_descriptor(td); |
| 602 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 603 | } |
| 604 | |
| 605 | void |
| 606 | T6_free(asn1_TYPE_descriptor_t *td, |
| 607 | void *struct_ptr, int contents_only) { |
| 608 | T6_inherit_TYPE_descriptor(td); |
| 609 | td->free_struct(td, struct_ptr, contents_only); |
| 610 | } |
| 611 | |
| 612 | |
| 613 | /*** <<< STAT-DEFS [T6] >>> ***/ |
| 614 | |
| 615 | static ber_tlv_tag_t asn1_DEF_T6_tags[] = { |
vlm | de592d7 | 2004-09-14 12:46:58 +0000 | [diff] [blame] | 616 | (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 617 | }; |
| 618 | asn1_TYPE_descriptor_t asn1_DEF_T6 = { |
| 619 | "T6", |
| 620 | T6_constraint, |
| 621 | T6_decode_ber, |
| 622 | T6_encode_der, |
| 623 | T6_print, |
| 624 | T6_free, |
| 625 | 0, /* Use generic outmost tag fetcher */ |
| 626 | asn1_DEF_T6_tags, |
| 627 | sizeof(asn1_DEF_T6_tags) |
| 628 | /sizeof(asn1_DEF_T6_tags[0]), /* 1 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 629 | asn1_DEF_T6_tags, /* Same as above */ |
| 630 | sizeof(asn1_DEF_T6_tags) |
| 631 | /sizeof(asn1_DEF_T6_tags[0]), /* 1 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 632 | -0, /* Unknown yet */ |
| 633 | 0, 0, /* No members */ |
| 634 | 0 /* No specifics */ |
| 635 | }; |
| 636 | |
| 637 | |
| 638 | /*** <<< INCLUDES [T] >>> ***/ |
| 639 | |
| 640 | #include <Ts.h> |
| 641 | |
| 642 | /*** <<< TYPE-DECLS [T] >>> ***/ |
| 643 | |
| 644 | |
| 645 | typedef Ts_t T_t; |
| 646 | |
| 647 | /*** <<< FUNC-DECLS [T] >>> ***/ |
| 648 | |
| 649 | extern asn1_TYPE_descriptor_t asn1_DEF_T; |
| 650 | asn_constr_check_f T_constraint; |
| 651 | ber_type_decoder_f T_decode_ber; |
| 652 | der_type_encoder_f T_encode_der; |
| 653 | asn_struct_print_f T_print; |
| 654 | asn_struct_free_f T_free; |
| 655 | |
| 656 | /*** <<< CODE [T] >>> ***/ |
| 657 | |
| 658 | int |
| 659 | T_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 660 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 661 | |
| 662 | /* Make the underlying type checker permanent */ |
| 663 | td->check_constraints = asn1_DEF_Ts.check_constraints; |
| 664 | return td->check_constraints |
| 665 | (td, sptr, app_errlog, app_key); |
| 666 | } |
| 667 | |
| 668 | /* |
| 669 | * This type is implemented using Ts, |
| 670 | * so adjust the DEF appropriately. |
| 671 | */ |
| 672 | static void |
| 673 | T_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 674 | td->ber_decoder = asn1_DEF_Ts.ber_decoder; |
| 675 | td->der_encoder = asn1_DEF_Ts.der_encoder; |
| 676 | td->free_struct = asn1_DEF_Ts.free_struct; |
| 677 | td->print_struct = asn1_DEF_Ts.print_struct; |
| 678 | td->last_tag_form = asn1_DEF_Ts.last_tag_form; |
| 679 | td->elements = asn1_DEF_Ts.elements; |
| 680 | td->elements_count = asn1_DEF_Ts.elements_count; |
| 681 | td->specifics = asn1_DEF_Ts.specifics; |
| 682 | } |
| 683 | |
| 684 | ber_dec_rval_t |
| 685 | T_decode_ber(asn1_TYPE_descriptor_t *td, |
| 686 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 687 | T_inherit_TYPE_descriptor(td); |
| 688 | return td->ber_decoder(td, structure, bufptr, size, tag_mode); |
| 689 | } |
| 690 | |
| 691 | der_enc_rval_t |
| 692 | T_encode_der(asn1_TYPE_descriptor_t *td, |
| 693 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 694 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 695 | T_inherit_TYPE_descriptor(td); |
| 696 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 697 | } |
| 698 | |
| 699 | int |
| 700 | T_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 701 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 702 | T_inherit_TYPE_descriptor(td); |
| 703 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 704 | } |
| 705 | |
| 706 | void |
| 707 | T_free(asn1_TYPE_descriptor_t *td, |
| 708 | void *struct_ptr, int contents_only) { |
| 709 | T_inherit_TYPE_descriptor(td); |
| 710 | td->free_struct(td, struct_ptr, contents_only); |
| 711 | } |
| 712 | |
| 713 | |
| 714 | /*** <<< STAT-DEFS [T] >>> ***/ |
| 715 | |
| 716 | static ber_tlv_tag_t asn1_DEF_T_tags[] = { |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 717 | (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 718 | (ASN_TAG_CLASS_CONTEXT | (123 << 2)), |
| 719 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 720 | }; |
| 721 | asn1_TYPE_descriptor_t asn1_DEF_T = { |
| 722 | "T", |
| 723 | T_constraint, |
| 724 | T_decode_ber, |
| 725 | T_encode_der, |
| 726 | T_print, |
| 727 | T_free, |
| 728 | 0, /* Use generic outmost tag fetcher */ |
| 729 | asn1_DEF_T_tags, |
| 730 | sizeof(asn1_DEF_T_tags) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 731 | /sizeof(asn1_DEF_T_tags[0]) - 2, /* 1 */ |
| 732 | asn1_DEF_T_tags, /* Same as above */ |
| 733 | sizeof(asn1_DEF_T_tags) |
| 734 | /sizeof(asn1_DEF_T_tags[0]), /* 3 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 735 | -0, /* Unknown yet */ |
| 736 | 0, 0, /* Defined elsewhere */ |
| 737 | 0 /* No specifics */ |
| 738 | }; |
| 739 | |
| 740 | |
| 741 | /*** <<< INCLUDES [Ts] >>> ***/ |
| 742 | |
| 743 | #include <T2.h> |
| 744 | #include <T3.h> |
| 745 | #include <constr_SEQUENCE.h> |
| 746 | |
| 747 | /*** <<< DEPS [Ts] >>> ***/ |
| 748 | |
| 749 | extern asn1_TYPE_descriptor_t asn1_DEF_Ts; |
| 750 | |
| 751 | /*** <<< TYPE-DECLS [Ts] >>> ***/ |
| 752 | |
| 753 | |
| 754 | typedef struct Ts { |
| 755 | T2_t m1; |
| 756 | T3_t *m2 /* OPTIONAL */; |
| 757 | T3_t m3; |
| 758 | |
| 759 | /* Context for parsing across buffer boundaries */ |
| 760 | ber_dec_ctx_t _ber_dec_ctx; |
| 761 | } Ts_t; |
| 762 | |
| 763 | /*** <<< STAT-DEFS [Ts] >>> ***/ |
| 764 | |
| 765 | static asn1_TYPE_member_t asn1_MBR_Ts[] = { |
| 766 | { ATF_NOFLAGS, 0, offsetof(struct Ts, m1), |
| 767 | .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 768 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 769 | .type = (void *)&asn1_DEF_T2, |
| 770 | .memb_constraints = 0, /* Defer to actual type */ |
| 771 | .name = "m1" |
| 772 | }, |
| 773 | { ATF_POINTER, 1, offsetof(struct Ts, m2), |
| 774 | .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 775 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 776 | .type = (void *)&asn1_DEF_T3, |
| 777 | .memb_constraints = 0, /* Defer to actual type */ |
| 778 | .name = "m2" |
| 779 | }, |
| 780 | { ATF_NOFLAGS, 0, offsetof(struct Ts, m3), |
| 781 | .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), |
| 782 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 783 | .type = (void *)&asn1_DEF_T3, |
| 784 | .memb_constraints = 0, /* Defer to actual type */ |
| 785 | .name = "m3" |
| 786 | }, |
| 787 | }; |
| 788 | static ber_tlv_tag_t asn1_DEF_Ts_tags[] = { |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 789 | (ASN_TAG_CLASS_CONTEXT | (123 << 2)), |
| 790 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 791 | }; |
| 792 | static asn1_TYPE_tag2member_t asn1_DEF_Ts_tag2el[] = { |
| 793 | { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* m1 at 24 */ |
| 794 | { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* m2 at 25 */ |
| 795 | { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 }, /* m3 at 27 */ |
| 796 | }; |
| 797 | static asn1_SEQUENCE_specifics_t asn1_DEF_Ts_specs = { |
| 798 | sizeof(struct Ts), |
| 799 | offsetof(struct Ts, _ber_dec_ctx), |
| 800 | asn1_DEF_Ts_tag2el, |
| 801 | 3, /* Count of tags in the map */ |
| 802 | -1, /* Start extensions */ |
| 803 | -1 /* Stop extensions */ |
| 804 | }; |
| 805 | asn1_TYPE_descriptor_t asn1_DEF_Ts = { |
| 806 | "Ts", |
| 807 | SEQUENCE_constraint, |
| 808 | SEQUENCE_decode_ber, |
| 809 | SEQUENCE_encode_der, |
| 810 | SEQUENCE_print, |
| 811 | SEQUENCE_free, |
| 812 | 0, /* Use generic outmost tag fetcher */ |
| 813 | asn1_DEF_Ts_tags, |
| 814 | sizeof(asn1_DEF_Ts_tags) |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 815 | /sizeof(asn1_DEF_Ts_tags[0]) - 1, /* 1 */ |
| 816 | asn1_DEF_Ts_tags, /* Same as above */ |
| 817 | sizeof(asn1_DEF_Ts_tags) |
| 818 | /sizeof(asn1_DEF_Ts_tags[0]), /* 2 */ |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 819 | 1, /* Whether CONSTRUCTED */ |
| 820 | asn1_MBR_Ts, |
| 821 | 3, /* Elements count */ |
| 822 | &asn1_DEF_Ts_specs /* Additional specs */ |
| 823 | }; |
| 824 | |