Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Forest] >>> ***/ |
| 3 | |
| 4 | #include <Tree.h> |
| 5 | #include <asn_SET_OF.h> |
| 6 | #include <constr_SET_OF.h> |
| 7 | |
| 8 | /*** <<< DEPS [Forest] >>> ***/ |
| 9 | |
| 10 | extern asn1_TYPE_descriptor_t asn1_DEF_Forest; |
| 11 | |
| 12 | /*** <<< TYPE-DECLS [Forest] >>> ***/ |
| 13 | |
| 14 | |
| 15 | typedef struct Forest { |
| 16 | A_SET_OF(struct Tree) list; |
| 17 | |
| 18 | /* Context for parsing across buffer boundaries */ |
| 19 | ber_dec_ctx_t _ber_dec_ctx; |
| 20 | } Forest_t; |
| 21 | |
| 22 | /*** <<< STAT-DEFS [Forest] >>> ***/ |
| 23 | |
| 24 | static asn1_TYPE_member_t asn1_MBR_Forest[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 25 | { ATF_NOFLAGS, 0, 0, |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 26 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 27 | .tag_mode = 0, |
| 28 | .type = (void *)&asn1_DEF_Tree, |
| 29 | .memb_constraints = 0, /* Defer to actual type */ |
| 30 | .name = "" |
| 31 | }, |
| 32 | }; |
| 33 | static ber_tlv_tag_t asn1_DEF_Forest_tags[] = { |
| 34 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 35 | }; |
| 36 | static asn1_SET_OF_specifics_t asn1_DEF_Forest_specs = { |
| 37 | sizeof(struct Forest), |
| 38 | offsetof(struct Forest, _ber_dec_ctx), |
| 39 | }; |
| 40 | asn1_TYPE_descriptor_t asn1_DEF_Forest = { |
| 41 | "Forest", |
| 42 | SET_OF_constraint, |
| 43 | SET_OF_decode_ber, |
| 44 | SET_OF_encode_der, |
| 45 | SET_OF_print, |
| 46 | SET_OF_free, |
| 47 | 0, /* Use generic outmost tag fetcher */ |
| 48 | asn1_DEF_Forest_tags, |
| 49 | sizeof(asn1_DEF_Forest_tags) |
| 50 | /sizeof(asn1_DEF_Forest_tags[0]), /* 1 */ |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 51 | asn1_DEF_Forest_tags, /* Same as above */ |
| 52 | sizeof(asn1_DEF_Forest_tags) |
| 53 | /sizeof(asn1_DEF_Forest_tags[0]), /* 1 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 54 | 1, /* Whether CONSTRUCTED */ |
| 55 | asn1_MBR_Forest, |
| 56 | 1, /* Single element */ |
| 57 | &asn1_DEF_Forest_specs /* Additional specs */ |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | /*** <<< INCLUDES [Tree] >>> ***/ |
| 62 | |
| 63 | #include <INTEGER.h> |
| 64 | #include <constr_SEQUENCE.h> |
| 65 | |
| 66 | /*** <<< DEPS [Tree] >>> ***/ |
| 67 | |
| 68 | extern asn1_TYPE_descriptor_t asn1_DEF_Tree; |
| 69 | |
| 70 | /*** <<< TYPE-DECLS [Tree] >>> ***/ |
| 71 | |
| 72 | |
| 73 | typedef struct Tree { |
| 74 | INTEGER_t height; |
| 75 | INTEGER_t width; |
| 76 | |
| 77 | /* Context for parsing across buffer boundaries */ |
| 78 | ber_dec_ctx_t _ber_dec_ctx; |
| 79 | } Tree_t; |
| 80 | |
| 81 | /*** <<< STAT-DEFS [Tree] >>> ***/ |
| 82 | |
| 83 | static asn1_TYPE_member_t asn1_MBR_Tree[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 84 | { ATF_NOFLAGS, 0, offsetof(struct Tree, height), |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 85 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 86 | .tag_mode = 0, |
| 87 | .type = (void *)&asn1_DEF_INTEGER, |
| 88 | .memb_constraints = 0, /* Defer to actual type */ |
| 89 | .name = "height" |
| 90 | }, |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 91 | { ATF_NOFLAGS, 0, offsetof(struct Tree, width), |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 92 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 93 | .tag_mode = 0, |
| 94 | .type = (void *)&asn1_DEF_INTEGER, |
| 95 | .memb_constraints = 0, /* Defer to actual type */ |
| 96 | .name = "width" |
| 97 | }, |
| 98 | }; |
| 99 | static ber_tlv_tag_t asn1_DEF_Tree_tags[] = { |
| 100 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 101 | }; |
| 102 | static asn1_TYPE_tag2member_t asn1_DEF_Tree_tag2el[] = { |
| 103 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* height at 17 */ |
| 104 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 }, /* width at 19 */ |
| 105 | }; |
| 106 | static asn1_SEQUENCE_specifics_t asn1_DEF_Tree_specs = { |
| 107 | sizeof(struct Tree), |
| 108 | offsetof(struct Tree, _ber_dec_ctx), |
| 109 | asn1_DEF_Tree_tag2el, |
| 110 | 2, /* Count of tags in the map */ |
| 111 | -1, /* Start extensions */ |
| 112 | -1 /* Stop extensions */ |
| 113 | }; |
| 114 | asn1_TYPE_descriptor_t asn1_DEF_Tree = { |
| 115 | "Tree", |
| 116 | SEQUENCE_constraint, |
| 117 | SEQUENCE_decode_ber, |
| 118 | SEQUENCE_encode_der, |
| 119 | SEQUENCE_print, |
| 120 | SEQUENCE_free, |
| 121 | 0, /* Use generic outmost tag fetcher */ |
| 122 | asn1_DEF_Tree_tags, |
| 123 | sizeof(asn1_DEF_Tree_tags) |
| 124 | /sizeof(asn1_DEF_Tree_tags[0]), /* 1 */ |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 125 | asn1_DEF_Tree_tags, /* Same as above */ |
| 126 | sizeof(asn1_DEF_Tree_tags) |
| 127 | /sizeof(asn1_DEF_Tree_tags[0]), /* 1 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 128 | 1, /* Whether CONSTRUCTED */ |
| 129 | asn1_MBR_Tree, |
| 130 | 2, /* Elements count */ |
| 131 | &asn1_DEF_Tree_specs /* Additional specs */ |
| 132 | }; |
| 133 | |
| 134 | |
| 135 | /*** <<< INCLUDES [Stuff] >>> ***/ |
| 136 | |
| 137 | #include <Forest.h> |
| 138 | #include <asn_SET_OF.h> |
| 139 | #include <constr_SET_OF.h> |
| 140 | #include <BIT_STRING.h> |
| 141 | #include <constr_SEQUENCE.h> |
| 142 | #include <constr_SET.h> |
| 143 | |
| 144 | /*** <<< DEPS [Stuff] >>> ***/ |
| 145 | |
| 146 | |
| 147 | /* |
| 148 | * Method of determining the components presence |
| 149 | */ |
| 150 | typedef enum Stuff_PR { |
| 151 | Stuff_PR_trees, /* Member trees is present */ |
| 152 | Stuff_PR_anything, /* Member anything is present */ |
| 153 | } Stuff_PR; |
| 154 | extern asn1_TYPE_descriptor_t asn1_DEF_Stuff; |
| 155 | |
| 156 | /*** <<< TYPE-DECLS [Stuff] >>> ***/ |
| 157 | |
| 158 | |
| 159 | typedef struct Stuff { |
| 160 | struct trees { |
| 161 | A_SET_OF(struct Forest) list; |
| 162 | |
| 163 | /* Context for parsing across buffer boundaries */ |
| 164 | ber_dec_ctx_t _ber_dec_ctx; |
| 165 | } *trees; |
| 166 | struct anything { |
| 167 | A_SET_OF(struct anything_member { |
| 168 | BIT_STRING_t cup_of_coffee; |
| 169 | /* |
| 170 | * This type is extensible, |
| 171 | * possible extensions are below. |
| 172 | */ |
| 173 | |
| 174 | /* Context for parsing across buffer boundaries */ |
| 175 | ber_dec_ctx_t _ber_dec_ctx; |
| 176 | } ) list; |
| 177 | |
| 178 | /* Context for parsing across buffer boundaries */ |
| 179 | ber_dec_ctx_t _ber_dec_ctx; |
| 180 | } *anything; |
| 181 | |
| 182 | /* Presence bitmask: ASN_SET_ISPRESENT(pStuff, Stuff_PR_x) */ |
| 183 | unsigned int _presence_map |
| 184 | [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 185 | |
| 186 | /* Context for parsing across buffer boundaries */ |
| 187 | ber_dec_ctx_t _ber_dec_ctx; |
| 188 | } Stuff_t; |
| 189 | |
| 190 | /*** <<< STAT-DEFS [Stuff] >>> ***/ |
| 191 | |
| 192 | static asn1_TYPE_member_t asn1_MBR_trees[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 193 | { ATF_NOFLAGS, 0, 0, |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 194 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), |
| 195 | .tag_mode = 0, |
| 196 | .type = (void *)&asn1_DEF_Forest, |
| 197 | .memb_constraints = 0, /* Defer to actual type */ |
| 198 | .name = "" |
| 199 | }, |
| 200 | }; |
| 201 | static ber_tlv_tag_t asn1_DEF_trees_tags[] = { |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 202 | (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 203 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 204 | }; |
| 205 | static asn1_SET_OF_specifics_t asn1_DEF_trees_specs = { |
| 206 | sizeof(struct trees), |
| 207 | offsetof(struct trees, _ber_dec_ctx), |
| 208 | }; |
Lev Walkin | d04430c | 2004-09-07 06:44:29 +0000 | [diff] [blame] | 209 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 210 | asn1_TYPE_descriptor_t asn1_DEF_trees = { |
| 211 | "trees", |
| 212 | SET_OF_constraint, |
| 213 | SET_OF_decode_ber, |
| 214 | SET_OF_encode_der, |
| 215 | SET_OF_print, |
| 216 | SET_OF_free, |
| 217 | 0, /* Use generic outmost tag fetcher */ |
| 218 | asn1_DEF_trees_tags, |
| 219 | sizeof(asn1_DEF_trees_tags) |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 220 | /sizeof(asn1_DEF_trees_tags[0]) - 1, /* 1 */ |
| 221 | asn1_DEF_trees_tags, /* Same as above */ |
| 222 | sizeof(asn1_DEF_trees_tags) |
| 223 | /sizeof(asn1_DEF_trees_tags[0]), /* 2 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 224 | 1, /* Whether CONSTRUCTED */ |
| 225 | asn1_MBR_trees, |
| 226 | 1, /* Single element */ |
| 227 | &asn1_DEF_trees_specs /* Additional specs */ |
| 228 | }; |
| 229 | |
| 230 | static asn1_TYPE_member_t asn1_MBR_anything_member[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 231 | { ATF_NOFLAGS, 0, offsetof(struct anything_member, cup_of_coffee), |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 232 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), |
| 233 | .tag_mode = 0, |
| 234 | .type = (void *)&asn1_DEF_BIT_STRING, |
| 235 | .memb_constraints = 0, /* Defer to actual type */ |
| 236 | .name = "cup-of-coffee" |
| 237 | }, |
| 238 | }; |
| 239 | static ber_tlv_tag_t asn1_DEF_anything_member_tags[] = { |
| 240 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 241 | }; |
| 242 | static asn1_TYPE_tag2member_t asn1_DEF_anything_member_tag2el[] = { |
| 243 | { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 }, /* cup-of-coffee at 26 */ |
| 244 | }; |
| 245 | static asn1_SEQUENCE_specifics_t asn1_DEF_anything_member_specs = { |
| 246 | sizeof(struct anything_member), |
| 247 | offsetof(struct anything_member, _ber_dec_ctx), |
| 248 | asn1_DEF_anything_member_tag2el, |
| 249 | 1, /* Count of tags in the map */ |
| 250 | 0, /* Start extensions */ |
| 251 | 2 /* Stop extensions */ |
| 252 | }; |
Lev Walkin | d04430c | 2004-09-07 06:44:29 +0000 | [diff] [blame] | 253 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 254 | asn1_TYPE_descriptor_t asn1_DEF_anything_member = { |
| 255 | "", |
| 256 | SEQUENCE_constraint, |
| 257 | SEQUENCE_decode_ber, |
| 258 | SEQUENCE_encode_der, |
| 259 | SEQUENCE_print, |
| 260 | SEQUENCE_free, |
| 261 | 0, /* Use generic outmost tag fetcher */ |
| 262 | asn1_DEF_anything_member_tags, |
| 263 | sizeof(asn1_DEF_anything_member_tags) |
| 264 | /sizeof(asn1_DEF_anything_member_tags[0]), /* 1 */ |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 265 | asn1_DEF_anything_member_tags, /* Same as above */ |
| 266 | sizeof(asn1_DEF_anything_member_tags) |
| 267 | /sizeof(asn1_DEF_anything_member_tags[0]), /* 1 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 268 | 1, /* Whether CONSTRUCTED */ |
| 269 | asn1_MBR_anything_member, |
| 270 | 1, /* Elements count */ |
| 271 | &asn1_DEF_anything_member_specs /* Additional specs */ |
| 272 | }; |
| 273 | |
| 274 | static asn1_TYPE_member_t asn1_MBR_anything[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 275 | { ATF_NOFLAGS, 0, 0, |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 276 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 277 | .tag_mode = 0, |
| 278 | .type = (void *)&asn1_DEF_anything_member, |
| 279 | .memb_constraints = 0, /* Defer to actual type */ |
| 280 | .name = "" |
| 281 | }, |
| 282 | }; |
| 283 | static ber_tlv_tag_t asn1_DEF_anything_tags[] = { |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 284 | (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 285 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 286 | }; |
| 287 | static asn1_SET_OF_specifics_t asn1_DEF_anything_specs = { |
| 288 | sizeof(struct anything), |
| 289 | offsetof(struct anything, _ber_dec_ctx), |
| 290 | }; |
Lev Walkin | d04430c | 2004-09-07 06:44:29 +0000 | [diff] [blame] | 291 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 292 | asn1_TYPE_descriptor_t asn1_DEF_anything = { |
| 293 | "anything", |
| 294 | SET_OF_constraint, |
| 295 | SET_OF_decode_ber, |
| 296 | SET_OF_encode_der, |
| 297 | SET_OF_print, |
| 298 | SET_OF_free, |
| 299 | 0, /* Use generic outmost tag fetcher */ |
| 300 | asn1_DEF_anything_tags, |
| 301 | sizeof(asn1_DEF_anything_tags) |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 302 | /sizeof(asn1_DEF_anything_tags[0]) - 1, /* 1 */ |
| 303 | asn1_DEF_anything_tags, /* Same as above */ |
| 304 | sizeof(asn1_DEF_anything_tags) |
| 305 | /sizeof(asn1_DEF_anything_tags[0]), /* 2 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 306 | 1, /* Whether CONSTRUCTED */ |
| 307 | asn1_MBR_anything, |
| 308 | 1, /* Single element */ |
| 309 | &asn1_DEF_anything_specs /* Additional specs */ |
| 310 | }; |
| 311 | |
| 312 | static asn1_TYPE_member_t asn1_MBR_Stuff[] = { |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 313 | { ATF_POINTER, 2, offsetof(struct Stuff, trees), |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 314 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 315 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 316 | .type = (void *)&asn1_DEF_trees, |
| 317 | .memb_constraints = 0, /* Defer to actual type */ |
| 318 | .name = "trees" |
| 319 | }, |
Lev Walkin | cc93b0f | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 320 | { ATF_POINTER, 1, offsetof(struct Stuff, anything), |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 321 | .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 322 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
| 323 | .type = (void *)&asn1_DEF_anything, |
| 324 | .memb_constraints = 0, /* Defer to actual type */ |
| 325 | .name = "anything" |
| 326 | }, |
| 327 | }; |
| 328 | static ber_tlv_tag_t asn1_DEF_Stuff_tags[] = { |
| 329 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 330 | }; |
| 331 | static asn1_TYPE_tag2member_t asn1_DEF_Stuff_tag2el[] = { |
| 332 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* trees at 23 */ |
| 333 | { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* anything at 28 */ |
| 334 | }; |
| 335 | static uint8_t asn1_DEF_Stuff_mmap[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
| 336 | (0 << 7) | (0 << 6) |
| 337 | }; |
| 338 | static asn1_SET_specifics_t asn1_DEF_Stuff_specs = { |
| 339 | sizeof(struct Stuff), |
| 340 | offsetof(struct Stuff, _ber_dec_ctx), |
| 341 | offsetof(struct Stuff, _presence_map), |
| 342 | asn1_DEF_Stuff_tag2el, |
| 343 | 2, /* Count of tags in the map */ |
| 344 | 0, /* Whether extensible */ |
| 345 | (unsigned int *)asn1_DEF_Stuff_mmap /* Mandatory elements map */ |
| 346 | }; |
| 347 | asn1_TYPE_descriptor_t asn1_DEF_Stuff = { |
| 348 | "Stuff", |
| 349 | SET_constraint, |
| 350 | SET_decode_ber, |
| 351 | SET_encode_der, |
| 352 | SET_print, |
| 353 | SET_free, |
| 354 | 0, /* Use generic outmost tag fetcher */ |
| 355 | asn1_DEF_Stuff_tags, |
| 356 | sizeof(asn1_DEF_Stuff_tags) |
| 357 | /sizeof(asn1_DEF_Stuff_tags[0]), /* 1 */ |
Lev Walkin | 188ed2c | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 358 | asn1_DEF_Stuff_tags, /* Same as above */ |
| 359 | sizeof(asn1_DEF_Stuff_tags) |
| 360 | /sizeof(asn1_DEF_Stuff_tags[0]), /* 1 */ |
Lev Walkin | 03ba3e9 | 2004-08-22 03:18:17 +0000 | [diff] [blame] | 361 | 1, /* Whether CONSTRUCTED */ |
| 362 | asn1_MBR_Stuff, |
| 363 | 2, /* Elements count */ |
| 364 | &asn1_DEF_Stuff_specs /* Additional specs */ |
| 365 | }; |
| 366 | |