Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 1 | |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 2 | /*** <<< INCLUDES [T] >>> ***/ |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 3 | |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 4 | #include <NULL.h> |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 5 | #include <constr_CHOICE.h> |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 6 | #include <constr_SEQUENCE.h> |
| 7 | |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 8 | /*** <<< DEPS [T] >>> ***/ |
| 9 | |
| 10 | typedef enum b_PR { |
| 11 | b_PR_NOTHING, /* No components present */ |
| 12 | b_PR_c, |
| 13 | b_PR_d, |
| 14 | b_PR_e, |
| 15 | b_PR_h, |
| 16 | } b_PR_e; |
| 17 | typedef enum e_PR { |
| 18 | e_PR_NOTHING, /* No components present */ |
| 19 | e_PR_f, |
| 20 | e_PR_g, |
| 21 | } e_PR_e; |
| 22 | typedef enum h_PR { |
| 23 | h_PR_NOTHING, /* No components present */ |
| 24 | h_PR_i, |
| 25 | h_PR_j, |
| 26 | } h_PR_e; |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 27 | extern asn1_TYPE_descriptor_t asn1_DEF_T; |
| 28 | |
| 29 | /*** <<< TYPE-DECLS [T] >>> ***/ |
| 30 | |
| 31 | |
| 32 | typedef struct T { |
| 33 | NULL_t a; |
| 34 | struct b { |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 35 | b_PR_e present; |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 36 | union { |
| 37 | NULL_t c; |
| 38 | NULL_t d; |
| 39 | struct e { |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 40 | e_PR_e present; |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 41 | union { |
| 42 | NULL_t f; |
| 43 | NULL_t g; |
| 44 | } choice; |
| 45 | |
| 46 | /* Context for parsing across buffer boundaries */ |
| 47 | ber_dec_ctx_t _ber_dec_ctx; |
| 48 | } e; |
| 49 | struct h { |
Lev Walkin | b47ddce | 2004-08-11 05:25:47 +0000 | [diff] [blame^] | 50 | h_PR_e present; |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 51 | union { |
| 52 | NULL_t i; |
| 53 | NULL_t j; |
| 54 | } choice; |
| 55 | |
| 56 | /* Context for parsing across buffer boundaries */ |
| 57 | ber_dec_ctx_t _ber_dec_ctx; |
| 58 | } h; |
| 59 | } choice; |
| 60 | |
| 61 | /* Context for parsing across buffer boundaries */ |
| 62 | ber_dec_ctx_t _ber_dec_ctx; |
| 63 | } b; |
| 64 | |
| 65 | /* Context for parsing across buffer boundaries */ |
| 66 | ber_dec_ctx_t _ber_dec_ctx; |
| 67 | } T_t; |
| 68 | |
| 69 | /*** <<< STAT-DEFS [T] >>> ***/ |
| 70 | |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 71 | static asn1_CHOICE_element_t asn1_DEF_e_elements[] = { |
| 72 | { offsetof(struct e, choice.f), 0, |
| 73 | (ASN_TAG_CLASS_PRIVATE | (7 << 2)), |
| 74 | -1, /* IMPLICIT tag at current level */ |
| 75 | (void *)&asn1_DEF_NULL, |
| 76 | "f" |
| 77 | }, |
| 78 | { offsetof(struct e, choice.g), 0, |
| 79 | (ASN_TAG_CLASS_PRIVATE | (8 << 2)), |
| 80 | -1, /* IMPLICIT tag at current level */ |
| 81 | (void *)&asn1_DEF_NULL, |
| 82 | "g" |
| 83 | }, |
| 84 | }; |
| 85 | static ber_tlv_tag_t asn1_DEF_e_tags[] = { |
| 86 | }; |
| 87 | static asn1_TYPE_tag2member_t asn1_DEF_e_tag2el[] = { |
| 88 | { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 0, 0, 0 }, /* f at 20 */ |
| 89 | { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */ |
| 90 | }; |
| 91 | static asn1_CHOICE_specifics_t asn1_DEF_e_specs = { |
| 92 | sizeof(struct e), |
| 93 | offsetof(struct e, _ber_dec_ctx), |
| 94 | offsetof(struct e, present), |
| 95 | sizeof(((struct e *)0)->present), |
| 96 | asn1_DEF_e_elements, |
| 97 | 2, /* Elements count */ |
| 98 | asn1_DEF_e_tag2el, |
| 99 | 2, /* Count of tags in the map */ |
| 100 | 0 /* Whether extensible */ |
| 101 | }; |
| 102 | asn1_TYPE_descriptor_t asn1_DEF_e = { |
| 103 | "e", |
| 104 | CHOICE_constraint, |
| 105 | CHOICE_decode_ber, |
| 106 | CHOICE_encode_der, |
| 107 | CHOICE_print, |
| 108 | CHOICE_free, |
| 109 | CHOICE_outmost_tag, |
| 110 | asn1_DEF_e_tags, |
| 111 | sizeof(asn1_DEF_e_tags) |
| 112 | /sizeof(asn1_DEF_e_tags[0]), |
| 113 | 0, /* Tags to skip */ |
| 114 | 1, /* Whether CONSTRUCTED */ |
| 115 | &asn1_DEF_e_specs /* Additional specs */ |
| 116 | }; |
| 117 | |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 118 | static asn1_CHOICE_element_t asn1_DEF_h_elements[] = { |
| 119 | { offsetof(struct h, choice.i), 0, |
| 120 | (ASN_TAG_CLASS_PRIVATE | (1 << 2)), |
| 121 | -1, /* IMPLICIT tag at current level */ |
| 122 | (void *)&asn1_DEF_NULL, |
| 123 | "i" |
| 124 | }, |
| 125 | { offsetof(struct h, choice.j), 0, |
| 126 | (ASN_TAG_CLASS_PRIVATE | (2 << 2)), |
| 127 | -1, /* IMPLICIT tag at current level */ |
| 128 | (void *)&asn1_DEF_NULL, |
| 129 | "j" |
| 130 | }, |
| 131 | }; |
| 132 | static ber_tlv_tag_t asn1_DEF_h_tags[] = { |
| 133 | }; |
| 134 | static asn1_TYPE_tag2member_t asn1_DEF_h_tag2el[] = { |
| 135 | { (ASN_TAG_CLASS_PRIVATE | (1 << 2)), 0, 0, 0 }, /* i at 24 */ |
| 136 | { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 1, 0, 0 }, /* j at 25 */ |
| 137 | }; |
| 138 | static asn1_CHOICE_specifics_t asn1_DEF_h_specs = { |
| 139 | sizeof(struct h), |
| 140 | offsetof(struct h, _ber_dec_ctx), |
| 141 | offsetof(struct h, present), |
| 142 | sizeof(((struct h *)0)->present), |
| 143 | asn1_DEF_h_elements, |
| 144 | 2, /* Elements count */ |
| 145 | asn1_DEF_h_tag2el, |
| 146 | 2, /* Count of tags in the map */ |
| 147 | 0 /* Whether extensible */ |
| 148 | }; |
| 149 | asn1_TYPE_descriptor_t asn1_DEF_h = { |
| 150 | "h", |
| 151 | CHOICE_constraint, |
| 152 | CHOICE_decode_ber, |
| 153 | CHOICE_encode_der, |
| 154 | CHOICE_print, |
| 155 | CHOICE_free, |
| 156 | CHOICE_outmost_tag, |
| 157 | asn1_DEF_h_tags, |
| 158 | sizeof(asn1_DEF_h_tags) |
| 159 | /sizeof(asn1_DEF_h_tags[0]), |
| 160 | 0, /* Tags to skip */ |
| 161 | 1, /* Whether CONSTRUCTED */ |
| 162 | &asn1_DEF_h_specs /* Additional specs */ |
| 163 | }; |
| 164 | |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 165 | static asn1_CHOICE_element_t asn1_DEF_b_elements[] = { |
| 166 | { offsetof(struct b, choice.c), 0, |
| 167 | (ASN_TAG_CLASS_PRIVATE | (5 << 2)), |
| 168 | -1, /* IMPLICIT tag at current level */ |
| 169 | (void *)&asn1_DEF_NULL, |
| 170 | "c" |
| 171 | }, |
| 172 | { offsetof(struct b, choice.d), 0, |
| 173 | (ASN_TAG_CLASS_PRIVATE | (6 << 2)), |
| 174 | -1, /* IMPLICIT tag at current level */ |
| 175 | (void *)&asn1_DEF_NULL, |
| 176 | "d" |
| 177 | }, |
| 178 | { offsetof(struct b, choice.e), 0, |
| 179 | -1 /* Ambiguous tag (CHOICE?) */, |
| 180 | 0, |
| 181 | (void *)&asn1_DEF_e, |
| 182 | "e" |
| 183 | }, |
| 184 | { offsetof(struct b, choice.h), 0, |
| 185 | (ASN_TAG_CLASS_PRIVATE | (9 << 2)), |
| 186 | +1, /* EXPLICIT tag at current level */ |
| 187 | (void *)&asn1_DEF_h, |
| 188 | "h" |
| 189 | }, |
| 190 | }; |
| 191 | static ber_tlv_tag_t asn1_DEF_b_tags[] = { |
| 192 | }; |
| 193 | static asn1_TYPE_tag2member_t asn1_DEF_b_tag2el[] = { |
| 194 | { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 0, 0, 0 }, /* c at 17 */ |
| 195 | { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */ |
| 196 | { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 2, 0, 0 }, /* f at 20 */ |
| 197 | { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 2, 0, 0 }, /* g at 21 */ |
| 198 | { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 3, 0, 0 }, /* h at 24 */ |
| 199 | }; |
| 200 | static asn1_CHOICE_specifics_t asn1_DEF_b_specs = { |
| 201 | sizeof(struct b), |
| 202 | offsetof(struct b, _ber_dec_ctx), |
| 203 | offsetof(struct b, present), |
| 204 | sizeof(((struct b *)0)->present), |
| 205 | asn1_DEF_b_elements, |
| 206 | 4, /* Elements count */ |
| 207 | asn1_DEF_b_tag2el, |
| 208 | 5, /* Count of tags in the map */ |
| 209 | 0 /* Whether extensible */ |
| 210 | }; |
| 211 | asn1_TYPE_descriptor_t asn1_DEF_b = { |
| 212 | "b", |
| 213 | CHOICE_constraint, |
| 214 | CHOICE_decode_ber, |
| 215 | CHOICE_encode_der, |
| 216 | CHOICE_print, |
| 217 | CHOICE_free, |
| 218 | CHOICE_outmost_tag, |
| 219 | asn1_DEF_b_tags, |
| 220 | sizeof(asn1_DEF_b_tags) |
| 221 | /sizeof(asn1_DEF_b_tags[0]), |
| 222 | 0, /* Tags to skip */ |
| 223 | 1, /* Whether CONSTRUCTED */ |
| 224 | &asn1_DEF_b_specs /* Additional specs */ |
| 225 | }; |
| 226 | |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 227 | static asn1_SEQUENCE_element_t asn1_DEF_T_elements[] = { |
| 228 | { offsetof(struct T, a), 0, |
| 229 | (ASN_TAG_CLASS_PRIVATE | (2 << 2)), |
| 230 | -1, /* IMPLICIT tag at current level */ |
| 231 | (void *)&asn1_DEF_NULL, |
| 232 | "a" |
| 233 | }, |
| 234 | { offsetof(struct T, b), 0, |
| 235 | -1 /* Ambiguous tag (CHOICE?) */, |
| 236 | 0, |
| 237 | (void *)&asn1_DEF_b, |
| 238 | "b" |
| 239 | }, |
| 240 | }; |
| 241 | static ber_tlv_tag_t asn1_DEF_T_tags[] = { |
| 242 | (ASN_TAG_CLASS_PRIVATE | (1 << 2)) |
| 243 | }; |
| 244 | static asn1_TYPE_tag2member_t asn1_DEF_T_tag2el[] = { |
| 245 | { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 0, 0, 0 }, /* a at 15 */ |
| 246 | { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 1, 0, 0 }, /* c at 17 */ |
| 247 | { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */ |
| 248 | { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 1, 0, 0 }, /* f at 20 */ |
| 249 | { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */ |
| 250 | { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 1, 0, 0 }, /* h at 24 */ |
| 251 | }; |
| 252 | static asn1_SEQUENCE_specifics_t asn1_DEF_T_specs = { |
| 253 | sizeof(struct T), |
| 254 | offsetof(struct T, _ber_dec_ctx), |
| 255 | asn1_DEF_T_elements, |
| 256 | 2, /* Elements count */ |
| 257 | asn1_DEF_T_tag2el, |
| 258 | 6, /* Count of tags in the map */ |
| 259 | -1, /* Start extensions */ |
| 260 | -1 /* Stop extensions */ |
| 261 | }; |
| 262 | asn1_TYPE_descriptor_t asn1_DEF_T = { |
| 263 | "T", |
| 264 | SEQUENCE_constraint, |
| 265 | SEQUENCE_decode_ber, |
| 266 | SEQUENCE_encode_der, |
| 267 | SEQUENCE_print, |
| 268 | SEQUENCE_free, |
| 269 | 0, /* Use generic outmost tag fetcher */ |
| 270 | asn1_DEF_T_tags, |
| 271 | sizeof(asn1_DEF_T_tags) |
| 272 | /sizeof(asn1_DEF_T_tags[0]), |
| 273 | 1, /* Tags to skip */ |
| 274 | 1, /* Whether CONSTRUCTED */ |
| 275 | &asn1_DEF_T_specs /* Additional specs */ |
| 276 | }; |
| 277 | |