Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Type] >>> ***/ |
| 3 | |
| 4 | #include <asn_SET_OF.h> |
| 5 | #include <Type1.h> |
| 6 | #include <Type2.h> |
| 7 | #include <constr_SEQUENCE.h> |
| 8 | #include <constr_SET_OF.h> |
| 9 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 10 | /*** <<< TYPE-DECLS [Type] >>> ***/ |
| 11 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 12 | typedef struct Type { |
| 13 | A_SET_OF(struct Member { |
| 14 | Type1_t t1; |
| 15 | Type2_t t2; |
| 16 | |
| 17 | /* Context for parsing across buffer boundaries */ |
| 18 | asn_struct_ctx_t _asn_ctx; |
| 19 | } ) list; |
| 20 | |
| 21 | /* Context for parsing across buffer boundaries */ |
| 22 | asn_struct_ctx_t _asn_ctx; |
| 23 | } Type_t; |
| 24 | |
Lev Walkin | c828571 | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 25 | /*** <<< FUNC-DECLS [Type] >>> ***/ |
| 26 | |
| 27 | extern asn_TYPE_descriptor_t asn_DEF_Type; |
| 28 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 29 | /*** <<< STAT-DEFS [Type] >>> ***/ |
| 30 | |
| 31 | static asn_TYPE_member_t asn_MBR_Member_2[] = { |
| 32 | { ATF_NOFLAGS, 0, offsetof(struct Member, t1), |
| 33 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 34 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 35 | .type = &asn_DEF_Type1, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 36 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 37 | .name = "t1" |
| 38 | }, |
| 39 | { ATF_NOFLAGS, 0, offsetof(struct Member, t2), |
| 40 | .tag = -1 /* Ambiguous tag (CHOICE?) */, |
| 41 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 42 | .type = &asn_DEF_Type2, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 43 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 44 | .name = "t2" |
| 45 | }, |
| 46 | }; |
| 47 | static ber_tlv_tag_t asn_DEF_Member_2_tags[] = { |
| 48 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 49 | }; |
| 50 | static asn_TYPE_tag2member_t asn_MAP_Member_2_tag2el[] = { |
| 51 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* t1 at 21 */ |
| 52 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 }, /* one-name at 37 */ |
| 53 | { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* two-name at 43 */ |
| 54 | }; |
| 55 | static asn_SEQUENCE_specifics_t asn_SPC_Member_2_specs = { |
| 56 | sizeof(struct Member), |
| 57 | offsetof(struct Member, _asn_ctx), |
| 58 | asn_MAP_Member_2_tag2el, |
| 59 | 3, /* Count of tags in the map */ |
| 60 | -1, /* Start extensions */ |
| 61 | -1 /* Stop extensions */ |
| 62 | }; |
| 63 | static /* Use -fall-defs-global to expose */ |
| 64 | asn_TYPE_descriptor_t asn_DEF_Member_2 = { |
| 65 | "", |
| 66 | "", |
| 67 | SEQUENCE_free, |
| 68 | SEQUENCE_print, |
| 69 | SEQUENCE_constraint, |
| 70 | SEQUENCE_decode_ber, |
| 71 | SEQUENCE_encode_der, |
| 72 | SEQUENCE_decode_xer, |
| 73 | SEQUENCE_encode_xer, |
| 74 | 0, /* Use generic outmost tag fetcher */ |
| 75 | asn_DEF_Member_2_tags, |
| 76 | sizeof(asn_DEF_Member_2_tags) |
| 77 | /sizeof(asn_DEF_Member_2_tags[0]), /* 1 */ |
| 78 | asn_DEF_Member_2_tags, /* Same as above */ |
| 79 | sizeof(asn_DEF_Member_2_tags) |
| 80 | /sizeof(asn_DEF_Member_2_tags[0]), /* 1 */ |
| 81 | asn_MBR_Member_2, |
| 82 | 2, /* Elements count */ |
| 83 | &asn_SPC_Member_2_specs /* Additional specs */ |
| 84 | }; |
| 85 | |
| 86 | static asn_TYPE_member_t asn_MBR_Type_1[] = { |
Lev Walkin | 8eb4b57 | 2005-08-16 16:57:17 +0000 | [diff] [blame] | 87 | { ATF_POINTER, 0, 0, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 88 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 89 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 90 | .type = &asn_DEF_Member_2, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 91 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 92 | .name = "" |
| 93 | }, |
| 94 | }; |
| 95 | static ber_tlv_tag_t asn_DEF_Type_1_tags[] = { |
| 96 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 97 | }; |
| 98 | static asn_SET_OF_specifics_t asn_SPC_Type_1_specs = { |
| 99 | sizeof(struct Type), |
| 100 | offsetof(struct Type, _asn_ctx), |
| 101 | 0, /* XER encoding is XMLDelimitedItemList */ |
| 102 | }; |
| 103 | asn_TYPE_descriptor_t asn_DEF_Type = { |
| 104 | "Type", |
| 105 | "Type", |
| 106 | SET_OF_free, |
| 107 | SET_OF_print, |
| 108 | SET_OF_constraint, |
| 109 | SET_OF_decode_ber, |
| 110 | SET_OF_encode_der, |
| 111 | SET_OF_decode_xer, |
| 112 | SET_OF_encode_xer, |
| 113 | 0, /* Use generic outmost tag fetcher */ |
| 114 | asn_DEF_Type_1_tags, |
| 115 | sizeof(asn_DEF_Type_1_tags) |
| 116 | /sizeof(asn_DEF_Type_1_tags[0]), /* 1 */ |
| 117 | asn_DEF_Type_1_tags, /* Same as above */ |
| 118 | sizeof(asn_DEF_Type_1_tags) |
| 119 | /sizeof(asn_DEF_Type_1_tags[0]), /* 1 */ |
| 120 | asn_MBR_Type_1, |
| 121 | 1, /* Single element */ |
| 122 | &asn_SPC_Type_1_specs /* Additional specs */ |
| 123 | }; |
| 124 | |
| 125 | |
| 126 | /*** <<< INCLUDES [Type1] >>> ***/ |
| 127 | |
| 128 | #include <INTEGER.h> |
| 129 | #include <constr_SEQUENCE.h> |
| 130 | #include <constr_CHOICE.h> |
| 131 | |
| 132 | /*** <<< DEPS [Type1] >>> ***/ |
| 133 | |
| 134 | typedef enum one_name_PR { |
| 135 | one_name_PR_NOTHING, /* No components present */ |
| 136 | one_name_PR_another_name, |
| 137 | } one_name_PR; |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 138 | |
| 139 | /*** <<< TYPE-DECLS [Type1] >>> ***/ |
| 140 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 141 | typedef struct Type1 { |
| 142 | struct one_name { |
| 143 | one_name_PR present; |
Lev Walkin | 0f5d74c | 2005-08-14 15:03:31 +0000 | [diff] [blame] | 144 | union Type1__one_name_u { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 145 | struct another_name { |
| 146 | INTEGER_t a; |
| 147 | INTEGER_t b; |
| 148 | |
| 149 | /* Context for parsing across buffer boundaries */ |
| 150 | asn_struct_ctx_t _asn_ctx; |
| 151 | } another_name; |
| 152 | } choice; |
| 153 | |
| 154 | /* Context for parsing across buffer boundaries */ |
| 155 | asn_struct_ctx_t _asn_ctx; |
| 156 | } one_name; |
| 157 | |
| 158 | /* Context for parsing across buffer boundaries */ |
| 159 | asn_struct_ctx_t _asn_ctx; |
| 160 | } Type1_t; |
| 161 | |
Lev Walkin | c828571 | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 162 | /*** <<< FUNC-DECLS [Type1] >>> ***/ |
| 163 | |
| 164 | extern asn_TYPE_descriptor_t asn_DEF_Type1; |
| 165 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 166 | /*** <<< STAT-DEFS [Type1] >>> ***/ |
| 167 | |
| 168 | static asn_TYPE_member_t asn_MBR_another_name_3[] = { |
| 169 | { ATF_NOFLAGS, 0, offsetof(struct another_name, a), |
| 170 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 171 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 172 | .type = &asn_DEF_INTEGER, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 173 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 174 | .name = "a" |
| 175 | }, |
| 176 | { ATF_NOFLAGS, 0, offsetof(struct another_name, b), |
| 177 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 178 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 179 | .type = &asn_DEF_INTEGER, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 180 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 181 | .name = "b" |
| 182 | }, |
| 183 | }; |
| 184 | static ber_tlv_tag_t asn_DEF_another_name_3_tags[] = { |
| 185 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 186 | }; |
| 187 | static asn_TYPE_tag2member_t asn_MAP_another_name_3_tag2el[] = { |
| 188 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* a at 27 */ |
| 189 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* b at 27 */ |
| 190 | }; |
| 191 | static asn_SEQUENCE_specifics_t asn_SPC_another_name_3_specs = { |
| 192 | sizeof(struct another_name), |
| 193 | offsetof(struct another_name, _asn_ctx), |
| 194 | asn_MAP_another_name_3_tag2el, |
| 195 | 2, /* Count of tags in the map */ |
| 196 | -1, /* Start extensions */ |
| 197 | -1 /* Stop extensions */ |
| 198 | }; |
| 199 | static /* Use -fall-defs-global to expose */ |
| 200 | asn_TYPE_descriptor_t asn_DEF_another_name_3 = { |
| 201 | "another-name", |
| 202 | "another-name", |
| 203 | SEQUENCE_free, |
| 204 | SEQUENCE_print, |
| 205 | SEQUENCE_constraint, |
| 206 | SEQUENCE_decode_ber, |
| 207 | SEQUENCE_encode_der, |
| 208 | SEQUENCE_decode_xer, |
| 209 | SEQUENCE_encode_xer, |
| 210 | 0, /* Use generic outmost tag fetcher */ |
| 211 | asn_DEF_another_name_3_tags, |
| 212 | sizeof(asn_DEF_another_name_3_tags) |
| 213 | /sizeof(asn_DEF_another_name_3_tags[0]), /* 1 */ |
| 214 | asn_DEF_another_name_3_tags, /* Same as above */ |
| 215 | sizeof(asn_DEF_another_name_3_tags) |
| 216 | /sizeof(asn_DEF_another_name_3_tags[0]), /* 1 */ |
| 217 | asn_MBR_another_name_3, |
| 218 | 2, /* Elements count */ |
| 219 | &asn_SPC_another_name_3_specs /* Additional specs */ |
| 220 | }; |
| 221 | |
| 222 | static asn_TYPE_member_t asn_MBR_one_name_2[] = { |
| 223 | { ATF_NOFLAGS, 0, offsetof(struct one_name, choice.another_name), |
| 224 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 225 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 226 | .type = &asn_DEF_another_name_3, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 227 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 228 | .name = "another-name" |
| 229 | }, |
| 230 | }; |
| 231 | static asn_TYPE_tag2member_t asn_MAP_one_name_2_tag2el[] = { |
| 232 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name at 27 */ |
| 233 | }; |
| 234 | static asn_CHOICE_specifics_t asn_SPC_one_name_2_specs = { |
| 235 | sizeof(struct one_name), |
| 236 | offsetof(struct one_name, _asn_ctx), |
| 237 | offsetof(struct one_name, present), |
| 238 | sizeof(((struct one_name *)0)->present), |
| 239 | asn_MAP_one_name_2_tag2el, |
| 240 | 1, /* Count of tags in the map */ |
| 241 | 0 /* Whether extensible */ |
| 242 | }; |
| 243 | static /* Use -fall-defs-global to expose */ |
| 244 | asn_TYPE_descriptor_t asn_DEF_one_name_2 = { |
| 245 | "one-name", |
| 246 | "one-name", |
| 247 | CHOICE_free, |
| 248 | CHOICE_print, |
| 249 | CHOICE_constraint, |
| 250 | CHOICE_decode_ber, |
| 251 | CHOICE_encode_der, |
| 252 | CHOICE_decode_xer, |
| 253 | CHOICE_encode_xer, |
| 254 | CHOICE_outmost_tag, |
| 255 | 0, /* No effective tags (pointer) */ |
| 256 | 0, /* No effective tags (count) */ |
| 257 | 0, /* No tags (pointer) */ |
| 258 | 0, /* No tags (count) */ |
| 259 | asn_MBR_one_name_2, |
| 260 | 1, /* Elements count */ |
| 261 | &asn_SPC_one_name_2_specs /* Additional specs */ |
| 262 | }; |
| 263 | |
| 264 | static asn_TYPE_member_t asn_MBR_Type1_1[] = { |
| 265 | { ATF_NOFLAGS, 0, offsetof(struct Type1, one_name), |
| 266 | .tag = -1 /* Ambiguous tag (CHOICE?) */, |
| 267 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 268 | .type = &asn_DEF_one_name_2, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 269 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 270 | .name = "one-name" |
| 271 | }, |
| 272 | }; |
| 273 | static ber_tlv_tag_t asn_DEF_Type1_1_tags[] = { |
| 274 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 275 | }; |
| 276 | static asn_TYPE_tag2member_t asn_MAP_Type1_1_tag2el[] = { |
| 277 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name at 27 */ |
| 278 | }; |
| 279 | static asn_SEQUENCE_specifics_t asn_SPC_Type1_1_specs = { |
| 280 | sizeof(struct Type1), |
| 281 | offsetof(struct Type1, _asn_ctx), |
| 282 | asn_MAP_Type1_1_tag2el, |
| 283 | 1, /* Count of tags in the map */ |
| 284 | -1, /* Start extensions */ |
| 285 | -1 /* Stop extensions */ |
| 286 | }; |
| 287 | asn_TYPE_descriptor_t asn_DEF_Type1 = { |
| 288 | "Type1", |
| 289 | "Type1", |
| 290 | SEQUENCE_free, |
| 291 | SEQUENCE_print, |
| 292 | SEQUENCE_constraint, |
| 293 | SEQUENCE_decode_ber, |
| 294 | SEQUENCE_encode_der, |
| 295 | SEQUENCE_decode_xer, |
| 296 | SEQUENCE_encode_xer, |
| 297 | 0, /* Use generic outmost tag fetcher */ |
| 298 | asn_DEF_Type1_1_tags, |
| 299 | sizeof(asn_DEF_Type1_1_tags) |
| 300 | /sizeof(asn_DEF_Type1_1_tags[0]), /* 1 */ |
| 301 | asn_DEF_Type1_1_tags, /* Same as above */ |
| 302 | sizeof(asn_DEF_Type1_1_tags) |
| 303 | /sizeof(asn_DEF_Type1_1_tags[0]), /* 1 */ |
| 304 | asn_MBR_Type1_1, |
| 305 | 1, /* Elements count */ |
| 306 | &asn_SPC_Type1_1_specs /* Additional specs */ |
| 307 | }; |
| 308 | |
| 309 | |
| 310 | /*** <<< INCLUDES [Type2] >>> ***/ |
| 311 | |
| 312 | #include <BIT_STRING.h> |
| 313 | #include <INTEGER.h> |
| 314 | #include <constr_SEQUENCE.h> |
| 315 | #include <constr_SET.h> |
| 316 | #include <constr_CHOICE.h> |
| 317 | |
| 318 | /*** <<< DEPS [Type2] >>> ***/ |
| 319 | |
| 320 | typedef enum Type2_PR { |
| 321 | Type2_PR_NOTHING, /* No components present */ |
| 322 | Type2_PR_one_name, |
| 323 | Type2_PR_two_name, |
| 324 | } Type2_PR; |
Lev Walkin | b02a883 | 2005-08-13 23:51:47 +0000 | [diff] [blame] | 325 | typedef enum a { |
| 326 | a_one = 0 |
| 327 | } a_e; |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 328 | |
| 329 | /* |
| 330 | * Method of determining the components presence |
| 331 | */ |
| 332 | typedef enum two_name_PR { |
| 333 | two_name_PR_another_name, /* Member another_name is present */ |
| 334 | } two_name_PR; |
Lev Walkin | b02a883 | 2005-08-13 23:51:47 +0000 | [diff] [blame] | 335 | typedef enum a { |
| 336 | a_one = 0 |
| 337 | } a_e; |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 338 | |
| 339 | /*** <<< TYPE-DECLS [Type2] >>> ***/ |
| 340 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 341 | typedef struct Type2 { |
| 342 | Type2_PR present; |
Lev Walkin | 0f5d74c | 2005-08-14 15:03:31 +0000 | [diff] [blame] | 343 | union Type2_u { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 344 | struct one_name { |
| 345 | struct another_name { |
| 346 | BIT_STRING_t a; |
| 347 | INTEGER_t b; |
| 348 | |
| 349 | /* Context for parsing across buffer boundaries */ |
| 350 | asn_struct_ctx_t _asn_ctx; |
| 351 | } another_name; |
| 352 | |
| 353 | /* Context for parsing across buffer boundaries */ |
| 354 | asn_struct_ctx_t _asn_ctx; |
| 355 | } one_name; |
| 356 | struct two_name { |
| 357 | struct another_name { |
| 358 | BIT_STRING_t a; |
| 359 | INTEGER_t b; |
| 360 | |
| 361 | /* Context for parsing across buffer boundaries */ |
| 362 | asn_struct_ctx_t _asn_ctx; |
| 363 | } another_name; |
| 364 | |
| 365 | /* Presence bitmask: ASN_SET_ISPRESENT(ptwo_name, two_name_PR_x) */ |
| 366 | unsigned int _presence_map |
| 367 | [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 368 | |
| 369 | /* Context for parsing across buffer boundaries */ |
| 370 | asn_struct_ctx_t _asn_ctx; |
| 371 | } two_name; |
| 372 | } choice; |
| 373 | |
| 374 | /* Context for parsing across buffer boundaries */ |
| 375 | asn_struct_ctx_t _asn_ctx; |
| 376 | } Type2_t; |
| 377 | |
Lev Walkin | c828571 | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 378 | /*** <<< FUNC-DECLS [Type2] >>> ***/ |
| 379 | |
| 380 | extern asn_TYPE_descriptor_t asn_DEF_Type2; |
| 381 | |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 382 | /*** <<< CODE [Type2] >>> ***/ |
| 383 | |
| 384 | static int |
| 385 | memb_a_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 386 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 387 | const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; |
| 388 | size_t size; |
| 389 | |
| 390 | if(!sptr) { |
| 391 | _ASN_ERRLOG(app_errlog, app_key, |
| 392 | "%s: value not given (%s:%d)", |
| 393 | td->name, __FILE__, __LINE__); |
| 394 | return -1; |
| 395 | } |
| 396 | |
| 397 | if(st->size > 0) { |
| 398 | /* Size in bits */ |
| 399 | size = 8 * (st->size - 1) - (st->buf[0] & 0x7); |
| 400 | } else { |
| 401 | size = 0; |
| 402 | } |
| 403 | |
| 404 | if((size == 2)) { |
| 405 | /* Constraint check succeeded */ |
| 406 | return 0; |
| 407 | } else { |
| 408 | _ASN_ERRLOG(app_errlog, app_key, |
| 409 | "%s: constraint failed (%s:%d)", |
| 410 | td->name, __FILE__, __LINE__); |
| 411 | return -1; |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | static int |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 416 | memb_a_8_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 417 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 418 | const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; |
| 419 | size_t size; |
| 420 | |
| 421 | if(!sptr) { |
| 422 | _ASN_ERRLOG(app_errlog, app_key, |
| 423 | "%s: value not given (%s:%d)", |
| 424 | td->name, __FILE__, __LINE__); |
| 425 | return -1; |
| 426 | } |
| 427 | |
| 428 | if(st->size > 0) { |
| 429 | /* Size in bits */ |
| 430 | size = 8 * (st->size - 1) - (st->buf[0] & 0x7); |
| 431 | } else { |
| 432 | size = 0; |
| 433 | } |
| 434 | |
| 435 | if((size == 2)) { |
| 436 | /* Constraint check succeeded */ |
| 437 | return 0; |
| 438 | } else { |
| 439 | _ASN_ERRLOG(app_errlog, app_key, |
| 440 | "%s: constraint failed (%s:%d)", |
| 441 | td->name, __FILE__, __LINE__); |
| 442 | return -1; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | |
| 447 | /*** <<< STAT-DEFS [Type2] >>> ***/ |
| 448 | |
| 449 | static asn_TYPE_member_t asn_MBR_another_name_3[] = { |
| 450 | { ATF_NOFLAGS, 0, offsetof(struct another_name, a), |
| 451 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), |
| 452 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 453 | .type = &asn_DEF_BIT_STRING, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 454 | .memb_constraints = memb_a_3_constraint, |
| 455 | .name = "a" |
| 456 | }, |
| 457 | { ATF_NOFLAGS, 0, offsetof(struct another_name, b), |
| 458 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 459 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 460 | .type = &asn_DEF_INTEGER, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 461 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 462 | .name = "b" |
| 463 | }, |
| 464 | }; |
| 465 | static ber_tlv_tag_t asn_DEF_another_name_3_tags[] = { |
| 466 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 467 | }; |
| 468 | static asn_TYPE_tag2member_t asn_MAP_another_name_3_tag2el[] = { |
| 469 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* b at 36 */ |
| 470 | { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* a at 34 */ |
| 471 | }; |
| 472 | static asn_SEQUENCE_specifics_t asn_SPC_another_name_3_specs = { |
| 473 | sizeof(struct another_name), |
| 474 | offsetof(struct another_name, _asn_ctx), |
| 475 | asn_MAP_another_name_3_tag2el, |
| 476 | 2, /* Count of tags in the map */ |
| 477 | -1, /* Start extensions */ |
| 478 | -1 /* Stop extensions */ |
| 479 | }; |
| 480 | static /* Use -fall-defs-global to expose */ |
| 481 | asn_TYPE_descriptor_t asn_DEF_another_name_3 = { |
| 482 | "another-name", |
| 483 | "another-name", |
| 484 | SEQUENCE_free, |
| 485 | SEQUENCE_print, |
| 486 | SEQUENCE_constraint, |
| 487 | SEQUENCE_decode_ber, |
| 488 | SEQUENCE_encode_der, |
| 489 | SEQUENCE_decode_xer, |
| 490 | SEQUENCE_encode_xer, |
| 491 | 0, /* Use generic outmost tag fetcher */ |
| 492 | asn_DEF_another_name_3_tags, |
| 493 | sizeof(asn_DEF_another_name_3_tags) |
| 494 | /sizeof(asn_DEF_another_name_3_tags[0]), /* 1 */ |
| 495 | asn_DEF_another_name_3_tags, /* Same as above */ |
| 496 | sizeof(asn_DEF_another_name_3_tags) |
| 497 | /sizeof(asn_DEF_another_name_3_tags[0]), /* 1 */ |
| 498 | asn_MBR_another_name_3, |
| 499 | 2, /* Elements count */ |
| 500 | &asn_SPC_another_name_3_specs /* Additional specs */ |
| 501 | }; |
| 502 | |
| 503 | static asn_TYPE_member_t asn_MBR_one_name_2[] = { |
| 504 | { ATF_NOFLAGS, 0, offsetof(struct one_name, another_name), |
| 505 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 506 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 507 | .type = &asn_DEF_another_name_3, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 508 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 509 | .name = "another-name" |
| 510 | }, |
| 511 | }; |
| 512 | static ber_tlv_tag_t asn_DEF_one_name_2_tags[] = { |
| 513 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 514 | }; |
| 515 | static asn_TYPE_tag2member_t asn_MAP_one_name_2_tag2el[] = { |
| 516 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name at 34 */ |
| 517 | }; |
| 518 | static asn_SEQUENCE_specifics_t asn_SPC_one_name_2_specs = { |
| 519 | sizeof(struct one_name), |
| 520 | offsetof(struct one_name, _asn_ctx), |
| 521 | asn_MAP_one_name_2_tag2el, |
| 522 | 1, /* Count of tags in the map */ |
| 523 | -1, /* Start extensions */ |
| 524 | -1 /* Stop extensions */ |
| 525 | }; |
| 526 | static /* Use -fall-defs-global to expose */ |
| 527 | asn_TYPE_descriptor_t asn_DEF_one_name_2 = { |
| 528 | "one-name", |
| 529 | "one-name", |
| 530 | SEQUENCE_free, |
| 531 | SEQUENCE_print, |
| 532 | SEQUENCE_constraint, |
| 533 | SEQUENCE_decode_ber, |
| 534 | SEQUENCE_encode_der, |
| 535 | SEQUENCE_decode_xer, |
| 536 | SEQUENCE_encode_xer, |
| 537 | 0, /* Use generic outmost tag fetcher */ |
| 538 | asn_DEF_one_name_2_tags, |
| 539 | sizeof(asn_DEF_one_name_2_tags) |
| 540 | /sizeof(asn_DEF_one_name_2_tags[0]), /* 1 */ |
| 541 | asn_DEF_one_name_2_tags, /* Same as above */ |
| 542 | sizeof(asn_DEF_one_name_2_tags) |
| 543 | /sizeof(asn_DEF_one_name_2_tags[0]), /* 1 */ |
| 544 | asn_MBR_one_name_2, |
| 545 | 1, /* Elements count */ |
| 546 | &asn_SPC_one_name_2_specs /* Additional specs */ |
| 547 | }; |
| 548 | |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 549 | static asn_TYPE_member_t asn_MBR_another_name_8[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 550 | { ATF_NOFLAGS, 0, offsetof(struct another_name, a), |
| 551 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), |
| 552 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 553 | .type = &asn_DEF_BIT_STRING, |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 554 | .memb_constraints = memb_a_8_constraint, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 555 | .name = "a" |
| 556 | }, |
| 557 | { ATF_NOFLAGS, 0, offsetof(struct another_name, b), |
| 558 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 559 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 560 | .type = &asn_DEF_INTEGER, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 561 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 562 | .name = "b" |
| 563 | }, |
| 564 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 565 | static ber_tlv_tag_t asn_DEF_another_name_8_tags[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 566 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 567 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 568 | static asn_TYPE_tag2member_t asn_MAP_another_name_8_tag2el[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 569 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* b at 42 */ |
| 570 | { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* a at 40 */ |
| 571 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 572 | static asn_SEQUENCE_specifics_t asn_SPC_another_name_8_specs = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 573 | sizeof(struct another_name), |
| 574 | offsetof(struct another_name, _asn_ctx), |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 575 | asn_MAP_another_name_8_tag2el, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 576 | 2, /* Count of tags in the map */ |
| 577 | -1, /* Start extensions */ |
| 578 | -1 /* Stop extensions */ |
| 579 | }; |
| 580 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 581 | asn_TYPE_descriptor_t asn_DEF_another_name_8 = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 582 | "another-name", |
| 583 | "another-name", |
| 584 | SEQUENCE_free, |
| 585 | SEQUENCE_print, |
| 586 | SEQUENCE_constraint, |
| 587 | SEQUENCE_decode_ber, |
| 588 | SEQUENCE_encode_der, |
| 589 | SEQUENCE_decode_xer, |
| 590 | SEQUENCE_encode_xer, |
| 591 | 0, /* Use generic outmost tag fetcher */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 592 | asn_DEF_another_name_8_tags, |
| 593 | sizeof(asn_DEF_another_name_8_tags) |
| 594 | /sizeof(asn_DEF_another_name_8_tags[0]), /* 1 */ |
| 595 | asn_DEF_another_name_8_tags, /* Same as above */ |
| 596 | sizeof(asn_DEF_another_name_8_tags) |
| 597 | /sizeof(asn_DEF_another_name_8_tags[0]), /* 1 */ |
| 598 | asn_MBR_another_name_8, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 599 | 2, /* Elements count */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 600 | &asn_SPC_another_name_8_specs /* Additional specs */ |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 601 | }; |
| 602 | |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 603 | static asn_TYPE_member_t asn_MBR_two_name_7[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 604 | { ATF_NOFLAGS, 0, offsetof(struct two_name, another_name), |
| 605 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 606 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 607 | .type = &asn_DEF_another_name_8, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 608 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 609 | .name = "another-name" |
| 610 | }, |
| 611 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 612 | static ber_tlv_tag_t asn_DEF_two_name_7_tags[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 613 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 614 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 615 | static asn_TYPE_tag2member_t asn_MAP_two_name_7_tag2el[] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 616 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name at 40 */ |
| 617 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 618 | static uint8_t asn_MAP_two_name_7_mmap[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 619 | (1 << 7) |
| 620 | }; |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 621 | static asn_SET_specifics_t asn_SPC_two_name_7_specs = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 622 | sizeof(struct two_name), |
| 623 | offsetof(struct two_name, _asn_ctx), |
| 624 | offsetof(struct two_name, _presence_map), |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 625 | asn_MAP_two_name_7_tag2el, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 626 | 1, /* Count of tags in the map */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 627 | asn_MAP_two_name_7_tag2el, /* Same as above */ |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 628 | 1, /* Count of tags in the CXER map */ |
| 629 | 0, /* Whether extensible */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 630 | (unsigned int *)asn_MAP_two_name_7_mmap /* Mandatory elements map */ |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 631 | }; |
| 632 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 633 | asn_TYPE_descriptor_t asn_DEF_two_name_7 = { |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 634 | "two-name", |
| 635 | "two-name", |
| 636 | SET_free, |
| 637 | SET_print, |
| 638 | SET_constraint, |
| 639 | SET_decode_ber, |
| 640 | SET_encode_der, |
| 641 | SET_decode_xer, |
| 642 | SET_encode_xer, |
| 643 | 0, /* Use generic outmost tag fetcher */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 644 | asn_DEF_two_name_7_tags, |
| 645 | sizeof(asn_DEF_two_name_7_tags) |
| 646 | /sizeof(asn_DEF_two_name_7_tags[0]), /* 1 */ |
| 647 | asn_DEF_two_name_7_tags, /* Same as above */ |
| 648 | sizeof(asn_DEF_two_name_7_tags) |
| 649 | /sizeof(asn_DEF_two_name_7_tags[0]), /* 1 */ |
| 650 | asn_MBR_two_name_7, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 651 | 1, /* Elements count */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 652 | &asn_SPC_two_name_7_specs /* Additional specs */ |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 653 | }; |
| 654 | |
| 655 | static asn_TYPE_member_t asn_MBR_Type2_1[] = { |
| 656 | { ATF_NOFLAGS, 0, offsetof(struct Type2, choice.one_name), |
| 657 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 658 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 659 | .type = &asn_DEF_one_name_2, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 660 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 661 | .name = "one-name" |
| 662 | }, |
| 663 | { ATF_NOFLAGS, 0, offsetof(struct Type2, choice.two_name), |
| 664 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), |
| 665 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame^] | 666 | .type = &asn_DEF_two_name_7, |
Lev Walkin | b7f1797 | 2005-03-04 09:10:19 +0000 | [diff] [blame] | 667 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 668 | .name = "two-name" |
| 669 | }, |
| 670 | }; |
| 671 | static asn_TYPE_tag2member_t asn_MAP_Type2_1_tag2el[] = { |
| 672 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* one-name at 37 */ |
| 673 | { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* two-name at 43 */ |
| 674 | }; |
| 675 | static asn_CHOICE_specifics_t asn_SPC_Type2_1_specs = { |
| 676 | sizeof(struct Type2), |
| 677 | offsetof(struct Type2, _asn_ctx), |
| 678 | offsetof(struct Type2, present), |
| 679 | sizeof(((struct Type2 *)0)->present), |
| 680 | asn_MAP_Type2_1_tag2el, |
| 681 | 2, /* Count of tags in the map */ |
| 682 | 0 /* Whether extensible */ |
| 683 | }; |
| 684 | asn_TYPE_descriptor_t asn_DEF_Type2 = { |
| 685 | "Type2", |
| 686 | "Type2", |
| 687 | CHOICE_free, |
| 688 | CHOICE_print, |
| 689 | CHOICE_constraint, |
| 690 | CHOICE_decode_ber, |
| 691 | CHOICE_encode_der, |
| 692 | CHOICE_decode_xer, |
| 693 | CHOICE_encode_xer, |
| 694 | CHOICE_outmost_tag, |
| 695 | 0, /* No effective tags (pointer) */ |
| 696 | 0, /* No effective tags (count) */ |
| 697 | 0, /* No tags (pointer) */ |
| 698 | 0, /* No tags (count) */ |
| 699 | asn_MBR_Type2_1, |
| 700 | 2, /* Elements count */ |
| 701 | &asn_SPC_Type2_1_specs /* Additional specs */ |
| 702 | }; |
| 703 | |