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