Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4 | #include <NativeInteger.h> |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 8 | typedef long Int1_t; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 9 | |
| 10 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 11 | |
| 12 | extern asn_TYPE_descriptor_t asn_DEF_Int1; |
| 13 | asn_struct_free_f Int1_free; |
| 14 | asn_struct_print_f Int1_print; |
| 15 | asn_constr_check_f Int1_constraint; |
| 16 | ber_type_decoder_f Int1_decode_ber; |
| 17 | der_type_encoder_f Int1_encode_der; |
| 18 | xer_type_decoder_f Int1_decode_xer; |
| 19 | xer_type_encoder_f Int1_encode_xer; |
| 20 | per_type_decoder_f Int1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 21 | per_type_encoder_f Int1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 22 | |
| 23 | /*** <<< CODE [Int1] >>> ***/ |
| 24 | |
| 25 | int |
| 26 | Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 27 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 28 | /* Replace with underlying type checker */ |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 29 | td->check_constraints = asn_DEF_NativeInteger.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 30 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | /* |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 34 | * This type is implemented using NativeInteger, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 35 | * so here we adjust the DEF accordingly. |
| 36 | */ |
| 37 | static void |
| 38 | Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 39 | td->free_struct = asn_DEF_NativeInteger.free_struct; |
| 40 | td->print_struct = asn_DEF_NativeInteger.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 41 | td->check_constraints = asn_DEF_NativeInteger.check_constraints; |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 42 | td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; |
| 43 | td->der_encoder = asn_DEF_NativeInteger.der_encoder; |
| 44 | td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; |
| 45 | td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; |
| 46 | td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; |
| 47 | td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 48 | if(!td->per_constraints) |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 49 | td->per_constraints = asn_DEF_NativeInteger.per_constraints; |
| 50 | td->elements = asn_DEF_NativeInteger.elements; |
| 51 | td->elements_count = asn_DEF_NativeInteger.elements_count; |
| 52 | td->specifics = asn_DEF_NativeInteger.specifics; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | void |
| 56 | Int1_free(asn_TYPE_descriptor_t *td, |
| 57 | void *struct_ptr, int contents_only) { |
| 58 | Int1_1_inherit_TYPE_descriptor(td); |
| 59 | td->free_struct(td, struct_ptr, contents_only); |
| 60 | } |
| 61 | |
| 62 | int |
| 63 | Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 64 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 65 | Int1_1_inherit_TYPE_descriptor(td); |
| 66 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 67 | } |
| 68 | |
| 69 | asn_dec_rval_t |
| 70 | Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 71 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 72 | Int1_1_inherit_TYPE_descriptor(td); |
| 73 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 74 | } |
| 75 | |
| 76 | asn_enc_rval_t |
| 77 | Int1_encode_der(asn_TYPE_descriptor_t *td, |
| 78 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 79 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 80 | Int1_1_inherit_TYPE_descriptor(td); |
| 81 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 82 | } |
| 83 | |
| 84 | asn_dec_rval_t |
| 85 | Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 86 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 87 | Int1_1_inherit_TYPE_descriptor(td); |
| 88 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 89 | } |
| 90 | |
| 91 | asn_enc_rval_t |
| 92 | Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 93 | int ilevel, enum xer_encoder_flags_e flags, |
| 94 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 95 | Int1_1_inherit_TYPE_descriptor(td); |
| 96 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 97 | } |
| 98 | |
| 99 | asn_dec_rval_t |
| 100 | Int1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 101 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 102 | Int1_1_inherit_TYPE_descriptor(td); |
| 103 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 104 | } |
| 105 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 106 | asn_enc_rval_t |
| 107 | Int1_encode_uper(asn_TYPE_descriptor_t *td, |
| 108 | asn_per_constraints_t *constraints, |
| 109 | void *structure, asn_per_outp_t *per_out) { |
| 110 | Int1_1_inherit_TYPE_descriptor(td); |
| 111 | return td->uper_encoder(td, constraints, structure, per_out); |
| 112 | } |
| 113 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 114 | |
| 115 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 116 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 117 | static const ber_tlv_tag_t asn_DEF_Int1_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 118 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 119 | }; |
| 120 | asn_TYPE_descriptor_t asn_DEF_Int1 = { |
| 121 | "Int1", |
| 122 | "Int1", |
| 123 | Int1_free, |
| 124 | Int1_print, |
| 125 | Int1_constraint, |
| 126 | Int1_decode_ber, |
| 127 | Int1_encode_der, |
| 128 | Int1_decode_xer, |
| 129 | Int1_encode_xer, |
| 130 | Int1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 131 | Int1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 132 | 0, /* Use generic outmost tag fetcher */ |
| 133 | asn_DEF_Int1_tags_1, |
| 134 | sizeof(asn_DEF_Int1_tags_1) |
| 135 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 136 | asn_DEF_Int1_tags_1, /* Same as above */ |
| 137 | sizeof(asn_DEF_Int1_tags_1) |
| 138 | /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ |
| 139 | 0, /* No PER visible constraints */ |
| 140 | 0, 0, /* No members */ |
| 141 | 0 /* No specifics */ |
| 142 | }; |
| 143 | |
| 144 | |
| 145 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 146 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 147 | #include "Int1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 148 | |
| 149 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 150 | |
| 151 | typedef Int1_t Int2_t; |
| 152 | |
| 153 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 154 | |
| 155 | extern asn_TYPE_descriptor_t asn_DEF_Int2; |
| 156 | asn_struct_free_f Int2_free; |
| 157 | asn_struct_print_f Int2_print; |
| 158 | asn_constr_check_f Int2_constraint; |
| 159 | ber_type_decoder_f Int2_decode_ber; |
| 160 | der_type_encoder_f Int2_encode_der; |
| 161 | xer_type_decoder_f Int2_decode_xer; |
| 162 | xer_type_encoder_f Int2_encode_xer; |
| 163 | per_type_decoder_f Int2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 164 | per_type_encoder_f Int2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 165 | |
| 166 | /*** <<< CODE [Int2] >>> ***/ |
| 167 | |
| 168 | int |
| 169 | Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 170 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 171 | long value; |
| 172 | |
| 173 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 174 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 175 | "%s: value not given (%s:%d)", |
| 176 | td->name, __FILE__, __LINE__); |
| 177 | return -1; |
| 178 | } |
| 179 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 180 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 181 | |
| 182 | if((value >= 0)) { |
| 183 | /* Constraint check succeeded */ |
| 184 | return 0; |
| 185 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 186 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 187 | "%s: constraint failed (%s:%d)", |
| 188 | td->name, __FILE__, __LINE__); |
| 189 | return -1; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /* |
| 194 | * This type is implemented using Int1, |
| 195 | * so here we adjust the DEF accordingly. |
| 196 | */ |
| 197 | static void |
| 198 | Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 199 | td->free_struct = asn_DEF_Int1.free_struct; |
| 200 | td->print_struct = asn_DEF_Int1.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 201 | td->check_constraints = asn_DEF_Int1.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 202 | td->ber_decoder = asn_DEF_Int1.ber_decoder; |
| 203 | td->der_encoder = asn_DEF_Int1.der_encoder; |
| 204 | td->xer_decoder = asn_DEF_Int1.xer_decoder; |
| 205 | td->xer_encoder = asn_DEF_Int1.xer_encoder; |
| 206 | td->uper_decoder = asn_DEF_Int1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 207 | td->uper_encoder = asn_DEF_Int1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 208 | if(!td->per_constraints) |
| 209 | td->per_constraints = asn_DEF_Int1.per_constraints; |
| 210 | td->elements = asn_DEF_Int1.elements; |
| 211 | td->elements_count = asn_DEF_Int1.elements_count; |
| 212 | td->specifics = asn_DEF_Int1.specifics; |
| 213 | } |
| 214 | |
| 215 | void |
| 216 | Int2_free(asn_TYPE_descriptor_t *td, |
| 217 | void *struct_ptr, int contents_only) { |
| 218 | Int2_1_inherit_TYPE_descriptor(td); |
| 219 | td->free_struct(td, struct_ptr, contents_only); |
| 220 | } |
| 221 | |
| 222 | int |
| 223 | Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 224 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 225 | Int2_1_inherit_TYPE_descriptor(td); |
| 226 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 227 | } |
| 228 | |
| 229 | asn_dec_rval_t |
| 230 | Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 231 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 232 | Int2_1_inherit_TYPE_descriptor(td); |
| 233 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 234 | } |
| 235 | |
| 236 | asn_enc_rval_t |
| 237 | Int2_encode_der(asn_TYPE_descriptor_t *td, |
| 238 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 239 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 240 | Int2_1_inherit_TYPE_descriptor(td); |
| 241 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 242 | } |
| 243 | |
| 244 | asn_dec_rval_t |
| 245 | Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 246 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 247 | Int2_1_inherit_TYPE_descriptor(td); |
| 248 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 249 | } |
| 250 | |
| 251 | asn_enc_rval_t |
| 252 | Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 253 | int ilevel, enum xer_encoder_flags_e flags, |
| 254 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 255 | Int2_1_inherit_TYPE_descriptor(td); |
| 256 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 257 | } |
| 258 | |
| 259 | asn_dec_rval_t |
| 260 | Int2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 261 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 262 | Int2_1_inherit_TYPE_descriptor(td); |
| 263 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 264 | } |
| 265 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 266 | asn_enc_rval_t |
| 267 | Int2_encode_uper(asn_TYPE_descriptor_t *td, |
| 268 | asn_per_constraints_t *constraints, |
| 269 | void *structure, asn_per_outp_t *per_out) { |
| 270 | Int2_1_inherit_TYPE_descriptor(td); |
| 271 | return td->uper_encoder(td, constraints, structure, per_out); |
| 272 | } |
| 273 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 274 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 275 | /*** <<< CTDEFS [Int2] >>> ***/ |
| 276 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 277 | static asn_per_constraints_t asn_PER_type_Int2_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 278 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (0..MAX) */, |
| 279 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 280 | 0, 0 /* No PER value map */ |
| 281 | }; |
| 282 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 283 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 284 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 285 | static const ber_tlv_tag_t asn_DEF_Int2_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 286 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 287 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 288 | asn_TYPE_descriptor_t asn_DEF_Int2 = { |
| 289 | "Int2", |
| 290 | "Int2", |
| 291 | Int2_free, |
| 292 | Int2_print, |
| 293 | Int2_constraint, |
| 294 | Int2_decode_ber, |
| 295 | Int2_encode_der, |
| 296 | Int2_decode_xer, |
| 297 | Int2_encode_xer, |
| 298 | Int2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 299 | Int2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 300 | 0, /* Use generic outmost tag fetcher */ |
| 301 | asn_DEF_Int2_tags_1, |
| 302 | sizeof(asn_DEF_Int2_tags_1) |
| 303 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
| 304 | asn_DEF_Int2_tags_1, /* Same as above */ |
| 305 | sizeof(asn_DEF_Int2_tags_1) |
| 306 | /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 307 | &asn_PER_type_Int2_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 308 | 0, 0, /* No members */ |
| 309 | 0 /* No specifics */ |
| 310 | }; |
| 311 | |
| 312 | |
| 313 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 314 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 315 | #include "Int2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 316 | |
| 317 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 318 | |
| 319 | typedef Int2_t Int3_t; |
| 320 | |
| 321 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 322 | |
| 323 | extern asn_TYPE_descriptor_t asn_DEF_Int3; |
| 324 | asn_struct_free_f Int3_free; |
| 325 | asn_struct_print_f Int3_print; |
| 326 | asn_constr_check_f Int3_constraint; |
| 327 | ber_type_decoder_f Int3_decode_ber; |
| 328 | der_type_encoder_f Int3_encode_der; |
| 329 | xer_type_decoder_f Int3_decode_xer; |
| 330 | xer_type_encoder_f Int3_encode_xer; |
| 331 | per_type_decoder_f Int3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 332 | per_type_encoder_f Int3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 333 | |
| 334 | /*** <<< CODE [Int3] >>> ***/ |
| 335 | |
| 336 | int |
| 337 | Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 338 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 339 | long value; |
| 340 | |
| 341 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 342 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 343 | "%s: value not given (%s:%d)", |
| 344 | td->name, __FILE__, __LINE__); |
| 345 | return -1; |
| 346 | } |
| 347 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 348 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 349 | |
| 350 | if((value >= 0 && value <= 10)) { |
| 351 | /* Constraint check succeeded */ |
| 352 | return 0; |
| 353 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 354 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 355 | "%s: constraint failed (%s:%d)", |
| 356 | td->name, __FILE__, __LINE__); |
| 357 | return -1; |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | /* |
| 362 | * This type is implemented using Int2, |
| 363 | * so here we adjust the DEF accordingly. |
| 364 | */ |
| 365 | static void |
| 366 | Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 367 | td->free_struct = asn_DEF_Int2.free_struct; |
| 368 | td->print_struct = asn_DEF_Int2.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 369 | td->check_constraints = asn_DEF_Int2.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 370 | td->ber_decoder = asn_DEF_Int2.ber_decoder; |
| 371 | td->der_encoder = asn_DEF_Int2.der_encoder; |
| 372 | td->xer_decoder = asn_DEF_Int2.xer_decoder; |
| 373 | td->xer_encoder = asn_DEF_Int2.xer_encoder; |
| 374 | td->uper_decoder = asn_DEF_Int2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 375 | td->uper_encoder = asn_DEF_Int2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 376 | if(!td->per_constraints) |
| 377 | td->per_constraints = asn_DEF_Int2.per_constraints; |
| 378 | td->elements = asn_DEF_Int2.elements; |
| 379 | td->elements_count = asn_DEF_Int2.elements_count; |
| 380 | td->specifics = asn_DEF_Int2.specifics; |
| 381 | } |
| 382 | |
| 383 | void |
| 384 | Int3_free(asn_TYPE_descriptor_t *td, |
| 385 | void *struct_ptr, int contents_only) { |
| 386 | Int3_1_inherit_TYPE_descriptor(td); |
| 387 | td->free_struct(td, struct_ptr, contents_only); |
| 388 | } |
| 389 | |
| 390 | int |
| 391 | Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 392 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 393 | Int3_1_inherit_TYPE_descriptor(td); |
| 394 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 395 | } |
| 396 | |
| 397 | asn_dec_rval_t |
| 398 | Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 399 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 400 | Int3_1_inherit_TYPE_descriptor(td); |
| 401 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 402 | } |
| 403 | |
| 404 | asn_enc_rval_t |
| 405 | Int3_encode_der(asn_TYPE_descriptor_t *td, |
| 406 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 407 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 408 | Int3_1_inherit_TYPE_descriptor(td); |
| 409 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 410 | } |
| 411 | |
| 412 | asn_dec_rval_t |
| 413 | Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 414 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 415 | Int3_1_inherit_TYPE_descriptor(td); |
| 416 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 417 | } |
| 418 | |
| 419 | asn_enc_rval_t |
| 420 | Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 421 | int ilevel, enum xer_encoder_flags_e flags, |
| 422 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 423 | Int3_1_inherit_TYPE_descriptor(td); |
| 424 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 425 | } |
| 426 | |
| 427 | asn_dec_rval_t |
| 428 | Int3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 429 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 430 | Int3_1_inherit_TYPE_descriptor(td); |
| 431 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 432 | } |
| 433 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 434 | asn_enc_rval_t |
| 435 | Int3_encode_uper(asn_TYPE_descriptor_t *td, |
| 436 | asn_per_constraints_t *constraints, |
| 437 | void *structure, asn_per_outp_t *per_out) { |
| 438 | Int3_1_inherit_TYPE_descriptor(td); |
| 439 | return td->uper_encoder(td, constraints, structure, per_out); |
| 440 | } |
| 441 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 442 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 443 | /*** <<< CTDEFS [Int3] >>> ***/ |
| 444 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 445 | static asn_per_constraints_t asn_PER_type_Int3_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 446 | { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, |
| 447 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 448 | 0, 0 /* No PER value map */ |
| 449 | }; |
| 450 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 451 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 452 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 453 | static const ber_tlv_tag_t asn_DEF_Int3_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 454 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 455 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 456 | asn_TYPE_descriptor_t asn_DEF_Int3 = { |
| 457 | "Int3", |
| 458 | "Int3", |
| 459 | Int3_free, |
| 460 | Int3_print, |
| 461 | Int3_constraint, |
| 462 | Int3_decode_ber, |
| 463 | Int3_encode_der, |
| 464 | Int3_decode_xer, |
| 465 | Int3_encode_xer, |
| 466 | Int3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 467 | Int3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 468 | 0, /* Use generic outmost tag fetcher */ |
| 469 | asn_DEF_Int3_tags_1, |
| 470 | sizeof(asn_DEF_Int3_tags_1) |
| 471 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
| 472 | asn_DEF_Int3_tags_1, /* Same as above */ |
| 473 | sizeof(asn_DEF_Int3_tags_1) |
| 474 | /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 475 | &asn_PER_type_Int3_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 476 | 0, 0, /* No members */ |
| 477 | 0 /* No specifics */ |
| 478 | }; |
| 479 | |
| 480 | |
| 481 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 482 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 483 | #include "Int3.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 484 | |
| 485 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 486 | |
| 487 | typedef Int3_t Int4_t; |
| 488 | |
| 489 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 490 | |
| 491 | extern asn_TYPE_descriptor_t asn_DEF_Int4; |
| 492 | asn_struct_free_f Int4_free; |
| 493 | asn_struct_print_f Int4_print; |
| 494 | asn_constr_check_f Int4_constraint; |
| 495 | ber_type_decoder_f Int4_decode_ber; |
| 496 | der_type_encoder_f Int4_encode_der; |
| 497 | xer_type_decoder_f Int4_decode_xer; |
| 498 | xer_type_encoder_f Int4_encode_xer; |
| 499 | per_type_decoder_f Int4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 500 | per_type_encoder_f Int4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 501 | |
| 502 | /*** <<< CODE [Int4] >>> ***/ |
| 503 | |
| 504 | int |
| 505 | Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 506 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 507 | long value; |
| 508 | |
| 509 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 510 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 511 | "%s: value not given (%s:%d)", |
| 512 | td->name, __FILE__, __LINE__); |
| 513 | return -1; |
| 514 | } |
| 515 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 516 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 517 | |
| 518 | if((value >= 1 && value <= 10)) { |
| 519 | /* Constraint check succeeded */ |
| 520 | return 0; |
| 521 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 522 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 523 | "%s: constraint failed (%s:%d)", |
| 524 | td->name, __FILE__, __LINE__); |
| 525 | return -1; |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | /* |
| 530 | * This type is implemented using Int3, |
| 531 | * so here we adjust the DEF accordingly. |
| 532 | */ |
| 533 | static void |
| 534 | Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 535 | td->free_struct = asn_DEF_Int3.free_struct; |
| 536 | td->print_struct = asn_DEF_Int3.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 537 | td->check_constraints = asn_DEF_Int3.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 538 | td->ber_decoder = asn_DEF_Int3.ber_decoder; |
| 539 | td->der_encoder = asn_DEF_Int3.der_encoder; |
| 540 | td->xer_decoder = asn_DEF_Int3.xer_decoder; |
| 541 | td->xer_encoder = asn_DEF_Int3.xer_encoder; |
| 542 | td->uper_decoder = asn_DEF_Int3.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 543 | td->uper_encoder = asn_DEF_Int3.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 544 | if(!td->per_constraints) |
| 545 | td->per_constraints = asn_DEF_Int3.per_constraints; |
| 546 | td->elements = asn_DEF_Int3.elements; |
| 547 | td->elements_count = asn_DEF_Int3.elements_count; |
| 548 | td->specifics = asn_DEF_Int3.specifics; |
| 549 | } |
| 550 | |
| 551 | void |
| 552 | Int4_free(asn_TYPE_descriptor_t *td, |
| 553 | void *struct_ptr, int contents_only) { |
| 554 | Int4_1_inherit_TYPE_descriptor(td); |
| 555 | td->free_struct(td, struct_ptr, contents_only); |
| 556 | } |
| 557 | |
| 558 | int |
| 559 | Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 560 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 561 | Int4_1_inherit_TYPE_descriptor(td); |
| 562 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 563 | } |
| 564 | |
| 565 | asn_dec_rval_t |
| 566 | Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 567 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 568 | Int4_1_inherit_TYPE_descriptor(td); |
| 569 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 570 | } |
| 571 | |
| 572 | asn_enc_rval_t |
| 573 | Int4_encode_der(asn_TYPE_descriptor_t *td, |
| 574 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 575 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 576 | Int4_1_inherit_TYPE_descriptor(td); |
| 577 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 578 | } |
| 579 | |
| 580 | asn_dec_rval_t |
| 581 | Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 582 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 583 | Int4_1_inherit_TYPE_descriptor(td); |
| 584 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 585 | } |
| 586 | |
| 587 | asn_enc_rval_t |
| 588 | Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 589 | int ilevel, enum xer_encoder_flags_e flags, |
| 590 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 591 | Int4_1_inherit_TYPE_descriptor(td); |
| 592 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 593 | } |
| 594 | |
| 595 | asn_dec_rval_t |
| 596 | Int4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 597 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 598 | Int4_1_inherit_TYPE_descriptor(td); |
| 599 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 600 | } |
| 601 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 602 | asn_enc_rval_t |
| 603 | Int4_encode_uper(asn_TYPE_descriptor_t *td, |
| 604 | asn_per_constraints_t *constraints, |
| 605 | void *structure, asn_per_outp_t *per_out) { |
| 606 | Int4_1_inherit_TYPE_descriptor(td); |
| 607 | return td->uper_encoder(td, constraints, structure, per_out); |
| 608 | } |
| 609 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 610 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 611 | /*** <<< CTDEFS [Int4] >>> ***/ |
| 612 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 613 | static asn_per_constraints_t asn_PER_type_Int4_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 614 | { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1, 10 } /* (1..10,...) */, |
| 615 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 616 | 0, 0 /* No PER value map */ |
| 617 | }; |
| 618 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 619 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 620 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 621 | static const ber_tlv_tag_t asn_DEF_Int4_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 622 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 623 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 624 | asn_TYPE_descriptor_t asn_DEF_Int4 = { |
| 625 | "Int4", |
| 626 | "Int4", |
| 627 | Int4_free, |
| 628 | Int4_print, |
| 629 | Int4_constraint, |
| 630 | Int4_decode_ber, |
| 631 | Int4_encode_der, |
| 632 | Int4_decode_xer, |
| 633 | Int4_encode_xer, |
| 634 | Int4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 635 | Int4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 636 | 0, /* Use generic outmost tag fetcher */ |
| 637 | asn_DEF_Int4_tags_1, |
| 638 | sizeof(asn_DEF_Int4_tags_1) |
| 639 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
| 640 | asn_DEF_Int4_tags_1, /* Same as above */ |
| 641 | sizeof(asn_DEF_Int4_tags_1) |
| 642 | /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 643 | &asn_PER_type_Int4_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 644 | 0, 0, /* No members */ |
| 645 | 0 /* No specifics */ |
| 646 | }; |
| 647 | |
| 648 | |
| 649 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 650 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 651 | #include "Int4.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 652 | |
| 653 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 654 | |
| 655 | typedef Int4_t Int5_t; |
| 656 | |
| 657 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 658 | |
| 659 | extern asn_TYPE_descriptor_t asn_DEF_Int5; |
| 660 | asn_struct_free_f Int5_free; |
| 661 | asn_struct_print_f Int5_print; |
| 662 | asn_constr_check_f Int5_constraint; |
| 663 | ber_type_decoder_f Int5_decode_ber; |
| 664 | der_type_encoder_f Int5_encode_der; |
| 665 | xer_type_decoder_f Int5_decode_xer; |
| 666 | xer_type_encoder_f Int5_encode_xer; |
| 667 | per_type_decoder_f Int5_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 668 | per_type_encoder_f Int5_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 669 | |
| 670 | /*** <<< CODE [Int5] >>> ***/ |
| 671 | |
| 672 | int |
| 673 | Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 674 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 675 | long value; |
| 676 | |
| 677 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 678 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 679 | "%s: value not given (%s:%d)", |
| 680 | td->name, __FILE__, __LINE__); |
| 681 | return -1; |
| 682 | } |
| 683 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 684 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 685 | |
| 686 | if((value == 5)) { |
| 687 | /* Constraint check succeeded */ |
| 688 | return 0; |
| 689 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 690 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 691 | "%s: constraint failed (%s:%d)", |
| 692 | td->name, __FILE__, __LINE__); |
| 693 | return -1; |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | /* |
| 698 | * This type is implemented using Int4, |
| 699 | * so here we adjust the DEF accordingly. |
| 700 | */ |
| 701 | static void |
| 702 | Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 703 | td->free_struct = asn_DEF_Int4.free_struct; |
| 704 | td->print_struct = asn_DEF_Int4.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 705 | td->check_constraints = asn_DEF_Int4.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 706 | td->ber_decoder = asn_DEF_Int4.ber_decoder; |
| 707 | td->der_encoder = asn_DEF_Int4.der_encoder; |
| 708 | td->xer_decoder = asn_DEF_Int4.xer_decoder; |
| 709 | td->xer_encoder = asn_DEF_Int4.xer_encoder; |
| 710 | td->uper_decoder = asn_DEF_Int4.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 711 | td->uper_encoder = asn_DEF_Int4.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 712 | if(!td->per_constraints) |
| 713 | td->per_constraints = asn_DEF_Int4.per_constraints; |
| 714 | td->elements = asn_DEF_Int4.elements; |
| 715 | td->elements_count = asn_DEF_Int4.elements_count; |
| 716 | td->specifics = asn_DEF_Int4.specifics; |
| 717 | } |
| 718 | |
| 719 | void |
| 720 | Int5_free(asn_TYPE_descriptor_t *td, |
| 721 | void *struct_ptr, int contents_only) { |
| 722 | Int5_1_inherit_TYPE_descriptor(td); |
| 723 | td->free_struct(td, struct_ptr, contents_only); |
| 724 | } |
| 725 | |
| 726 | int |
| 727 | Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 728 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 729 | Int5_1_inherit_TYPE_descriptor(td); |
| 730 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 731 | } |
| 732 | |
| 733 | asn_dec_rval_t |
| 734 | Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 735 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 736 | Int5_1_inherit_TYPE_descriptor(td); |
| 737 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 738 | } |
| 739 | |
| 740 | asn_enc_rval_t |
| 741 | Int5_encode_der(asn_TYPE_descriptor_t *td, |
| 742 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 743 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 744 | Int5_1_inherit_TYPE_descriptor(td); |
| 745 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 746 | } |
| 747 | |
| 748 | asn_dec_rval_t |
| 749 | Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 750 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 751 | Int5_1_inherit_TYPE_descriptor(td); |
| 752 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 753 | } |
| 754 | |
| 755 | asn_enc_rval_t |
| 756 | Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 757 | int ilevel, enum xer_encoder_flags_e flags, |
| 758 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 759 | Int5_1_inherit_TYPE_descriptor(td); |
| 760 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 761 | } |
| 762 | |
| 763 | asn_dec_rval_t |
| 764 | Int5_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 765 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 766 | Int5_1_inherit_TYPE_descriptor(td); |
| 767 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 768 | } |
| 769 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 770 | asn_enc_rval_t |
| 771 | Int5_encode_uper(asn_TYPE_descriptor_t *td, |
| 772 | asn_per_constraints_t *constraints, |
| 773 | void *structure, asn_per_outp_t *per_out) { |
| 774 | Int5_1_inherit_TYPE_descriptor(td); |
| 775 | return td->uper_encoder(td, constraints, structure, per_out); |
| 776 | } |
| 777 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 778 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 779 | /*** <<< CTDEFS [Int5] >>> ***/ |
| 780 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 781 | static asn_per_constraints_t asn_PER_type_Int5_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 782 | { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, |
| 783 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 784 | 0, 0 /* No PER value map */ |
| 785 | }; |
| 786 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 787 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 788 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 789 | static const ber_tlv_tag_t asn_DEF_Int5_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 790 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 791 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 792 | asn_TYPE_descriptor_t asn_DEF_Int5 = { |
| 793 | "Int5", |
| 794 | "Int5", |
| 795 | Int5_free, |
| 796 | Int5_print, |
| 797 | Int5_constraint, |
| 798 | Int5_decode_ber, |
| 799 | Int5_encode_der, |
| 800 | Int5_decode_xer, |
| 801 | Int5_encode_xer, |
| 802 | Int5_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 803 | Int5_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 804 | 0, /* Use generic outmost tag fetcher */ |
| 805 | asn_DEF_Int5_tags_1, |
| 806 | sizeof(asn_DEF_Int5_tags_1) |
| 807 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
| 808 | asn_DEF_Int5_tags_1, /* Same as above */ |
| 809 | sizeof(asn_DEF_Int5_tags_1) |
| 810 | /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 811 | &asn_PER_type_Int5_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 812 | 0, 0, /* No members */ |
| 813 | 0 /* No specifics */ |
| 814 | }; |
| 815 | |
| 816 | |
| 817 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 818 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 819 | #include <NativeInteger.h> |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 820 | |
| 821 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 822 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 823 | typedef long ExtensibleExtensions_t; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 824 | |
| 825 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 826 | |
| 827 | extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; |
| 828 | asn_struct_free_f ExtensibleExtensions_free; |
| 829 | asn_struct_print_f ExtensibleExtensions_print; |
| 830 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 831 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 832 | der_type_encoder_f ExtensibleExtensions_encode_der; |
| 833 | xer_type_decoder_f ExtensibleExtensions_decode_xer; |
| 834 | xer_type_encoder_f ExtensibleExtensions_encode_xer; |
| 835 | per_type_decoder_f ExtensibleExtensions_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 836 | per_type_encoder_f ExtensibleExtensions_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 837 | |
| 838 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 839 | |
| 840 | int |
| 841 | ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 842 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 843 | long value; |
| 844 | |
| 845 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 846 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 847 | "%s: value not given (%s:%d)", |
| 848 | td->name, __FILE__, __LINE__); |
| 849 | return -1; |
| 850 | } |
| 851 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 852 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 853 | |
| 854 | if((value >= 1 && value <= 256)) { |
| 855 | /* Constraint check succeeded */ |
| 856 | return 0; |
| 857 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 858 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 859 | "%s: constraint failed (%s:%d)", |
| 860 | td->name, __FILE__, __LINE__); |
| 861 | return -1; |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | /* |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 866 | * This type is implemented using NativeInteger, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 867 | * so here we adjust the DEF accordingly. |
| 868 | */ |
| 869 | static void |
| 870 | ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 871 | td->free_struct = asn_DEF_NativeInteger.free_struct; |
| 872 | td->print_struct = asn_DEF_NativeInteger.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 873 | td->check_constraints = asn_DEF_NativeInteger.check_constraints; |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 874 | td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; |
| 875 | td->der_encoder = asn_DEF_NativeInteger.der_encoder; |
| 876 | td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; |
| 877 | td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; |
| 878 | td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; |
| 879 | td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 880 | if(!td->per_constraints) |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 881 | td->per_constraints = asn_DEF_NativeInteger.per_constraints; |
| 882 | td->elements = asn_DEF_NativeInteger.elements; |
| 883 | td->elements_count = asn_DEF_NativeInteger.elements_count; |
| 884 | td->specifics = asn_DEF_NativeInteger.specifics; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 885 | } |
| 886 | |
| 887 | void |
| 888 | ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, |
| 889 | void *struct_ptr, int contents_only) { |
| 890 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 891 | td->free_struct(td, struct_ptr, contents_only); |
| 892 | } |
| 893 | |
| 894 | int |
| 895 | ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 896 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 897 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 898 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 899 | } |
| 900 | |
| 901 | asn_dec_rval_t |
| 902 | ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 903 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 904 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 905 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 906 | } |
| 907 | |
| 908 | asn_enc_rval_t |
| 909 | ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, |
| 910 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 911 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 912 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 913 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 914 | } |
| 915 | |
| 916 | asn_dec_rval_t |
| 917 | ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 918 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 919 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 920 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 921 | } |
| 922 | |
| 923 | asn_enc_rval_t |
| 924 | ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 925 | int ilevel, enum xer_encoder_flags_e flags, |
| 926 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 927 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 928 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 929 | } |
| 930 | |
| 931 | asn_dec_rval_t |
| 932 | ExtensibleExtensions_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 933 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 934 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 935 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 936 | } |
| 937 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 938 | asn_enc_rval_t |
| 939 | ExtensibleExtensions_encode_uper(asn_TYPE_descriptor_t *td, |
| 940 | asn_per_constraints_t *constraints, |
| 941 | void *structure, asn_per_outp_t *per_out) { |
| 942 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
| 943 | return td->uper_encoder(td, constraints, structure, per_out); |
| 944 | } |
| 945 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 946 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 947 | /*** <<< CTDEFS [ExtensibleExtensions] >>> ***/ |
| 948 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 949 | static asn_per_constraints_t asn_PER_type_ExtensibleExtensions_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 950 | { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */, |
| 951 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 952 | 0, 0 /* No PER value map */ |
| 953 | }; |
| 954 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 955 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 956 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 957 | static const ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 958 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 959 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 960 | asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { |
| 961 | "ExtensibleExtensions", |
| 962 | "ExtensibleExtensions", |
| 963 | ExtensibleExtensions_free, |
| 964 | ExtensibleExtensions_print, |
| 965 | ExtensibleExtensions_constraint, |
| 966 | ExtensibleExtensions_decode_ber, |
| 967 | ExtensibleExtensions_encode_der, |
| 968 | ExtensibleExtensions_decode_xer, |
| 969 | ExtensibleExtensions_encode_xer, |
| 970 | ExtensibleExtensions_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 971 | ExtensibleExtensions_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 972 | 0, /* Use generic outmost tag fetcher */ |
| 973 | asn_DEF_ExtensibleExtensions_tags_1, |
| 974 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 975 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
| 976 | asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */ |
| 977 | sizeof(asn_DEF_ExtensibleExtensions_tags_1) |
| 978 | /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 979 | &asn_PER_type_ExtensibleExtensions_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 980 | 0, 0, /* No members */ |
| 981 | 0 /* No specifics */ |
| 982 | }; |
| 983 | |
| 984 | |
| 985 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 986 | |
| 987 | #include <IA5String.h> |
| 988 | |
| 989 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 990 | |
| 991 | typedef IA5String_t Str1_t; |
| 992 | |
| 993 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 994 | |
| 995 | extern asn_TYPE_descriptor_t asn_DEF_Str1; |
| 996 | asn_struct_free_f Str1_free; |
| 997 | asn_struct_print_f Str1_print; |
| 998 | asn_constr_check_f Str1_constraint; |
| 999 | ber_type_decoder_f Str1_decode_ber; |
| 1000 | der_type_encoder_f Str1_encode_der; |
| 1001 | xer_type_decoder_f Str1_decode_xer; |
| 1002 | xer_type_encoder_f Str1_encode_xer; |
| 1003 | per_type_decoder_f Str1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1004 | per_type_encoder_f Str1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1005 | |
| 1006 | /*** <<< CODE [Str1] >>> ***/ |
| 1007 | |
| 1008 | int |
| 1009 | Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1010 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1011 | /* Replace with underlying type checker */ |
| 1012 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1013 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1014 | } |
| 1015 | |
| 1016 | /* |
| 1017 | * This type is implemented using IA5String, |
| 1018 | * so here we adjust the DEF accordingly. |
| 1019 | */ |
| 1020 | static void |
| 1021 | Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1022 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1023 | td->print_struct = asn_DEF_IA5String.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1024 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1025 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1026 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1027 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1028 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1029 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1030 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1031 | if(!td->per_constraints) |
| 1032 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1033 | td->elements = asn_DEF_IA5String.elements; |
| 1034 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1035 | td->specifics = asn_DEF_IA5String.specifics; |
| 1036 | } |
| 1037 | |
| 1038 | void |
| 1039 | Str1_free(asn_TYPE_descriptor_t *td, |
| 1040 | void *struct_ptr, int contents_only) { |
| 1041 | Str1_1_inherit_TYPE_descriptor(td); |
| 1042 | td->free_struct(td, struct_ptr, contents_only); |
| 1043 | } |
| 1044 | |
| 1045 | int |
| 1046 | Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1047 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1048 | Str1_1_inherit_TYPE_descriptor(td); |
| 1049 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1050 | } |
| 1051 | |
| 1052 | asn_dec_rval_t |
| 1053 | Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1054 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1055 | Str1_1_inherit_TYPE_descriptor(td); |
| 1056 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1057 | } |
| 1058 | |
| 1059 | asn_enc_rval_t |
| 1060 | Str1_encode_der(asn_TYPE_descriptor_t *td, |
| 1061 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1062 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1063 | Str1_1_inherit_TYPE_descriptor(td); |
| 1064 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1065 | } |
| 1066 | |
| 1067 | asn_dec_rval_t |
| 1068 | Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1069 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1070 | Str1_1_inherit_TYPE_descriptor(td); |
| 1071 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1072 | } |
| 1073 | |
| 1074 | asn_enc_rval_t |
| 1075 | Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1076 | int ilevel, enum xer_encoder_flags_e flags, |
| 1077 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1078 | Str1_1_inherit_TYPE_descriptor(td); |
| 1079 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1080 | } |
| 1081 | |
| 1082 | asn_dec_rval_t |
| 1083 | Str1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1084 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1085 | Str1_1_inherit_TYPE_descriptor(td); |
| 1086 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1087 | } |
| 1088 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1089 | asn_enc_rval_t |
| 1090 | Str1_encode_uper(asn_TYPE_descriptor_t *td, |
| 1091 | asn_per_constraints_t *constraints, |
| 1092 | void *structure, asn_per_outp_t *per_out) { |
| 1093 | Str1_1_inherit_TYPE_descriptor(td); |
| 1094 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1095 | } |
| 1096 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1097 | |
| 1098 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 1099 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1100 | static const ber_tlv_tag_t asn_DEF_Str1_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1101 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1102 | }; |
| 1103 | asn_TYPE_descriptor_t asn_DEF_Str1 = { |
| 1104 | "Str1", |
| 1105 | "Str1", |
| 1106 | Str1_free, |
| 1107 | Str1_print, |
| 1108 | Str1_constraint, |
| 1109 | Str1_decode_ber, |
| 1110 | Str1_encode_der, |
| 1111 | Str1_decode_xer, |
| 1112 | Str1_encode_xer, |
| 1113 | Str1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1114 | Str1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1115 | 0, /* Use generic outmost tag fetcher */ |
| 1116 | asn_DEF_Str1_tags_1, |
| 1117 | sizeof(asn_DEF_Str1_tags_1) |
| 1118 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 1119 | asn_DEF_Str1_tags_1, /* Same as above */ |
| 1120 | sizeof(asn_DEF_Str1_tags_1) |
| 1121 | /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ |
| 1122 | 0, /* No PER visible constraints */ |
| 1123 | 0, 0, /* No members */ |
| 1124 | 0 /* No specifics */ |
| 1125 | }; |
| 1126 | |
| 1127 | |
| 1128 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 1129 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 1130 | #include "Str1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1131 | |
| 1132 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 1133 | |
| 1134 | typedef Str1_t Str2_t; |
| 1135 | |
| 1136 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 1137 | |
| 1138 | extern asn_TYPE_descriptor_t asn_DEF_Str2; |
| 1139 | asn_struct_free_f Str2_free; |
| 1140 | asn_struct_print_f Str2_print; |
| 1141 | asn_constr_check_f Str2_constraint; |
| 1142 | ber_type_decoder_f Str2_decode_ber; |
| 1143 | der_type_encoder_f Str2_encode_der; |
| 1144 | xer_type_decoder_f Str2_decode_xer; |
| 1145 | xer_type_encoder_f Str2_encode_xer; |
| 1146 | per_type_decoder_f Str2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1147 | per_type_encoder_f Str2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1148 | |
| 1149 | /*** <<< CTABLES [Str2] >>> ***/ |
| 1150 | |
| 1151 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1152 | /* The underlying type is IA5String */ |
| 1153 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1154 | const uint8_t *ch = st->buf; |
| 1155 | const uint8_t *end = ch + st->size; |
| 1156 | |
| 1157 | for(; ch < end; ch++) { |
| 1158 | uint8_t cv = *ch; |
| 1159 | if(!(cv <= 127)) return -1; |
| 1160 | } |
| 1161 | return 0; |
| 1162 | } |
| 1163 | |
| 1164 | |
| 1165 | /*** <<< CODE [Str2] >>> ***/ |
| 1166 | |
| 1167 | int |
| 1168 | Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1169 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1170 | const Str1_t *st = (const Str1_t *)sptr; |
| 1171 | size_t size; |
| 1172 | |
| 1173 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1174 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1175 | "%s: value not given (%s:%d)", |
| 1176 | td->name, __FILE__, __LINE__); |
| 1177 | return -1; |
| 1178 | } |
| 1179 | |
| 1180 | size = st->size; |
| 1181 | |
| 1182 | if(((size <= 20) || (size >= 25 && size <= 30)) |
| 1183 | && !check_permitted_alphabet_1(st)) { |
| 1184 | /* Constraint check succeeded */ |
| 1185 | return 0; |
| 1186 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1187 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1188 | "%s: constraint failed (%s:%d)", |
| 1189 | td->name, __FILE__, __LINE__); |
| 1190 | return -1; |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | /* |
| 1195 | * This type is implemented using Str1, |
| 1196 | * so here we adjust the DEF accordingly. |
| 1197 | */ |
| 1198 | static void |
| 1199 | Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1200 | td->free_struct = asn_DEF_Str1.free_struct; |
| 1201 | td->print_struct = asn_DEF_Str1.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1202 | td->check_constraints = asn_DEF_Str1.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1203 | td->ber_decoder = asn_DEF_Str1.ber_decoder; |
| 1204 | td->der_encoder = asn_DEF_Str1.der_encoder; |
| 1205 | td->xer_decoder = asn_DEF_Str1.xer_decoder; |
| 1206 | td->xer_encoder = asn_DEF_Str1.xer_encoder; |
| 1207 | td->uper_decoder = asn_DEF_Str1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1208 | td->uper_encoder = asn_DEF_Str1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1209 | if(!td->per_constraints) |
| 1210 | td->per_constraints = asn_DEF_Str1.per_constraints; |
| 1211 | td->elements = asn_DEF_Str1.elements; |
| 1212 | td->elements_count = asn_DEF_Str1.elements_count; |
| 1213 | td->specifics = asn_DEF_Str1.specifics; |
| 1214 | } |
| 1215 | |
| 1216 | void |
| 1217 | Str2_free(asn_TYPE_descriptor_t *td, |
| 1218 | void *struct_ptr, int contents_only) { |
| 1219 | Str2_1_inherit_TYPE_descriptor(td); |
| 1220 | td->free_struct(td, struct_ptr, contents_only); |
| 1221 | } |
| 1222 | |
| 1223 | int |
| 1224 | Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1225 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1226 | Str2_1_inherit_TYPE_descriptor(td); |
| 1227 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1228 | } |
| 1229 | |
| 1230 | asn_dec_rval_t |
| 1231 | Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1232 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1233 | Str2_1_inherit_TYPE_descriptor(td); |
| 1234 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1235 | } |
| 1236 | |
| 1237 | asn_enc_rval_t |
| 1238 | Str2_encode_der(asn_TYPE_descriptor_t *td, |
| 1239 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1240 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1241 | Str2_1_inherit_TYPE_descriptor(td); |
| 1242 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1243 | } |
| 1244 | |
| 1245 | asn_dec_rval_t |
| 1246 | Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1247 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1248 | Str2_1_inherit_TYPE_descriptor(td); |
| 1249 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1250 | } |
| 1251 | |
| 1252 | asn_enc_rval_t |
| 1253 | Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1254 | int ilevel, enum xer_encoder_flags_e flags, |
| 1255 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1256 | Str2_1_inherit_TYPE_descriptor(td); |
| 1257 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1258 | } |
| 1259 | |
| 1260 | asn_dec_rval_t |
| 1261 | Str2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1262 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1263 | Str2_1_inherit_TYPE_descriptor(td); |
| 1264 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1265 | } |
| 1266 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1267 | asn_enc_rval_t |
| 1268 | Str2_encode_uper(asn_TYPE_descriptor_t *td, |
| 1269 | asn_per_constraints_t *constraints, |
| 1270 | void *structure, asn_per_outp_t *per_out) { |
| 1271 | Str2_1_inherit_TYPE_descriptor(td); |
| 1272 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1273 | } |
| 1274 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1275 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1276 | /*** <<< CTDEFS [Str2] >>> ***/ |
| 1277 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 1278 | static asn_per_constraints_t asn_PER_type_Str2_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1279 | { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, |
| 1280 | { APC_CONSTRAINED, 5, 5, 0, 30 } /* (SIZE(0..30)) */, |
| 1281 | 0, 0 /* No PER character map necessary */ |
| 1282 | }; |
| 1283 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1284 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 1285 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1286 | static const ber_tlv_tag_t asn_DEF_Str2_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1287 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1288 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1289 | asn_TYPE_descriptor_t asn_DEF_Str2 = { |
| 1290 | "Str2", |
| 1291 | "Str2", |
| 1292 | Str2_free, |
| 1293 | Str2_print, |
| 1294 | Str2_constraint, |
| 1295 | Str2_decode_ber, |
| 1296 | Str2_encode_der, |
| 1297 | Str2_decode_xer, |
| 1298 | Str2_encode_xer, |
| 1299 | Str2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1300 | Str2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1301 | 0, /* Use generic outmost tag fetcher */ |
| 1302 | asn_DEF_Str2_tags_1, |
| 1303 | sizeof(asn_DEF_Str2_tags_1) |
| 1304 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
| 1305 | asn_DEF_Str2_tags_1, /* Same as above */ |
| 1306 | sizeof(asn_DEF_Str2_tags_1) |
| 1307 | /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 1308 | &asn_PER_type_Str2_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1309 | 0, 0, /* No members */ |
| 1310 | 0 /* No specifics */ |
| 1311 | }; |
| 1312 | |
| 1313 | |
| 1314 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 1315 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 1316 | #include "Str2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1317 | |
| 1318 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 1319 | |
| 1320 | typedef Str2_t Str3_t; |
| 1321 | |
| 1322 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 1323 | |
| 1324 | extern asn_TYPE_descriptor_t asn_DEF_Str3; |
| 1325 | asn_struct_free_f Str3_free; |
| 1326 | asn_struct_print_f Str3_print; |
| 1327 | asn_constr_check_f Str3_constraint; |
| 1328 | ber_type_decoder_f Str3_decode_ber; |
| 1329 | der_type_encoder_f Str3_encode_der; |
| 1330 | xer_type_decoder_f Str3_decode_xer; |
| 1331 | xer_type_encoder_f Str3_encode_xer; |
| 1332 | per_type_decoder_f Str3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1333 | per_type_encoder_f Str3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1334 | |
| 1335 | /*** <<< CTABLES [Str3] >>> ***/ |
| 1336 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1337 | static const int permitted_alphabet_table_1[256] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 1338 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 1339 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 1340 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 1341 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 1342 | 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ABC */ |
| 1343 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 1344 | 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1345 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1346 | static const int permitted_alphabet_code2value_1[6] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 1347 | 65,66,67,100,101,102,}; |
| 1348 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1349 | |
| 1350 | static int check_permitted_alphabet_1(const void *sptr) { |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1351 | const int *table = permitted_alphabet_table_1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1352 | /* The underlying type is IA5String */ |
| 1353 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1354 | const uint8_t *ch = st->buf; |
| 1355 | const uint8_t *end = ch + st->size; |
| 1356 | |
| 1357 | for(; ch < end; ch++) { |
| 1358 | uint8_t cv = *ch; |
| 1359 | if(!table[cv]) return -1; |
| 1360 | } |
| 1361 | return 0; |
| 1362 | } |
| 1363 | |
| 1364 | |
| 1365 | /*** <<< CODE [Str3] >>> ***/ |
| 1366 | |
| 1367 | int |
| 1368 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1369 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1370 | const Str2_t *st = (const Str2_t *)sptr; |
| 1371 | size_t size; |
| 1372 | |
| 1373 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1374 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1375 | "%s: value not given (%s:%d)", |
| 1376 | td->name, __FILE__, __LINE__); |
| 1377 | return -1; |
| 1378 | } |
| 1379 | |
| 1380 | size = st->size; |
| 1381 | |
| 1382 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
| 1383 | && !check_permitted_alphabet_1(st)) { |
| 1384 | /* Constraint check succeeded */ |
| 1385 | return 0; |
| 1386 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1387 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1388 | "%s: constraint failed (%s:%d)", |
| 1389 | td->name, __FILE__, __LINE__); |
| 1390 | return -1; |
| 1391 | } |
| 1392 | } |
| 1393 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1394 | static int asn_PER_MAP_Str3_1_v2c(unsigned int value) { |
| 1395 | if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) |
| 1396 | return -1; |
| 1397 | return permitted_alphabet_table_1[value] - 1; |
| 1398 | } |
| 1399 | static int asn_PER_MAP_Str3_1_c2v(unsigned int code) { |
| 1400 | if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) |
| 1401 | return -1; |
| 1402 | return permitted_alphabet_code2value_1[code]; |
| 1403 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1404 | /* |
| 1405 | * This type is implemented using Str2, |
| 1406 | * so here we adjust the DEF accordingly. |
| 1407 | */ |
| 1408 | static void |
| 1409 | Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1410 | td->free_struct = asn_DEF_Str2.free_struct; |
| 1411 | td->print_struct = asn_DEF_Str2.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1412 | td->check_constraints = asn_DEF_Str2.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1413 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 1414 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 1415 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 1416 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
| 1417 | td->uper_decoder = asn_DEF_Str2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1418 | td->uper_encoder = asn_DEF_Str2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1419 | if(!td->per_constraints) |
| 1420 | td->per_constraints = asn_DEF_Str2.per_constraints; |
| 1421 | td->elements = asn_DEF_Str2.elements; |
| 1422 | td->elements_count = asn_DEF_Str2.elements_count; |
| 1423 | td->specifics = asn_DEF_Str2.specifics; |
| 1424 | } |
| 1425 | |
| 1426 | void |
| 1427 | Str3_free(asn_TYPE_descriptor_t *td, |
| 1428 | void *struct_ptr, int contents_only) { |
| 1429 | Str3_1_inherit_TYPE_descriptor(td); |
| 1430 | td->free_struct(td, struct_ptr, contents_only); |
| 1431 | } |
| 1432 | |
| 1433 | int |
| 1434 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1435 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1436 | Str3_1_inherit_TYPE_descriptor(td); |
| 1437 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1438 | } |
| 1439 | |
| 1440 | asn_dec_rval_t |
| 1441 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1442 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1443 | Str3_1_inherit_TYPE_descriptor(td); |
| 1444 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1445 | } |
| 1446 | |
| 1447 | asn_enc_rval_t |
| 1448 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
| 1449 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1450 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1451 | Str3_1_inherit_TYPE_descriptor(td); |
| 1452 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1453 | } |
| 1454 | |
| 1455 | asn_dec_rval_t |
| 1456 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1457 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1458 | Str3_1_inherit_TYPE_descriptor(td); |
| 1459 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1460 | } |
| 1461 | |
| 1462 | asn_enc_rval_t |
| 1463 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1464 | int ilevel, enum xer_encoder_flags_e flags, |
| 1465 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1466 | Str3_1_inherit_TYPE_descriptor(td); |
| 1467 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1468 | } |
| 1469 | |
| 1470 | asn_dec_rval_t |
| 1471 | Str3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1472 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1473 | Str3_1_inherit_TYPE_descriptor(td); |
| 1474 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1475 | } |
| 1476 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1477 | asn_enc_rval_t |
| 1478 | Str3_encode_uper(asn_TYPE_descriptor_t *td, |
| 1479 | asn_per_constraints_t *constraints, |
| 1480 | void *structure, asn_per_outp_t *per_out) { |
| 1481 | Str3_1_inherit_TYPE_descriptor(td); |
| 1482 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1483 | } |
| 1484 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1485 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1486 | /*** <<< CTDEFS [Str3] >>> ***/ |
| 1487 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 1488 | static asn_per_constraints_t asn_PER_type_Str3_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1489 | { APC_CONSTRAINED, 3, 3, 65, 102 } /* (65..102) */, |
| 1490 | { APC_CONSTRAINED, 5, 5, 10, 27 } /* (SIZE(10..27)) */, |
| 1491 | asn_PER_MAP_Str3_1_v2c, /* Value to PER code map */ |
| 1492 | asn_PER_MAP_Str3_1_c2v /* PER code to value map */ |
| 1493 | }; |
| 1494 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1495 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1496 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1497 | static const ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1498 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1499 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1500 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
| 1501 | "Str3", |
| 1502 | "Str3", |
| 1503 | Str3_free, |
| 1504 | Str3_print, |
| 1505 | Str3_constraint, |
| 1506 | Str3_decode_ber, |
| 1507 | Str3_encode_der, |
| 1508 | Str3_decode_xer, |
| 1509 | Str3_encode_xer, |
| 1510 | Str3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1511 | Str3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1512 | 0, /* Use generic outmost tag fetcher */ |
| 1513 | asn_DEF_Str3_tags_1, |
| 1514 | sizeof(asn_DEF_Str3_tags_1) |
| 1515 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
| 1516 | asn_DEF_Str3_tags_1, /* Same as above */ |
| 1517 | sizeof(asn_DEF_Str3_tags_1) |
| 1518 | /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 1519 | &asn_PER_type_Str3_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1520 | 0, 0, /* No members */ |
| 1521 | 0 /* No specifics */ |
| 1522 | }; |
| 1523 | |
| 1524 | |
| 1525 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1526 | |
| 1527 | #include <IA5String.h> |
| 1528 | |
| 1529 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1530 | |
| 1531 | typedef IA5String_t Str4_t; |
| 1532 | |
| 1533 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1534 | |
| 1535 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
| 1536 | asn_struct_free_f Str4_free; |
| 1537 | asn_struct_print_f Str4_print; |
| 1538 | asn_constr_check_f Str4_constraint; |
| 1539 | ber_type_decoder_f Str4_decode_ber; |
| 1540 | der_type_encoder_f Str4_encode_der; |
| 1541 | xer_type_decoder_f Str4_decode_xer; |
| 1542 | xer_type_encoder_f Str4_encode_xer; |
| 1543 | per_type_decoder_f Str4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1544 | per_type_encoder_f Str4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1545 | |
| 1546 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1547 | |
| 1548 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1549 | /* The underlying type is IA5String */ |
| 1550 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1551 | const uint8_t *ch = st->buf; |
| 1552 | const uint8_t *end = ch + st->size; |
| 1553 | |
| 1554 | for(; ch < end; ch++) { |
| 1555 | uint8_t cv = *ch; |
| 1556 | if(!(cv <= 127)) return -1; |
| 1557 | } |
| 1558 | return 0; |
| 1559 | } |
| 1560 | |
| 1561 | |
| 1562 | /*** <<< CODE [Str4] >>> ***/ |
| 1563 | |
| 1564 | int |
| 1565 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1566 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1567 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1568 | |
| 1569 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1570 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1571 | "%s: value not given (%s:%d)", |
| 1572 | td->name, __FILE__, __LINE__); |
| 1573 | return -1; |
| 1574 | } |
| 1575 | |
| 1576 | |
| 1577 | if(!check_permitted_alphabet_1(st)) { |
| 1578 | /* Constraint check succeeded */ |
| 1579 | return 0; |
| 1580 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1581 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1582 | "%s: constraint failed (%s:%d)", |
| 1583 | td->name, __FILE__, __LINE__); |
| 1584 | return -1; |
| 1585 | } |
| 1586 | } |
| 1587 | |
| 1588 | /* |
| 1589 | * This type is implemented using IA5String, |
| 1590 | * so here we adjust the DEF accordingly. |
| 1591 | */ |
| 1592 | static void |
| 1593 | Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1594 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1595 | td->print_struct = asn_DEF_IA5String.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1596 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1597 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1598 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1599 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1600 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1601 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1602 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1603 | if(!td->per_constraints) |
| 1604 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1605 | td->elements = asn_DEF_IA5String.elements; |
| 1606 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1607 | td->specifics = asn_DEF_IA5String.specifics; |
| 1608 | } |
| 1609 | |
| 1610 | void |
| 1611 | Str4_free(asn_TYPE_descriptor_t *td, |
| 1612 | void *struct_ptr, int contents_only) { |
| 1613 | Str4_1_inherit_TYPE_descriptor(td); |
| 1614 | td->free_struct(td, struct_ptr, contents_only); |
| 1615 | } |
| 1616 | |
| 1617 | int |
| 1618 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1619 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1620 | Str4_1_inherit_TYPE_descriptor(td); |
| 1621 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1622 | } |
| 1623 | |
| 1624 | asn_dec_rval_t |
| 1625 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1626 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1627 | Str4_1_inherit_TYPE_descriptor(td); |
| 1628 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1629 | } |
| 1630 | |
| 1631 | asn_enc_rval_t |
| 1632 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
| 1633 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1634 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1635 | Str4_1_inherit_TYPE_descriptor(td); |
| 1636 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1637 | } |
| 1638 | |
| 1639 | asn_dec_rval_t |
| 1640 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1641 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1642 | Str4_1_inherit_TYPE_descriptor(td); |
| 1643 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1644 | } |
| 1645 | |
| 1646 | asn_enc_rval_t |
| 1647 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1648 | int ilevel, enum xer_encoder_flags_e flags, |
| 1649 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1650 | Str4_1_inherit_TYPE_descriptor(td); |
| 1651 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1652 | } |
| 1653 | |
| 1654 | asn_dec_rval_t |
| 1655 | Str4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1656 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1657 | Str4_1_inherit_TYPE_descriptor(td); |
| 1658 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1659 | } |
| 1660 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1661 | asn_enc_rval_t |
| 1662 | Str4_encode_uper(asn_TYPE_descriptor_t *td, |
| 1663 | asn_per_constraints_t *constraints, |
| 1664 | void *structure, asn_per_outp_t *per_out) { |
| 1665 | Str4_1_inherit_TYPE_descriptor(td); |
| 1666 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1667 | } |
| 1668 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1669 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1670 | /*** <<< CTDEFS [Str4] >>> ***/ |
| 1671 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 1672 | static asn_per_constraints_t asn_PER_type_Str4_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1673 | { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, |
| 1674 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 1675 | 0, 0 /* No PER character map necessary */ |
| 1676 | }; |
| 1677 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1678 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1679 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1680 | static const ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1681 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1682 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1683 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
| 1684 | "Str4", |
| 1685 | "Str4", |
| 1686 | Str4_free, |
| 1687 | Str4_print, |
| 1688 | Str4_constraint, |
| 1689 | Str4_decode_ber, |
| 1690 | Str4_encode_der, |
| 1691 | Str4_decode_xer, |
| 1692 | Str4_encode_xer, |
| 1693 | Str4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1694 | Str4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1695 | 0, /* Use generic outmost tag fetcher */ |
| 1696 | asn_DEF_Str4_tags_1, |
| 1697 | sizeof(asn_DEF_Str4_tags_1) |
| 1698 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
| 1699 | asn_DEF_Str4_tags_1, /* Same as above */ |
| 1700 | sizeof(asn_DEF_Str4_tags_1) |
| 1701 | /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 1702 | &asn_PER_type_Str4_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1703 | 0, 0, /* No members */ |
| 1704 | 0 /* No specifics */ |
| 1705 | }; |
| 1706 | |
| 1707 | |
| 1708 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1709 | |
| 1710 | #include <IA5String.h> |
| 1711 | |
| 1712 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1713 | |
| 1714 | typedef IA5String_t PER_Visible_t; |
| 1715 | |
| 1716 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1717 | |
| 1718 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
| 1719 | asn_struct_free_f PER_Visible_free; |
| 1720 | asn_struct_print_f PER_Visible_print; |
| 1721 | asn_constr_check_f PER_Visible_constraint; |
| 1722 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1723 | der_type_encoder_f PER_Visible_encode_der; |
| 1724 | xer_type_decoder_f PER_Visible_decode_xer; |
| 1725 | xer_type_encoder_f PER_Visible_encode_xer; |
| 1726 | per_type_decoder_f PER_Visible_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1727 | per_type_encoder_f PER_Visible_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1728 | |
| 1729 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1730 | |
| 1731 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1732 | /* The underlying type is IA5String */ |
| 1733 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1734 | const uint8_t *ch = st->buf; |
| 1735 | const uint8_t *end = ch + st->size; |
| 1736 | |
| 1737 | for(; ch < end; ch++) { |
| 1738 | uint8_t cv = *ch; |
| 1739 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 1740 | } |
| 1741 | return 0; |
| 1742 | } |
| 1743 | |
| 1744 | |
| 1745 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1746 | |
| 1747 | int |
| 1748 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1749 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1750 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1751 | |
| 1752 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1753 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1754 | "%s: value not given (%s:%d)", |
| 1755 | td->name, __FILE__, __LINE__); |
| 1756 | return -1; |
| 1757 | } |
| 1758 | |
| 1759 | |
| 1760 | if(!check_permitted_alphabet_1(st)) { |
| 1761 | /* Constraint check succeeded */ |
| 1762 | return 0; |
| 1763 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1764 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1765 | "%s: constraint failed (%s:%d)", |
| 1766 | td->name, __FILE__, __LINE__); |
| 1767 | return -1; |
| 1768 | } |
| 1769 | } |
| 1770 | |
| 1771 | /* |
| 1772 | * This type is implemented using IA5String, |
| 1773 | * so here we adjust the DEF accordingly. |
| 1774 | */ |
| 1775 | static void |
| 1776 | PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1777 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1778 | td->print_struct = asn_DEF_IA5String.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1779 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1780 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1781 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1782 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1783 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1784 | td->uper_decoder = asn_DEF_IA5String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1785 | td->uper_encoder = asn_DEF_IA5String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1786 | if(!td->per_constraints) |
| 1787 | td->per_constraints = asn_DEF_IA5String.per_constraints; |
| 1788 | td->elements = asn_DEF_IA5String.elements; |
| 1789 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1790 | td->specifics = asn_DEF_IA5String.specifics; |
| 1791 | } |
| 1792 | |
| 1793 | void |
| 1794 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
| 1795 | void *struct_ptr, int contents_only) { |
| 1796 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1797 | td->free_struct(td, struct_ptr, contents_only); |
| 1798 | } |
| 1799 | |
| 1800 | int |
| 1801 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1802 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1803 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1804 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1805 | } |
| 1806 | |
| 1807 | asn_dec_rval_t |
| 1808 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1809 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1810 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1811 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1812 | } |
| 1813 | |
| 1814 | asn_enc_rval_t |
| 1815 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
| 1816 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1817 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1818 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1819 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1820 | } |
| 1821 | |
| 1822 | asn_dec_rval_t |
| 1823 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1824 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 1825 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1826 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1827 | } |
| 1828 | |
| 1829 | asn_enc_rval_t |
| 1830 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 1831 | int ilevel, enum xer_encoder_flags_e flags, |
| 1832 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1833 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1834 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 1835 | } |
| 1836 | |
| 1837 | asn_dec_rval_t |
| 1838 | PER_Visible_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1839 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 1840 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1841 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 1842 | } |
| 1843 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1844 | asn_enc_rval_t |
| 1845 | PER_Visible_encode_uper(asn_TYPE_descriptor_t *td, |
| 1846 | asn_per_constraints_t *constraints, |
| 1847 | void *structure, asn_per_outp_t *per_out) { |
| 1848 | PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1849 | return td->uper_encoder(td, constraints, structure, per_out); |
| 1850 | } |
| 1851 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1852 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1853 | /*** <<< CTDEFS [PER-Visible] >>> ***/ |
| 1854 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 1855 | static asn_per_constraints_t asn_PER_type_PER_Visible_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 1856 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
| 1857 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 1858 | 0, 0 /* No PER character map necessary */ |
| 1859 | }; |
| 1860 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1861 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1862 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 1863 | static const ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1864 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1865 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1866 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
| 1867 | "PER-Visible", |
| 1868 | "PER-Visible", |
| 1869 | PER_Visible_free, |
| 1870 | PER_Visible_print, |
| 1871 | PER_Visible_constraint, |
| 1872 | PER_Visible_decode_ber, |
| 1873 | PER_Visible_encode_der, |
| 1874 | PER_Visible_decode_xer, |
| 1875 | PER_Visible_encode_xer, |
| 1876 | PER_Visible_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1877 | PER_Visible_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1878 | 0, /* Use generic outmost tag fetcher */ |
| 1879 | asn_DEF_PER_Visible_tags_1, |
| 1880 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1881 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
| 1882 | asn_DEF_PER_Visible_tags_1, /* Same as above */ |
| 1883 | sizeof(asn_DEF_PER_Visible_tags_1) |
| 1884 | /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 1885 | &asn_PER_type_PER_Visible_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1886 | 0, 0, /* No members */ |
| 1887 | 0 /* No specifics */ |
| 1888 | }; |
| 1889 | |
| 1890 | |
| 1891 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1892 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 1893 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1894 | |
| 1895 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1896 | |
| 1897 | typedef PER_Visible_t PER_Visible_2_t; |
| 1898 | |
| 1899 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1900 | |
| 1901 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
| 1902 | asn_struct_free_f PER_Visible_2_free; |
| 1903 | asn_struct_print_f PER_Visible_2_print; |
| 1904 | asn_constr_check_f PER_Visible_2_constraint; |
| 1905 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1906 | der_type_encoder_f PER_Visible_2_encode_der; |
| 1907 | xer_type_decoder_f PER_Visible_2_decode_xer; |
| 1908 | xer_type_encoder_f PER_Visible_2_encode_xer; |
| 1909 | per_type_decoder_f PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1910 | per_type_encoder_f PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1911 | |
| 1912 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1913 | |
| 1914 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1915 | /* The underlying type is IA5String */ |
| 1916 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 1917 | const uint8_t *ch = st->buf; |
| 1918 | const uint8_t *end = ch + st->size; |
| 1919 | |
| 1920 | for(; ch < end; ch++) { |
| 1921 | uint8_t cv = *ch; |
| 1922 | if(!(cv >= 69 && cv <= 70)) return -1; |
| 1923 | } |
| 1924 | return 0; |
| 1925 | } |
| 1926 | |
| 1927 | |
| 1928 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1929 | |
| 1930 | int |
| 1931 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 1932 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1933 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 1934 | |
| 1935 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1936 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1937 | "%s: value not given (%s:%d)", |
| 1938 | td->name, __FILE__, __LINE__); |
| 1939 | return -1; |
| 1940 | } |
| 1941 | |
| 1942 | |
| 1943 | if(!check_permitted_alphabet_1(st)) { |
| 1944 | /* Constraint check succeeded */ |
| 1945 | return 0; |
| 1946 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 1947 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1948 | "%s: constraint failed (%s:%d)", |
| 1949 | td->name, __FILE__, __LINE__); |
| 1950 | return -1; |
| 1951 | } |
| 1952 | } |
| 1953 | |
| 1954 | /* |
| 1955 | * This type is implemented using PER_Visible, |
| 1956 | * so here we adjust the DEF accordingly. |
| 1957 | */ |
| 1958 | static void |
| 1959 | PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 1960 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1961 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 1962 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1963 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1964 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1965 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1966 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1967 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 1968 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1969 | if(!td->per_constraints) |
| 1970 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 1971 | td->elements = asn_DEF_PER_Visible.elements; |
| 1972 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1973 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 1974 | } |
| 1975 | |
| 1976 | void |
| 1977 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 1978 | void *struct_ptr, int contents_only) { |
| 1979 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1980 | td->free_struct(td, struct_ptr, contents_only); |
| 1981 | } |
| 1982 | |
| 1983 | int |
| 1984 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1985 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1986 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1987 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1988 | } |
| 1989 | |
| 1990 | asn_dec_rval_t |
| 1991 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 1992 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 1993 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 1994 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 1995 | } |
| 1996 | |
| 1997 | asn_enc_rval_t |
| 1998 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 1999 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2000 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2001 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2002 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2003 | } |
| 2004 | |
| 2005 | asn_dec_rval_t |
| 2006 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2007 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2008 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2009 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2010 | } |
| 2011 | |
| 2012 | asn_enc_rval_t |
| 2013 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2014 | int ilevel, enum xer_encoder_flags_e flags, |
| 2015 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2016 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2017 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2018 | } |
| 2019 | |
| 2020 | asn_dec_rval_t |
| 2021 | PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2022 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2023 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2024 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2025 | } |
| 2026 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2027 | asn_enc_rval_t |
| 2028 | PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 2029 | asn_per_constraints_t *constraints, |
| 2030 | void *structure, asn_per_outp_t *per_out) { |
| 2031 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2032 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2033 | } |
| 2034 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2035 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2036 | /*** <<< CTDEFS [PER-Visible-2] >>> ***/ |
| 2037 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2038 | static asn_per_constraints_t asn_PER_type_PER_Visible_2_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2039 | { APC_CONSTRAINED, 1, 1, 69, 70 } /* (69..70) */, |
| 2040 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 2041 | 0, 0 /* No PER character map necessary */ |
| 2042 | }; |
| 2043 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2044 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 2045 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2046 | static const ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2047 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2048 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2049 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
| 2050 | "PER-Visible-2", |
| 2051 | "PER-Visible-2", |
| 2052 | PER_Visible_2_free, |
| 2053 | PER_Visible_2_print, |
| 2054 | PER_Visible_2_constraint, |
| 2055 | PER_Visible_2_decode_ber, |
| 2056 | PER_Visible_2_encode_der, |
| 2057 | PER_Visible_2_decode_xer, |
| 2058 | PER_Visible_2_encode_xer, |
| 2059 | PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2060 | PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2061 | 0, /* Use generic outmost tag fetcher */ |
| 2062 | asn_DEF_PER_Visible_2_tags_1, |
| 2063 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2064 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2065 | asn_DEF_PER_Visible_2_tags_1, /* Same as above */ |
| 2066 | sizeof(asn_DEF_PER_Visible_2_tags_1) |
| 2067 | /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2068 | &asn_PER_type_PER_Visible_2_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2069 | 0, 0, /* No members */ |
| 2070 | 0 /* No specifics */ |
| 2071 | }; |
| 2072 | |
| 2073 | |
| 2074 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 2075 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2076 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2077 | |
| 2078 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2079 | |
| 2080 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 2081 | |
| 2082 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 2083 | |
| 2084 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
| 2085 | asn_struct_free_f Not_PER_Visible_1_free; |
| 2086 | asn_struct_print_f Not_PER_Visible_1_print; |
| 2087 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 2088 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 2089 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
| 2090 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
| 2091 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
| 2092 | per_type_decoder_f Not_PER_Visible_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2093 | per_type_encoder_f Not_PER_Visible_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2094 | |
| 2095 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 2096 | |
| 2097 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2098 | /* The underlying type is IA5String */ |
| 2099 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2100 | const uint8_t *ch = st->buf; |
| 2101 | const uint8_t *end = ch + st->size; |
| 2102 | |
| 2103 | for(; ch < end; ch++) { |
| 2104 | uint8_t cv = *ch; |
| 2105 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 2106 | } |
| 2107 | return 0; |
| 2108 | } |
| 2109 | |
| 2110 | |
| 2111 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 2112 | |
| 2113 | int |
| 2114 | Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2115 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2116 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2117 | |
| 2118 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2119 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2120 | "%s: value not given (%s:%d)", |
| 2121 | td->name, __FILE__, __LINE__); |
| 2122 | return -1; |
| 2123 | } |
| 2124 | |
| 2125 | |
| 2126 | if(!check_permitted_alphabet_1(st)) { |
| 2127 | /* Constraint check succeeded */ |
| 2128 | return 0; |
| 2129 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2130 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2131 | "%s: constraint failed (%s:%d)", |
| 2132 | td->name, __FILE__, __LINE__); |
| 2133 | return -1; |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | /* |
| 2138 | * This type is implemented using PER_Visible, |
| 2139 | * so here we adjust the DEF accordingly. |
| 2140 | */ |
| 2141 | static void |
| 2142 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2143 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2144 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 2145 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2146 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2147 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2148 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2149 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2150 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2151 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2152 | if(!td->per_constraints) |
| 2153 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2154 | td->elements = asn_DEF_PER_Visible.elements; |
| 2155 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2156 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2157 | } |
| 2158 | |
| 2159 | void |
| 2160 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
| 2161 | void *struct_ptr, int contents_only) { |
| 2162 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2163 | td->free_struct(td, struct_ptr, contents_only); |
| 2164 | } |
| 2165 | |
| 2166 | int |
| 2167 | Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2168 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2169 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2170 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2171 | } |
| 2172 | |
| 2173 | asn_dec_rval_t |
| 2174 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2175 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2176 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2177 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2178 | } |
| 2179 | |
| 2180 | asn_enc_rval_t |
| 2181 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
| 2182 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2183 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2184 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2185 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2186 | } |
| 2187 | |
| 2188 | asn_dec_rval_t |
| 2189 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2190 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2191 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2192 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2193 | } |
| 2194 | |
| 2195 | asn_enc_rval_t |
| 2196 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2197 | int ilevel, enum xer_encoder_flags_e flags, |
| 2198 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2199 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2200 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2201 | } |
| 2202 | |
| 2203 | asn_dec_rval_t |
| 2204 | Not_PER_Visible_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2205 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2206 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2207 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2208 | } |
| 2209 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2210 | asn_enc_rval_t |
| 2211 | Not_PER_Visible_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 2212 | asn_per_constraints_t *constraints, |
| 2213 | void *structure, asn_per_outp_t *per_out) { |
| 2214 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
| 2215 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2216 | } |
| 2217 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2218 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2219 | /*** <<< CTDEFS [Not-PER-Visible-1] >>> ***/ |
| 2220 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2221 | static asn_per_constraints_t asn_PER_type_Not_PER_Visible_1_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2222 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
| 2223 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 2224 | 0, 0 /* No PER character map necessary */ |
| 2225 | }; |
| 2226 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2227 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 2228 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2229 | static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2230 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2231 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2232 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
| 2233 | "Not-PER-Visible-1", |
| 2234 | "Not-PER-Visible-1", |
| 2235 | Not_PER_Visible_1_free, |
| 2236 | Not_PER_Visible_1_print, |
| 2237 | Not_PER_Visible_1_constraint, |
| 2238 | Not_PER_Visible_1_decode_ber, |
| 2239 | Not_PER_Visible_1_encode_der, |
| 2240 | Not_PER_Visible_1_decode_xer, |
| 2241 | Not_PER_Visible_1_encode_xer, |
| 2242 | Not_PER_Visible_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2243 | Not_PER_Visible_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2244 | 0, /* Use generic outmost tag fetcher */ |
| 2245 | asn_DEF_Not_PER_Visible_1_tags_1, |
| 2246 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2247 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
| 2248 | asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ |
| 2249 | sizeof(asn_DEF_Not_PER_Visible_1_tags_1) |
| 2250 | /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2251 | &asn_PER_type_Not_PER_Visible_1_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2252 | 0, 0, /* No members */ |
| 2253 | 0 /* No specifics */ |
| 2254 | }; |
| 2255 | |
| 2256 | |
| 2257 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 2258 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2259 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2260 | |
| 2261 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2262 | |
| 2263 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 2264 | |
| 2265 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 2266 | |
| 2267 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
| 2268 | asn_struct_free_f Not_PER_Visible_2_free; |
| 2269 | asn_struct_print_f Not_PER_Visible_2_print; |
| 2270 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 2271 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 2272 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
| 2273 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
| 2274 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
| 2275 | per_type_decoder_f Not_PER_Visible_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2276 | per_type_encoder_f Not_PER_Visible_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2277 | |
| 2278 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 2279 | |
| 2280 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2281 | /* The underlying type is IA5String */ |
| 2282 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2283 | const uint8_t *ch = st->buf; |
| 2284 | const uint8_t *end = ch + st->size; |
| 2285 | |
| 2286 | for(; ch < end; ch++) { |
| 2287 | uint8_t cv = *ch; |
| 2288 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2289 | } |
| 2290 | return 0; |
| 2291 | } |
| 2292 | |
| 2293 | |
| 2294 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 2295 | |
| 2296 | int |
| 2297 | Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2298 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2299 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2300 | |
| 2301 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2302 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2303 | "%s: value not given (%s:%d)", |
| 2304 | td->name, __FILE__, __LINE__); |
| 2305 | return -1; |
| 2306 | } |
| 2307 | |
| 2308 | |
| 2309 | if(!check_permitted_alphabet_1(st)) { |
| 2310 | /* Constraint check succeeded */ |
| 2311 | return 0; |
| 2312 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2313 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2314 | "%s: constraint failed (%s:%d)", |
| 2315 | td->name, __FILE__, __LINE__); |
| 2316 | return -1; |
| 2317 | } |
| 2318 | } |
| 2319 | |
| 2320 | /* |
| 2321 | * This type is implemented using PER_Visible, |
| 2322 | * so here we adjust the DEF accordingly. |
| 2323 | */ |
| 2324 | static void |
| 2325 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2326 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2327 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 2328 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2329 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2330 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2331 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2332 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2333 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2334 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2335 | if(!td->per_constraints) |
| 2336 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2337 | td->elements = asn_DEF_PER_Visible.elements; |
| 2338 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2339 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2340 | } |
| 2341 | |
| 2342 | void |
| 2343 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
| 2344 | void *struct_ptr, int contents_only) { |
| 2345 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2346 | td->free_struct(td, struct_ptr, contents_only); |
| 2347 | } |
| 2348 | |
| 2349 | int |
| 2350 | Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2351 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2352 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2353 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2354 | } |
| 2355 | |
| 2356 | asn_dec_rval_t |
| 2357 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2358 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2359 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2360 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2361 | } |
| 2362 | |
| 2363 | asn_enc_rval_t |
| 2364 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
| 2365 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2366 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2367 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2368 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2369 | } |
| 2370 | |
| 2371 | asn_dec_rval_t |
| 2372 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2373 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2374 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2375 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2376 | } |
| 2377 | |
| 2378 | asn_enc_rval_t |
| 2379 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2380 | int ilevel, enum xer_encoder_flags_e flags, |
| 2381 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2382 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2383 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2384 | } |
| 2385 | |
| 2386 | asn_dec_rval_t |
| 2387 | Not_PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2388 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2389 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2390 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2391 | } |
| 2392 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2393 | asn_enc_rval_t |
| 2394 | Not_PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 2395 | asn_per_constraints_t *constraints, |
| 2396 | void *structure, asn_per_outp_t *per_out) { |
| 2397 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
| 2398 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2399 | } |
| 2400 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2401 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2402 | /*** <<< CTDEFS [Not-PER-Visible-2] >>> ***/ |
| 2403 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2404 | static asn_per_constraints_t asn_PER_type_Not_PER_Visible_2_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2405 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2406 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 2407 | 0, 0 /* No PER character map necessary */ |
| 2408 | }; |
| 2409 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2410 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 2411 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2412 | static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2413 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2414 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2415 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
| 2416 | "Not-PER-Visible-2", |
| 2417 | "Not-PER-Visible-2", |
| 2418 | Not_PER_Visible_2_free, |
| 2419 | Not_PER_Visible_2_print, |
| 2420 | Not_PER_Visible_2_constraint, |
| 2421 | Not_PER_Visible_2_decode_ber, |
| 2422 | Not_PER_Visible_2_encode_der, |
| 2423 | Not_PER_Visible_2_decode_xer, |
| 2424 | Not_PER_Visible_2_encode_xer, |
| 2425 | Not_PER_Visible_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2426 | Not_PER_Visible_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2427 | 0, /* Use generic outmost tag fetcher */ |
| 2428 | asn_DEF_Not_PER_Visible_2_tags_1, |
| 2429 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2430 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
| 2431 | asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ |
| 2432 | sizeof(asn_DEF_Not_PER_Visible_2_tags_1) |
| 2433 | /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2434 | &asn_PER_type_Not_PER_Visible_2_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2435 | 0, 0, /* No members */ |
| 2436 | 0 /* No specifics */ |
| 2437 | }; |
| 2438 | |
| 2439 | |
| 2440 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 2441 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2442 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2443 | |
| 2444 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2445 | |
| 2446 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 2447 | |
| 2448 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2449 | |
| 2450 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
| 2451 | asn_struct_free_f Not_PER_Visible_3_free; |
| 2452 | asn_struct_print_f Not_PER_Visible_3_print; |
| 2453 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 2454 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 2455 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
| 2456 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
| 2457 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
| 2458 | per_type_decoder_f Not_PER_Visible_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2459 | per_type_encoder_f Not_PER_Visible_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2460 | |
| 2461 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 2462 | |
| 2463 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2464 | /* The underlying type is IA5String */ |
| 2465 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2466 | const uint8_t *ch = st->buf; |
| 2467 | const uint8_t *end = ch + st->size; |
| 2468 | |
| 2469 | for(; ch < end; ch++) { |
| 2470 | uint8_t cv = *ch; |
| 2471 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2472 | } |
| 2473 | return 0; |
| 2474 | } |
| 2475 | |
| 2476 | |
| 2477 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 2478 | |
| 2479 | int |
| 2480 | Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2481 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2482 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2483 | |
| 2484 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2485 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2486 | "%s: value not given (%s:%d)", |
| 2487 | td->name, __FILE__, __LINE__); |
| 2488 | return -1; |
| 2489 | } |
| 2490 | |
| 2491 | |
| 2492 | if(!check_permitted_alphabet_1(st)) { |
| 2493 | /* Constraint check succeeded */ |
| 2494 | return 0; |
| 2495 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2496 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2497 | "%s: constraint failed (%s:%d)", |
| 2498 | td->name, __FILE__, __LINE__); |
| 2499 | return -1; |
| 2500 | } |
| 2501 | } |
| 2502 | |
| 2503 | /* |
| 2504 | * This type is implemented using PER_Visible, |
| 2505 | * so here we adjust the DEF accordingly. |
| 2506 | */ |
| 2507 | static void |
| 2508 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2509 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2510 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 2511 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2512 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2513 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2514 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2515 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2516 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2517 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2518 | if(!td->per_constraints) |
| 2519 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2520 | td->elements = asn_DEF_PER_Visible.elements; |
| 2521 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2522 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2523 | } |
| 2524 | |
| 2525 | void |
| 2526 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
| 2527 | void *struct_ptr, int contents_only) { |
| 2528 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2529 | td->free_struct(td, struct_ptr, contents_only); |
| 2530 | } |
| 2531 | |
| 2532 | int |
| 2533 | Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2534 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2535 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2536 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2537 | } |
| 2538 | |
| 2539 | asn_dec_rval_t |
| 2540 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2541 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2542 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2543 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2544 | } |
| 2545 | |
| 2546 | asn_enc_rval_t |
| 2547 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
| 2548 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2549 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2550 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2551 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2552 | } |
| 2553 | |
| 2554 | asn_dec_rval_t |
| 2555 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2556 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2557 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2558 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2559 | } |
| 2560 | |
| 2561 | asn_enc_rval_t |
| 2562 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2563 | int ilevel, enum xer_encoder_flags_e flags, |
| 2564 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2565 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2566 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2567 | } |
| 2568 | |
| 2569 | asn_dec_rval_t |
| 2570 | Not_PER_Visible_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2571 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2572 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2573 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2574 | } |
| 2575 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2576 | asn_enc_rval_t |
| 2577 | Not_PER_Visible_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 2578 | asn_per_constraints_t *constraints, |
| 2579 | void *structure, asn_per_outp_t *per_out) { |
| 2580 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
| 2581 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2582 | } |
| 2583 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2584 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2585 | /*** <<< CTDEFS [Not-PER-Visible-3] >>> ***/ |
| 2586 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2587 | static asn_per_constraints_t asn_PER_type_Not_PER_Visible_3_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2588 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2589 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 2590 | 0, 0 /* No PER character map necessary */ |
| 2591 | }; |
| 2592 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2593 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 2594 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2595 | static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2596 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2597 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2598 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
| 2599 | "Not-PER-Visible-3", |
| 2600 | "Not-PER-Visible-3", |
| 2601 | Not_PER_Visible_3_free, |
| 2602 | Not_PER_Visible_3_print, |
| 2603 | Not_PER_Visible_3_constraint, |
| 2604 | Not_PER_Visible_3_decode_ber, |
| 2605 | Not_PER_Visible_3_encode_der, |
| 2606 | Not_PER_Visible_3_decode_xer, |
| 2607 | Not_PER_Visible_3_encode_xer, |
| 2608 | Not_PER_Visible_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2609 | Not_PER_Visible_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2610 | 0, /* Use generic outmost tag fetcher */ |
| 2611 | asn_DEF_Not_PER_Visible_3_tags_1, |
| 2612 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2613 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
| 2614 | asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ |
| 2615 | sizeof(asn_DEF_Not_PER_Visible_3_tags_1) |
| 2616 | /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2617 | &asn_PER_type_Not_PER_Visible_3_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2618 | 0, 0, /* No members */ |
| 2619 | 0 /* No specifics */ |
| 2620 | }; |
| 2621 | |
| 2622 | |
| 2623 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 2624 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2625 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2626 | |
| 2627 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2628 | |
| 2629 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 2630 | |
| 2631 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2632 | |
| 2633 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
| 2634 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 2635 | asn_struct_print_f SIZE_but_not_FROM_print; |
| 2636 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 2637 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 2638 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
| 2639 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
| 2640 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
| 2641 | per_type_decoder_f SIZE_but_not_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2642 | per_type_encoder_f SIZE_but_not_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2643 | |
| 2644 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 2645 | |
| 2646 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2647 | /* The underlying type is IA5String */ |
| 2648 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2649 | const uint8_t *ch = st->buf; |
| 2650 | const uint8_t *end = ch + st->size; |
| 2651 | |
| 2652 | for(; ch < end; ch++) { |
| 2653 | uint8_t cv = *ch; |
| 2654 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2655 | } |
| 2656 | return 0; |
| 2657 | } |
| 2658 | |
| 2659 | |
| 2660 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2661 | |
| 2662 | int |
| 2663 | SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2664 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2665 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2666 | size_t size; |
| 2667 | |
| 2668 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2669 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2670 | "%s: value not given (%s:%d)", |
| 2671 | td->name, __FILE__, __LINE__); |
| 2672 | return -1; |
| 2673 | } |
| 2674 | |
| 2675 | size = st->size; |
| 2676 | |
| 2677 | if((size >= 1 && size <= 4) |
| 2678 | && !check_permitted_alphabet_1(st)) { |
| 2679 | /* Constraint check succeeded */ |
| 2680 | return 0; |
| 2681 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2682 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2683 | "%s: constraint failed (%s:%d)", |
| 2684 | td->name, __FILE__, __LINE__); |
| 2685 | return -1; |
| 2686 | } |
| 2687 | } |
| 2688 | |
| 2689 | /* |
| 2690 | * This type is implemented using PER_Visible, |
| 2691 | * so here we adjust the DEF accordingly. |
| 2692 | */ |
| 2693 | static void |
| 2694 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2695 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2696 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 2697 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2698 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2699 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2700 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2701 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2702 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2703 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2704 | if(!td->per_constraints) |
| 2705 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2706 | td->elements = asn_DEF_PER_Visible.elements; |
| 2707 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2708 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2709 | } |
| 2710 | |
| 2711 | void |
| 2712 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
| 2713 | void *struct_ptr, int contents_only) { |
| 2714 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2715 | td->free_struct(td, struct_ptr, contents_only); |
| 2716 | } |
| 2717 | |
| 2718 | int |
| 2719 | SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2720 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2721 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2722 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2723 | } |
| 2724 | |
| 2725 | asn_dec_rval_t |
| 2726 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2727 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2728 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2729 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2730 | } |
| 2731 | |
| 2732 | asn_enc_rval_t |
| 2733 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2734 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2735 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2736 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2737 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2738 | } |
| 2739 | |
| 2740 | asn_dec_rval_t |
| 2741 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2742 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2743 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2744 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2745 | } |
| 2746 | |
| 2747 | asn_enc_rval_t |
| 2748 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2749 | int ilevel, enum xer_encoder_flags_e flags, |
| 2750 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2751 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2752 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2753 | } |
| 2754 | |
| 2755 | asn_dec_rval_t |
| 2756 | SIZE_but_not_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2757 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2758 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2759 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2760 | } |
| 2761 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2762 | asn_enc_rval_t |
| 2763 | SIZE_but_not_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2764 | asn_per_constraints_t *constraints, |
| 2765 | void *structure, asn_per_outp_t *per_out) { |
| 2766 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
| 2767 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2768 | } |
| 2769 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2770 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2771 | /*** <<< CTDEFS [SIZE-but-not-FROM] >>> ***/ |
| 2772 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2773 | static asn_per_constraints_t asn_PER_type_SIZE_but_not_FROM_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2774 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 2775 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, |
| 2776 | 0, 0 /* No PER character map necessary */ |
| 2777 | }; |
| 2778 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2779 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2780 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2781 | static const ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2782 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2783 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2784 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
| 2785 | "SIZE-but-not-FROM", |
| 2786 | "SIZE-but-not-FROM", |
| 2787 | SIZE_but_not_FROM_free, |
| 2788 | SIZE_but_not_FROM_print, |
| 2789 | SIZE_but_not_FROM_constraint, |
| 2790 | SIZE_but_not_FROM_decode_ber, |
| 2791 | SIZE_but_not_FROM_encode_der, |
| 2792 | SIZE_but_not_FROM_decode_xer, |
| 2793 | SIZE_but_not_FROM_encode_xer, |
| 2794 | SIZE_but_not_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2795 | SIZE_but_not_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2796 | 0, /* Use generic outmost tag fetcher */ |
| 2797 | asn_DEF_SIZE_but_not_FROM_tags_1, |
| 2798 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2799 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
| 2800 | asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ |
| 2801 | sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) |
| 2802 | /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2803 | &asn_PER_type_SIZE_but_not_FROM_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2804 | 0, 0, /* No members */ |
| 2805 | 0 /* No specifics */ |
| 2806 | }; |
| 2807 | |
| 2808 | |
| 2809 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2810 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2811 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2812 | |
| 2813 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2814 | |
| 2815 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2816 | |
| 2817 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2818 | |
| 2819 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
| 2820 | asn_struct_free_f SIZE_and_FROM_free; |
| 2821 | asn_struct_print_f SIZE_and_FROM_print; |
| 2822 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2823 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2824 | der_type_encoder_f SIZE_and_FROM_encode_der; |
| 2825 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
| 2826 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
| 2827 | per_type_decoder_f SIZE_and_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2828 | per_type_encoder_f SIZE_and_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2829 | |
| 2830 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2831 | |
| 2832 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2833 | /* The underlying type is IA5String */ |
| 2834 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 2835 | const uint8_t *ch = st->buf; |
| 2836 | const uint8_t *end = ch + st->size; |
| 2837 | |
| 2838 | for(; ch < end; ch++) { |
| 2839 | uint8_t cv = *ch; |
| 2840 | if(!(cv >= 65 && cv <= 68)) return -1; |
| 2841 | } |
| 2842 | return 0; |
| 2843 | } |
| 2844 | |
| 2845 | |
| 2846 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2847 | |
| 2848 | int |
| 2849 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 2850 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2851 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 2852 | size_t size; |
| 2853 | |
| 2854 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2855 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2856 | "%s: value not given (%s:%d)", |
| 2857 | td->name, __FILE__, __LINE__); |
| 2858 | return -1; |
| 2859 | } |
| 2860 | |
| 2861 | size = st->size; |
| 2862 | |
| 2863 | if((size >= 1 && size <= 4) |
| 2864 | && !check_permitted_alphabet_1(st)) { |
| 2865 | /* Constraint check succeeded */ |
| 2866 | return 0; |
| 2867 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 2868 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2869 | "%s: constraint failed (%s:%d)", |
| 2870 | td->name, __FILE__, __LINE__); |
| 2871 | return -1; |
| 2872 | } |
| 2873 | } |
| 2874 | |
| 2875 | /* |
| 2876 | * This type is implemented using PER_Visible, |
| 2877 | * so here we adjust the DEF accordingly. |
| 2878 | */ |
| 2879 | static void |
| 2880 | SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 2881 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2882 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 2883 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2884 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2885 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2886 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2887 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2888 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2889 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2890 | if(!td->per_constraints) |
| 2891 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 2892 | td->elements = asn_DEF_PER_Visible.elements; |
| 2893 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2894 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 2895 | } |
| 2896 | |
| 2897 | void |
| 2898 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
| 2899 | void *struct_ptr, int contents_only) { |
| 2900 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2901 | td->free_struct(td, struct_ptr, contents_only); |
| 2902 | } |
| 2903 | |
| 2904 | int |
| 2905 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2906 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2907 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2908 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2909 | } |
| 2910 | |
| 2911 | asn_dec_rval_t |
| 2912 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2913 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 2914 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2915 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2916 | } |
| 2917 | |
| 2918 | asn_enc_rval_t |
| 2919 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 2920 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2921 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2922 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2923 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2924 | } |
| 2925 | |
| 2926 | asn_dec_rval_t |
| 2927 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2928 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 2929 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2930 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2931 | } |
| 2932 | |
| 2933 | asn_enc_rval_t |
| 2934 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2935 | int ilevel, enum xer_encoder_flags_e flags, |
| 2936 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2937 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2938 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2939 | } |
| 2940 | |
| 2941 | asn_dec_rval_t |
| 2942 | SIZE_and_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 2943 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 2944 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2945 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 2946 | } |
| 2947 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2948 | asn_enc_rval_t |
| 2949 | SIZE_and_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 2950 | asn_per_constraints_t *constraints, |
| 2951 | void *structure, asn_per_outp_t *per_out) { |
| 2952 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
| 2953 | return td->uper_encoder(td, constraints, structure, per_out); |
| 2954 | } |
| 2955 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2956 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2957 | /*** <<< CTDEFS [SIZE-and-FROM] >>> ***/ |
| 2958 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 2959 | static asn_per_constraints_t asn_PER_type_SIZE_and_FROM_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 2960 | { APC_CONSTRAINED, 2, 2, 65, 68 } /* (65..68) */, |
| 2961 | { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, |
| 2962 | 0, 0 /* No PER character map necessary */ |
| 2963 | }; |
| 2964 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2965 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2966 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 2967 | static const ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2968 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 2969 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2970 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
| 2971 | "SIZE-and-FROM", |
| 2972 | "SIZE-and-FROM", |
| 2973 | SIZE_and_FROM_free, |
| 2974 | SIZE_and_FROM_print, |
| 2975 | SIZE_and_FROM_constraint, |
| 2976 | SIZE_and_FROM_decode_ber, |
| 2977 | SIZE_and_FROM_encode_der, |
| 2978 | SIZE_and_FROM_decode_xer, |
| 2979 | SIZE_and_FROM_encode_xer, |
| 2980 | SIZE_and_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 2981 | SIZE_and_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2982 | 0, /* Use generic outmost tag fetcher */ |
| 2983 | asn_DEF_SIZE_and_FROM_tags_1, |
| 2984 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2985 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
| 2986 | asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ |
| 2987 | sizeof(asn_DEF_SIZE_and_FROM_tags_1) |
| 2988 | /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 2989 | &asn_PER_type_SIZE_and_FROM_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2990 | 0, 0, /* No members */ |
| 2991 | 0 /* No specifics */ |
| 2992 | }; |
| 2993 | |
| 2994 | |
| 2995 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2996 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 2997 | #include "PER-Visible.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 2998 | |
| 2999 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3000 | |
| 3001 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 3002 | |
| 3003 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3004 | |
| 3005 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
| 3006 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 3007 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
| 3008 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 3009 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 3010 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
| 3011 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
| 3012 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
| 3013 | per_type_decoder_f Neither_SIZE_nor_FROM_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3014 | per_type_encoder_f Neither_SIZE_nor_FROM_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3015 | |
| 3016 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 3017 | |
| 3018 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3019 | /* The underlying type is IA5String */ |
| 3020 | const IA5String_t *st = (const IA5String_t *)sptr; |
| 3021 | const uint8_t *ch = st->buf; |
| 3022 | const uint8_t *end = ch + st->size; |
| 3023 | |
| 3024 | for(; ch < end; ch++) { |
| 3025 | uint8_t cv = *ch; |
| 3026 | if(!(cv >= 65 && cv <= 70)) return -1; |
| 3027 | } |
| 3028 | return 0; |
| 3029 | } |
| 3030 | |
| 3031 | |
| 3032 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 3033 | |
| 3034 | int |
| 3035 | Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3036 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3037 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
| 3038 | |
| 3039 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3040 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3041 | "%s: value not given (%s:%d)", |
| 3042 | td->name, __FILE__, __LINE__); |
| 3043 | return -1; |
| 3044 | } |
| 3045 | |
| 3046 | |
| 3047 | if(!check_permitted_alphabet_1(st)) { |
| 3048 | /* Constraint check succeeded */ |
| 3049 | return 0; |
| 3050 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3051 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3052 | "%s: constraint failed (%s:%d)", |
| 3053 | td->name, __FILE__, __LINE__); |
| 3054 | return -1; |
| 3055 | } |
| 3056 | } |
| 3057 | |
| 3058 | /* |
| 3059 | * This type is implemented using PER_Visible, |
| 3060 | * so here we adjust the DEF accordingly. |
| 3061 | */ |
| 3062 | static void |
| 3063 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3064 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 3065 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3066 | td->check_constraints = asn_DEF_PER_Visible.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3067 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 3068 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 3069 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 3070 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 3071 | td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3072 | td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3073 | if(!td->per_constraints) |
| 3074 | td->per_constraints = asn_DEF_PER_Visible.per_constraints; |
| 3075 | td->elements = asn_DEF_PER_Visible.elements; |
| 3076 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 3077 | td->specifics = asn_DEF_PER_Visible.specifics; |
| 3078 | } |
| 3079 | |
| 3080 | void |
| 3081 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
| 3082 | void *struct_ptr, int contents_only) { |
| 3083 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3084 | td->free_struct(td, struct_ptr, contents_only); |
| 3085 | } |
| 3086 | |
| 3087 | int |
| 3088 | Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3089 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3090 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3091 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3092 | } |
| 3093 | |
| 3094 | asn_dec_rval_t |
| 3095 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3096 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3097 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3098 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3099 | } |
| 3100 | |
| 3101 | asn_enc_rval_t |
| 3102 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
| 3103 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3104 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3105 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3106 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3107 | } |
| 3108 | |
| 3109 | asn_dec_rval_t |
| 3110 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3111 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3112 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3113 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3114 | } |
| 3115 | |
| 3116 | asn_enc_rval_t |
| 3117 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3118 | int ilevel, enum xer_encoder_flags_e flags, |
| 3119 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3120 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3121 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3122 | } |
| 3123 | |
| 3124 | asn_dec_rval_t |
| 3125 | Neither_SIZE_nor_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3126 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3127 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3128 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3129 | } |
| 3130 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3131 | asn_enc_rval_t |
| 3132 | Neither_SIZE_nor_FROM_encode_uper(asn_TYPE_descriptor_t *td, |
| 3133 | asn_per_constraints_t *constraints, |
| 3134 | void *structure, asn_per_outp_t *per_out) { |
| 3135 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
| 3136 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3137 | } |
| 3138 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3139 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3140 | /*** <<< CTDEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3141 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 3142 | static asn_per_constraints_t asn_PER_type_Neither_SIZE_nor_FROM_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3143 | { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, |
| 3144 | { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, |
| 3145 | 0, 0 /* No PER character map necessary */ |
| 3146 | }; |
| 3147 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3148 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 3149 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3150 | static const ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3151 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 3152 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3153 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
| 3154 | "Neither-SIZE-nor-FROM", |
| 3155 | "Neither-SIZE-nor-FROM", |
| 3156 | Neither_SIZE_nor_FROM_free, |
| 3157 | Neither_SIZE_nor_FROM_print, |
| 3158 | Neither_SIZE_nor_FROM_constraint, |
| 3159 | Neither_SIZE_nor_FROM_decode_ber, |
| 3160 | Neither_SIZE_nor_FROM_encode_der, |
| 3161 | Neither_SIZE_nor_FROM_decode_xer, |
| 3162 | Neither_SIZE_nor_FROM_encode_xer, |
| 3163 | Neither_SIZE_nor_FROM_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3164 | Neither_SIZE_nor_FROM_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3165 | 0, /* Use generic outmost tag fetcher */ |
| 3166 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, |
| 3167 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3168 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
| 3169 | asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ |
| 3170 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) |
| 3171 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 3172 | &asn_PER_type_Neither_SIZE_nor_FROM_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3173 | 0, 0, /* No members */ |
| 3174 | 0 /* No specifics */ |
| 3175 | }; |
| 3176 | |
| 3177 | |
| 3178 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 3179 | |
| 3180 | #include <UTF8String.h> |
| 3181 | |
| 3182 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 3183 | |
| 3184 | typedef UTF8String_t Utf8_4_t; |
| 3185 | |
| 3186 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 3187 | |
| 3188 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 3189 | asn_struct_free_f Utf8_4_free; |
| 3190 | asn_struct_print_f Utf8_4_print; |
| 3191 | asn_constr_check_f Utf8_4_constraint; |
| 3192 | ber_type_decoder_f Utf8_4_decode_ber; |
| 3193 | der_type_encoder_f Utf8_4_encode_der; |
| 3194 | xer_type_decoder_f Utf8_4_decode_xer; |
| 3195 | xer_type_encoder_f Utf8_4_encode_xer; |
| 3196 | per_type_decoder_f Utf8_4_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3197 | per_type_encoder_f Utf8_4_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3198 | |
| 3199 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 3200 | |
| 3201 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3202 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 3203 | return -1; /* Alphabet (sic!) test failed. */ |
| 3204 | |
| 3205 | return 0; |
| 3206 | } |
| 3207 | |
| 3208 | |
| 3209 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 3210 | |
| 3211 | int |
| 3212 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3213 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3214 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3215 | |
| 3216 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3217 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3218 | "%s: value not given (%s:%d)", |
| 3219 | td->name, __FILE__, __LINE__); |
| 3220 | return -1; |
| 3221 | } |
| 3222 | |
| 3223 | |
| 3224 | if(!check_permitted_alphabet_1(st)) { |
| 3225 | /* Constraint check succeeded */ |
| 3226 | return 0; |
| 3227 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3228 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3229 | "%s: constraint failed (%s:%d)", |
| 3230 | td->name, __FILE__, __LINE__); |
| 3231 | return -1; |
| 3232 | } |
| 3233 | } |
| 3234 | |
| 3235 | /* |
| 3236 | * This type is implemented using UTF8String, |
| 3237 | * so here we adjust the DEF accordingly. |
| 3238 | */ |
| 3239 | static void |
| 3240 | Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3241 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3242 | td->print_struct = asn_DEF_UTF8String.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3243 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3244 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3245 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3246 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3247 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3248 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3249 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3250 | if(!td->per_constraints) |
| 3251 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3252 | td->elements = asn_DEF_UTF8String.elements; |
| 3253 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3254 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3255 | } |
| 3256 | |
| 3257 | void |
| 3258 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 3259 | void *struct_ptr, int contents_only) { |
| 3260 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3261 | td->free_struct(td, struct_ptr, contents_only); |
| 3262 | } |
| 3263 | |
| 3264 | int |
| 3265 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3266 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3267 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3268 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3269 | } |
| 3270 | |
| 3271 | asn_dec_rval_t |
| 3272 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3273 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3274 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3275 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3276 | } |
| 3277 | |
| 3278 | asn_enc_rval_t |
| 3279 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 3280 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3281 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3282 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3283 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3284 | } |
| 3285 | |
| 3286 | asn_dec_rval_t |
| 3287 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3288 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3289 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3290 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3291 | } |
| 3292 | |
| 3293 | asn_enc_rval_t |
| 3294 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3295 | int ilevel, enum xer_encoder_flags_e flags, |
| 3296 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3297 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3298 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3299 | } |
| 3300 | |
| 3301 | asn_dec_rval_t |
| 3302 | Utf8_4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3303 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3304 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3305 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3306 | } |
| 3307 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3308 | asn_enc_rval_t |
| 3309 | Utf8_4_encode_uper(asn_TYPE_descriptor_t *td, |
| 3310 | asn_per_constraints_t *constraints, |
| 3311 | void *structure, asn_per_outp_t *per_out) { |
| 3312 | Utf8_4_1_inherit_TYPE_descriptor(td); |
| 3313 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3314 | } |
| 3315 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3316 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3317 | /*** <<< CTDEFS [Utf8-4] >>> ***/ |
| 3318 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 3319 | static asn_per_constraints_t asn_PER_type_Utf8_4_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3320 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3321 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3322 | 0, 0 /* No PER value map */ |
| 3323 | }; |
| 3324 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3325 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 3326 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3327 | static const ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3328 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3329 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3330 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 3331 | "Utf8-4", |
| 3332 | "Utf8-4", |
| 3333 | Utf8_4_free, |
| 3334 | Utf8_4_print, |
| 3335 | Utf8_4_constraint, |
| 3336 | Utf8_4_decode_ber, |
| 3337 | Utf8_4_encode_der, |
| 3338 | Utf8_4_decode_xer, |
| 3339 | Utf8_4_encode_xer, |
| 3340 | Utf8_4_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3341 | Utf8_4_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3342 | 0, /* Use generic outmost tag fetcher */ |
| 3343 | asn_DEF_Utf8_4_tags_1, |
| 3344 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3345 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
| 3346 | asn_DEF_Utf8_4_tags_1, /* Same as above */ |
| 3347 | sizeof(asn_DEF_Utf8_4_tags_1) |
| 3348 | /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 3349 | &asn_PER_type_Utf8_4_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3350 | 0, 0, /* No members */ |
| 3351 | 0 /* No specifics */ |
| 3352 | }; |
| 3353 | |
| 3354 | |
| 3355 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 3356 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3357 | #include "Utf8-2.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3358 | |
| 3359 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 3360 | |
| 3361 | typedef Utf8_2_t Utf8_3_t; |
| 3362 | |
| 3363 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 3364 | |
| 3365 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
| 3366 | asn_struct_free_f Utf8_3_free; |
| 3367 | asn_struct_print_f Utf8_3_print; |
| 3368 | asn_constr_check_f Utf8_3_constraint; |
| 3369 | ber_type_decoder_f Utf8_3_decode_ber; |
| 3370 | der_type_encoder_f Utf8_3_encode_der; |
| 3371 | xer_type_decoder_f Utf8_3_decode_xer; |
| 3372 | xer_type_encoder_f Utf8_3_encode_xer; |
| 3373 | per_type_decoder_f Utf8_3_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3374 | per_type_encoder_f Utf8_3_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3375 | |
| 3376 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 3377 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3378 | static const int permitted_alphabet_table_1[128] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 3379 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3380 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3381 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3382 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3383 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */ |
| 3384 | 16,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ |
| 3385 | 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */ |
| 3386 | 42,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3387 | }; |
| 3388 | |
| 3389 | static int check_permitted_alphabet_1(const void *sptr) { |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3390 | const int *table = permitted_alphabet_table_1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3391 | /* The underlying type is UTF8String */ |
| 3392 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
| 3393 | const uint8_t *ch = st->buf; |
| 3394 | const uint8_t *end = ch + st->size; |
| 3395 | |
| 3396 | for(; ch < end; ch++) { |
| 3397 | uint8_t cv = *ch; |
| 3398 | if(cv >= 0x80) return -1; |
| 3399 | if(!table[cv]) return -1; |
| 3400 | } |
| 3401 | return 0; |
| 3402 | } |
| 3403 | |
| 3404 | |
| 3405 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 3406 | |
| 3407 | int |
| 3408 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3409 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3410 | const Utf8_2_t *st = (const Utf8_2_t *)sptr; |
| 3411 | size_t size; |
| 3412 | |
| 3413 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3414 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3415 | "%s: value not given (%s:%d)", |
| 3416 | td->name, __FILE__, __LINE__); |
| 3417 | return -1; |
| 3418 | } |
| 3419 | |
| 3420 | size = UTF8String_length(st); |
| 3421 | if((ssize_t)size < 0) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3422 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3423 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3424 | td->name, __FILE__, __LINE__); |
| 3425 | return -1; |
| 3426 | } |
| 3427 | |
| 3428 | if((size >= 1 && size <= 2) |
| 3429 | && !check_permitted_alphabet_1(st)) { |
| 3430 | /* Constraint check succeeded */ |
| 3431 | return 0; |
| 3432 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3433 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3434 | "%s: constraint failed (%s:%d)", |
| 3435 | td->name, __FILE__, __LINE__); |
| 3436 | return -1; |
| 3437 | } |
| 3438 | } |
| 3439 | |
| 3440 | /* |
| 3441 | * This type is implemented using Utf8_2, |
| 3442 | * so here we adjust the DEF accordingly. |
| 3443 | */ |
| 3444 | static void |
| 3445 | Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3446 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 3447 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3448 | td->check_constraints = asn_DEF_Utf8_2.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3449 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 3450 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 3451 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 3452 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
| 3453 | td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3454 | td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3455 | if(!td->per_constraints) |
| 3456 | td->per_constraints = asn_DEF_Utf8_2.per_constraints; |
| 3457 | td->elements = asn_DEF_Utf8_2.elements; |
| 3458 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 3459 | td->specifics = asn_DEF_Utf8_2.specifics; |
| 3460 | } |
| 3461 | |
| 3462 | void |
| 3463 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
| 3464 | void *struct_ptr, int contents_only) { |
| 3465 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3466 | td->free_struct(td, struct_ptr, contents_only); |
| 3467 | } |
| 3468 | |
| 3469 | int |
| 3470 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3471 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3472 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3473 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3474 | } |
| 3475 | |
| 3476 | asn_dec_rval_t |
| 3477 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3478 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3479 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3480 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3481 | } |
| 3482 | |
| 3483 | asn_enc_rval_t |
| 3484 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
| 3485 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3486 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3487 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3488 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3489 | } |
| 3490 | |
| 3491 | asn_dec_rval_t |
| 3492 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3493 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3494 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3495 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3496 | } |
| 3497 | |
| 3498 | asn_enc_rval_t |
| 3499 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3500 | int ilevel, enum xer_encoder_flags_e flags, |
| 3501 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3502 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3503 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3504 | } |
| 3505 | |
| 3506 | asn_dec_rval_t |
| 3507 | Utf8_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3508 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3509 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3510 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3511 | } |
| 3512 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3513 | asn_enc_rval_t |
| 3514 | Utf8_3_encode_uper(asn_TYPE_descriptor_t *td, |
| 3515 | asn_per_constraints_t *constraints, |
| 3516 | void *structure, asn_per_outp_t *per_out) { |
| 3517 | Utf8_3_1_inherit_TYPE_descriptor(td); |
| 3518 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3519 | } |
| 3520 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3521 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3522 | /*** <<< CTDEFS [Utf8-3] >>> ***/ |
| 3523 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 3524 | static asn_per_constraints_t asn_PER_type_Utf8_3_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3525 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3526 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3527 | 0, 0 /* No PER value map */ |
| 3528 | }; |
| 3529 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3530 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 3531 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3532 | static const ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3533 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3534 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3535 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
| 3536 | "Utf8-3", |
| 3537 | "Utf8-3", |
| 3538 | Utf8_3_free, |
| 3539 | Utf8_3_print, |
| 3540 | Utf8_3_constraint, |
| 3541 | Utf8_3_decode_ber, |
| 3542 | Utf8_3_encode_der, |
| 3543 | Utf8_3_decode_xer, |
| 3544 | Utf8_3_encode_xer, |
| 3545 | Utf8_3_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3546 | Utf8_3_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3547 | 0, /* Use generic outmost tag fetcher */ |
| 3548 | asn_DEF_Utf8_3_tags_1, |
| 3549 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3550 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
| 3551 | asn_DEF_Utf8_3_tags_1, /* Same as above */ |
| 3552 | sizeof(asn_DEF_Utf8_3_tags_1) |
| 3553 | /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 3554 | &asn_PER_type_Utf8_3_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3555 | 0, 0, /* No members */ |
| 3556 | 0 /* No specifics */ |
| 3557 | }; |
| 3558 | |
| 3559 | |
| 3560 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 3561 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3562 | #include "Utf8-1.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3563 | |
| 3564 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 3565 | |
| 3566 | typedef Utf8_1_t Utf8_2_t; |
| 3567 | |
| 3568 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 3569 | |
| 3570 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
| 3571 | asn_struct_free_f Utf8_2_free; |
| 3572 | asn_struct_print_f Utf8_2_print; |
| 3573 | asn_constr_check_f Utf8_2_constraint; |
| 3574 | ber_type_decoder_f Utf8_2_decode_ber; |
| 3575 | der_type_encoder_f Utf8_2_encode_der; |
| 3576 | xer_type_decoder_f Utf8_2_decode_xer; |
| 3577 | xer_type_encoder_f Utf8_2_encode_xer; |
| 3578 | per_type_decoder_f Utf8_2_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3579 | per_type_encoder_f Utf8_2_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3580 | |
| 3581 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 3582 | |
| 3583 | int |
| 3584 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3585 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3586 | const Utf8_1_t *st = (const Utf8_1_t *)sptr; |
| 3587 | size_t size; |
| 3588 | |
| 3589 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3590 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3591 | "%s: value not given (%s:%d)", |
| 3592 | td->name, __FILE__, __LINE__); |
| 3593 | return -1; |
| 3594 | } |
| 3595 | |
| 3596 | size = UTF8String_length(st); |
| 3597 | if((ssize_t)size < 0) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3598 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3599 | "%s: UTF-8: broken encoding (%s:%d)", |
| 3600 | td->name, __FILE__, __LINE__); |
| 3601 | return -1; |
| 3602 | } |
| 3603 | |
| 3604 | if((size >= 1 && size <= 2)) { |
| 3605 | /* Constraint check succeeded */ |
| 3606 | return 0; |
| 3607 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3608 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3609 | "%s: constraint failed (%s:%d)", |
| 3610 | td->name, __FILE__, __LINE__); |
| 3611 | return -1; |
| 3612 | } |
| 3613 | } |
| 3614 | |
| 3615 | /* |
| 3616 | * This type is implemented using Utf8_1, |
| 3617 | * so here we adjust the DEF accordingly. |
| 3618 | */ |
| 3619 | static void |
| 3620 | Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3621 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 3622 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3623 | td->check_constraints = asn_DEF_Utf8_1.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3624 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 3625 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 3626 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 3627 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
| 3628 | td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3629 | td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3630 | if(!td->per_constraints) |
| 3631 | td->per_constraints = asn_DEF_Utf8_1.per_constraints; |
| 3632 | td->elements = asn_DEF_Utf8_1.elements; |
| 3633 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 3634 | td->specifics = asn_DEF_Utf8_1.specifics; |
| 3635 | } |
| 3636 | |
| 3637 | void |
| 3638 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
| 3639 | void *struct_ptr, int contents_only) { |
| 3640 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3641 | td->free_struct(td, struct_ptr, contents_only); |
| 3642 | } |
| 3643 | |
| 3644 | int |
| 3645 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3646 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3647 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3648 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3649 | } |
| 3650 | |
| 3651 | asn_dec_rval_t |
| 3652 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3653 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3654 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3655 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3656 | } |
| 3657 | |
| 3658 | asn_enc_rval_t |
| 3659 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
| 3660 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3661 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3662 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3663 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3664 | } |
| 3665 | |
| 3666 | asn_dec_rval_t |
| 3667 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3668 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3669 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3670 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3671 | } |
| 3672 | |
| 3673 | asn_enc_rval_t |
| 3674 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3675 | int ilevel, enum xer_encoder_flags_e flags, |
| 3676 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3677 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3678 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3679 | } |
| 3680 | |
| 3681 | asn_dec_rval_t |
| 3682 | Utf8_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3683 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3684 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3685 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3686 | } |
| 3687 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3688 | asn_enc_rval_t |
| 3689 | Utf8_2_encode_uper(asn_TYPE_descriptor_t *td, |
| 3690 | asn_per_constraints_t *constraints, |
| 3691 | void *structure, asn_per_outp_t *per_out) { |
| 3692 | Utf8_2_1_inherit_TYPE_descriptor(td); |
| 3693 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3694 | } |
| 3695 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3696 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3697 | /*** <<< CTDEFS [Utf8-2] >>> ***/ |
| 3698 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 3699 | static asn_per_constraints_t asn_PER_type_Utf8_2_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 3700 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3701 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 3702 | 0, 0 /* No PER value map */ |
| 3703 | }; |
| 3704 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3705 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 3706 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3707 | static const ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3708 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3709 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3710 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
| 3711 | "Utf8-2", |
| 3712 | "Utf8-2", |
| 3713 | Utf8_2_free, |
| 3714 | Utf8_2_print, |
| 3715 | Utf8_2_constraint, |
| 3716 | Utf8_2_decode_ber, |
| 3717 | Utf8_2_encode_der, |
| 3718 | Utf8_2_decode_xer, |
| 3719 | Utf8_2_encode_xer, |
| 3720 | Utf8_2_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3721 | Utf8_2_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3722 | 0, /* Use generic outmost tag fetcher */ |
| 3723 | asn_DEF_Utf8_2_tags_1, |
| 3724 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3725 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
| 3726 | asn_DEF_Utf8_2_tags_1, /* Same as above */ |
| 3727 | sizeof(asn_DEF_Utf8_2_tags_1) |
| 3728 | /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 3729 | &asn_PER_type_Utf8_2_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3730 | 0, 0, /* No members */ |
| 3731 | 0 /* No specifics */ |
| 3732 | }; |
| 3733 | |
| 3734 | |
| 3735 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 3736 | |
| 3737 | #include <UTF8String.h> |
| 3738 | |
| 3739 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 3740 | |
| 3741 | typedef UTF8String_t Utf8_1_t; |
| 3742 | |
| 3743 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 3744 | |
| 3745 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; |
| 3746 | asn_struct_free_f Utf8_1_free; |
| 3747 | asn_struct_print_f Utf8_1_print; |
| 3748 | asn_constr_check_f Utf8_1_constraint; |
| 3749 | ber_type_decoder_f Utf8_1_decode_ber; |
| 3750 | der_type_encoder_f Utf8_1_encode_der; |
| 3751 | xer_type_decoder_f Utf8_1_decode_xer; |
| 3752 | xer_type_encoder_f Utf8_1_encode_xer; |
| 3753 | per_type_decoder_f Utf8_1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3754 | per_type_encoder_f Utf8_1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3755 | |
| 3756 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 3757 | |
| 3758 | int |
| 3759 | Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3760 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3761 | /* Replace with underlying type checker */ |
| 3762 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3763 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3764 | } |
| 3765 | |
| 3766 | /* |
| 3767 | * This type is implemented using UTF8String, |
| 3768 | * so here we adjust the DEF accordingly. |
| 3769 | */ |
| 3770 | static void |
| 3771 | Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3772 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3773 | td->print_struct = asn_DEF_UTF8String.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3774 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3775 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3776 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3777 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3778 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3779 | td->uper_decoder = asn_DEF_UTF8String.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3780 | td->uper_encoder = asn_DEF_UTF8String.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3781 | if(!td->per_constraints) |
| 3782 | td->per_constraints = asn_DEF_UTF8String.per_constraints; |
| 3783 | td->elements = asn_DEF_UTF8String.elements; |
| 3784 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3785 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3786 | } |
| 3787 | |
| 3788 | void |
| 3789 | Utf8_1_free(asn_TYPE_descriptor_t *td, |
| 3790 | void *struct_ptr, int contents_only) { |
| 3791 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3792 | td->free_struct(td, struct_ptr, contents_only); |
| 3793 | } |
| 3794 | |
| 3795 | int |
| 3796 | Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3797 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3798 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3799 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3800 | } |
| 3801 | |
| 3802 | asn_dec_rval_t |
| 3803 | Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3804 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 3805 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3806 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3807 | } |
| 3808 | |
| 3809 | asn_enc_rval_t |
| 3810 | Utf8_1_encode_der(asn_TYPE_descriptor_t *td, |
| 3811 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3812 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3813 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3814 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3815 | } |
| 3816 | |
| 3817 | asn_dec_rval_t |
| 3818 | Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3819 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 3820 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3821 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3822 | } |
| 3823 | |
| 3824 | asn_enc_rval_t |
| 3825 | Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3826 | int ilevel, enum xer_encoder_flags_e flags, |
| 3827 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 3828 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3829 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3830 | } |
| 3831 | |
| 3832 | asn_dec_rval_t |
| 3833 | Utf8_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 3834 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 3835 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3836 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 3837 | } |
| 3838 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3839 | asn_enc_rval_t |
| 3840 | Utf8_1_encode_uper(asn_TYPE_descriptor_t *td, |
| 3841 | asn_per_constraints_t *constraints, |
| 3842 | void *structure, asn_per_outp_t *per_out) { |
| 3843 | Utf8_1_1_inherit_TYPE_descriptor(td); |
| 3844 | return td->uper_encoder(td, constraints, structure, per_out); |
| 3845 | } |
| 3846 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3847 | |
| 3848 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 3849 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3850 | static const ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3851 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3852 | }; |
| 3853 | asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { |
| 3854 | "Utf8-1", |
| 3855 | "Utf8-1", |
| 3856 | Utf8_1_free, |
| 3857 | Utf8_1_print, |
| 3858 | Utf8_1_constraint, |
| 3859 | Utf8_1_decode_ber, |
| 3860 | Utf8_1_encode_der, |
| 3861 | Utf8_1_decode_xer, |
| 3862 | Utf8_1_encode_xer, |
| 3863 | Utf8_1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3864 | Utf8_1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3865 | 0, /* Use generic outmost tag fetcher */ |
| 3866 | asn_DEF_Utf8_1_tags_1, |
| 3867 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3868 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3869 | asn_DEF_Utf8_1_tags_1, /* Same as above */ |
| 3870 | sizeof(asn_DEF_Utf8_1_tags_1) |
| 3871 | /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ |
| 3872 | 0, /* No PER visible constraints */ |
| 3873 | 0, 0, /* No members */ |
| 3874 | 0 /* No specifics */ |
| 3875 | }; |
| 3876 | |
| 3877 | |
| 3878 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 3879 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 3880 | #include "Identifier.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3881 | |
| 3882 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 3883 | |
| 3884 | typedef Identifier_t VisibleIdentifier_t; |
| 3885 | |
| 3886 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 3887 | |
| 3888 | extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; |
| 3889 | asn_struct_free_f VisibleIdentifier_free; |
| 3890 | asn_struct_print_f VisibleIdentifier_print; |
| 3891 | asn_constr_check_f VisibleIdentifier_constraint; |
| 3892 | ber_type_decoder_f VisibleIdentifier_decode_ber; |
| 3893 | der_type_encoder_f VisibleIdentifier_encode_der; |
| 3894 | xer_type_decoder_f VisibleIdentifier_decode_xer; |
| 3895 | xer_type_encoder_f VisibleIdentifier_encode_xer; |
| 3896 | per_type_decoder_f VisibleIdentifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3897 | per_type_encoder_f VisibleIdentifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3898 | |
| 3899 | /*** <<< CTABLES [VisibleIdentifier] >>> ***/ |
| 3900 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3901 | static const int permitted_alphabet_table_1[256] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 3902 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3903 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 3904 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ |
| 3905 | 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ |
| 3906 | 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ |
| 3907 | 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ |
| 3908 | 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ |
| 3909 | 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3910 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3911 | static const int permitted_alphabet_code2value_1[64] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 3912 | 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, |
| 3913 | 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, |
| 3914 | 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, |
| 3915 | 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, |
| 3916 | }; |
| 3917 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3918 | |
| 3919 | static int check_permitted_alphabet_1(const void *sptr) { |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 3920 | const int *table = permitted_alphabet_table_1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3921 | /* The underlying type is VisibleString */ |
| 3922 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 3923 | const uint8_t *ch = st->buf; |
| 3924 | const uint8_t *end = ch + st->size; |
| 3925 | |
| 3926 | for(; ch < end; ch++) { |
| 3927 | uint8_t cv = *ch; |
| 3928 | if(!table[cv]) return -1; |
| 3929 | } |
| 3930 | return 0; |
| 3931 | } |
| 3932 | |
| 3933 | |
| 3934 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 3935 | |
| 3936 | int |
| 3937 | VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 3938 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3939 | const Identifier_t *st = (const Identifier_t *)sptr; |
| 3940 | size_t size; |
| 3941 | |
| 3942 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3943 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3944 | "%s: value not given (%s:%d)", |
| 3945 | td->name, __FILE__, __LINE__); |
| 3946 | return -1; |
| 3947 | } |
| 3948 | |
| 3949 | size = st->size; |
| 3950 | |
| 3951 | if((size >= 1 && size <= 32) |
| 3952 | && !check_permitted_alphabet_1(st)) { |
| 3953 | /* Constraint check succeeded */ |
| 3954 | return 0; |
| 3955 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 3956 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3957 | "%s: constraint failed (%s:%d)", |
| 3958 | td->name, __FILE__, __LINE__); |
| 3959 | return -1; |
| 3960 | } |
| 3961 | } |
| 3962 | |
| 3963 | /* |
| 3964 | * This type is implemented using Identifier, |
| 3965 | * so here we adjust the DEF accordingly. |
| 3966 | */ |
| 3967 | static void |
| 3968 | VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 3969 | td->free_struct = asn_DEF_Identifier.free_struct; |
| 3970 | td->print_struct = asn_DEF_Identifier.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 3971 | td->check_constraints = asn_DEF_Identifier.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3972 | td->ber_decoder = asn_DEF_Identifier.ber_decoder; |
| 3973 | td->der_encoder = asn_DEF_Identifier.der_encoder; |
| 3974 | td->xer_decoder = asn_DEF_Identifier.xer_decoder; |
| 3975 | td->xer_encoder = asn_DEF_Identifier.xer_encoder; |
| 3976 | td->uper_decoder = asn_DEF_Identifier.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 3977 | td->uper_encoder = asn_DEF_Identifier.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 3978 | if(!td->per_constraints) |
| 3979 | td->per_constraints = asn_DEF_Identifier.per_constraints; |
| 3980 | td->elements = asn_DEF_Identifier.elements; |
| 3981 | td->elements_count = asn_DEF_Identifier.elements_count; |
| 3982 | td->specifics = asn_DEF_Identifier.specifics; |
| 3983 | } |
| 3984 | |
| 3985 | void |
| 3986 | VisibleIdentifier_free(asn_TYPE_descriptor_t *td, |
| 3987 | void *struct_ptr, int contents_only) { |
| 3988 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3989 | td->free_struct(td, struct_ptr, contents_only); |
| 3990 | } |
| 3991 | |
| 3992 | int |
| 3993 | VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3994 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 3995 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 3996 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3997 | } |
| 3998 | |
| 3999 | asn_dec_rval_t |
| 4000 | VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4001 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4002 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4003 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4004 | } |
| 4005 | |
| 4006 | asn_enc_rval_t |
| 4007 | VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, |
| 4008 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4009 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4010 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4011 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4012 | } |
| 4013 | |
| 4014 | asn_dec_rval_t |
| 4015 | VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4016 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4017 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4018 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4019 | } |
| 4020 | |
| 4021 | asn_enc_rval_t |
| 4022 | VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4023 | int ilevel, enum xer_encoder_flags_e flags, |
| 4024 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4025 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4026 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4027 | } |
| 4028 | |
| 4029 | asn_dec_rval_t |
| 4030 | VisibleIdentifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4031 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4032 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4033 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4034 | } |
| 4035 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4036 | asn_enc_rval_t |
| 4037 | VisibleIdentifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 4038 | asn_per_constraints_t *constraints, |
| 4039 | void *structure, asn_per_outp_t *per_out) { |
| 4040 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
| 4041 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4042 | } |
| 4043 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4044 | |
| 4045 | /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ |
| 4046 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4047 | static const ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4048 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 4049 | }; |
| 4050 | asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { |
| 4051 | "VisibleIdentifier", |
| 4052 | "VisibleIdentifier", |
| 4053 | VisibleIdentifier_free, |
| 4054 | VisibleIdentifier_print, |
| 4055 | VisibleIdentifier_constraint, |
| 4056 | VisibleIdentifier_decode_ber, |
| 4057 | VisibleIdentifier_encode_der, |
| 4058 | VisibleIdentifier_decode_xer, |
| 4059 | VisibleIdentifier_encode_xer, |
| 4060 | VisibleIdentifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4061 | VisibleIdentifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4062 | 0, /* Use generic outmost tag fetcher */ |
| 4063 | asn_DEF_VisibleIdentifier_tags_1, |
| 4064 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 4065 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 4066 | asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ |
| 4067 | sizeof(asn_DEF_VisibleIdentifier_tags_1) |
| 4068 | /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ |
| 4069 | 0, /* No PER visible constraints */ |
| 4070 | 0, 0, /* No members */ |
| 4071 | 0 /* No specifics */ |
| 4072 | }; |
| 4073 | |
| 4074 | |
| 4075 | /*** <<< INCLUDES [Sequence] >>> ***/ |
| 4076 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 4077 | #include "Int1.h" |
| 4078 | #include "Int4.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4079 | #include <BOOLEAN.h> |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4080 | #include <NativeEnumerated.h> |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4081 | #include <NULL.h> |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 4082 | #include "Int5.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4083 | #include <constr_SEQUENCE.h> |
| 4084 | |
| 4085 | /*** <<< DEPS [Sequence] >>> ***/ |
| 4086 | |
| 4087 | typedef enum enum_c { |
| 4088 | enum_c_one = 1, |
| 4089 | enum_c_two = 2, |
| 4090 | /* |
| 4091 | * Enumeration is extensible |
| 4092 | */ |
| 4093 | enum_c_three = 3 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4094 | } e_enum_c; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4095 | |
| 4096 | /*** <<< TYPE-DECLS [Sequence] >>> ***/ |
| 4097 | |
| 4098 | typedef struct Sequence { |
| 4099 | Int1_t *int1_c /* DEFAULT 3 */; |
| 4100 | Int4_t int4; |
| 4101 | Int4_t int4_c; |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4102 | BOOLEAN_t *Bool /* DEFAULT 1 */; |
| 4103 | long enum_c; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4104 | NULL_t *null /* OPTIONAL */; |
| 4105 | /* |
| 4106 | * This type is extensible, |
| 4107 | * possible extensions are below. |
| 4108 | */ |
| 4109 | Int5_t *int5_c /* OPTIONAL */; |
| 4110 | |
| 4111 | /* Context for parsing across buffer boundaries */ |
| 4112 | asn_struct_ctx_t _asn_ctx; |
| 4113 | } Sequence_t; |
| 4114 | |
| 4115 | /*** <<< FUNC-DECLS [Sequence] >>> ***/ |
| 4116 | |
| 4117 | /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ |
| 4118 | extern asn_TYPE_descriptor_t asn_DEF_Sequence; |
| 4119 | |
| 4120 | /*** <<< CODE [Sequence] >>> ***/ |
| 4121 | |
| 4122 | static int |
| 4123 | enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4124 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4125 | /* Replace with underlying type checker */ |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4126 | td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4127 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4128 | } |
| 4129 | |
| 4130 | /* |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4131 | * This type is implemented using NativeEnumerated, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4132 | * so here we adjust the DEF accordingly. |
| 4133 | */ |
| 4134 | static void |
| 4135 | enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4136 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4137 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 4138 | td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4139 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4140 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4141 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4142 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4143 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
| 4144 | td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4145 | if(!td->per_constraints) |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4146 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4147 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4148 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4149 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4150 | } |
| 4151 | |
| 4152 | static void |
| 4153 | enum_c_6_free(asn_TYPE_descriptor_t *td, |
| 4154 | void *struct_ptr, int contents_only) { |
| 4155 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4156 | td->free_struct(td, struct_ptr, contents_only); |
| 4157 | } |
| 4158 | |
| 4159 | static int |
| 4160 | enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4161 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4162 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4163 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4164 | } |
| 4165 | |
| 4166 | static asn_dec_rval_t |
| 4167 | enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4168 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4169 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4170 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4171 | } |
| 4172 | |
| 4173 | static asn_enc_rval_t |
| 4174 | enum_c_6_encode_der(asn_TYPE_descriptor_t *td, |
| 4175 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4176 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4177 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4178 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4179 | } |
| 4180 | |
| 4181 | static asn_dec_rval_t |
| 4182 | enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4183 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4184 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4185 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4186 | } |
| 4187 | |
| 4188 | static asn_enc_rval_t |
| 4189 | enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4190 | int ilevel, enum xer_encoder_flags_e flags, |
| 4191 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4192 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4193 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4194 | } |
| 4195 | |
| 4196 | static asn_dec_rval_t |
| 4197 | enum_c_6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4198 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4199 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4200 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4201 | } |
| 4202 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4203 | static asn_enc_rval_t |
| 4204 | enum_c_6_encode_uper(asn_TYPE_descriptor_t *td, |
| 4205 | asn_per_constraints_t *constraints, |
| 4206 | void *structure, asn_per_outp_t *per_out) { |
| 4207 | enum_c_6_inherit_TYPE_descriptor(td); |
| 4208 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4209 | } |
| 4210 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4211 | static int |
| 4212 | memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4213 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4214 | long value; |
| 4215 | |
| 4216 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4217 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4218 | "%s: value not given (%s:%d)", |
| 4219 | td->name, __FILE__, __LINE__); |
| 4220 | return -1; |
| 4221 | } |
| 4222 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4223 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4224 | |
| 4225 | if((value >= -2)) { |
| 4226 | /* Constraint check succeeded */ |
| 4227 | return 0; |
| 4228 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4229 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4230 | "%s: constraint failed (%s:%d)", |
| 4231 | td->name, __FILE__, __LINE__); |
| 4232 | return -1; |
| 4233 | } |
| 4234 | } |
| 4235 | |
| 4236 | static int |
| 4237 | memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4238 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4239 | long value; |
| 4240 | |
| 4241 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4242 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4243 | "%s: value not given (%s:%d)", |
| 4244 | td->name, __FILE__, __LINE__); |
| 4245 | return -1; |
| 4246 | } |
| 4247 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4248 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4249 | |
| 4250 | if((value >= 5 && value <= 7)) { |
| 4251 | /* Constraint check succeeded */ |
| 4252 | return 0; |
| 4253 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4254 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4255 | "%s: constraint failed (%s:%d)", |
| 4256 | td->name, __FILE__, __LINE__); |
| 4257 | return -1; |
| 4258 | } |
| 4259 | } |
| 4260 | |
| 4261 | static int |
| 4262 | memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4263 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4264 | long value; |
| 4265 | |
| 4266 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4267 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4268 | "%s: value not given (%s:%d)", |
| 4269 | td->name, __FILE__, __LINE__); |
| 4270 | return -1; |
| 4271 | } |
| 4272 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4273 | value = *(const long *)sptr; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4274 | |
| 4275 | if((value == 5)) { |
| 4276 | /* Constraint check succeeded */ |
| 4277 | return 0; |
| 4278 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4279 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4280 | "%s: constraint failed (%s:%d)", |
| 4281 | td->name, __FILE__, __LINE__); |
| 4282 | return -1; |
| 4283 | } |
| 4284 | } |
| 4285 | |
| 4286 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4287 | /*** <<< CTDEFS [Sequence] >>> ***/ |
| 4288 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4289 | static asn_per_constraints_t asn_PER_type_enum_c_constr_6 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4290 | { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, |
| 4291 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4292 | 0, 0 /* No PER value map */ |
| 4293 | }; |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4294 | static asn_per_constraints_t asn_PER_memb_int1_c_constr_2 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4295 | { APC_SEMI_CONSTRAINED, -1, -1, -2, 0 } /* (-2..MAX) */, |
| 4296 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4297 | 0, 0 /* No PER value map */ |
| 4298 | }; |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4299 | static asn_per_constraints_t asn_PER_memb_int4_c_constr_4 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4300 | { APC_CONSTRAINED, 2, 2, 5, 7 } /* (5..7) */, |
| 4301 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4302 | 0, 0 /* No PER value map */ |
| 4303 | }; |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4304 | static asn_per_constraints_t asn_PER_memb_int5_c_constr_13 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4305 | { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, |
| 4306 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4307 | 0, 0 /* No PER value map */ |
| 4308 | }; |
| 4309 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4310 | /*** <<< STAT-DEFS [Sequence] >>> ***/ |
| 4311 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4312 | static int asn_DFL_2_set_3(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4313 | Int1_t *st = *sptr; |
| 4314 | |
| 4315 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4316 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4317 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4318 | if(!st) return -1; |
| 4319 | } |
| 4320 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4321 | if(set_value) { |
| 4322 | /* Install default value 3 */ |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4323 | *st = 3; |
| 4324 | return 0; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4325 | } else { |
| 4326 | /* Test default value 3 */ |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4327 | return (*st == 3); |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4328 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4329 | } |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4330 | static int asn_DFL_5_set_1(int set_value, void **sptr) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4331 | BOOLEAN_t *st = *sptr; |
| 4332 | |
| 4333 | if(!st) { |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4334 | if(!set_value) return -1; /* Not a default value */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4335 | st = (*sptr = CALLOC(1, sizeof(*st))); |
| 4336 | if(!st) return -1; |
| 4337 | } |
| 4338 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4339 | if(set_value) { |
| 4340 | /* Install default value 1 */ |
| 4341 | *st = 1; |
| 4342 | return 0; |
| 4343 | } else { |
| 4344 | /* Test default value 1 */ |
| 4345 | return (*st == 1); |
| 4346 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4347 | } |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4348 | static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4349 | { 1, 3, "one" }, |
| 4350 | { 2, 3, "two" }, |
| 4351 | { 3, 5, "three" } |
| 4352 | /* This list is extensible */ |
| 4353 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4354 | static const unsigned int asn_MAP_enum_c_enum2value_6[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4355 | 0, /* one(1) */ |
| 4356 | 2, /* three(3) */ |
| 4357 | 1 /* two(2) */ |
| 4358 | /* This list is extensible */ |
| 4359 | }; |
johvik | e70c407 | 2017-05-09 11:06:12 +0200 | [diff] [blame] | 4360 | static asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4361 | asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ |
| 4362 | asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ |
| 4363 | 3, /* Number of elements in the maps */ |
| 4364 | 3, /* Extensions before this member */ |
Lev Walkin | 8bb57a2 | 2007-12-03 13:41:36 +0000 | [diff] [blame] | 4365 | 1, /* Strict enumeration */ |
| 4366 | 0, /* Native long size */ |
| 4367 | 0 |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4368 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4369 | static const ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4370 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4371 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4372 | static /* Use -fall-defs-global to expose */ |
| 4373 | asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { |
| 4374 | "enum-c", |
| 4375 | "enum-c", |
| 4376 | enum_c_6_free, |
| 4377 | enum_c_6_print, |
| 4378 | enum_c_6_constraint, |
| 4379 | enum_c_6_decode_ber, |
| 4380 | enum_c_6_encode_der, |
| 4381 | enum_c_6_decode_xer, |
| 4382 | enum_c_6_encode_xer, |
| 4383 | enum_c_6_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4384 | enum_c_6_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4385 | 0, /* Use generic outmost tag fetcher */ |
| 4386 | asn_DEF_enum_c_tags_6, |
| 4387 | sizeof(asn_DEF_enum_c_tags_6) |
| 4388 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
| 4389 | asn_DEF_enum_c_tags_6, /* Same as above */ |
| 4390 | sizeof(asn_DEF_enum_c_tags_6) |
| 4391 | /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4392 | &asn_PER_type_enum_c_constr_6, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4393 | 0, 0, /* Defined elsewhere */ |
| 4394 | &asn_SPC_enum_c_specs_6 /* Additional specs */ |
| 4395 | }; |
| 4396 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4397 | static asn_TYPE_member_t asn_MBR_Sequence_1[] = { |
| 4398 | { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), |
| 4399 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4400 | .tag_mode = 0, |
| 4401 | .type = &asn_DEF_Int1, |
| 4402 | .memb_constraints = memb_int1_c_constraint_1, |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4403 | .per_constraints = &asn_PER_memb_int1_c_constr_2, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4404 | .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ |
| 4405 | .name = "int1-c" |
| 4406 | }, |
| 4407 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), |
| 4408 | .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), |
| 4409 | .tag_mode = +1, /* EXPLICIT tag at current level */ |
| 4410 | .type = &asn_DEF_Int4, |
| 4411 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4412 | .per_constraints = 0, /* No PER visible constraints */ |
| 4413 | .default_value = 0, |
| 4414 | .name = "int4" |
| 4415 | }, |
| 4416 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), |
| 4417 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4418 | .tag_mode = 0, |
| 4419 | .type = &asn_DEF_Int4, |
| 4420 | .memb_constraints = memb_int4_c_constraint_1, |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4421 | .per_constraints = &asn_PER_memb_int4_c_constr_4, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4422 | .default_value = 0, |
| 4423 | .name = "int4-c" |
| 4424 | }, |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4425 | { ATF_POINTER, 1, offsetof(struct Sequence, Bool), |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4426 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), |
| 4427 | .tag_mode = 0, |
| 4428 | .type = &asn_DEF_BOOLEAN, |
| 4429 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4430 | .per_constraints = 0, /* No PER visible constraints */ |
| 4431 | .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ |
| 4432 | .name = "bool" |
| 4433 | }, |
| 4434 | { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), |
| 4435 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), |
| 4436 | .tag_mode = 0, |
| 4437 | .type = &asn_DEF_enum_c_6, |
| 4438 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
Lev Walkin | 07aaa34 | 2006-10-09 12:52:15 +0000 | [diff] [blame] | 4439 | .per_constraints = 0, /* No PER visible constraints */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4440 | .default_value = 0, |
| 4441 | .name = "enum-c" |
| 4442 | }, |
| 4443 | { ATF_POINTER, 2, offsetof(struct Sequence, null), |
| 4444 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), |
| 4445 | .tag_mode = 0, |
| 4446 | .type = &asn_DEF_NULL, |
| 4447 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4448 | .per_constraints = 0, /* No PER visible constraints */ |
| 4449 | .default_value = 0, |
| 4450 | .name = "null" |
| 4451 | }, |
| 4452 | { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), |
| 4453 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 4454 | .tag_mode = 0, |
| 4455 | .type = &asn_DEF_Int5, |
| 4456 | .memb_constraints = memb_int5_c_constraint_1, |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4457 | .per_constraints = &asn_PER_memb_int5_c_constr_13, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4458 | .default_value = 0, |
| 4459 | .name = "int5-c" |
| 4460 | }, |
| 4461 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4462 | static const int asn_MAP_Sequence_oms_1[] = { 0, 3, 5, 6 }; |
| 4463 | static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4464 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4465 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4466 | static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { |
Lev Walkin | 4062b01 | 2013-10-11 14:29:38 -0700 | [diff] [blame] | 4467 | { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */ |
| 4468 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c */ |
| 4469 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c */ |
| 4470 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c */ |
| 4471 | { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null */ |
| 4472 | { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c */ |
| 4473 | { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4474 | }; |
| 4475 | static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { |
| 4476 | sizeof(struct Sequence), |
| 4477 | offsetof(struct Sequence, _asn_ctx), |
| 4478 | asn_MAP_Sequence_tag2el_1, |
| 4479 | 7, /* Count of tags in the map */ |
| 4480 | asn_MAP_Sequence_oms_1, /* Optional members */ |
| 4481 | 3, 1, /* Root/Additions */ |
| 4482 | 5, /* Start extensions */ |
| 4483 | 8 /* Stop extensions */ |
| 4484 | }; |
| 4485 | asn_TYPE_descriptor_t asn_DEF_Sequence = { |
| 4486 | "Sequence", |
| 4487 | "Sequence", |
| 4488 | SEQUENCE_free, |
| 4489 | SEQUENCE_print, |
| 4490 | SEQUENCE_constraint, |
| 4491 | SEQUENCE_decode_ber, |
| 4492 | SEQUENCE_encode_der, |
| 4493 | SEQUENCE_decode_xer, |
| 4494 | SEQUENCE_encode_xer, |
| 4495 | SEQUENCE_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4496 | SEQUENCE_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4497 | 0, /* Use generic outmost tag fetcher */ |
| 4498 | asn_DEF_Sequence_tags_1, |
| 4499 | sizeof(asn_DEF_Sequence_tags_1) |
| 4500 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4501 | asn_DEF_Sequence_tags_1, /* Same as above */ |
| 4502 | sizeof(asn_DEF_Sequence_tags_1) |
| 4503 | /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ |
| 4504 | 0, /* No PER visible constraints */ |
| 4505 | asn_MBR_Sequence_1, |
| 4506 | 7, /* Elements count */ |
| 4507 | &asn_SPC_Sequence_specs_1 /* Additional specs */ |
| 4508 | }; |
| 4509 | |
| 4510 | |
| 4511 | /*** <<< INCLUDES [SequenceOf] >>> ***/ |
| 4512 | |
| 4513 | #include <asn_SEQUENCE_OF.h> |
| 4514 | #include <constr_SEQUENCE_OF.h> |
| 4515 | |
| 4516 | /*** <<< FWD-DECLS [SequenceOf] >>> ***/ |
| 4517 | |
| 4518 | struct Sequence; |
| 4519 | |
| 4520 | /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ |
| 4521 | |
| 4522 | typedef struct SequenceOf { |
| 4523 | A_SEQUENCE_OF(struct Sequence) list; |
| 4524 | |
| 4525 | /* Context for parsing across buffer boundaries */ |
| 4526 | asn_struct_ctx_t _asn_ctx; |
| 4527 | } SequenceOf_t; |
| 4528 | |
| 4529 | /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ |
| 4530 | |
| 4531 | extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; |
| 4532 | |
| 4533 | /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ |
| 4534 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 4535 | #include "Sequence.h" |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4536 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4537 | /*** <<< CTDEFS [SequenceOf] >>> ***/ |
| 4538 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4539 | static asn_per_constraints_t asn_PER_type_SequenceOf_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4540 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4541 | { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, |
| 4542 | 0, 0 /* No PER value map */ |
| 4543 | }; |
| 4544 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4545 | /*** <<< STAT-DEFS [SequenceOf] >>> ***/ |
| 4546 | |
| 4547 | static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { |
| 4548 | { ATF_POINTER, 0, 0, |
| 4549 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 4550 | .tag_mode = 0, |
| 4551 | .type = &asn_DEF_Sequence, |
| 4552 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 4553 | .per_constraints = 0, /* No PER visible constraints */ |
| 4554 | .default_value = 0, |
| 4555 | .name = "" |
| 4556 | }, |
| 4557 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4558 | static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4559 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 4560 | }; |
| 4561 | static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { |
| 4562 | sizeof(struct SequenceOf), |
| 4563 | offsetof(struct SequenceOf, _asn_ctx), |
| 4564 | 0, /* XER encoding is XMLDelimitedItemList */ |
| 4565 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4566 | asn_TYPE_descriptor_t asn_DEF_SequenceOf = { |
| 4567 | "SequenceOf", |
| 4568 | "SequenceOf", |
| 4569 | SEQUENCE_OF_free, |
| 4570 | SEQUENCE_OF_print, |
| 4571 | SEQUENCE_OF_constraint, |
| 4572 | SEQUENCE_OF_decode_ber, |
| 4573 | SEQUENCE_OF_encode_der, |
| 4574 | SEQUENCE_OF_decode_xer, |
| 4575 | SEQUENCE_OF_encode_xer, |
| 4576 | SEQUENCE_OF_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4577 | SEQUENCE_OF_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4578 | 0, /* Use generic outmost tag fetcher */ |
| 4579 | asn_DEF_SequenceOf_tags_1, |
| 4580 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4581 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
| 4582 | asn_DEF_SequenceOf_tags_1, /* Same as above */ |
| 4583 | sizeof(asn_DEF_SequenceOf_tags_1) |
| 4584 | /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4585 | &asn_PER_type_SequenceOf_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4586 | asn_MBR_SequenceOf_1, |
| 4587 | 1, /* Single element */ |
| 4588 | &asn_SPC_SequenceOf_specs_1 /* Additional specs */ |
| 4589 | }; |
| 4590 | |
| 4591 | |
| 4592 | /*** <<< INCLUDES [Enum0] >>> ***/ |
| 4593 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4594 | #include <NativeEnumerated.h> |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4595 | |
| 4596 | /*** <<< DEPS [Enum0] >>> ***/ |
| 4597 | |
| 4598 | typedef enum Enum0 { |
| 4599 | Enum0_one = 0, |
| 4600 | Enum0_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4601 | } e_Enum0; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4602 | |
| 4603 | /*** <<< TYPE-DECLS [Enum0] >>> ***/ |
| 4604 | |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4605 | typedef long Enum0_t; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4606 | |
| 4607 | /*** <<< FUNC-DECLS [Enum0] >>> ***/ |
| 4608 | |
| 4609 | extern asn_TYPE_descriptor_t asn_DEF_Enum0; |
| 4610 | asn_struct_free_f Enum0_free; |
| 4611 | asn_struct_print_f Enum0_print; |
| 4612 | asn_constr_check_f Enum0_constraint; |
| 4613 | ber_type_decoder_f Enum0_decode_ber; |
| 4614 | der_type_encoder_f Enum0_encode_der; |
| 4615 | xer_type_decoder_f Enum0_decode_xer; |
| 4616 | xer_type_encoder_f Enum0_encode_xer; |
| 4617 | per_type_decoder_f Enum0_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4618 | per_type_encoder_f Enum0_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4619 | |
| 4620 | /*** <<< CODE [Enum0] >>> ***/ |
| 4621 | |
| 4622 | int |
| 4623 | Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4624 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4625 | /* Replace with underlying type checker */ |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4626 | td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4627 | return td->check_constraints(td, sptr, ctfailcb, app_key); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4628 | } |
| 4629 | |
| 4630 | /* |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4631 | * This type is implemented using NativeEnumerated, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4632 | * so here we adjust the DEF accordingly. |
| 4633 | */ |
| 4634 | static void |
| 4635 | Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4636 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4637 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 4638 | td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4639 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4640 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4641 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4642 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4643 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
| 4644 | td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4645 | if(!td->per_constraints) |
Lev Walkin | 2a744a7 | 2013-03-27 01:56:23 -0700 | [diff] [blame] | 4646 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4647 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4648 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4649 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4650 | } |
| 4651 | |
| 4652 | void |
| 4653 | Enum0_free(asn_TYPE_descriptor_t *td, |
| 4654 | void *struct_ptr, int contents_only) { |
| 4655 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4656 | td->free_struct(td, struct_ptr, contents_only); |
| 4657 | } |
| 4658 | |
| 4659 | int |
| 4660 | Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4661 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4662 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4663 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4664 | } |
| 4665 | |
| 4666 | asn_dec_rval_t |
| 4667 | Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4668 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4669 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4670 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4671 | } |
| 4672 | |
| 4673 | asn_enc_rval_t |
| 4674 | Enum0_encode_der(asn_TYPE_descriptor_t *td, |
| 4675 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4676 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4677 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4678 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4679 | } |
| 4680 | |
| 4681 | asn_dec_rval_t |
| 4682 | Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4683 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4684 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4685 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4686 | } |
| 4687 | |
| 4688 | asn_enc_rval_t |
| 4689 | Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4690 | int ilevel, enum xer_encoder_flags_e flags, |
| 4691 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4692 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4693 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4694 | } |
| 4695 | |
| 4696 | asn_dec_rval_t |
| 4697 | Enum0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4698 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4699 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4700 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4701 | } |
| 4702 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4703 | asn_enc_rval_t |
| 4704 | Enum0_encode_uper(asn_TYPE_descriptor_t *td, |
| 4705 | asn_per_constraints_t *constraints, |
| 4706 | void *structure, asn_per_outp_t *per_out) { |
| 4707 | Enum0_1_inherit_TYPE_descriptor(td); |
| 4708 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4709 | } |
| 4710 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4711 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4712 | /*** <<< CTDEFS [Enum0] >>> ***/ |
| 4713 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4714 | static asn_per_constraints_t asn_PER_type_Enum0_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4715 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4716 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4717 | 0, 0 /* No PER value map */ |
| 4718 | }; |
| 4719 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4720 | /*** <<< STAT-DEFS [Enum0] >>> ***/ |
| 4721 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4722 | static const asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4723 | { 0, 3, "one" }, |
| 4724 | { 1, 3, "two" } |
| 4725 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4726 | static const unsigned int asn_MAP_Enum0_enum2value_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4727 | 0, /* one(0) */ |
| 4728 | 1 /* two(1) */ |
| 4729 | }; |
johvik | e70c407 | 2017-05-09 11:06:12 +0200 | [diff] [blame] | 4730 | static asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4731 | asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4732 | asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ |
| 4733 | 2, /* Number of elements in the maps */ |
| 4734 | 0, /* Enumeration is not extensible */ |
Lev Walkin | 8bb57a2 | 2007-12-03 13:41:36 +0000 | [diff] [blame] | 4735 | 1, /* Strict enumeration */ |
| 4736 | 0, /* Native long size */ |
| 4737 | 0 |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4738 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4739 | static const ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4740 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4741 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4742 | asn_TYPE_descriptor_t asn_DEF_Enum0 = { |
| 4743 | "Enum0", |
| 4744 | "Enum0", |
| 4745 | Enum0_free, |
| 4746 | Enum0_print, |
| 4747 | Enum0_constraint, |
| 4748 | Enum0_decode_ber, |
| 4749 | Enum0_encode_der, |
| 4750 | Enum0_decode_xer, |
| 4751 | Enum0_encode_xer, |
| 4752 | Enum0_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4753 | Enum0_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4754 | 0, /* Use generic outmost tag fetcher */ |
| 4755 | asn_DEF_Enum0_tags_1, |
| 4756 | sizeof(asn_DEF_Enum0_tags_1) |
| 4757 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
| 4758 | asn_DEF_Enum0_tags_1, /* Same as above */ |
| 4759 | sizeof(asn_DEF_Enum0_tags_1) |
| 4760 | /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4761 | &asn_PER_type_Enum0_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4762 | 0, 0, /* Defined elsewhere */ |
| 4763 | &asn_SPC_Enum0_specs_1 /* Additional specs */ |
| 4764 | }; |
| 4765 | |
| 4766 | |
| 4767 | /*** <<< INCLUDES [Enum1] >>> ***/ |
| 4768 | |
| 4769 | #include <NativeEnumerated.h> |
| 4770 | |
| 4771 | /*** <<< DEPS [Enum1] >>> ***/ |
| 4772 | |
| 4773 | typedef enum Enum1 { |
| 4774 | Enum1_one = 0, |
| 4775 | Enum1_two = 1 |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 4776 | } e_Enum1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4777 | |
| 4778 | /*** <<< TYPE-DECLS [Enum1] >>> ***/ |
| 4779 | |
| 4780 | typedef long Enum1_t; |
| 4781 | |
| 4782 | /*** <<< FUNC-DECLS [Enum1] >>> ***/ |
| 4783 | |
| 4784 | extern asn_TYPE_descriptor_t asn_DEF_Enum1; |
| 4785 | asn_struct_free_f Enum1_free; |
| 4786 | asn_struct_print_f Enum1_print; |
| 4787 | asn_constr_check_f Enum1_constraint; |
| 4788 | ber_type_decoder_f Enum1_decode_ber; |
| 4789 | der_type_encoder_f Enum1_encode_der; |
| 4790 | xer_type_decoder_f Enum1_decode_xer; |
| 4791 | xer_type_encoder_f Enum1_encode_xer; |
| 4792 | per_type_decoder_f Enum1_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4793 | per_type_encoder_f Enum1_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4794 | |
| 4795 | /*** <<< CODE [Enum1] >>> ***/ |
| 4796 | |
| 4797 | int |
| 4798 | Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 4799 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4800 | long value; |
| 4801 | |
| 4802 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4803 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4804 | "%s: value not given (%s:%d)", |
| 4805 | td->name, __FILE__, __LINE__); |
| 4806 | return -1; |
| 4807 | } |
| 4808 | |
| 4809 | value = *(const long *)sptr; |
| 4810 | |
| 4811 | if((value == 0)) { |
| 4812 | /* Constraint check succeeded */ |
| 4813 | return 0; |
| 4814 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 4815 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4816 | "%s: constraint failed (%s:%d)", |
| 4817 | td->name, __FILE__, __LINE__); |
| 4818 | return -1; |
| 4819 | } |
| 4820 | } |
| 4821 | |
| 4822 | /* |
| 4823 | * This type is implemented using NativeEnumerated, |
| 4824 | * so here we adjust the DEF accordingly. |
| 4825 | */ |
| 4826 | static void |
| 4827 | Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 4828 | td->free_struct = asn_DEF_NativeEnumerated.free_struct; |
| 4829 | td->print_struct = asn_DEF_NativeEnumerated.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 4830 | td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4831 | td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; |
| 4832 | td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; |
| 4833 | td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; |
| 4834 | td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; |
| 4835 | td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4836 | td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4837 | if(!td->per_constraints) |
| 4838 | td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; |
| 4839 | td->elements = asn_DEF_NativeEnumerated.elements; |
| 4840 | td->elements_count = asn_DEF_NativeEnumerated.elements_count; |
| 4841 | /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ |
| 4842 | } |
| 4843 | |
| 4844 | void |
| 4845 | Enum1_free(asn_TYPE_descriptor_t *td, |
| 4846 | void *struct_ptr, int contents_only) { |
| 4847 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4848 | td->free_struct(td, struct_ptr, contents_only); |
| 4849 | } |
| 4850 | |
| 4851 | int |
| 4852 | Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 4853 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 4854 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4855 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 4856 | } |
| 4857 | |
| 4858 | asn_dec_rval_t |
| 4859 | Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4860 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 4861 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4862 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 4863 | } |
| 4864 | |
| 4865 | asn_enc_rval_t |
| 4866 | Enum1_encode_der(asn_TYPE_descriptor_t *td, |
| 4867 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 4868 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4869 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4870 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 4871 | } |
| 4872 | |
| 4873 | asn_dec_rval_t |
| 4874 | Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4875 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 4876 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4877 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 4878 | } |
| 4879 | |
| 4880 | asn_enc_rval_t |
| 4881 | Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 4882 | int ilevel, enum xer_encoder_flags_e flags, |
| 4883 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 4884 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4885 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 4886 | } |
| 4887 | |
| 4888 | asn_dec_rval_t |
| 4889 | Enum1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 4890 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 4891 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4892 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 4893 | } |
| 4894 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4895 | asn_enc_rval_t |
| 4896 | Enum1_encode_uper(asn_TYPE_descriptor_t *td, |
| 4897 | asn_per_constraints_t *constraints, |
| 4898 | void *structure, asn_per_outp_t *per_out) { |
| 4899 | Enum1_1_inherit_TYPE_descriptor(td); |
| 4900 | return td->uper_encoder(td, constraints, structure, per_out); |
| 4901 | } |
| 4902 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4903 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4904 | /*** <<< CTDEFS [Enum1] >>> ***/ |
| 4905 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 4906 | static asn_per_constraints_t asn_PER_type_Enum1_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 4907 | { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, |
| 4908 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 4909 | 0, 0 /* No PER value map */ |
| 4910 | }; |
| 4911 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4912 | /*** <<< STAT-DEFS [Enum1] >>> ***/ |
| 4913 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4914 | static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4915 | { 0, 3, "one" }, |
| 4916 | { 1, 3, "two" } |
| 4917 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4918 | static const unsigned int asn_MAP_Enum1_enum2value_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4919 | 0, /* one(0) */ |
| 4920 | 1 /* two(1) */ |
| 4921 | }; |
johvik | e70c407 | 2017-05-09 11:06:12 +0200 | [diff] [blame] | 4922 | static asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4923 | asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ |
| 4924 | asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ |
| 4925 | 2, /* Number of elements in the maps */ |
| 4926 | 0, /* Enumeration is not extensible */ |
Lev Walkin | 8bb57a2 | 2007-12-03 13:41:36 +0000 | [diff] [blame] | 4927 | 1, /* Strict enumeration */ |
| 4928 | 0, /* Native long size */ |
| 4929 | 0 |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4930 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4931 | static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4932 | (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) |
| 4933 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4934 | asn_TYPE_descriptor_t asn_DEF_Enum1 = { |
| 4935 | "Enum1", |
| 4936 | "Enum1", |
| 4937 | Enum1_free, |
| 4938 | Enum1_print, |
| 4939 | Enum1_constraint, |
| 4940 | Enum1_decode_ber, |
| 4941 | Enum1_encode_der, |
| 4942 | Enum1_decode_xer, |
| 4943 | Enum1_encode_xer, |
| 4944 | Enum1_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4945 | Enum1_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4946 | 0, /* Use generic outmost tag fetcher */ |
| 4947 | asn_DEF_Enum1_tags_1, |
| 4948 | sizeof(asn_DEF_Enum1_tags_1) |
| 4949 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
| 4950 | asn_DEF_Enum1_tags_1, /* Same as above */ |
| 4951 | sizeof(asn_DEF_Enum1_tags_1) |
| 4952 | /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 4953 | &asn_PER_type_Enum1_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4954 | 0, 0, /* Defined elsewhere */ |
| 4955 | &asn_SPC_Enum1_specs_1 /* Additional specs */ |
| 4956 | }; |
| 4957 | |
| 4958 | |
| 4959 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 4960 | |
| 4961 | #include <VisibleString.h> |
| 4962 | |
| 4963 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 4964 | |
| 4965 | typedef VisibleString_t Identifier_t; |
| 4966 | |
| 4967 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 4968 | |
| 4969 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
| 4970 | asn_struct_free_f Identifier_free; |
| 4971 | asn_struct_print_f Identifier_print; |
| 4972 | asn_constr_check_f Identifier_constraint; |
| 4973 | ber_type_decoder_f Identifier_decode_ber; |
| 4974 | der_type_encoder_f Identifier_encode_der; |
| 4975 | xer_type_decoder_f Identifier_decode_xer; |
| 4976 | xer_type_encoder_f Identifier_encode_xer; |
| 4977 | per_type_decoder_f Identifier_decode_uper; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 4978 | per_type_encoder_f Identifier_encode_uper; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4979 | |
| 4980 | /*** <<< CTABLES [Identifier] >>> ***/ |
| 4981 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4982 | static const int permitted_alphabet_table_1[256] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 4983 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 4984 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ |
| 4985 | 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ |
| 4986 | 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ |
| 4987 | 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ |
| 4988 | 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ |
| 4989 | 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ |
| 4990 | 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4991 | }; |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 4992 | static const int permitted_alphabet_code2value_1[64] = { |
Lev Walkin | 5b62ca8 | 2006-09-21 01:52:07 +0000 | [diff] [blame] | 4993 | 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, |
| 4994 | 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, |
| 4995 | 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, |
| 4996 | 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, |
| 4997 | }; |
| 4998 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 4999 | |
| 5000 | static int check_permitted_alphabet_1(const void *sptr) { |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 5001 | const int *table = permitted_alphabet_table_1; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5002 | /* The underlying type is VisibleString */ |
| 5003 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 5004 | const uint8_t *ch = st->buf; |
| 5005 | const uint8_t *end = ch + st->size; |
| 5006 | |
| 5007 | for(; ch < end; ch++) { |
| 5008 | uint8_t cv = *ch; |
| 5009 | if(!table[cv]) return -1; |
| 5010 | } |
| 5011 | return 0; |
| 5012 | } |
| 5013 | |
| 5014 | |
| 5015 | /*** <<< CODE [Identifier] >>> ***/ |
| 5016 | |
| 5017 | int |
| 5018 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 5019 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5020 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 5021 | size_t size; |
| 5022 | |
| 5023 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 5024 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5025 | "%s: value not given (%s:%d)", |
| 5026 | td->name, __FILE__, __LINE__); |
| 5027 | return -1; |
| 5028 | } |
| 5029 | |
| 5030 | size = st->size; |
| 5031 | |
| 5032 | if((size >= 1 && size <= 32) |
| 5033 | && !check_permitted_alphabet_1(st)) { |
| 5034 | /* Constraint check succeeded */ |
| 5035 | return 0; |
| 5036 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 5037 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5038 | "%s: constraint failed (%s:%d)", |
| 5039 | td->name, __FILE__, __LINE__); |
| 5040 | return -1; |
| 5041 | } |
| 5042 | } |
| 5043 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 5044 | static int asn_PER_MAP_Identifier_1_v2c(unsigned int value) { |
| 5045 | if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) |
| 5046 | return -1; |
| 5047 | return permitted_alphabet_table_1[value] - 1; |
| 5048 | } |
| 5049 | static int asn_PER_MAP_Identifier_1_c2v(unsigned int code) { |
| 5050 | if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) |
| 5051 | return -1; |
| 5052 | return permitted_alphabet_code2value_1[code]; |
| 5053 | } |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5054 | /* |
| 5055 | * This type is implemented using VisibleString, |
| 5056 | * so here we adjust the DEF accordingly. |
| 5057 | */ |
| 5058 | static void |
| 5059 | Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 5060 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 5061 | td->print_struct = asn_DEF_VisibleString.print_struct; |
Lev Walkin | 6169b8d | 2013-12-07 11:02:44 -0800 | [diff] [blame] | 5062 | td->check_constraints = asn_DEF_VisibleString.check_constraints; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5063 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 5064 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 5065 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 5066 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
| 5067 | td->uper_decoder = asn_DEF_VisibleString.uper_decoder; |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5068 | td->uper_encoder = asn_DEF_VisibleString.uper_encoder; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5069 | if(!td->per_constraints) |
| 5070 | td->per_constraints = asn_DEF_VisibleString.per_constraints; |
| 5071 | td->elements = asn_DEF_VisibleString.elements; |
| 5072 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 5073 | td->specifics = asn_DEF_VisibleString.specifics; |
| 5074 | } |
| 5075 | |
| 5076 | void |
| 5077 | Identifier_free(asn_TYPE_descriptor_t *td, |
| 5078 | void *struct_ptr, int contents_only) { |
| 5079 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5080 | td->free_struct(td, struct_ptr, contents_only); |
| 5081 | } |
| 5082 | |
| 5083 | int |
| 5084 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 5085 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 5086 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5087 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 5088 | } |
| 5089 | |
| 5090 | asn_dec_rval_t |
| 5091 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5092 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 5093 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5094 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 5095 | } |
| 5096 | |
| 5097 | asn_enc_rval_t |
| 5098 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
| 5099 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 5100 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 5101 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5102 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 5103 | } |
| 5104 | |
| 5105 | asn_dec_rval_t |
| 5106 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5107 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 5108 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5109 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 5110 | } |
| 5111 | |
| 5112 | asn_enc_rval_t |
| 5113 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 5114 | int ilevel, enum xer_encoder_flags_e flags, |
| 5115 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 5116 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5117 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 5118 | } |
| 5119 | |
| 5120 | asn_dec_rval_t |
| 5121 | Identifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 5122 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 5123 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5124 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 5125 | } |
| 5126 | |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5127 | asn_enc_rval_t |
| 5128 | Identifier_encode_uper(asn_TYPE_descriptor_t *td, |
| 5129 | asn_per_constraints_t *constraints, |
| 5130 | void *structure, asn_per_outp_t *per_out) { |
| 5131 | Identifier_1_inherit_TYPE_descriptor(td); |
| 5132 | return td->uper_encoder(td, constraints, structure, per_out); |
| 5133 | } |
| 5134 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5135 | |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 5136 | /*** <<< CTDEFS [Identifier] >>> ***/ |
| 5137 | |
Lev Walkin | 2fce55d | 2013-03-28 05:00:39 -0700 | [diff] [blame] | 5138 | static asn_per_constraints_t asn_PER_type_Identifier_constr_1 GCC_NOTUSED = { |
Lev Walkin | 725883b | 2006-10-09 12:07:58 +0000 | [diff] [blame] | 5139 | { APC_CONSTRAINED, 6, 6, 36, 122 } /* (36..122) */, |
| 5140 | { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, |
| 5141 | asn_PER_MAP_Identifier_1_v2c, /* Value to PER code map */ |
| 5142 | asn_PER_MAP_Identifier_1_c2v /* PER code to value map */ |
| 5143 | }; |
| 5144 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5145 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 5146 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 5147 | static const ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5148 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 5149 | }; |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5150 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
| 5151 | "Identifier", |
| 5152 | "Identifier", |
| 5153 | Identifier_free, |
| 5154 | Identifier_print, |
| 5155 | Identifier_constraint, |
| 5156 | Identifier_decode_ber, |
| 5157 | Identifier_encode_der, |
| 5158 | Identifier_decode_xer, |
| 5159 | Identifier_encode_xer, |
| 5160 | Identifier_decode_uper, |
Lev Walkin | 9f5bb3a | 2006-08-18 01:46:46 +0000 | [diff] [blame] | 5161 | Identifier_encode_uper, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5162 | 0, /* Use generic outmost tag fetcher */ |
| 5163 | asn_DEF_Identifier_tags_1, |
| 5164 | sizeof(asn_DEF_Identifier_tags_1) |
| 5165 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
| 5166 | asn_DEF_Identifier_tags_1, /* Same as above */ |
| 5167 | sizeof(asn_DEF_Identifier_tags_1) |
| 5168 | /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ |
Lev Walkin | 4b5dae3 | 2006-10-09 12:27:44 +0000 | [diff] [blame] | 5169 | &asn_PER_type_Identifier_constr_1, |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 5170 | 0, 0, /* No members */ |
| 5171 | 0 /* No specifics */ |
| 5172 | }; |
| 5173 | |