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 | |
Lev Walkin | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 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; |
| 17 | typedef enum e_PR { |
| 18 | e_PR_NOTHING, /* No components present */ |
| 19 | e_PR_f, |
| 20 | e_PR_g, |
| 21 | } e_PR; |
| 22 | typedef enum h_PR { |
| 23 | h_PR_NOTHING, /* No components present */ |
| 24 | h_PR_i, |
| 25 | h_PR_j, |
| 26 | } h_PR; |
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 | 6439972 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 35 | b_PR 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 | 6439972 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 40 | e_PR 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 | 6439972 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 50 | h_PR 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 | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 71 | static asn1_TYPE_member_t asn1_MBR_e[] = { |
| 72 | { 0, offsetof(struct e, choice.f), |
| 73 | .tag = (ASN_TAG_CLASS_PRIVATE | (7 << 2)), |
| 74 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 75 | .type = (void *)&asn1_DEF_NULL, |
| 76 | .memb_constraints = 0, /* Defer to actual type */ |
| 77 | .name = "f" |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 78 | }, |
Lev Walkin | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 79 | { 0, offsetof(struct e, choice.g), |
| 80 | .tag = (ASN_TAG_CLASS_PRIVATE | (8 << 2)), |
| 81 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 82 | .type = (void *)&asn1_DEF_NULL, |
| 83 | .memb_constraints = 0, /* Defer to actual type */ |
| 84 | .name = "g" |
| 85 | }, |
| 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_tag2el, |
| 97 | 2, /* Count of tags in the map */ |
| 98 | 0 /* Whether extensible */ |
| 99 | }; |
| 100 | asn1_TYPE_descriptor_t asn1_DEF_e = { |
| 101 | "e", |
| 102 | CHOICE_constraint, |
| 103 | CHOICE_decode_ber, |
| 104 | CHOICE_encode_der, |
| 105 | CHOICE_print, |
| 106 | CHOICE_free, |
| 107 | CHOICE_outmost_tag, |
| 108 | 0, /* No explicit tags (pointer) */ |
| 109 | 0, /* No explicit tags (count) */ |
| 110 | 0, /* Tags to skip */ |
| 111 | 1, /* Whether CONSTRUCTED */ |
| 112 | asn1_MBR_e, |
| 113 | 2, /* Elements count */ |
| 114 | &asn1_DEF_e_specs /* Additional specs */ |
| 115 | }; |
| 116 | |
| 117 | static asn1_TYPE_member_t asn1_MBR_h[] = { |
| 118 | { 0, offsetof(struct h, choice.i), |
| 119 | .tag = (ASN_TAG_CLASS_PRIVATE | (1 << 2)), |
| 120 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 121 | .type = (void *)&asn1_DEF_NULL, |
| 122 | .memb_constraints = 0, /* Defer to actual type */ |
| 123 | .name = "i" |
| 124 | }, |
| 125 | { 0, offsetof(struct h, choice.j), |
| 126 | .tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)), |
| 127 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 128 | .type = (void *)&asn1_DEF_NULL, |
| 129 | .memb_constraints = 0, /* Defer to actual type */ |
| 130 | .name = "j" |
| 131 | }, |
| 132 | }; |
| 133 | static asn1_TYPE_tag2member_t asn1_DEF_h_tag2el[] = { |
| 134 | { (ASN_TAG_CLASS_PRIVATE | (1 << 2)), 0, 0, 0 }, /* i at 24 */ |
| 135 | { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 1, 0, 0 }, /* j at 25 */ |
| 136 | }; |
| 137 | static asn1_CHOICE_specifics_t asn1_DEF_h_specs = { |
| 138 | sizeof(struct h), |
| 139 | offsetof(struct h, _ber_dec_ctx), |
| 140 | offsetof(struct h, present), |
| 141 | sizeof(((struct h *)0)->present), |
| 142 | asn1_DEF_h_tag2el, |
| 143 | 2, /* Count of tags in the map */ |
| 144 | 0 /* Whether extensible */ |
| 145 | }; |
| 146 | asn1_TYPE_descriptor_t asn1_DEF_h = { |
| 147 | "h", |
| 148 | CHOICE_constraint, |
| 149 | CHOICE_decode_ber, |
| 150 | CHOICE_encode_der, |
| 151 | CHOICE_print, |
| 152 | CHOICE_free, |
| 153 | CHOICE_outmost_tag, |
| 154 | 0, /* No explicit tags (pointer) */ |
| 155 | 0, /* No explicit tags (count) */ |
| 156 | 0, /* Tags to skip */ |
| 157 | 1, /* Whether CONSTRUCTED */ |
| 158 | asn1_MBR_h, |
| 159 | 2, /* Elements count */ |
| 160 | &asn1_DEF_h_specs /* Additional specs */ |
| 161 | }; |
| 162 | |
| 163 | static asn1_TYPE_member_t asn1_MBR_b[] = { |
| 164 | { 0, offsetof(struct b, choice.c), |
| 165 | .tag = (ASN_TAG_CLASS_PRIVATE | (5 << 2)), |
| 166 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 167 | .type = (void *)&asn1_DEF_NULL, |
| 168 | .memb_constraints = 0, /* Defer to actual type */ |
| 169 | .name = "c" |
| 170 | }, |
| 171 | { 0, offsetof(struct b, choice.d), |
| 172 | .tag = (ASN_TAG_CLASS_PRIVATE | (6 << 2)), |
| 173 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 174 | .type = (void *)&asn1_DEF_NULL, |
| 175 | .memb_constraints = 0, /* Defer to actual type */ |
| 176 | .name = "d" |
| 177 | }, |
| 178 | { 0, offsetof(struct b, choice.e), |
Lev Walkin | 0f2848f | 2004-09-04 04:54:42 +0000 | [diff] [blame] | 179 | .tag = -1 /* Ambiguous tag (CHOICE|ANY?) */, |
Lev Walkin | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 180 | .tag_mode = 0, |
| 181 | .type = (void *)&asn1_DEF_e, |
| 182 | .memb_constraints = 0, /* Defer to actual type */ |
| 183 | .name = "e" |
| 184 | }, |
| 185 | { 0, offsetof(struct b, choice.h), |
| 186 | .tag = (ASN_TAG_CLASS_PRIVATE | (9 << 2)), |
| 187 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 188 | .type = (void *)&asn1_DEF_h, |
| 189 | .memb_constraints = 0, /* Defer to actual type */ |
| 190 | .name = "h" |
| 191 | }, |
| 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_tag2el, |
| 206 | 5, /* Count of tags in the map */ |
| 207 | 0 /* Whether extensible */ |
| 208 | }; |
| 209 | asn1_TYPE_descriptor_t asn1_DEF_b = { |
| 210 | "b", |
| 211 | CHOICE_constraint, |
| 212 | CHOICE_decode_ber, |
| 213 | CHOICE_encode_der, |
| 214 | CHOICE_print, |
| 215 | CHOICE_free, |
| 216 | CHOICE_outmost_tag, |
| 217 | 0, /* No explicit tags (pointer) */ |
| 218 | 0, /* No explicit tags (count) */ |
| 219 | 0, /* Tags to skip */ |
| 220 | 1, /* Whether CONSTRUCTED */ |
| 221 | asn1_MBR_b, |
| 222 | 4, /* Elements count */ |
| 223 | &asn1_DEF_b_specs /* Additional specs */ |
| 224 | }; |
| 225 | |
| 226 | static asn1_TYPE_member_t asn1_MBR_T[] = { |
| 227 | { 0, offsetof(struct T, a), |
| 228 | .tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)), |
| 229 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 230 | .type = (void *)&asn1_DEF_NULL, |
| 231 | .memb_constraints = 0, /* Defer to actual type */ |
| 232 | .name = "a" |
| 233 | }, |
| 234 | { 0, offsetof(struct T, b), |
Lev Walkin | 0f2848f | 2004-09-04 04:54:42 +0000 | [diff] [blame] | 235 | .tag = -1 /* Ambiguous tag (CHOICE|ANY?) */, |
Lev Walkin | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 236 | .tag_mode = 0, |
| 237 | .type = (void *)&asn1_DEF_b, |
| 238 | .memb_constraints = 0, /* Defer to actual type */ |
| 239 | .name = "b" |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 240 | }, |
| 241 | }; |
| 242 | static ber_tlv_tag_t asn1_DEF_T_tags[] = { |
| 243 | (ASN_TAG_CLASS_PRIVATE | (1 << 2)) |
| 244 | }; |
| 245 | static asn1_TYPE_tag2member_t asn1_DEF_T_tag2el[] = { |
| 246 | { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 0, 0, 0 }, /* a at 15 */ |
| 247 | { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 1, 0, 0 }, /* c at 17 */ |
| 248 | { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d at 18 */ |
| 249 | { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 1, 0, 0 }, /* f at 20 */ |
| 250 | { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g at 21 */ |
| 251 | { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 1, 0, 0 }, /* h at 24 */ |
| 252 | }; |
| 253 | static asn1_SEQUENCE_specifics_t asn1_DEF_T_specs = { |
| 254 | sizeof(struct T), |
| 255 | offsetof(struct T, _ber_dec_ctx), |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 256 | asn1_DEF_T_tag2el, |
| 257 | 6, /* Count of tags in the map */ |
| 258 | -1, /* Start extensions */ |
| 259 | -1 /* Stop extensions */ |
| 260 | }; |
| 261 | asn1_TYPE_descriptor_t asn1_DEF_T = { |
| 262 | "T", |
| 263 | SEQUENCE_constraint, |
| 264 | SEQUENCE_decode_ber, |
| 265 | SEQUENCE_encode_der, |
| 266 | SEQUENCE_print, |
| 267 | SEQUENCE_free, |
| 268 | 0, /* Use generic outmost tag fetcher */ |
| 269 | asn1_DEF_T_tags, |
| 270 | sizeof(asn1_DEF_T_tags) |
Lev Walkin | 6439972 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 271 | /sizeof(asn1_DEF_T_tags[0]), /* 1 */ |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 272 | 1, /* Tags to skip */ |
| 273 | 1, /* Whether CONSTRUCTED */ |
Lev Walkin | 2e3055d | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 274 | asn1_MBR_T, |
| 275 | 2, /* Elements count */ |
Lev Walkin | 5bbff1e | 2004-06-28 21:13:22 +0000 | [diff] [blame] | 276 | &asn1_DEF_T_specs /* Additional specs */ |
| 277 | }; |
| 278 | |