Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [T] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | #include <OCTET_STRING.h> |
| 6 | #include <REAL.h> |
| 7 | #include <constr_SET.h> |
| 8 | #include <constr_SEQUENCE.h> |
| 9 | |
| 10 | /*** <<< DEPS [T] >>> ***/ |
| 11 | |
| 12 | |
| 13 | /* |
| 14 | * Method of determining the components presence |
| 15 | */ |
| 16 | typedef enum class_PR { |
| 17 | } class_PR; |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 18 | |
| 19 | /*** <<< TYPE-DECLS [T] >>> ***/ |
| 20 | |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 21 | typedef struct T { |
| 22 | INTEGER_t Int; |
| 23 | OCTET_STRING_t Char; |
| 24 | struct Class { |
| 25 | /* |
| 26 | * This type is extensible, |
| 27 | * possible extensions are below. |
| 28 | */ |
| 29 | |
| 30 | /* Presence bitmask: ASN_SET_ISPRESENT(pclass, class_PR_x) */ |
| 31 | unsigned int _presence_map |
| 32 | [((0+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 33 | |
| 34 | /* Context for parsing across buffer boundaries */ |
| 35 | asn_struct_ctx_t _asn_ctx; |
| 36 | } Class; |
| 37 | REAL_t Double; |
| 38 | |
| 39 | /* Context for parsing across buffer boundaries */ |
| 40 | asn_struct_ctx_t _asn_ctx; |
| 41 | } T_t; |
| 42 | |
Lev Walkin | c828571 | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 43 | /*** <<< FUNC-DECLS [T] >>> ***/ |
| 44 | |
| 45 | extern asn_TYPE_descriptor_t asn_DEF_T; |
| 46 | |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 47 | /*** <<< CODE [T] >>> ***/ |
| 48 | |
| 49 | static int |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 50 | memb_char_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 51 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 8a7af0e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 52 | const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 53 | size_t size; |
| 54 | |
| 55 | if(!sptr) { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 56 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 57 | "%s: value not given (%s:%d)", |
| 58 | td->name, __FILE__, __LINE__); |
| 59 | return -1; |
| 60 | } |
| 61 | |
| 62 | size = st->size; |
| 63 | |
| 64 | if((size == 1)) { |
| 65 | /* Constraint check succeeded */ |
| 66 | return 0; |
| 67 | } else { |
Lev Walkin | 739d9bf | 2006-07-13 13:28:32 +0000 | [diff] [blame] | 68 | _ASN_CTFAIL(app_key, td, sptr, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 69 | "%s: constraint failed (%s:%d)", |
| 70 | td->name, __FILE__, __LINE__); |
| 71 | return -1; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /*** <<< STAT-DEFS [T] >>> ***/ |
| 77 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 78 | static ber_tlv_tag_t asn_DEF_class_tags_4[] = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 79 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 80 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 81 | static uint8_t asn_MAP_class_mmap_4[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 82 | 0 |
| 83 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 84 | static asn_SET_specifics_t asn_SPC_class_specs_4 = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 85 | sizeof(struct Class), |
| 86 | offsetof(struct Class, _asn_ctx), |
| 87 | offsetof(struct Class, _presence_map), |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 88 | asn_MAP_class_tag2el_4, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 89 | 0, /* Count of tags in the map */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 90 | asn_MAP_class_tag2el_4, /* Same as above */ |
Lev Walkin | f82138b | 2005-02-25 08:20:32 +0000 | [diff] [blame] | 91 | 0, /* Count of tags in the CXER map */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 92 | 1, /* Whether extensible */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 93 | (unsigned int *)asn_MAP_class_mmap_4 /* Mandatory elements map */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 94 | }; |
| 95 | static /* Use -fall-defs-global to expose */ |
Lev Walkin | e8318b8 | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 96 | asn_TYPE_descriptor_t asn_DEF_class_4 = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 97 | "class", |
| 98 | "class", |
| 99 | SET_free, |
| 100 | SET_print, |
| 101 | SET_constraint, |
| 102 | SET_decode_ber, |
| 103 | SET_encode_der, |
Lev Walkin | b223080 | 2005-02-14 20:31:31 +0000 | [diff] [blame] | 104 | SET_decode_xer, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 105 | SET_encode_xer, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 106 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 107 | 0, /* Use generic outmost tag fetcher */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 108 | asn_DEF_class_tags_4, |
| 109 | sizeof(asn_DEF_class_tags_4) |
| 110 | /sizeof(asn_DEF_class_tags_4[0]), /* 1 */ |
| 111 | asn_DEF_class_tags_4, /* Same as above */ |
| 112 | sizeof(asn_DEF_class_tags_4) |
| 113 | /sizeof(asn_DEF_class_tags_4[0]), /* 1 */ |
| 114 | 0, /* No PER visible constraints */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 115 | 0, 0, /* No members */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 116 | &asn_SPC_class_specs_4 /* Additional specs */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 117 | }; |
| 118 | |
Lev Walkin | e0272aa | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 119 | static asn_TYPE_member_t asn_MBR_T_1[] = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 120 | { ATF_NOFLAGS, 0, offsetof(struct T, Int), |
| 121 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 122 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 123 | .type = &asn_DEF_INTEGER, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 124 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 125 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 126 | .default_value = 0, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 127 | .name = "int" |
| 128 | }, |
| 129 | { ATF_NOFLAGS, 0, offsetof(struct T, Char), |
| 130 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), |
| 131 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 132 | .type = &asn_DEF_OCTET_STRING, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 133 | .memb_constraints = memb_char_constraint_1, |
| 134 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 135 | .default_value = 0, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 136 | .name = "char" |
| 137 | }, |
| 138 | { ATF_NOFLAGS, 0, offsetof(struct T, Class), |
| 139 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), |
| 140 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 141 | .type = &asn_DEF_class_4, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 142 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 143 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 144 | .default_value = 0, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 145 | .name = "class" |
| 146 | }, |
| 147 | { ATF_NOFLAGS, 0, offsetof(struct T, Double), |
| 148 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), |
| 149 | .tag_mode = 0, |
Lev Walkin | ae7bf3f | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 150 | .type = &asn_DEF_REAL, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 151 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 152 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 153 | .default_value = 0, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 154 | .name = "double" |
| 155 | }, |
| 156 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 157 | static ber_tlv_tag_t asn_DEF_T_tags_1[] = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 158 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 159 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 160 | static asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 161 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int at 15 */ |
| 162 | { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char at 16 */ |
| 163 | { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double at 18 */ |
Lev Walkin | f82138b | 2005-02-25 08:20:32 +0000 | [diff] [blame] | 164 | { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* class at 17 */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 165 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 166 | static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 167 | sizeof(struct T), |
| 168 | offsetof(struct T, _asn_ctx), |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 169 | asn_MAP_T_tag2el_1, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 170 | 4, /* Count of tags in the map */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 171 | 0, 0, 0, /* Optional elements (not needed) */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 172 | -1, /* Start extensions */ |
| 173 | -1 /* Stop extensions */ |
| 174 | }; |
| 175 | asn_TYPE_descriptor_t asn_DEF_T = { |
| 176 | "T", |
| 177 | "T", |
| 178 | SEQUENCE_free, |
| 179 | SEQUENCE_print, |
| 180 | SEQUENCE_constraint, |
| 181 | SEQUENCE_decode_ber, |
| 182 | SEQUENCE_encode_der, |
| 183 | SEQUENCE_decode_xer, |
| 184 | SEQUENCE_encode_xer, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 185 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 186 | 0, /* Use generic outmost tag fetcher */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 187 | asn_DEF_T_tags_1, |
| 188 | sizeof(asn_DEF_T_tags_1) |
| 189 | /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ |
| 190 | asn_DEF_T_tags_1, /* Same as above */ |
| 191 | sizeof(asn_DEF_T_tags_1) |
| 192 | /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ |
| 193 | 0, /* No PER visible constraints */ |
Lev Walkin | e0272aa | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 194 | asn_MBR_T_1, |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 195 | 4, /* Elements count */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 196 | &asn_SPC_T_specs_1 /* Additional specs */ |
Lev Walkin | 64d99e9 | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 197 | }; |
| 198 | |