vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 1 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 2 | /*** <<< INCLUDES [T1] >>> ***/ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 3 | |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 4 | #include <INTEGER.h> |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 5 | #include <constr_SET.h> |
| 6 | |
| 7 | /*** <<< DEPS [T1] >>> ***/ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | /* |
| 11 | * Method of determining the components presence |
| 12 | */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 13 | typedef enum T1_PR { |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 14 | T1_PR_i, /* Member i is present */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 15 | } T1_PR; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 16 | extern asn1_TYPE_descriptor_t asn1_DEF_T1; |
| 17 | |
| 18 | /*** <<< TYPE-DECLS [T1] >>> ***/ |
| 19 | |
| 20 | |
| 21 | typedef struct T1 { |
| 22 | INTEGER_t i; |
| 23 | /* |
| 24 | * This type is extensible, |
| 25 | * possible extensions are below. |
| 26 | */ |
| 27 | |
| 28 | /* Presence bitmask: ASN_SET_ISPRESENT(pT1, T1_PR_x) */ |
| 29 | unsigned int _presence_map |
| 30 | [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 31 | |
| 32 | /* Context for parsing across buffer boundaries */ |
| 33 | ber_dec_ctx_t _ber_dec_ctx; |
| 34 | } T1_t; |
| 35 | |
| 36 | /*** <<< STAT-DEFS [T1] >>> ***/ |
| 37 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 38 | static asn1_TYPE_member_t asn1_MBR_T1[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 39 | { ATF_NOFLAGS, 0, offsetof(struct T1, i), |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 40 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 41 | .tag_mode = 0, |
| 42 | .type = (void *)&asn1_DEF_INTEGER, |
| 43 | .memb_constraints = 0, /* Defer to actual type */ |
| 44 | .name = "i" |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 45 | }, |
| 46 | }; |
| 47 | static ber_tlv_tag_t asn1_DEF_T1_tags[] = { |
| 48 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 49 | }; |
| 50 | static asn1_TYPE_tag2member_t asn1_DEF_T1_tag2el[] = { |
| 51 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 14 */ |
| 52 | }; |
| 53 | static uint8_t asn1_DEF_T1_mmap[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
| 54 | (1 << 7) |
| 55 | }; |
| 56 | static asn1_SET_specifics_t asn1_DEF_T1_specs = { |
| 57 | sizeof(struct T1), |
| 58 | offsetof(struct T1, _ber_dec_ctx), |
| 59 | offsetof(struct T1, _presence_map), |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 60 | asn1_DEF_T1_tag2el, |
| 61 | 1, /* Count of tags in the map */ |
| 62 | 1, /* Whether extensible */ |
| 63 | (unsigned int *)asn1_DEF_T1_mmap /* Mandatory elements map */ |
| 64 | }; |
| 65 | asn1_TYPE_descriptor_t asn1_DEF_T1 = { |
| 66 | "T1", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 67 | SET_free, |
| 68 | SET_print, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 69 | SET_constraint, |
| 70 | SET_decode_ber, |
| 71 | SET_encode_der, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 72 | 0, /* Not implemented yet */ |
| 73 | SET_encode_xer, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 74 | 0, /* Use generic outmost tag fetcher */ |
| 75 | asn1_DEF_T1_tags, |
| 76 | sizeof(asn1_DEF_T1_tags) |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 77 | /sizeof(asn1_DEF_T1_tags[0]), /* 1 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 78 | asn1_DEF_T1_tags, /* Same as above */ |
| 79 | sizeof(asn1_DEF_T1_tags) |
| 80 | /sizeof(asn1_DEF_T1_tags[0]), /* 1 */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 81 | 1, /* Whether CONSTRUCTED */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 82 | asn1_MBR_T1, |
| 83 | 1, /* Elements count */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 84 | &asn1_DEF_T1_specs /* Additional specs */ |
| 85 | }; |
| 86 | |
| 87 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 88 | /*** <<< INCLUDES [T2] >>> ***/ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 89 | |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 90 | #include <INTEGER.h> |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 91 | #include <constr_SET.h> |
| 92 | |
| 93 | /*** <<< DEPS [T2] >>> ***/ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 94 | |
| 95 | |
| 96 | /* |
| 97 | * Method of determining the components presence |
| 98 | */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 99 | typedef enum T2_PR { |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 100 | T2_PR_i, /* Member i is present */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 101 | } T2_PR; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 102 | extern asn1_TYPE_descriptor_t asn1_DEF_T2; |
| 103 | |
| 104 | /*** <<< TYPE-DECLS [T2] >>> ***/ |
| 105 | |
| 106 | |
| 107 | typedef struct T2 { |
| 108 | INTEGER_t i; |
| 109 | /* |
| 110 | * This type is extensible, |
| 111 | * possible extensions are below. |
| 112 | */ |
| 113 | |
| 114 | /* Presence bitmask: ASN_SET_ISPRESENT(pT2, T2_PR_x) */ |
| 115 | unsigned int _presence_map |
| 116 | [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 117 | |
| 118 | /* Context for parsing across buffer boundaries */ |
| 119 | ber_dec_ctx_t _ber_dec_ctx; |
| 120 | } T2_t; |
| 121 | |
| 122 | /*** <<< STAT-DEFS [T2] >>> ***/ |
| 123 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 124 | static asn1_TYPE_member_t asn1_MBR_T2[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 125 | { ATF_NOFLAGS, 0, offsetof(struct T2, i), |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 126 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 127 | .tag_mode = 0, |
| 128 | .type = (void *)&asn1_DEF_INTEGER, |
| 129 | .memb_constraints = 0, /* Defer to actual type */ |
| 130 | .name = "i" |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 131 | }, |
| 132 | }; |
| 133 | static ber_tlv_tag_t asn1_DEF_T2_tags[] = { |
| 134 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 135 | }; |
| 136 | static asn1_TYPE_tag2member_t asn1_DEF_T2_tag2el[] = { |
| 137 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 15 */ |
| 138 | }; |
| 139 | static uint8_t asn1_DEF_T2_mmap[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
| 140 | (1 << 7) |
| 141 | }; |
| 142 | static asn1_SET_specifics_t asn1_DEF_T2_specs = { |
| 143 | sizeof(struct T2), |
| 144 | offsetof(struct T2, _ber_dec_ctx), |
| 145 | offsetof(struct T2, _presence_map), |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 146 | asn1_DEF_T2_tag2el, |
| 147 | 1, /* Count of tags in the map */ |
| 148 | 1, /* Whether extensible */ |
| 149 | (unsigned int *)asn1_DEF_T2_mmap /* Mandatory elements map */ |
| 150 | }; |
| 151 | asn1_TYPE_descriptor_t asn1_DEF_T2 = { |
| 152 | "T2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 153 | SET_free, |
| 154 | SET_print, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 155 | SET_constraint, |
| 156 | SET_decode_ber, |
| 157 | SET_encode_der, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 158 | 0, /* Not implemented yet */ |
| 159 | SET_encode_xer, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 160 | 0, /* Use generic outmost tag fetcher */ |
| 161 | asn1_DEF_T2_tags, |
| 162 | sizeof(asn1_DEF_T2_tags) |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 163 | /sizeof(asn1_DEF_T2_tags[0]), /* 1 */ |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 164 | asn1_DEF_T2_tags, /* Same as above */ |
| 165 | sizeof(asn1_DEF_T2_tags) |
| 166 | /sizeof(asn1_DEF_T2_tags[0]), /* 1 */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 167 | 1, /* Whether CONSTRUCTED */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 168 | asn1_MBR_T2, |
| 169 | 1, /* Elements count */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 170 | &asn1_DEF_T2_specs /* Additional specs */ |
| 171 | }; |
| 172 | |
| 173 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 174 | /*** <<< INCLUDES [T3] >>> ***/ |
| 175 | |
| 176 | #include <INTEGER.h> |
| 177 | #include <constr_CHOICE.h> |
| 178 | |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 179 | /*** <<< DEPS [T3] >>> ***/ |
| 180 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 181 | typedef enum T3_PR { |
| 182 | T3_PR_NOTHING, /* No components present */ |
| 183 | T3_PR_i, |
| 184 | /* Extensions may appear below */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 185 | } T3_PR; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 186 | extern asn1_TYPE_descriptor_t asn1_DEF_T3; |
| 187 | |
| 188 | /*** <<< TYPE-DECLS [T3] >>> ***/ |
| 189 | |
| 190 | |
| 191 | typedef struct T3 { |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 192 | T3_PR present; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 193 | union { |
| 194 | INTEGER_t i; |
| 195 | /* |
| 196 | * This type is extensible, |
| 197 | * possible extensions are below. |
| 198 | */ |
| 199 | } choice; |
| 200 | |
| 201 | /* Context for parsing across buffer boundaries */ |
| 202 | ber_dec_ctx_t _ber_dec_ctx; |
| 203 | } T3_t; |
| 204 | |
| 205 | /*** <<< STAT-DEFS [T3] >>> ***/ |
| 206 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 207 | static asn1_TYPE_member_t asn1_MBR_T3[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 208 | { ATF_NOFLAGS, 0, offsetof(struct T3, choice.i), |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 209 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 210 | .tag_mode = 0, |
| 211 | .type = (void *)&asn1_DEF_INTEGER, |
| 212 | .memb_constraints = 0, /* Defer to actual type */ |
| 213 | .name = "i" |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 214 | }, |
| 215 | }; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 216 | static asn1_TYPE_tag2member_t asn1_DEF_T3_tag2el[] = { |
| 217 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 16 */ |
| 218 | }; |
| 219 | static asn1_CHOICE_specifics_t asn1_DEF_T3_specs = { |
| 220 | sizeof(struct T3), |
| 221 | offsetof(struct T3, _ber_dec_ctx), |
| 222 | offsetof(struct T3, present), |
| 223 | sizeof(((struct T3 *)0)->present), |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 224 | asn1_DEF_T3_tag2el, |
| 225 | 1, /* Count of tags in the map */ |
| 226 | 1 /* Whether extensible */ |
| 227 | }; |
| 228 | asn1_TYPE_descriptor_t asn1_DEF_T3 = { |
| 229 | "T3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 230 | CHOICE_free, |
| 231 | CHOICE_print, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 232 | CHOICE_constraint, |
| 233 | CHOICE_decode_ber, |
| 234 | CHOICE_encode_der, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 235 | 0, /* Not implemented yet */ |
| 236 | CHOICE_encode_xer, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 237 | CHOICE_outmost_tag, |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 238 | 0, /* No effective tags (pointer) */ |
| 239 | 0, /* No effective tags (count) */ |
| 240 | 0, /* No tags (pointer) */ |
| 241 | 0, /* No tags (count) */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 242 | 1, /* Whether CONSTRUCTED */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 243 | asn1_MBR_T3, |
| 244 | 1, /* Elements count */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 245 | &asn1_DEF_T3_specs /* Additional specs */ |
| 246 | }; |
| 247 | |
| 248 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 249 | /*** <<< INCLUDES [T4] >>> ***/ |
| 250 | |
| 251 | #include <INTEGER.h> |
| 252 | #include <constr_CHOICE.h> |
| 253 | |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 254 | /*** <<< DEPS [T4] >>> ***/ |
| 255 | |
vlm | 6e1b13e | 2004-08-11 05:25:47 +0000 | [diff] [blame] | 256 | typedef enum T4_PR { |
| 257 | T4_PR_NOTHING, /* No components present */ |
| 258 | T4_PR_i, |
| 259 | /* Extensions may appear below */ |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 260 | } T4_PR; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 261 | extern asn1_TYPE_descriptor_t asn1_DEF_T4; |
| 262 | |
| 263 | /*** <<< TYPE-DECLS [T4] >>> ***/ |
| 264 | |
| 265 | |
| 266 | typedef struct T4 { |
vlm | 6e73a04 | 2004-08-11 07:17:22 +0000 | [diff] [blame] | 267 | T4_PR present; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 268 | union { |
| 269 | INTEGER_t i; |
| 270 | /* |
| 271 | * This type is extensible, |
| 272 | * possible extensions are below. |
| 273 | */ |
| 274 | } choice; |
| 275 | |
| 276 | /* Context for parsing across buffer boundaries */ |
| 277 | ber_dec_ctx_t _ber_dec_ctx; |
| 278 | } T4_t; |
| 279 | |
| 280 | /*** <<< STAT-DEFS [T4] >>> ***/ |
| 281 | |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 282 | static asn1_TYPE_member_t asn1_MBR_T4[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 283 | { ATF_NOFLAGS, 0, offsetof(struct T4, choice.i), |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 284 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 285 | .tag_mode = 0, |
| 286 | .type = (void *)&asn1_DEF_INTEGER, |
| 287 | .memb_constraints = 0, /* Defer to actual type */ |
| 288 | .name = "i" |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 289 | }, |
| 290 | }; |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 291 | static asn1_TYPE_tag2member_t asn1_DEF_T4_tag2el[] = { |
| 292 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i at 17 */ |
| 293 | }; |
| 294 | static asn1_CHOICE_specifics_t asn1_DEF_T4_specs = { |
| 295 | sizeof(struct T4), |
| 296 | offsetof(struct T4, _ber_dec_ctx), |
| 297 | offsetof(struct T4, present), |
| 298 | sizeof(((struct T4 *)0)->present), |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 299 | asn1_DEF_T4_tag2el, |
| 300 | 1, /* Count of tags in the map */ |
| 301 | 1 /* Whether extensible */ |
| 302 | }; |
| 303 | asn1_TYPE_descriptor_t asn1_DEF_T4 = { |
| 304 | "T4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 305 | CHOICE_free, |
| 306 | CHOICE_print, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 307 | CHOICE_constraint, |
| 308 | CHOICE_decode_ber, |
| 309 | CHOICE_encode_der, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 310 | 0, /* Not implemented yet */ |
| 311 | CHOICE_encode_xer, |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 312 | CHOICE_outmost_tag, |
vlm | 72425de | 2004-09-13 08:31:01 +0000 | [diff] [blame] | 313 | 0, /* No effective tags (pointer) */ |
| 314 | 0, /* No effective tags (count) */ |
| 315 | 0, /* No tags (pointer) */ |
| 316 | 0, /* No tags (count) */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 317 | 1, /* Whether CONSTRUCTED */ |
vlm | 21e4600 | 2004-08-20 13:36:32 +0000 | [diff] [blame] | 318 | asn1_MBR_T4, |
| 319 | 1, /* Elements count */ |
vlm | 79b08d5 | 2004-07-01 00:52:50 +0000 | [diff] [blame] | 320 | &asn1_DEF_T4_specs /* Additional specs */ |
| 321 | }; |
| 322 | |