vlm | 060fe2a | 2004-09-10 09:37:12 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [T1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | #include <ANY.h> |
| 6 | #include <constr_SEQUENCE.h> |
| 7 | |
| 8 | /*** <<< DEPS [T1] >>> ***/ |
| 9 | |
| 10 | extern asn1_TYPE_descriptor_t asn1_DEF_T1; |
| 11 | |
| 12 | /*** <<< TYPE-DECLS [T1] >>> ***/ |
| 13 | |
| 14 | |
| 15 | typedef struct T1 { |
| 16 | INTEGER_t i; |
| 17 | ANY_t any; |
| 18 | |
| 19 | /* Context for parsing across buffer boundaries */ |
| 20 | ber_dec_ctx_t _ber_dec_ctx; |
| 21 | } T1_t; |
| 22 | |
| 23 | /*** <<< STAT-DEFS [T1] >>> ***/ |
| 24 | |
| 25 | static asn1_TYPE_member_t asn1_MBR_T1[] = { |
| 26 | { ATF_NOFLAGS, 0, offsetof(struct T1, i), |
| 27 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 28 | .tag_mode = 0, |
| 29 | .type = (void *)&asn1_DEF_INTEGER, |
| 30 | .memb_constraints = 0, /* Defer to actual type */ |
| 31 | .name = "i" |
| 32 | }, |
| 33 | { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct T1, any), |
| 34 | .tag = -1 /* Ambiguous tag (ANY?) */, |
| 35 | .tag_mode = 0, |
| 36 | .type = (void *)&asn1_DEF_ANY, |
| 37 | .memb_constraints = 0, /* Defer to actual type */ |
| 38 | .name = "any" |
| 39 | }, |
| 40 | }; |
| 41 | static ber_tlv_tag_t asn1_DEF_T1_tags[] = { |
| 42 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 43 | }; |
| 44 | static asn1_TYPE_tag2member_t asn1_DEF_T1_tag2el[] = { |
| 45 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 15 */ |
| 46 | }; |
| 47 | static asn1_SEQUENCE_specifics_t asn1_DEF_T1_specs = { |
| 48 | sizeof(struct T1), |
| 49 | offsetof(struct T1, _ber_dec_ctx), |
| 50 | asn1_DEF_T1_tag2el, |
| 51 | 1, /* Count of tags in the map */ |
| 52 | -1, /* Start extensions */ |
| 53 | -1 /* Stop extensions */ |
| 54 | }; |
| 55 | asn1_TYPE_descriptor_t asn1_DEF_T1 = { |
| 56 | "T1", |
| 57 | SEQUENCE_constraint, |
| 58 | SEQUENCE_decode_ber, |
| 59 | SEQUENCE_encode_der, |
| 60 | SEQUENCE_print, |
| 61 | SEQUENCE_free, |
| 62 | 0, /* Use generic outmost tag fetcher */ |
| 63 | asn1_DEF_T1_tags, |
| 64 | sizeof(asn1_DEF_T1_tags) |
| 65 | /sizeof(asn1_DEF_T1_tags[0]), /* 1 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 66 | asn1_DEF_T1_tags, /* Same as above */ |
| 67 | sizeof(asn1_DEF_T1_tags) |
| 68 | /sizeof(asn1_DEF_T1_tags[0]), /* 1 */ |
vlm | 060fe2a | 2004-09-10 09:37:12 +0000 | [diff] [blame] | 69 | 1, /* Whether CONSTRUCTED */ |
| 70 | asn1_MBR_T1, |
| 71 | 2, /* Elements count */ |
| 72 | &asn1_DEF_T1_specs /* Additional specs */ |
| 73 | }; |
| 74 | |
| 75 | |
| 76 | /*** <<< INCLUDES [T2] >>> ***/ |
| 77 | |
| 78 | #include <INTEGER.h> |
| 79 | #include <ANY.h> |
| 80 | #include <constr_SEQUENCE.h> |
| 81 | |
| 82 | /*** <<< DEPS [T2] >>> ***/ |
| 83 | |
| 84 | extern asn1_TYPE_descriptor_t asn1_DEF_T2; |
| 85 | |
| 86 | /*** <<< TYPE-DECLS [T2] >>> ***/ |
| 87 | |
| 88 | |
| 89 | typedef struct T2 { |
| 90 | INTEGER_t i; |
| 91 | ANY_t *any /* OPTIONAL */; |
| 92 | |
| 93 | /* Context for parsing across buffer boundaries */ |
| 94 | ber_dec_ctx_t _ber_dec_ctx; |
| 95 | } T2_t; |
| 96 | |
| 97 | /*** <<< STAT-DEFS [T2] >>> ***/ |
| 98 | |
| 99 | static asn1_TYPE_member_t asn1_MBR_T2[] = { |
| 100 | { ATF_NOFLAGS, 0, offsetof(struct T2, i), |
| 101 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 102 | .tag_mode = 0, |
| 103 | .type = (void *)&asn1_DEF_INTEGER, |
| 104 | .memb_constraints = 0, /* Defer to actual type */ |
| 105 | .name = "i" |
| 106 | }, |
| 107 | { ATF_POINTER, 1, offsetof(struct T2, any), |
| 108 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 109 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 110 | .type = (void *)&asn1_DEF_ANY, |
| 111 | .memb_constraints = 0, /* Defer to actual type */ |
| 112 | .name = "any" |
| 113 | }, |
| 114 | }; |
| 115 | static ber_tlv_tag_t asn1_DEF_T2_tags[] = { |
| 116 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 117 | }; |
| 118 | static asn1_TYPE_tag2member_t asn1_DEF_T2_tag2el[] = { |
| 119 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 20 */ |
| 120 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* any at 21 */ |
| 121 | }; |
| 122 | static asn1_SEQUENCE_specifics_t asn1_DEF_T2_specs = { |
| 123 | sizeof(struct T2), |
| 124 | offsetof(struct T2, _ber_dec_ctx), |
| 125 | asn1_DEF_T2_tag2el, |
| 126 | 2, /* Count of tags in the map */ |
| 127 | -1, /* Start extensions */ |
| 128 | -1 /* Stop extensions */ |
| 129 | }; |
| 130 | asn1_TYPE_descriptor_t asn1_DEF_T2 = { |
| 131 | "T2", |
| 132 | SEQUENCE_constraint, |
| 133 | SEQUENCE_decode_ber, |
| 134 | SEQUENCE_encode_der, |
| 135 | SEQUENCE_print, |
| 136 | SEQUENCE_free, |
| 137 | 0, /* Use generic outmost tag fetcher */ |
| 138 | asn1_DEF_T2_tags, |
| 139 | sizeof(asn1_DEF_T2_tags) |
| 140 | /sizeof(asn1_DEF_T2_tags[0]), /* 1 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 141 | asn1_DEF_T2_tags, /* Same as above */ |
| 142 | sizeof(asn1_DEF_T2_tags) |
| 143 | /sizeof(asn1_DEF_T2_tags[0]), /* 1 */ |
vlm | 060fe2a | 2004-09-10 09:37:12 +0000 | [diff] [blame] | 144 | 1, /* Whether CONSTRUCTED */ |
| 145 | asn1_MBR_T2, |
| 146 | 2, /* Elements count */ |
| 147 | &asn1_DEF_T2_specs /* Additional specs */ |
| 148 | }; |
| 149 | |