Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Short] >>> ***/ |
| 3 | |
| 4 | #include <NativeInteger.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Short] >>> ***/ |
| 7 | |
| 8 | typedef long Short_t; |
| 9 | |
| 10 | /*** <<< FUNC-DECLS [Short] >>> ***/ |
| 11 | |
| 12 | extern asn_per_constraints_t asn_PER_type_Short_constr_1; |
| 13 | extern asn_TYPE_descriptor_t asn_DEF_Short; |
| 14 | asn_struct_free_f Short_free; |
| 15 | asn_struct_print_f Short_print; |
| 16 | asn_constr_check_f Short_constraint; |
| 17 | ber_type_decoder_f Short_decode_ber; |
| 18 | der_type_encoder_f Short_encode_der; |
| 19 | xer_type_decoder_f Short_decode_xer; |
| 20 | xer_type_encoder_f Short_encode_xer; |
| 21 | per_type_decoder_f Short_decode_uper; |
| 22 | per_type_encoder_f Short_encode_uper; |
| 23 | |
| 24 | /*** <<< CODE [Short] >>> ***/ |
| 25 | |
| 26 | int |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 27 | Short_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 28 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 29 | long value; |
| 30 | |
| 31 | if(!sptr) { |
| 32 | ASN__CTFAIL(app_key, td, sptr, |
| 33 | "%s: value not given (%s:%d)", |
| 34 | td->name, __FILE__, __LINE__); |
| 35 | return -1; |
| 36 | } |
| 37 | |
| 38 | value = *(const long *)sptr; |
| 39 | |
| 40 | if((value >= 0 && value <= 65535)) { |
| 41 | /* Constraint check succeeded */ |
| 42 | return 0; |
| 43 | } else { |
| 44 | ASN__CTFAIL(app_key, td, sptr, |
| 45 | "%s: constraint failed (%s:%d)", |
| 46 | td->name, __FILE__, __LINE__); |
| 47 | return -1; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * This type is implemented using NativeInteger, |
| 53 | * so here we adjust the DEF accordingly. |
| 54 | */ |
| 55 | |
| 56 | /*** <<< CTDEFS [Short] >>> ***/ |
| 57 | |
Lev Walkin | 0479e04 | 2017-09-26 18:39:58 -0700 | [diff] [blame] | 58 | asn_per_constraints_t asn_PER_type_Short_constr_1 CC_NOTUSED = { |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 59 | { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, |
| 60 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 61 | 0, 0 /* No PER value map */ |
| 62 | }; |
| 63 | |
| 64 | /*** <<< STAT-DEFS [Short] >>> ***/ |
| 65 | |
| 66 | static const ber_tlv_tag_t asn_DEF_Short_tags_1[] = { |
| 67 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 68 | }; |
| 69 | asn_TYPE_descriptor_t asn_DEF_Short = { |
| 70 | "Short", |
| 71 | "Short", |
| 72 | &asn_OP_NativeInteger, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 73 | asn_DEF_Short_tags_1, |
| 74 | sizeof(asn_DEF_Short_tags_1) |
| 75 | /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */ |
| 76 | asn_DEF_Short_tags_1, /* Same as above */ |
| 77 | sizeof(asn_DEF_Short_tags_1) |
| 78 | /sizeof(asn_DEF_Short_tags_1[0]), /* 1 */ |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 79 | { 0, &asn_PER_type_Short_constr_1, Short_constraint }, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 80 | 0, 0, /* No members */ |
| 81 | 0 /* No specifics */ |
| 82 | }; |
| 83 | |
| 84 | |
| 85 | /*** <<< INCLUDES [Alias] >>> ***/ |
| 86 | |
| 87 | #include "Short.h" |
| 88 | |
| 89 | /*** <<< TYPE-DECLS [Alias] >>> ***/ |
| 90 | |
| 91 | typedef Short_t Alias_t; |
| 92 | |
| 93 | /*** <<< FUNC-DECLS [Alias] >>> ***/ |
| 94 | |
Lev Walkin | 135d7dd | 2017-08-28 00:21:38 -0700 | [diff] [blame] | 95 | extern asn_per_constraints_t asn_PER_type_Alias_constr_1; |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 96 | extern asn_TYPE_descriptor_t asn_DEF_Alias; |
| 97 | asn_struct_free_f Alias_free; |
| 98 | asn_struct_print_f Alias_print; |
| 99 | asn_constr_check_f Alias_constraint; |
| 100 | ber_type_decoder_f Alias_decode_ber; |
| 101 | der_type_encoder_f Alias_encode_der; |
| 102 | xer_type_decoder_f Alias_decode_xer; |
| 103 | xer_type_encoder_f Alias_encode_xer; |
| 104 | per_type_decoder_f Alias_decode_uper; |
| 105 | per_type_encoder_f Alias_encode_uper; |
| 106 | |
| 107 | /*** <<< CODE [Alias] >>> ***/ |
| 108 | |
| 109 | int |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 110 | Alias_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 111 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 112 | long value; |
| 113 | |
| 114 | if(!sptr) { |
| 115 | ASN__CTFAIL(app_key, td, sptr, |
| 116 | "%s: value not given (%s:%d)", |
| 117 | td->name, __FILE__, __LINE__); |
| 118 | return -1; |
| 119 | } |
| 120 | |
| 121 | value = *(const long *)sptr; |
| 122 | |
| 123 | if((value >= 0 && value <= 65535)) { |
| 124 | /* Constraint check succeeded */ |
| 125 | return 0; |
| 126 | } else { |
| 127 | ASN__CTFAIL(app_key, td, sptr, |
| 128 | "%s: constraint failed (%s:%d)", |
| 129 | td->name, __FILE__, __LINE__); |
| 130 | return -1; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | * This type is implemented using Short, |
| 136 | * so here we adjust the DEF accordingly. |
| 137 | */ |
| 138 | |
Lev Walkin | 135d7dd | 2017-08-28 00:21:38 -0700 | [diff] [blame] | 139 | /*** <<< CTDEFS [Alias] >>> ***/ |
| 140 | |
Lev Walkin | 0479e04 | 2017-09-26 18:39:58 -0700 | [diff] [blame] | 141 | asn_per_constraints_t asn_PER_type_Alias_constr_1 CC_NOTUSED = { |
Lev Walkin | 135d7dd | 2017-08-28 00:21:38 -0700 | [diff] [blame] | 142 | { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, |
| 143 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 144 | 0, 0 /* No PER value map */ |
| 145 | }; |
| 146 | |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 147 | /*** <<< STAT-DEFS [Alias] >>> ***/ |
| 148 | |
| 149 | static const ber_tlv_tag_t asn_DEF_Alias_tags_1[] = { |
| 150 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 151 | }; |
| 152 | asn_TYPE_descriptor_t asn_DEF_Alias = { |
| 153 | "Alias", |
| 154 | "Alias", |
| 155 | &asn_OP_NativeInteger, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 156 | asn_DEF_Alias_tags_1, |
| 157 | sizeof(asn_DEF_Alias_tags_1) |
| 158 | /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */ |
| 159 | asn_DEF_Alias_tags_1, /* Same as above */ |
| 160 | sizeof(asn_DEF_Alias_tags_1) |
| 161 | /sizeof(asn_DEF_Alias_tags_1[0]), /* 1 */ |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 162 | { 0, &asn_PER_type_Alias_constr_1, Alias_constraint }, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 163 | 0, 0, /* No members */ |
| 164 | 0 /* No specifics */ |
| 165 | }; |
| 166 | |
| 167 | |
| 168 | /*** <<< INCLUDES [Soo] >>> ***/ |
| 169 | |
| 170 | #include <NativeInteger.h> |
| 171 | #include "Short.h" |
| 172 | #include "Alias.h" |
| 173 | #include <constr_SEQUENCE.h> |
| 174 | |
| 175 | /*** <<< TYPE-DECLS [Soo] >>> ***/ |
| 176 | |
| 177 | typedef struct Soo { |
| 178 | long foo; |
| 179 | Short_t bar; |
| 180 | Alias_t baz; |
| 181 | |
| 182 | /* Context for parsing across buffer boundaries */ |
| 183 | asn_struct_ctx_t _asn_ctx; |
| 184 | } Soo_t; |
| 185 | |
| 186 | /*** <<< FUNC-DECLS [Soo] >>> ***/ |
| 187 | |
| 188 | extern asn_TYPE_descriptor_t asn_DEF_Soo; |
| 189 | |
| 190 | /*** <<< CODE [Soo] >>> ***/ |
| 191 | |
| 192 | static int |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 193 | memb_foo_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 194 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 195 | long value; |
| 196 | |
| 197 | if(!sptr) { |
| 198 | ASN__CTFAIL(app_key, td, sptr, |
| 199 | "%s: value not given (%s:%d)", |
| 200 | td->name, __FILE__, __LINE__); |
| 201 | return -1; |
| 202 | } |
| 203 | |
| 204 | value = *(const long *)sptr; |
| 205 | |
| 206 | if((value >= 0 && value <= 65535)) { |
| 207 | /* Constraint check succeeded */ |
| 208 | return 0; |
| 209 | } else { |
| 210 | ASN__CTFAIL(app_key, td, sptr, |
| 211 | "%s: constraint failed (%s:%d)", |
| 212 | td->name, __FILE__, __LINE__); |
| 213 | return -1; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | |
| 218 | /*** <<< CTDEFS [Soo] >>> ***/ |
| 219 | |
Lev Walkin | 0479e04 | 2017-09-26 18:39:58 -0700 | [diff] [blame] | 220 | static asn_per_constraints_t asn_PER_memb_foo_constr_2 CC_NOTUSED = { |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 221 | { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, |
| 222 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 223 | 0, 0 /* No PER value map */ |
| 224 | }; |
| 225 | |
| 226 | /*** <<< STAT-DEFS [Soo] >>> ***/ |
| 227 | |
| 228 | static asn_TYPE_member_t asn_MBR_Soo_1[] = { |
| 229 | { ATF_NOFLAGS, 0, offsetof(struct Soo, foo), |
| 230 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 231 | .tag_mode = 0, |
| 232 | .type = &asn_DEF_NativeInteger, |
| 233 | .type_selector = 0, |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 234 | { .oer_constraints = 0, .per_constraints = &asn_PER_memb_foo_constr_2, .general_constraints = memb_foo_constraint_1 }, |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 235 | 0, 0, /* No default value */ |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 236 | .name = "foo" |
| 237 | }, |
| 238 | { ATF_NOFLAGS, 0, offsetof(struct Soo, bar), |
| 239 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 240 | .tag_mode = 0, |
| 241 | .type = &asn_DEF_Short, |
| 242 | .type_selector = 0, |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 243 | { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 }, |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 244 | 0, 0, /* No default value */ |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 245 | .name = "bar" |
| 246 | }, |
| 247 | { ATF_NOFLAGS, 0, offsetof(struct Soo, baz), |
| 248 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 249 | .tag_mode = 0, |
| 250 | .type = &asn_DEF_Alias, |
| 251 | .type_selector = 0, |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 252 | { .oer_constraints = 0, .per_constraints = 0, .general_constraints = 0 }, |
Lev Walkin | 20696a4 | 2017-10-17 21:27:33 -0700 | [diff] [blame] | 253 | 0, 0, /* No default value */ |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 254 | .name = "baz" |
| 255 | }, |
| 256 | }; |
| 257 | static const ber_tlv_tag_t asn_DEF_Soo_tags_1[] = { |
| 258 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 259 | }; |
| 260 | static const asn_TYPE_tag2member_t asn_MAP_Soo_tag2el_1[] = { |
| 261 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* foo */ |
| 262 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 1 }, /* bar */ |
| 263 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -2, 0 } /* baz */ |
| 264 | }; |
| 265 | static asn_SEQUENCE_specifics_t asn_SPC_Soo_specs_1 = { |
| 266 | sizeof(struct Soo), |
| 267 | offsetof(struct Soo, _asn_ctx), |
| 268 | .tag2el = asn_MAP_Soo_tag2el_1, |
| 269 | .tag2el_count = 3, /* Count of tags in the map */ |
| 270 | 0, 0, 0, /* Optional elements (not needed) */ |
| 271 | -1, /* Start extensions */ |
| 272 | -1 /* Stop extensions */ |
| 273 | }; |
| 274 | asn_TYPE_descriptor_t asn_DEF_Soo = { |
| 275 | "Soo", |
| 276 | "Soo", |
| 277 | &asn_OP_SEQUENCE, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 278 | asn_DEF_Soo_tags_1, |
| 279 | sizeof(asn_DEF_Soo_tags_1) |
| 280 | /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */ |
| 281 | asn_DEF_Soo_tags_1, /* Same as above */ |
| 282 | sizeof(asn_DEF_Soo_tags_1) |
| 283 | /sizeof(asn_DEF_Soo_tags_1[0]), /* 1 */ |
Lev Walkin | 0bfea56 | 2017-09-29 23:16:48 -0700 | [diff] [blame] | 284 | { 0, 0, SEQUENCE_constraint }, |
Lev Walkin | 20dc624 | 2017-08-27 23:44:39 -0700 | [diff] [blame] | 285 | asn_MBR_Soo_1, |
| 286 | 3, /* Elements count */ |
| 287 | &asn_SPC_Soo_specs_1 /* Additional specs */ |
| 288 | }; |
| 289 | |