vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [TestChoice] >>> ***/ |
| 3 | |
vlm | a33a216 | 2005-08-14 02:40:04 +0000 | [diff] [blame] | 4 | #include <NativeInteger.h> |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 5 | #include <constr_SEQUENCE.h> |
| 6 | #include <BOOLEAN.h> |
| 7 | #include <constr_CHOICE.h> |
| 8 | |
| 9 | /*** <<< DEPS [TestChoice] >>> ***/ |
| 10 | |
| 11 | typedef enum TestChoice_PR { |
| 12 | TestChoice_PR_NOTHING, /* No components present */ |
| 13 | TestChoice_PR_type1, |
| 14 | TestChoice_PR_type2, |
| 15 | } TestChoice_PR; |
| 16 | |
| 17 | /*** <<< TYPE-DECLS [TestChoice] >>> ***/ |
| 18 | |
| 19 | typedef struct TestChoice { |
| 20 | TestChoice_PR present; |
vlm | 2e77428 | 2005-08-14 15:03:31 +0000 | [diff] [blame] | 21 | union TestChoice_u { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 22 | struct type1 { |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 23 | long common /* DEFAULT 0 */; |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 24 | |
| 25 | /* Context for parsing across buffer boundaries */ |
| 26 | asn_struct_ctx_t _asn_ctx; |
| 27 | } type1; |
| 28 | struct type2 { |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 29 | BOOLEAN_t common /* DEFAULT 0 */; |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 30 | |
| 31 | /* Context for parsing across buffer boundaries */ |
| 32 | asn_struct_ctx_t _asn_ctx; |
| 33 | } type2; |
| 34 | } choice; |
| 35 | |
| 36 | /* Context for parsing across buffer boundaries */ |
| 37 | asn_struct_ctx_t _asn_ctx; |
| 38 | } TestChoice_t; |
| 39 | |
| 40 | /*** <<< FUNC-DECLS [TestChoice] >>> ***/ |
| 41 | |
| 42 | extern asn_TYPE_descriptor_t asn_DEF_TestChoice; |
| 43 | |
| 44 | /*** <<< CODE [TestChoice] >>> ***/ |
| 45 | |
| 46 | static int |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 47 | memb_common_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 48 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 49 | long value; |
| 50 | |
| 51 | if(!sptr) { |
| 52 | _ASN_ERRLOG(app_errlog, app_key, |
| 53 | "%s: value not given (%s:%d)", |
| 54 | td->name, __FILE__, __LINE__); |
| 55 | return -1; |
| 56 | } |
| 57 | |
vlm | a33a216 | 2005-08-14 02:40:04 +0000 | [diff] [blame] | 58 | value = *(const long *)sptr; |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 59 | |
| 60 | if((value >= 1 && value <= 10)) { |
| 61 | /* Constraint check succeeded */ |
| 62 | return 0; |
| 63 | } else { |
| 64 | _ASN_ERRLOG(app_errlog, app_key, |
| 65 | "%s: constraint failed (%s:%d)", |
| 66 | td->name, __FILE__, __LINE__); |
| 67 | return -1; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /*** <<< STAT-DEFS [TestChoice] >>> ***/ |
| 73 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 74 | static int asn_DFL_3_set_0(void **sptr) { |
| 75 | long *st = *sptr; |
| 76 | |
| 77 | if(!st) { |
| 78 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 79 | if(!st) return -1; |
| 80 | } |
| 81 | |
| 82 | /* Install default value 0 */ |
| 83 | *st = 0; |
| 84 | return 0; |
| 85 | } |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 86 | static asn_TYPE_member_t asn_MBR_type1_2[] = { |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 87 | { ATF_NOFLAGS, 1, offsetof(struct type1, common), |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 88 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 89 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 90 | .type = &asn_DEF_NativeInteger, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 91 | .memb_constraints = memb_common_constraint_2, |
| 92 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 93 | .default_value = asn_DFL_3_set_0, /* DEFAULT 0 */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 94 | .name = "common" |
| 95 | }, |
| 96 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 97 | static ber_tlv_tag_t asn_DEF_type1_tags_2[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 98 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 99 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 100 | static asn_TYPE_tag2member_t asn_MAP_type1_tag2el_2[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 101 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* common at 20 */ |
| 102 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 103 | static asn_SEQUENCE_specifics_t asn_SPC_type1_specs_2 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 104 | sizeof(struct type1), |
| 105 | offsetof(struct type1, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 106 | asn_MAP_type1_tag2el_2, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 107 | 1, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 108 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 109 | -1, /* Start extensions */ |
| 110 | -1 /* Stop extensions */ |
| 111 | }; |
| 112 | static /* Use -fall-defs-global to expose */ |
| 113 | asn_TYPE_descriptor_t asn_DEF_type1_2 = { |
| 114 | "type1", |
| 115 | "type1", |
| 116 | SEQUENCE_free, |
| 117 | SEQUENCE_print, |
| 118 | SEQUENCE_constraint, |
| 119 | SEQUENCE_decode_ber, |
| 120 | SEQUENCE_encode_der, |
| 121 | SEQUENCE_decode_xer, |
| 122 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 123 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 124 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 125 | asn_DEF_type1_tags_2, |
| 126 | sizeof(asn_DEF_type1_tags_2) |
| 127 | /sizeof(asn_DEF_type1_tags_2[0]), /* 1 */ |
| 128 | asn_DEF_type1_tags_2, /* Same as above */ |
| 129 | sizeof(asn_DEF_type1_tags_2) |
| 130 | /sizeof(asn_DEF_type1_tags_2[0]), /* 1 */ |
| 131 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 132 | asn_MBR_type1_2, |
| 133 | 1, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 134 | &asn_SPC_type1_specs_2 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 135 | }; |
| 136 | |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 137 | static int asn_DFL_5_set_0(void **sptr) { |
| 138 | BOOLEAN_t *st = *sptr; |
| 139 | |
| 140 | if(!st) { |
| 141 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 142 | if(!st) return -1; |
| 143 | } |
| 144 | |
| 145 | /* Install default value 0 */ |
| 146 | *st = 0; |
| 147 | return 0; |
| 148 | } |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 149 | static asn_TYPE_member_t asn_MBR_type2_4[] = { |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 150 | { ATF_NOFLAGS, 1, offsetof(struct type2, common), |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 151 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), |
| 152 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 153 | .type = &asn_DEF_BOOLEAN, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 154 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 155 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 156 | .default_value = asn_DFL_5_set_0, /* DEFAULT 0 */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 157 | .name = "common" |
| 158 | }, |
| 159 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 160 | static ber_tlv_tag_t asn_DEF_type2_tags_4[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 161 | (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 162 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 163 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 164 | static asn_TYPE_tag2member_t asn_MAP_type2_tag2el_4[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 165 | { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 } /* common at 21 */ |
| 166 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 167 | static asn_SEQUENCE_specifics_t asn_SPC_type2_specs_4 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 168 | sizeof(struct type2), |
| 169 | offsetof(struct type2, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 170 | asn_MAP_type2_tag2el_4, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 171 | 1, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 172 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 173 | -1, /* Start extensions */ |
| 174 | -1 /* Stop extensions */ |
| 175 | }; |
| 176 | static /* Use -fall-defs-global to expose */ |
| 177 | asn_TYPE_descriptor_t asn_DEF_type2_4 = { |
| 178 | "type2", |
| 179 | "type2", |
| 180 | SEQUENCE_free, |
| 181 | SEQUENCE_print, |
| 182 | SEQUENCE_constraint, |
| 183 | SEQUENCE_decode_ber, |
| 184 | SEQUENCE_encode_der, |
| 185 | SEQUENCE_decode_xer, |
| 186 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 187 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 188 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 189 | asn_DEF_type2_tags_4, |
| 190 | sizeof(asn_DEF_type2_tags_4) |
| 191 | /sizeof(asn_DEF_type2_tags_4[0]) - 1, /* 1 */ |
| 192 | asn_DEF_type2_tags_4, /* Same as above */ |
| 193 | sizeof(asn_DEF_type2_tags_4) |
| 194 | /sizeof(asn_DEF_type2_tags_4[0]), /* 2 */ |
| 195 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 196 | asn_MBR_type2_4, |
| 197 | 1, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 198 | &asn_SPC_type2_specs_4 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | static asn_TYPE_member_t asn_MBR_TestChoice_1[] = { |
| 202 | { ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type1), |
| 203 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 204 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 205 | .type = &asn_DEF_type1_2, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 206 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 207 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 208 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 209 | .name = "type1" |
| 210 | }, |
| 211 | { ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type2), |
| 212 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 213 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 214 | .type = &asn_DEF_type2_4, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 215 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 216 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 217 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 218 | .name = "type2" |
| 219 | }, |
| 220 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 221 | static asn_TYPE_tag2member_t asn_MAP_TestChoice_tag2el_1[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 222 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* type1 at 16 */ |
| 223 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* type2 at 16 */ |
| 224 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 225 | static asn_CHOICE_specifics_t asn_SPC_TestChoice_specs_1 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 226 | sizeof(struct TestChoice), |
| 227 | offsetof(struct TestChoice, _asn_ctx), |
| 228 | offsetof(struct TestChoice, present), |
| 229 | sizeof(((struct TestChoice *)0)->present), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 230 | asn_MAP_TestChoice_tag2el_1, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 231 | 2, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 232 | .canonical_order = 0, |
| 233 | .ext_start = -1 /* Extensions start */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 234 | }; |
| 235 | asn_TYPE_descriptor_t asn_DEF_TestChoice = { |
| 236 | "TestChoice", |
| 237 | "TestChoice", |
| 238 | CHOICE_free, |
| 239 | CHOICE_print, |
| 240 | CHOICE_constraint, |
| 241 | CHOICE_decode_ber, |
| 242 | CHOICE_encode_der, |
| 243 | CHOICE_decode_xer, |
| 244 | CHOICE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 245 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 246 | CHOICE_outmost_tag, |
| 247 | 0, /* No effective tags (pointer) */ |
| 248 | 0, /* No effective tags (count) */ |
| 249 | 0, /* No tags (pointer) */ |
| 250 | 0, /* No tags (count) */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 251 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 252 | asn_MBR_TestChoice_1, |
| 253 | 2, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 254 | &asn_SPC_TestChoice_specs_1 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | |
| 258 | /*** <<< INCLUDES [AutoChoice] >>> ***/ |
| 259 | |
vlm | a33a216 | 2005-08-14 02:40:04 +0000 | [diff] [blame] | 260 | #include <NativeInteger.h> |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 261 | #include <constr_SEQUENCE.h> |
| 262 | #include <BOOLEAN.h> |
| 263 | #include <constr_CHOICE.h> |
| 264 | |
| 265 | /*** <<< DEPS [AutoChoice] >>> ***/ |
| 266 | |
| 267 | typedef enum AutoChoice_PR { |
| 268 | AutoChoice_PR_NOTHING, /* No components present */ |
| 269 | AutoChoice_PR_type1, |
| 270 | AutoChoice_PR_type2, |
| 271 | } AutoChoice_PR; |
| 272 | |
| 273 | /*** <<< TYPE-DECLS [AutoChoice] >>> ***/ |
| 274 | |
| 275 | typedef struct AutoChoice { |
| 276 | AutoChoice_PR present; |
vlm | 2e77428 | 2005-08-14 15:03:31 +0000 | [diff] [blame] | 277 | union AutoChoice_u { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 278 | struct type1 { |
vlm | a33a216 | 2005-08-14 02:40:04 +0000 | [diff] [blame] | 279 | long common; |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 280 | |
| 281 | /* Context for parsing across buffer boundaries */ |
| 282 | asn_struct_ctx_t _asn_ctx; |
| 283 | } type1; |
| 284 | struct type2 { |
| 285 | BOOLEAN_t common; |
| 286 | |
| 287 | /* Context for parsing across buffer boundaries */ |
| 288 | asn_struct_ctx_t _asn_ctx; |
| 289 | } type2; |
| 290 | } choice; |
| 291 | |
| 292 | /* Context for parsing across buffer boundaries */ |
| 293 | asn_struct_ctx_t _asn_ctx; |
| 294 | } AutoChoice_t; |
| 295 | |
| 296 | /*** <<< FUNC-DECLS [AutoChoice] >>> ***/ |
| 297 | |
| 298 | extern asn_TYPE_descriptor_t asn_DEF_AutoChoice; |
| 299 | |
| 300 | /*** <<< CODE [AutoChoice] >>> ***/ |
| 301 | |
| 302 | static int |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 303 | memb_common_constraint_2(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 304 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 305 | long value; |
| 306 | |
| 307 | if(!sptr) { |
| 308 | _ASN_ERRLOG(app_errlog, app_key, |
| 309 | "%s: value not given (%s:%d)", |
| 310 | td->name, __FILE__, __LINE__); |
| 311 | return -1; |
| 312 | } |
| 313 | |
vlm | a33a216 | 2005-08-14 02:40:04 +0000 | [diff] [blame] | 314 | value = *(const long *)sptr; |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 315 | |
| 316 | if((value == 0)) { |
| 317 | /* Constraint check succeeded */ |
| 318 | return 0; |
| 319 | } else { |
| 320 | _ASN_ERRLOG(app_errlog, app_key, |
| 321 | "%s: constraint failed (%s:%d)", |
| 322 | td->name, __FILE__, __LINE__); |
| 323 | return -1; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | static int |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 328 | memb_common_constraint_4(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 329 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 330 | BOOLEAN_t value; |
| 331 | |
| 332 | if(!sptr) { |
| 333 | _ASN_ERRLOG(app_errlog, app_key, |
| 334 | "%s: value not given (%s:%d)", |
| 335 | td->name, __FILE__, __LINE__); |
| 336 | return -1; |
| 337 | } |
| 338 | |
| 339 | value = (*(const long *)sptr) ? 1 : 0; |
| 340 | |
| 341 | if((value <= 0)) { |
| 342 | /* Constraint check succeeded */ |
| 343 | return 0; |
| 344 | } else { |
| 345 | _ASN_ERRLOG(app_errlog, app_key, |
| 346 | "%s: constraint failed (%s:%d)", |
| 347 | td->name, __FILE__, __LINE__); |
| 348 | return -1; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | |
| 353 | /*** <<< STAT-DEFS [AutoChoice] >>> ***/ |
| 354 | |
| 355 | static asn_TYPE_member_t asn_MBR_type1_2[] = { |
| 356 | { ATF_NOFLAGS, 0, offsetof(struct type1, common), |
| 357 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 358 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 359 | .type = &asn_DEF_NativeInteger, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 360 | .memb_constraints = memb_common_constraint_2, |
| 361 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 362 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 363 | .name = "common" |
| 364 | }, |
| 365 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 366 | static ber_tlv_tag_t asn_DEF_type1_tags_2[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 367 | (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 368 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 369 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 370 | static asn_TYPE_tag2member_t asn_MAP_type1_tag2el_2[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 371 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common at 37 */ |
| 372 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 373 | static asn_SEQUENCE_specifics_t asn_SPC_type1_specs_2 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 374 | sizeof(struct type1), |
| 375 | offsetof(struct type1, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 376 | asn_MAP_type1_tag2el_2, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 377 | 1, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 378 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 379 | -1, /* Start extensions */ |
| 380 | -1 /* Stop extensions */ |
| 381 | }; |
| 382 | static /* Use -fall-defs-global to expose */ |
| 383 | asn_TYPE_descriptor_t asn_DEF_type1_2 = { |
| 384 | "type1", |
| 385 | "type1", |
| 386 | SEQUENCE_free, |
| 387 | SEQUENCE_print, |
| 388 | SEQUENCE_constraint, |
| 389 | SEQUENCE_decode_ber, |
| 390 | SEQUENCE_encode_der, |
| 391 | SEQUENCE_decode_xer, |
| 392 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 393 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 394 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 395 | asn_DEF_type1_tags_2, |
| 396 | sizeof(asn_DEF_type1_tags_2) |
| 397 | /sizeof(asn_DEF_type1_tags_2[0]) - 1, /* 1 */ |
| 398 | asn_DEF_type1_tags_2, /* Same as above */ |
| 399 | sizeof(asn_DEF_type1_tags_2) |
| 400 | /sizeof(asn_DEF_type1_tags_2[0]), /* 2 */ |
| 401 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 402 | asn_MBR_type1_2, |
| 403 | 1, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 404 | &asn_SPC_type1_specs_2 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 405 | }; |
| 406 | |
| 407 | static asn_TYPE_member_t asn_MBR_type2_4[] = { |
| 408 | { ATF_NOFLAGS, 0, offsetof(struct type2, common), |
| 409 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 410 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 411 | .type = &asn_DEF_BOOLEAN, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 412 | .memb_constraints = memb_common_constraint_4, |
| 413 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 414 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 415 | .name = "common" |
| 416 | }, |
| 417 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 418 | static ber_tlv_tag_t asn_DEF_type2_tags_4[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 419 | (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 420 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 421 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 422 | static asn_TYPE_tag2member_t asn_MAP_type2_tag2el_4[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 423 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common at 38 */ |
| 424 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 425 | static asn_SEQUENCE_specifics_t asn_SPC_type2_specs_4 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 426 | sizeof(struct type2), |
| 427 | offsetof(struct type2, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 428 | asn_MAP_type2_tag2el_4, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 429 | 1, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 430 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 431 | -1, /* Start extensions */ |
| 432 | -1 /* Stop extensions */ |
| 433 | }; |
| 434 | static /* Use -fall-defs-global to expose */ |
| 435 | asn_TYPE_descriptor_t asn_DEF_type2_4 = { |
| 436 | "type2", |
| 437 | "type2", |
| 438 | SEQUENCE_free, |
| 439 | SEQUENCE_print, |
| 440 | SEQUENCE_constraint, |
| 441 | SEQUENCE_decode_ber, |
| 442 | SEQUENCE_encode_der, |
| 443 | SEQUENCE_decode_xer, |
| 444 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 445 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 446 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 447 | asn_DEF_type2_tags_4, |
| 448 | sizeof(asn_DEF_type2_tags_4) |
| 449 | /sizeof(asn_DEF_type2_tags_4[0]) - 1, /* 1 */ |
| 450 | asn_DEF_type2_tags_4, /* Same as above */ |
| 451 | sizeof(asn_DEF_type2_tags_4) |
| 452 | /sizeof(asn_DEF_type2_tags_4[0]), /* 2 */ |
| 453 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 454 | asn_MBR_type2_4, |
| 455 | 1, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 456 | &asn_SPC_type2_specs_4 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 457 | }; |
| 458 | |
| 459 | static asn_TYPE_member_t asn_MBR_AutoChoice_1[] = { |
| 460 | { ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type1), |
| 461 | .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), |
| 462 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 463 | .type = &asn_DEF_type1_2, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 464 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 465 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 466 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 467 | .name = "type1" |
| 468 | }, |
| 469 | { ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type2), |
| 470 | .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), |
| 471 | .tag_mode = -1, /* IMPLICIT tag at current level */ |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 472 | .type = &asn_DEF_type2_4, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 473 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 474 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 475 | .default_value = 0, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 476 | .name = "type2" |
| 477 | }, |
| 478 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 479 | static asn_TYPE_tag2member_t asn_MAP_AutoChoice_tag2el_1[] = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 480 | { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* type1 at 34 */ |
| 481 | { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* type2 at 34 */ |
| 482 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 483 | static asn_CHOICE_specifics_t asn_SPC_AutoChoice_specs_1 = { |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 484 | sizeof(struct AutoChoice), |
| 485 | offsetof(struct AutoChoice, _asn_ctx), |
| 486 | offsetof(struct AutoChoice, present), |
| 487 | sizeof(((struct AutoChoice *)0)->present), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 488 | asn_MAP_AutoChoice_tag2el_1, |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 489 | 2, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 490 | .canonical_order = 0, |
| 491 | .ext_start = -1 /* Extensions start */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 492 | }; |
| 493 | asn_TYPE_descriptor_t asn_DEF_AutoChoice = { |
| 494 | "AutoChoice", |
| 495 | "AutoChoice", |
| 496 | CHOICE_free, |
| 497 | CHOICE_print, |
| 498 | CHOICE_constraint, |
| 499 | CHOICE_decode_ber, |
| 500 | CHOICE_encode_der, |
| 501 | CHOICE_decode_xer, |
| 502 | CHOICE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 503 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 504 | CHOICE_outmost_tag, |
| 505 | 0, /* No effective tags (pointer) */ |
| 506 | 0, /* No effective tags (count) */ |
| 507 | 0, /* No tags (pointer) */ |
| 508 | 0, /* No tags (count) */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 509 | 0, /* No PER visible constraints */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 510 | asn_MBR_AutoChoice_1, |
| 511 | 2, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 512 | &asn_SPC_AutoChoice_specs_1 /* Additional specs */ |
vlm | 1a9741e | 2005-07-03 05:27:19 +0000 | [diff] [blame] | 513 | }; |
| 514 | |