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