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