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