vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
| 8 | |
| 9 | typedef INTEGER_t Int1_t; |
| 10 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 11 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 12 | |
| 13 | extern asn1_TYPE_descriptor_t asn1_DEF_Int1; |
| 14 | asn_constr_check_f Int1_constraint; |
| 15 | ber_type_decoder_f Int1_decode_ber; |
| 16 | der_type_encoder_f Int1_encode_der; |
| 17 | asn_struct_print_f Int1_print; |
| 18 | asn_struct_free_f Int1_free; |
| 19 | |
| 20 | /*** <<< CODE [Int1] >>> ***/ |
| 21 | |
| 22 | int |
| 23 | Int1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 24 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 25 | |
| 26 | /* Make the underlying type checker permanent */ |
| 27 | td->check_constraints = asn1_DEF_INTEGER.check_constraints; |
| 28 | return td->check_constraints |
| 29 | (td, sptr, app_errlog, app_key); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | * This type is implemented using INTEGER, |
| 34 | * so adjust the DEF appropriately. |
| 35 | */ |
| 36 | static void |
| 37 | Int1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 38 | td->ber_decoder = asn1_DEF_INTEGER.ber_decoder; |
| 39 | td->der_encoder = asn1_DEF_INTEGER.der_encoder; |
| 40 | td->free_struct = asn1_DEF_INTEGER.free_struct; |
| 41 | td->print_struct = asn1_DEF_INTEGER.print_struct; |
| 42 | td->last_tag_form = asn1_DEF_INTEGER.last_tag_form; |
| 43 | td->elements = asn1_DEF_INTEGER.elements; |
| 44 | td->elements_count = asn1_DEF_INTEGER.elements_count; |
| 45 | td->specifics = asn1_DEF_INTEGER.specifics; |
| 46 | } |
| 47 | |
| 48 | ber_dec_rval_t |
| 49 | Int1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 50 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 51 | Int1_inherit_TYPE_descriptor(td); |
| 52 | return td->ber_decoder(td, structure, |
| 53 | bufptr, size, tag_mode); |
| 54 | } |
| 55 | |
| 56 | der_enc_rval_t |
| 57 | Int1_encode_der(asn1_TYPE_descriptor_t *td, |
| 58 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 59 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 60 | Int1_inherit_TYPE_descriptor(td); |
| 61 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 62 | } |
| 63 | |
| 64 | int |
| 65 | Int1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 66 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 67 | Int1_inherit_TYPE_descriptor(td); |
| 68 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 69 | } |
| 70 | |
| 71 | void |
| 72 | Int1_free(asn1_TYPE_descriptor_t *td, |
| 73 | void *struct_ptr, int contents_only) { |
| 74 | Int1_inherit_TYPE_descriptor(td); |
| 75 | td->free_struct(td, struct_ptr, contents_only); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 80 | |
| 81 | static ber_tlv_tag_t asn1_DEF_Int1_tags[] = { |
| 82 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 83 | }; |
| 84 | asn1_TYPE_descriptor_t asn1_DEF_Int1 = { |
| 85 | "Int1", |
| 86 | Int1_constraint, |
| 87 | Int1_decode_ber, |
| 88 | Int1_encode_der, |
| 89 | Int1_print, |
| 90 | Int1_free, |
| 91 | 0, /* Use generic outmost tag fetcher */ |
| 92 | asn1_DEF_Int1_tags, |
| 93 | sizeof(asn1_DEF_Int1_tags) |
| 94 | /sizeof(asn1_DEF_Int1_tags[0]), /* 1 */ |
| 95 | 1, /* Tags to skip */ |
| 96 | -0, /* Unknown yet */ |
| 97 | 0, 0, /* No members */ |
| 98 | 0 /* No specifics */ |
| 99 | }; |
| 100 | |
| 101 | |
| 102 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 103 | |
| 104 | #include <Int1.h> |
| 105 | |
| 106 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 107 | |
| 108 | |
| 109 | typedef Int1_t Int2_t; |
| 110 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 111 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 112 | |
| 113 | extern asn1_TYPE_descriptor_t asn1_DEF_Int2; |
| 114 | asn_constr_check_f Int2_constraint; |
| 115 | ber_type_decoder_f Int2_decode_ber; |
| 116 | der_type_encoder_f Int2_encode_der; |
| 117 | asn_struct_print_f Int2_print; |
| 118 | asn_struct_free_f Int2_free; |
| 119 | |
| 120 | /*** <<< CODE [Int2] >>> ***/ |
| 121 | |
| 122 | int |
| 123 | Int2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 124 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 125 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 126 | const Int1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 127 | long value; |
| 128 | |
| 129 | if(!sptr) { |
| 130 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 131 | "%s: value not given (%s:%d)", |
| 132 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 133 | return -1; |
| 134 | } |
| 135 | |
| 136 | if(asn1_INTEGER2long(st, &value)) { |
| 137 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 138 | "%s: value too large (%s:%d)", |
| 139 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 140 | return -1; |
| 141 | } |
| 142 | |
| 143 | if((value >= 0)) { |
| 144 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 145 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 146 | } else { |
| 147 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 148 | "%s: constraint failed (%s:%d)", |
| 149 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 150 | return -1; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | * This type is implemented using Int1, |
| 156 | * so adjust the DEF appropriately. |
| 157 | */ |
| 158 | static void |
| 159 | Int2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 160 | td->ber_decoder = asn1_DEF_Int1.ber_decoder; |
| 161 | td->der_encoder = asn1_DEF_Int1.der_encoder; |
| 162 | td->free_struct = asn1_DEF_Int1.free_struct; |
| 163 | td->print_struct = asn1_DEF_Int1.print_struct; |
| 164 | td->last_tag_form = asn1_DEF_Int1.last_tag_form; |
| 165 | td->elements = asn1_DEF_Int1.elements; |
| 166 | td->elements_count = asn1_DEF_Int1.elements_count; |
| 167 | td->specifics = asn1_DEF_Int1.specifics; |
| 168 | } |
| 169 | |
| 170 | ber_dec_rval_t |
| 171 | Int2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 172 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 173 | Int2_inherit_TYPE_descriptor(td); |
| 174 | return td->ber_decoder(td, structure, |
| 175 | bufptr, size, tag_mode); |
| 176 | } |
| 177 | |
| 178 | der_enc_rval_t |
| 179 | Int2_encode_der(asn1_TYPE_descriptor_t *td, |
| 180 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 181 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 182 | Int2_inherit_TYPE_descriptor(td); |
| 183 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 184 | } |
| 185 | |
| 186 | int |
| 187 | Int2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 188 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 189 | Int2_inherit_TYPE_descriptor(td); |
| 190 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 191 | } |
| 192 | |
| 193 | void |
| 194 | Int2_free(asn1_TYPE_descriptor_t *td, |
| 195 | void *struct_ptr, int contents_only) { |
| 196 | Int2_inherit_TYPE_descriptor(td); |
| 197 | td->free_struct(td, struct_ptr, contents_only); |
| 198 | } |
| 199 | |
| 200 | |
| 201 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 202 | |
| 203 | static ber_tlv_tag_t asn1_DEF_Int2_tags[] = { |
| 204 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 205 | }; |
| 206 | asn1_TYPE_descriptor_t asn1_DEF_Int2 = { |
| 207 | "Int2", |
| 208 | Int2_constraint, |
| 209 | Int2_decode_ber, |
| 210 | Int2_encode_der, |
| 211 | Int2_print, |
| 212 | Int2_free, |
| 213 | 0, /* Use generic outmost tag fetcher */ |
| 214 | asn1_DEF_Int2_tags, |
| 215 | sizeof(asn1_DEF_Int2_tags) |
| 216 | /sizeof(asn1_DEF_Int2_tags[0]), /* 1 */ |
| 217 | 1, /* Tags to skip */ |
| 218 | -0, /* Unknown yet */ |
| 219 | 0, 0, /* No members */ |
| 220 | 0 /* No specifics */ |
| 221 | }; |
| 222 | |
| 223 | |
| 224 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 225 | |
| 226 | #include <Int2.h> |
| 227 | |
| 228 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 229 | |
| 230 | |
| 231 | typedef Int2_t Int3_t; |
| 232 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 233 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 234 | |
| 235 | extern asn1_TYPE_descriptor_t asn1_DEF_Int3; |
| 236 | asn_constr_check_f Int3_constraint; |
| 237 | ber_type_decoder_f Int3_decode_ber; |
| 238 | der_type_encoder_f Int3_encode_der; |
| 239 | asn_struct_print_f Int3_print; |
| 240 | asn_struct_free_f Int3_free; |
| 241 | |
| 242 | /*** <<< CODE [Int3] >>> ***/ |
| 243 | |
| 244 | int |
| 245 | Int3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 246 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 247 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 248 | const Int2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 249 | long value; |
| 250 | |
| 251 | if(!sptr) { |
| 252 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 253 | "%s: value not given (%s:%d)", |
| 254 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 255 | return -1; |
| 256 | } |
| 257 | |
| 258 | if(asn1_INTEGER2long(st, &value)) { |
| 259 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 260 | "%s: value too large (%s:%d)", |
| 261 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 262 | return -1; |
| 263 | } |
| 264 | |
| 265 | if((value >= 0 && value <= 10)) { |
| 266 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 267 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 268 | } else { |
| 269 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 270 | "%s: constraint failed (%s:%d)", |
| 271 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 272 | return -1; |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | /* |
| 277 | * This type is implemented using Int2, |
| 278 | * so adjust the DEF appropriately. |
| 279 | */ |
| 280 | static void |
| 281 | Int3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 282 | td->ber_decoder = asn1_DEF_Int2.ber_decoder; |
| 283 | td->der_encoder = asn1_DEF_Int2.der_encoder; |
| 284 | td->free_struct = asn1_DEF_Int2.free_struct; |
| 285 | td->print_struct = asn1_DEF_Int2.print_struct; |
| 286 | td->last_tag_form = asn1_DEF_Int2.last_tag_form; |
| 287 | td->elements = asn1_DEF_Int2.elements; |
| 288 | td->elements_count = asn1_DEF_Int2.elements_count; |
| 289 | td->specifics = asn1_DEF_Int2.specifics; |
| 290 | } |
| 291 | |
| 292 | ber_dec_rval_t |
| 293 | Int3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 294 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 295 | Int3_inherit_TYPE_descriptor(td); |
| 296 | return td->ber_decoder(td, structure, |
| 297 | bufptr, size, tag_mode); |
| 298 | } |
| 299 | |
| 300 | der_enc_rval_t |
| 301 | Int3_encode_der(asn1_TYPE_descriptor_t *td, |
| 302 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 303 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 304 | Int3_inherit_TYPE_descriptor(td); |
| 305 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 306 | } |
| 307 | |
| 308 | int |
| 309 | Int3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 310 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 311 | Int3_inherit_TYPE_descriptor(td); |
| 312 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 313 | } |
| 314 | |
| 315 | void |
| 316 | Int3_free(asn1_TYPE_descriptor_t *td, |
| 317 | void *struct_ptr, int contents_only) { |
| 318 | Int3_inherit_TYPE_descriptor(td); |
| 319 | td->free_struct(td, struct_ptr, contents_only); |
| 320 | } |
| 321 | |
| 322 | |
| 323 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 324 | |
| 325 | static ber_tlv_tag_t asn1_DEF_Int3_tags[] = { |
| 326 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 327 | }; |
| 328 | asn1_TYPE_descriptor_t asn1_DEF_Int3 = { |
| 329 | "Int3", |
| 330 | Int3_constraint, |
| 331 | Int3_decode_ber, |
| 332 | Int3_encode_der, |
| 333 | Int3_print, |
| 334 | Int3_free, |
| 335 | 0, /* Use generic outmost tag fetcher */ |
| 336 | asn1_DEF_Int3_tags, |
| 337 | sizeof(asn1_DEF_Int3_tags) |
| 338 | /sizeof(asn1_DEF_Int3_tags[0]), /* 1 */ |
| 339 | 1, /* Tags to skip */ |
| 340 | -0, /* Unknown yet */ |
| 341 | 0, 0, /* No members */ |
| 342 | 0 /* No specifics */ |
| 343 | }; |
| 344 | |
| 345 | |
| 346 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 347 | |
| 348 | #include <Int3.h> |
| 349 | |
| 350 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 351 | |
| 352 | |
| 353 | typedef Int3_t Int4_t; |
| 354 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 355 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 356 | |
| 357 | extern asn1_TYPE_descriptor_t asn1_DEF_Int4; |
| 358 | asn_constr_check_f Int4_constraint; |
| 359 | ber_type_decoder_f Int4_decode_ber; |
| 360 | der_type_encoder_f Int4_encode_der; |
| 361 | asn_struct_print_f Int4_print; |
| 362 | asn_struct_free_f Int4_free; |
| 363 | |
| 364 | /*** <<< CODE [Int4] >>> ***/ |
| 365 | |
| 366 | int |
| 367 | Int4_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 368 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 369 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 370 | const Int3_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 371 | |
| 372 | if(!sptr) { |
| 373 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 374 | "%s: value not given (%s:%d)", |
| 375 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 376 | return -1; |
| 377 | } |
| 378 | |
| 379 | |
| 380 | if(1 /* No applicable constraints whatsoever */) { |
| 381 | /* Nothing is here. See below */ |
| 382 | } |
| 383 | |
| 384 | /* Make the underlying type checker permanent */ |
| 385 | td->check_constraints = asn1_DEF_Int3.check_constraints; |
| 386 | return td->check_constraints |
| 387 | (td, sptr, app_errlog, app_key); |
| 388 | } |
| 389 | |
| 390 | /* |
| 391 | * This type is implemented using Int3, |
| 392 | * so adjust the DEF appropriately. |
| 393 | */ |
| 394 | static void |
| 395 | Int4_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 396 | td->ber_decoder = asn1_DEF_Int3.ber_decoder; |
| 397 | td->der_encoder = asn1_DEF_Int3.der_encoder; |
| 398 | td->free_struct = asn1_DEF_Int3.free_struct; |
| 399 | td->print_struct = asn1_DEF_Int3.print_struct; |
| 400 | td->last_tag_form = asn1_DEF_Int3.last_tag_form; |
| 401 | td->elements = asn1_DEF_Int3.elements; |
| 402 | td->elements_count = asn1_DEF_Int3.elements_count; |
| 403 | td->specifics = asn1_DEF_Int3.specifics; |
| 404 | } |
| 405 | |
| 406 | ber_dec_rval_t |
| 407 | Int4_decode_ber(asn1_TYPE_descriptor_t *td, |
| 408 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 409 | Int4_inherit_TYPE_descriptor(td); |
| 410 | return td->ber_decoder(td, structure, |
| 411 | bufptr, size, tag_mode); |
| 412 | } |
| 413 | |
| 414 | der_enc_rval_t |
| 415 | Int4_encode_der(asn1_TYPE_descriptor_t *td, |
| 416 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 417 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 418 | Int4_inherit_TYPE_descriptor(td); |
| 419 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 420 | } |
| 421 | |
| 422 | int |
| 423 | Int4_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 424 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 425 | Int4_inherit_TYPE_descriptor(td); |
| 426 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 427 | } |
| 428 | |
| 429 | void |
| 430 | Int4_free(asn1_TYPE_descriptor_t *td, |
| 431 | void *struct_ptr, int contents_only) { |
| 432 | Int4_inherit_TYPE_descriptor(td); |
| 433 | td->free_struct(td, struct_ptr, contents_only); |
| 434 | } |
| 435 | |
| 436 | |
| 437 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 438 | |
| 439 | static ber_tlv_tag_t asn1_DEF_Int4_tags[] = { |
| 440 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 441 | }; |
| 442 | asn1_TYPE_descriptor_t asn1_DEF_Int4 = { |
| 443 | "Int4", |
| 444 | Int4_constraint, |
| 445 | Int4_decode_ber, |
| 446 | Int4_encode_der, |
| 447 | Int4_print, |
| 448 | Int4_free, |
| 449 | 0, /* Use generic outmost tag fetcher */ |
| 450 | asn1_DEF_Int4_tags, |
| 451 | sizeof(asn1_DEF_Int4_tags) |
| 452 | /sizeof(asn1_DEF_Int4_tags[0]), /* 1 */ |
| 453 | 1, /* Tags to skip */ |
| 454 | -0, /* Unknown yet */ |
| 455 | 0, 0, /* No members */ |
| 456 | 0 /* No specifics */ |
| 457 | }; |
| 458 | |
| 459 | |
| 460 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 461 | |
| 462 | #include <Int4.h> |
| 463 | |
| 464 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 465 | |
| 466 | |
| 467 | typedef Int4_t Int5_t; |
| 468 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 469 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 470 | |
| 471 | extern asn1_TYPE_descriptor_t asn1_DEF_Int5; |
| 472 | asn_constr_check_f Int5_constraint; |
| 473 | ber_type_decoder_f Int5_decode_ber; |
| 474 | der_type_encoder_f Int5_encode_der; |
| 475 | asn_struct_print_f Int5_print; |
| 476 | asn_struct_free_f Int5_free; |
| 477 | |
| 478 | /*** <<< CODE [Int5] >>> ***/ |
| 479 | |
| 480 | int |
| 481 | Int5_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 482 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 483 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 484 | const Int4_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 485 | long value; |
| 486 | |
| 487 | if(!sptr) { |
| 488 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 489 | "%s: value not given (%s:%d)", |
| 490 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 491 | return -1; |
| 492 | } |
| 493 | |
| 494 | if(asn1_INTEGER2long(st, &value)) { |
| 495 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 496 | "%s: value too large (%s:%d)", |
| 497 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 498 | return -1; |
| 499 | } |
| 500 | |
| 501 | if((value == 5)) { |
| 502 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 503 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 504 | } else { |
| 505 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 506 | "%s: constraint failed (%s:%d)", |
| 507 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 508 | return -1; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | /* |
| 513 | * This type is implemented using Int4, |
| 514 | * so adjust the DEF appropriately. |
| 515 | */ |
| 516 | static void |
| 517 | Int5_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 518 | td->ber_decoder = asn1_DEF_Int4.ber_decoder; |
| 519 | td->der_encoder = asn1_DEF_Int4.der_encoder; |
| 520 | td->free_struct = asn1_DEF_Int4.free_struct; |
| 521 | td->print_struct = asn1_DEF_Int4.print_struct; |
| 522 | td->last_tag_form = asn1_DEF_Int4.last_tag_form; |
| 523 | td->elements = asn1_DEF_Int4.elements; |
| 524 | td->elements_count = asn1_DEF_Int4.elements_count; |
| 525 | td->specifics = asn1_DEF_Int4.specifics; |
| 526 | } |
| 527 | |
| 528 | ber_dec_rval_t |
| 529 | Int5_decode_ber(asn1_TYPE_descriptor_t *td, |
| 530 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 531 | Int5_inherit_TYPE_descriptor(td); |
| 532 | return td->ber_decoder(td, structure, |
| 533 | bufptr, size, tag_mode); |
| 534 | } |
| 535 | |
| 536 | der_enc_rval_t |
| 537 | Int5_encode_der(asn1_TYPE_descriptor_t *td, |
| 538 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 539 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 540 | Int5_inherit_TYPE_descriptor(td); |
| 541 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 542 | } |
| 543 | |
| 544 | int |
| 545 | Int5_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 546 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 547 | Int5_inherit_TYPE_descriptor(td); |
| 548 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 549 | } |
| 550 | |
| 551 | void |
| 552 | Int5_free(asn1_TYPE_descriptor_t *td, |
| 553 | void *struct_ptr, int contents_only) { |
| 554 | Int5_inherit_TYPE_descriptor(td); |
| 555 | td->free_struct(td, struct_ptr, contents_only); |
| 556 | } |
| 557 | |
| 558 | |
| 559 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 560 | |
| 561 | static ber_tlv_tag_t asn1_DEF_Int5_tags[] = { |
| 562 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 563 | }; |
| 564 | asn1_TYPE_descriptor_t asn1_DEF_Int5 = { |
| 565 | "Int5", |
| 566 | Int5_constraint, |
| 567 | Int5_decode_ber, |
| 568 | Int5_encode_der, |
| 569 | Int5_print, |
| 570 | Int5_free, |
| 571 | 0, /* Use generic outmost tag fetcher */ |
| 572 | asn1_DEF_Int5_tags, |
| 573 | sizeof(asn1_DEF_Int5_tags) |
| 574 | /sizeof(asn1_DEF_Int5_tags[0]), /* 1 */ |
| 575 | 1, /* Tags to skip */ |
| 576 | -0, /* Unknown yet */ |
| 577 | 0, 0, /* No members */ |
| 578 | 0 /* No specifics */ |
| 579 | }; |
| 580 | |
| 581 | |
| 582 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 583 | |
| 584 | #include <INTEGER.h> |
| 585 | |
| 586 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 587 | |
| 588 | |
| 589 | typedef INTEGER_t ExtensibleExtensions_t; |
| 590 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 591 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 592 | |
| 593 | extern asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions; |
| 594 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 595 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 596 | der_type_encoder_f ExtensibleExtensions_encode_der; |
| 597 | asn_struct_print_f ExtensibleExtensions_print; |
| 598 | asn_struct_free_f ExtensibleExtensions_free; |
| 599 | |
| 600 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 601 | |
| 602 | int |
| 603 | ExtensibleExtensions_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 604 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 605 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 606 | const INTEGER_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 607 | |
| 608 | if(!sptr) { |
| 609 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 610 | "%s: value not given (%s:%d)", |
| 611 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 612 | return -1; |
| 613 | } |
| 614 | |
| 615 | |
| 616 | if(1 /* No applicable constraints whatsoever */) { |
| 617 | /* Nothing is here. See below */ |
| 618 | } |
| 619 | |
| 620 | /* Make the underlying type checker permanent */ |
| 621 | td->check_constraints = asn1_DEF_INTEGER.check_constraints; |
| 622 | return td->check_constraints |
| 623 | (td, sptr, app_errlog, app_key); |
| 624 | } |
| 625 | |
| 626 | /* |
| 627 | * This type is implemented using INTEGER, |
| 628 | * so adjust the DEF appropriately. |
| 629 | */ |
| 630 | static void |
| 631 | ExtensibleExtensions_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 632 | td->ber_decoder = asn1_DEF_INTEGER.ber_decoder; |
| 633 | td->der_encoder = asn1_DEF_INTEGER.der_encoder; |
| 634 | td->free_struct = asn1_DEF_INTEGER.free_struct; |
| 635 | td->print_struct = asn1_DEF_INTEGER.print_struct; |
| 636 | td->last_tag_form = asn1_DEF_INTEGER.last_tag_form; |
| 637 | td->elements = asn1_DEF_INTEGER.elements; |
| 638 | td->elements_count = asn1_DEF_INTEGER.elements_count; |
| 639 | td->specifics = asn1_DEF_INTEGER.specifics; |
| 640 | } |
| 641 | |
| 642 | ber_dec_rval_t |
| 643 | ExtensibleExtensions_decode_ber(asn1_TYPE_descriptor_t *td, |
| 644 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 645 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 646 | return td->ber_decoder(td, structure, |
| 647 | bufptr, size, tag_mode); |
| 648 | } |
| 649 | |
| 650 | der_enc_rval_t |
| 651 | ExtensibleExtensions_encode_der(asn1_TYPE_descriptor_t *td, |
| 652 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 653 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 654 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 655 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 656 | } |
| 657 | |
| 658 | int |
| 659 | ExtensibleExtensions_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 660 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 661 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 662 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 663 | } |
| 664 | |
| 665 | void |
| 666 | ExtensibleExtensions_free(asn1_TYPE_descriptor_t *td, |
| 667 | void *struct_ptr, int contents_only) { |
| 668 | ExtensibleExtensions_inherit_TYPE_descriptor(td); |
| 669 | td->free_struct(td, struct_ptr, contents_only); |
| 670 | } |
| 671 | |
| 672 | |
| 673 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 674 | |
| 675 | static ber_tlv_tag_t asn1_DEF_ExtensibleExtensions_tags[] = { |
| 676 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 677 | }; |
| 678 | asn1_TYPE_descriptor_t asn1_DEF_ExtensibleExtensions = { |
| 679 | "ExtensibleExtensions", |
| 680 | ExtensibleExtensions_constraint, |
| 681 | ExtensibleExtensions_decode_ber, |
| 682 | ExtensibleExtensions_encode_der, |
| 683 | ExtensibleExtensions_print, |
| 684 | ExtensibleExtensions_free, |
| 685 | 0, /* Use generic outmost tag fetcher */ |
| 686 | asn1_DEF_ExtensibleExtensions_tags, |
| 687 | sizeof(asn1_DEF_ExtensibleExtensions_tags) |
| 688 | /sizeof(asn1_DEF_ExtensibleExtensions_tags[0]), /* 1 */ |
| 689 | 1, /* Tags to skip */ |
| 690 | -0, /* Unknown yet */ |
| 691 | 0, 0, /* No members */ |
| 692 | 0 /* No specifics */ |
| 693 | }; |
| 694 | |
| 695 | |
| 696 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 697 | |
| 698 | #include <IA5String.h> |
| 699 | |
| 700 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 701 | |
| 702 | |
| 703 | typedef IA5String_t Str1_t; |
| 704 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 705 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 706 | |
| 707 | extern asn1_TYPE_descriptor_t asn1_DEF_Str1; |
| 708 | asn_constr_check_f Str1_constraint; |
| 709 | ber_type_decoder_f Str1_decode_ber; |
| 710 | der_type_encoder_f Str1_encode_der; |
| 711 | asn_struct_print_f Str1_print; |
| 712 | asn_struct_free_f Str1_free; |
| 713 | |
| 714 | /*** <<< CODE [Str1] >>> ***/ |
| 715 | |
| 716 | int |
| 717 | Str1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 718 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 719 | |
| 720 | /* Make the underlying type checker permanent */ |
| 721 | td->check_constraints = asn1_DEF_IA5String.check_constraints; |
| 722 | return td->check_constraints |
| 723 | (td, sptr, app_errlog, app_key); |
| 724 | } |
| 725 | |
| 726 | /* |
| 727 | * This type is implemented using IA5String, |
| 728 | * so adjust the DEF appropriately. |
| 729 | */ |
| 730 | static void |
| 731 | Str1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 732 | td->ber_decoder = asn1_DEF_IA5String.ber_decoder; |
| 733 | td->der_encoder = asn1_DEF_IA5String.der_encoder; |
| 734 | td->free_struct = asn1_DEF_IA5String.free_struct; |
| 735 | td->print_struct = asn1_DEF_IA5String.print_struct; |
| 736 | td->last_tag_form = asn1_DEF_IA5String.last_tag_form; |
| 737 | td->elements = asn1_DEF_IA5String.elements; |
| 738 | td->elements_count = asn1_DEF_IA5String.elements_count; |
| 739 | td->specifics = asn1_DEF_IA5String.specifics; |
| 740 | } |
| 741 | |
| 742 | ber_dec_rval_t |
| 743 | Str1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 744 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 745 | Str1_inherit_TYPE_descriptor(td); |
| 746 | return td->ber_decoder(td, structure, |
| 747 | bufptr, size, tag_mode); |
| 748 | } |
| 749 | |
| 750 | der_enc_rval_t |
| 751 | Str1_encode_der(asn1_TYPE_descriptor_t *td, |
| 752 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 753 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 754 | Str1_inherit_TYPE_descriptor(td); |
| 755 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 756 | } |
| 757 | |
| 758 | int |
| 759 | Str1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 760 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 761 | Str1_inherit_TYPE_descriptor(td); |
| 762 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 763 | } |
| 764 | |
| 765 | void |
| 766 | Str1_free(asn1_TYPE_descriptor_t *td, |
| 767 | void *struct_ptr, int contents_only) { |
| 768 | Str1_inherit_TYPE_descriptor(td); |
| 769 | td->free_struct(td, struct_ptr, contents_only); |
| 770 | } |
| 771 | |
| 772 | |
| 773 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 774 | |
| 775 | static ber_tlv_tag_t asn1_DEF_Str1_tags[] = { |
| 776 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 777 | }; |
| 778 | asn1_TYPE_descriptor_t asn1_DEF_Str1 = { |
| 779 | "Str1", |
| 780 | Str1_constraint, |
| 781 | Str1_decode_ber, |
| 782 | Str1_encode_der, |
| 783 | Str1_print, |
| 784 | Str1_free, |
| 785 | 0, /* Use generic outmost tag fetcher */ |
| 786 | asn1_DEF_Str1_tags, |
| 787 | sizeof(asn1_DEF_Str1_tags) |
| 788 | /sizeof(asn1_DEF_Str1_tags[0]), /* 1 */ |
| 789 | 1, /* Tags to skip */ |
| 790 | -0, /* Unknown yet */ |
| 791 | 0, 0, /* No members */ |
| 792 | 0 /* No specifics */ |
| 793 | }; |
| 794 | |
| 795 | |
| 796 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 797 | |
| 798 | #include <Str1.h> |
| 799 | |
| 800 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 801 | |
| 802 | |
| 803 | typedef Str1_t Str2_t; |
| 804 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 805 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 806 | |
| 807 | extern asn1_TYPE_descriptor_t asn1_DEF_Str2; |
| 808 | asn_constr_check_f Str2_constraint; |
| 809 | ber_type_decoder_f Str2_decode_ber; |
| 810 | der_type_encoder_f Str2_encode_der; |
| 811 | asn_struct_print_f Str2_print; |
| 812 | asn_struct_free_f Str2_free; |
| 813 | |
| 814 | /*** <<< CTABLES [Str2] >>> ***/ |
| 815 | |
| 816 | static int check_permitted_alphabet_1(const void *sptr) { |
| 817 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 818 | const IA5String_t *st = sptr; |
| 819 | const uint8_t *ch = st->buf; |
| 820 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 821 | |
| 822 | for(; ch < end; ch++) { |
| 823 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 824 | if(!(cv <= 127)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 825 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 826 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | |
| 830 | /*** <<< CODE [Str2] >>> ***/ |
| 831 | |
| 832 | int |
| 833 | Str2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 834 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 835 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 836 | const Str1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 837 | size_t size; |
| 838 | |
| 839 | if(!sptr) { |
| 840 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 841 | "%s: value not given (%s:%d)", |
| 842 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 843 | return -1; |
| 844 | } |
| 845 | |
| 846 | size = st->size; |
| 847 | |
| 848 | if(((size <= 20) || (size >= 25 && size <= 30)) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 849 | && !check_permitted_alphabet_1(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 850 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 851 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 852 | } else { |
| 853 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 854 | "%s: constraint failed (%s:%d)", |
| 855 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 856 | return -1; |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | /* |
| 861 | * This type is implemented using Str1, |
| 862 | * so adjust the DEF appropriately. |
| 863 | */ |
| 864 | static void |
| 865 | Str2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 866 | td->ber_decoder = asn1_DEF_Str1.ber_decoder; |
| 867 | td->der_encoder = asn1_DEF_Str1.der_encoder; |
| 868 | td->free_struct = asn1_DEF_Str1.free_struct; |
| 869 | td->print_struct = asn1_DEF_Str1.print_struct; |
| 870 | td->last_tag_form = asn1_DEF_Str1.last_tag_form; |
| 871 | td->elements = asn1_DEF_Str1.elements; |
| 872 | td->elements_count = asn1_DEF_Str1.elements_count; |
| 873 | td->specifics = asn1_DEF_Str1.specifics; |
| 874 | } |
| 875 | |
| 876 | ber_dec_rval_t |
| 877 | Str2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 878 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 879 | Str2_inherit_TYPE_descriptor(td); |
| 880 | return td->ber_decoder(td, structure, |
| 881 | bufptr, size, tag_mode); |
| 882 | } |
| 883 | |
| 884 | der_enc_rval_t |
| 885 | Str2_encode_der(asn1_TYPE_descriptor_t *td, |
| 886 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 887 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 888 | Str2_inherit_TYPE_descriptor(td); |
| 889 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 890 | } |
| 891 | |
| 892 | int |
| 893 | Str2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 894 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 895 | Str2_inherit_TYPE_descriptor(td); |
| 896 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 897 | } |
| 898 | |
| 899 | void |
| 900 | Str2_free(asn1_TYPE_descriptor_t *td, |
| 901 | void *struct_ptr, int contents_only) { |
| 902 | Str2_inherit_TYPE_descriptor(td); |
| 903 | td->free_struct(td, struct_ptr, contents_only); |
| 904 | } |
| 905 | |
| 906 | |
| 907 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 908 | |
| 909 | static ber_tlv_tag_t asn1_DEF_Str2_tags[] = { |
| 910 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 911 | }; |
| 912 | asn1_TYPE_descriptor_t asn1_DEF_Str2 = { |
| 913 | "Str2", |
| 914 | Str2_constraint, |
| 915 | Str2_decode_ber, |
| 916 | Str2_encode_der, |
| 917 | Str2_print, |
| 918 | Str2_free, |
| 919 | 0, /* Use generic outmost tag fetcher */ |
| 920 | asn1_DEF_Str2_tags, |
| 921 | sizeof(asn1_DEF_Str2_tags) |
| 922 | /sizeof(asn1_DEF_Str2_tags[0]), /* 1 */ |
| 923 | 1, /* Tags to skip */ |
| 924 | -0, /* Unknown yet */ |
| 925 | 0, 0, /* No members */ |
| 926 | 0 /* No specifics */ |
| 927 | }; |
| 928 | |
| 929 | |
| 930 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 931 | |
| 932 | #include <Str2.h> |
| 933 | |
| 934 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 935 | |
| 936 | |
| 937 | typedef Str2_t Str3_t; |
| 938 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 939 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 940 | |
| 941 | extern asn1_TYPE_descriptor_t asn1_DEF_Str3; |
| 942 | asn_constr_check_f Str3_constraint; |
| 943 | ber_type_decoder_f Str3_decode_ber; |
| 944 | der_type_encoder_f Str3_encode_der; |
| 945 | asn_struct_print_f Str3_print; |
| 946 | asn_struct_free_f Str3_free; |
| 947 | |
| 948 | /*** <<< CTABLES [Str3] >>> ***/ |
| 949 | |
| 950 | static int permitted_alphabet_table_2[256] = { |
| 951 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 952 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 953 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 954 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 955 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 956 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 957 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 958 | }; |
| 959 | |
| 960 | static int check_permitted_alphabet_2(const void *sptr) { |
| 961 | int *table = permitted_alphabet_table_2; |
| 962 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 963 | const IA5String_t *st = sptr; |
| 964 | const uint8_t *ch = st->buf; |
| 965 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 966 | |
| 967 | for(; ch < end; ch++) { |
| 968 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 969 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 970 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 971 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 972 | } |
| 973 | |
| 974 | |
| 975 | /*** <<< CODE [Str3] >>> ***/ |
| 976 | |
| 977 | int |
| 978 | Str3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 979 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 980 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 981 | const Str2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 982 | size_t size; |
| 983 | |
| 984 | if(!sptr) { |
| 985 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 986 | "%s: value not given (%s:%d)", |
| 987 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 988 | return -1; |
| 989 | } |
| 990 | |
| 991 | size = st->size; |
| 992 | |
| 993 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 994 | && !check_permitted_alphabet_2(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 995 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 996 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 997 | } else { |
| 998 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 999 | "%s: constraint failed (%s:%d)", |
| 1000 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1001 | return -1; |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | /* |
| 1006 | * This type is implemented using Str2, |
| 1007 | * so adjust the DEF appropriately. |
| 1008 | */ |
| 1009 | static void |
| 1010 | Str3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1011 | td->ber_decoder = asn1_DEF_Str2.ber_decoder; |
| 1012 | td->der_encoder = asn1_DEF_Str2.der_encoder; |
| 1013 | td->free_struct = asn1_DEF_Str2.free_struct; |
| 1014 | td->print_struct = asn1_DEF_Str2.print_struct; |
| 1015 | td->last_tag_form = asn1_DEF_Str2.last_tag_form; |
| 1016 | td->elements = asn1_DEF_Str2.elements; |
| 1017 | td->elements_count = asn1_DEF_Str2.elements_count; |
| 1018 | td->specifics = asn1_DEF_Str2.specifics; |
| 1019 | } |
| 1020 | |
| 1021 | ber_dec_rval_t |
| 1022 | Str3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1023 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1024 | Str3_inherit_TYPE_descriptor(td); |
| 1025 | return td->ber_decoder(td, structure, |
| 1026 | bufptr, size, tag_mode); |
| 1027 | } |
| 1028 | |
| 1029 | der_enc_rval_t |
| 1030 | Str3_encode_der(asn1_TYPE_descriptor_t *td, |
| 1031 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1032 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1033 | Str3_inherit_TYPE_descriptor(td); |
| 1034 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1035 | } |
| 1036 | |
| 1037 | int |
| 1038 | Str3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1039 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1040 | Str3_inherit_TYPE_descriptor(td); |
| 1041 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1042 | } |
| 1043 | |
| 1044 | void |
| 1045 | Str3_free(asn1_TYPE_descriptor_t *td, |
| 1046 | void *struct_ptr, int contents_only) { |
| 1047 | Str3_inherit_TYPE_descriptor(td); |
| 1048 | td->free_struct(td, struct_ptr, contents_only); |
| 1049 | } |
| 1050 | |
| 1051 | |
| 1052 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1053 | |
| 1054 | static ber_tlv_tag_t asn1_DEF_Str3_tags[] = { |
| 1055 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1056 | }; |
| 1057 | asn1_TYPE_descriptor_t asn1_DEF_Str3 = { |
| 1058 | "Str3", |
| 1059 | Str3_constraint, |
| 1060 | Str3_decode_ber, |
| 1061 | Str3_encode_der, |
| 1062 | Str3_print, |
| 1063 | Str3_free, |
| 1064 | 0, /* Use generic outmost tag fetcher */ |
| 1065 | asn1_DEF_Str3_tags, |
| 1066 | sizeof(asn1_DEF_Str3_tags) |
| 1067 | /sizeof(asn1_DEF_Str3_tags[0]), /* 1 */ |
| 1068 | 1, /* Tags to skip */ |
| 1069 | -0, /* Unknown yet */ |
| 1070 | 0, 0, /* No members */ |
| 1071 | 0 /* No specifics */ |
| 1072 | }; |
| 1073 | |
| 1074 | |
| 1075 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1076 | |
| 1077 | #include <IA5String.h> |
| 1078 | |
| 1079 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1080 | |
| 1081 | |
| 1082 | typedef IA5String_t PER_Visible_t; |
| 1083 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1084 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1085 | |
| 1086 | extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible; |
| 1087 | asn_constr_check_f PER_Visible_constraint; |
| 1088 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1089 | der_type_encoder_f PER_Visible_encode_der; |
| 1090 | asn_struct_print_f PER_Visible_print; |
| 1091 | asn_struct_free_f PER_Visible_free; |
| 1092 | |
| 1093 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1094 | |
| 1095 | static int check_permitted_alphabet_3(const void *sptr) { |
| 1096 | /* The underlying type is IA5String */ |
vlm | 4fdaead | 2004-08-21 07:34:17 +0000 | [diff] [blame] | 1097 | const IA5String_t *st = sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1098 | const uint8_t *ch = st->buf; |
| 1099 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1100 | |
| 1101 | for(; ch < end; ch++) { |
| 1102 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1103 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1104 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1105 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1106 | } |
| 1107 | |
| 1108 | |
| 1109 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1110 | |
| 1111 | int |
| 1112 | PER_Visible_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1113 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1114 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1115 | const IA5String_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1116 | |
| 1117 | if(!sptr) { |
| 1118 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1119 | "%s: value not given (%s:%d)", |
| 1120 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1121 | return -1; |
| 1122 | } |
| 1123 | |
| 1124 | |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 1125 | if(!check_permitted_alphabet_3(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1126 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1127 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1128 | } else { |
| 1129 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1130 | "%s: constraint failed (%s:%d)", |
| 1131 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1132 | return -1; |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | /* |
| 1137 | * This type is implemented using IA5String, |
| 1138 | * so adjust the DEF appropriately. |
| 1139 | */ |
| 1140 | static void |
| 1141 | PER_Visible_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1142 | td->ber_decoder = asn1_DEF_IA5String.ber_decoder; |
| 1143 | td->der_encoder = asn1_DEF_IA5String.der_encoder; |
| 1144 | td->free_struct = asn1_DEF_IA5String.free_struct; |
| 1145 | td->print_struct = asn1_DEF_IA5String.print_struct; |
| 1146 | td->last_tag_form = asn1_DEF_IA5String.last_tag_form; |
| 1147 | td->elements = asn1_DEF_IA5String.elements; |
| 1148 | td->elements_count = asn1_DEF_IA5String.elements_count; |
| 1149 | td->specifics = asn1_DEF_IA5String.specifics; |
| 1150 | } |
| 1151 | |
| 1152 | ber_dec_rval_t |
| 1153 | PER_Visible_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1154 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1155 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1156 | return td->ber_decoder(td, structure, |
| 1157 | bufptr, size, tag_mode); |
| 1158 | } |
| 1159 | |
| 1160 | der_enc_rval_t |
| 1161 | PER_Visible_encode_der(asn1_TYPE_descriptor_t *td, |
| 1162 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1163 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1164 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1165 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1166 | } |
| 1167 | |
| 1168 | int |
| 1169 | PER_Visible_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1170 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1171 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1172 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1173 | } |
| 1174 | |
| 1175 | void |
| 1176 | PER_Visible_free(asn1_TYPE_descriptor_t *td, |
| 1177 | void *struct_ptr, int contents_only) { |
| 1178 | PER_Visible_inherit_TYPE_descriptor(td); |
| 1179 | td->free_struct(td, struct_ptr, contents_only); |
| 1180 | } |
| 1181 | |
| 1182 | |
| 1183 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1184 | |
| 1185 | static ber_tlv_tag_t asn1_DEF_PER_Visible_tags[] = { |
| 1186 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1187 | }; |
| 1188 | asn1_TYPE_descriptor_t asn1_DEF_PER_Visible = { |
| 1189 | "PER-Visible", |
| 1190 | PER_Visible_constraint, |
| 1191 | PER_Visible_decode_ber, |
| 1192 | PER_Visible_encode_der, |
| 1193 | PER_Visible_print, |
| 1194 | PER_Visible_free, |
| 1195 | 0, /* Use generic outmost tag fetcher */ |
| 1196 | asn1_DEF_PER_Visible_tags, |
| 1197 | sizeof(asn1_DEF_PER_Visible_tags) |
| 1198 | /sizeof(asn1_DEF_PER_Visible_tags[0]), /* 1 */ |
| 1199 | 1, /* Tags to skip */ |
| 1200 | -0, /* Unknown yet */ |
| 1201 | 0, 0, /* No members */ |
| 1202 | 0 /* No specifics */ |
| 1203 | }; |
| 1204 | |
| 1205 | |
| 1206 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1207 | |
| 1208 | #include <PER-Visible.h> |
| 1209 | |
| 1210 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1211 | |
| 1212 | |
| 1213 | typedef PER_Visible_t PER_Visible_2_t; |
| 1214 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1215 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1216 | |
| 1217 | extern asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2; |
| 1218 | asn_constr_check_f PER_Visible_2_constraint; |
| 1219 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1220 | der_type_encoder_f PER_Visible_2_encode_der; |
| 1221 | asn_struct_print_f PER_Visible_2_print; |
| 1222 | asn_struct_free_f PER_Visible_2_free; |
| 1223 | |
| 1224 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1225 | |
| 1226 | static int check_permitted_alphabet_4(const void *sptr) { |
| 1227 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1228 | const IA5String_t *st = sptr; |
| 1229 | const uint8_t *ch = st->buf; |
| 1230 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1231 | |
| 1232 | for(; ch < end; ch++) { |
| 1233 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1234 | if(!(cv >= 69 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1235 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1236 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1237 | } |
| 1238 | |
| 1239 | |
| 1240 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1241 | |
| 1242 | int |
| 1243 | PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1244 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1245 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1246 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1247 | |
| 1248 | if(!sptr) { |
| 1249 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1250 | "%s: value not given (%s:%d)", |
| 1251 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1252 | return -1; |
| 1253 | } |
| 1254 | |
| 1255 | |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 1256 | if(!check_permitted_alphabet_4(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1257 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1258 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1259 | } else { |
| 1260 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1261 | "%s: constraint failed (%s:%d)", |
| 1262 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1263 | return -1; |
| 1264 | } |
| 1265 | } |
| 1266 | |
| 1267 | /* |
| 1268 | * This type is implemented using PER_Visible, |
| 1269 | * so adjust the DEF appropriately. |
| 1270 | */ |
| 1271 | static void |
| 1272 | PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1273 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1274 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1275 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1276 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1277 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1278 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1279 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1280 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1281 | } |
| 1282 | |
| 1283 | ber_dec_rval_t |
| 1284 | PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1285 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1286 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1287 | return td->ber_decoder(td, structure, |
| 1288 | bufptr, size, tag_mode); |
| 1289 | } |
| 1290 | |
| 1291 | der_enc_rval_t |
| 1292 | PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 1293 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1294 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1295 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1296 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1297 | } |
| 1298 | |
| 1299 | int |
| 1300 | PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1301 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1302 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1303 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1304 | } |
| 1305 | |
| 1306 | void |
| 1307 | PER_Visible_2_free(asn1_TYPE_descriptor_t *td, |
| 1308 | void *struct_ptr, int contents_only) { |
| 1309 | PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1310 | td->free_struct(td, struct_ptr, contents_only); |
| 1311 | } |
| 1312 | |
| 1313 | |
| 1314 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 1315 | |
| 1316 | static ber_tlv_tag_t asn1_DEF_PER_Visible_2_tags[] = { |
| 1317 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1318 | }; |
| 1319 | asn1_TYPE_descriptor_t asn1_DEF_PER_Visible_2 = { |
| 1320 | "PER-Visible-2", |
| 1321 | PER_Visible_2_constraint, |
| 1322 | PER_Visible_2_decode_ber, |
| 1323 | PER_Visible_2_encode_der, |
| 1324 | PER_Visible_2_print, |
| 1325 | PER_Visible_2_free, |
| 1326 | 0, /* Use generic outmost tag fetcher */ |
| 1327 | asn1_DEF_PER_Visible_2_tags, |
| 1328 | sizeof(asn1_DEF_PER_Visible_2_tags) |
| 1329 | /sizeof(asn1_DEF_PER_Visible_2_tags[0]), /* 1 */ |
| 1330 | 1, /* Tags to skip */ |
| 1331 | -0, /* Unknown yet */ |
| 1332 | 0, 0, /* No members */ |
| 1333 | 0 /* No specifics */ |
| 1334 | }; |
| 1335 | |
| 1336 | |
| 1337 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 1338 | |
| 1339 | #include <PER-Visible.h> |
| 1340 | |
| 1341 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1342 | |
| 1343 | |
| 1344 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 1345 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1346 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1347 | |
| 1348 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1; |
| 1349 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 1350 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 1351 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
| 1352 | asn_struct_print_f Not_PER_Visible_1_print; |
| 1353 | asn_struct_free_f Not_PER_Visible_1_free; |
| 1354 | |
| 1355 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 1356 | |
| 1357 | static int check_permitted_alphabet_5(const void *sptr) { |
| 1358 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1359 | const IA5String_t *st = sptr; |
| 1360 | const uint8_t *ch = st->buf; |
| 1361 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1362 | |
| 1363 | for(; ch < end; ch++) { |
| 1364 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1365 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1366 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1367 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1368 | } |
| 1369 | |
| 1370 | |
| 1371 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 1372 | |
| 1373 | int |
| 1374 | Not_PER_Visible_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1375 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1376 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1377 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1378 | |
| 1379 | if(!sptr) { |
| 1380 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1381 | "%s: value not given (%s:%d)", |
| 1382 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1383 | return -1; |
| 1384 | } |
| 1385 | |
| 1386 | |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 1387 | if(!check_permitted_alphabet_5(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1388 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1389 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1390 | } else { |
| 1391 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1392 | "%s: constraint failed (%s:%d)", |
| 1393 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1394 | return -1; |
| 1395 | } |
| 1396 | } |
| 1397 | |
| 1398 | /* |
| 1399 | * This type is implemented using PER_Visible, |
| 1400 | * so adjust the DEF appropriately. |
| 1401 | */ |
| 1402 | static void |
| 1403 | Not_PER_Visible_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1404 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1405 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1406 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1407 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1408 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1409 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1410 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1411 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1412 | } |
| 1413 | |
| 1414 | ber_dec_rval_t |
| 1415 | Not_PER_Visible_1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1416 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1417 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1418 | return td->ber_decoder(td, structure, |
| 1419 | bufptr, size, tag_mode); |
| 1420 | } |
| 1421 | |
| 1422 | der_enc_rval_t |
| 1423 | Not_PER_Visible_1_encode_der(asn1_TYPE_descriptor_t *td, |
| 1424 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1425 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1426 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1427 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1428 | } |
| 1429 | |
| 1430 | int |
| 1431 | Not_PER_Visible_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1432 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1433 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1434 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1435 | } |
| 1436 | |
| 1437 | void |
| 1438 | Not_PER_Visible_1_free(asn1_TYPE_descriptor_t *td, |
| 1439 | void *struct_ptr, int contents_only) { |
| 1440 | Not_PER_Visible_1_inherit_TYPE_descriptor(td); |
| 1441 | td->free_struct(td, struct_ptr, contents_only); |
| 1442 | } |
| 1443 | |
| 1444 | |
| 1445 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 1446 | |
| 1447 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_1_tags[] = { |
| 1448 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1449 | }; |
| 1450 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_1 = { |
| 1451 | "Not-PER-Visible-1", |
| 1452 | Not_PER_Visible_1_constraint, |
| 1453 | Not_PER_Visible_1_decode_ber, |
| 1454 | Not_PER_Visible_1_encode_der, |
| 1455 | Not_PER_Visible_1_print, |
| 1456 | Not_PER_Visible_1_free, |
| 1457 | 0, /* Use generic outmost tag fetcher */ |
| 1458 | asn1_DEF_Not_PER_Visible_1_tags, |
| 1459 | sizeof(asn1_DEF_Not_PER_Visible_1_tags) |
| 1460 | /sizeof(asn1_DEF_Not_PER_Visible_1_tags[0]), /* 1 */ |
| 1461 | 1, /* Tags to skip */ |
| 1462 | -0, /* Unknown yet */ |
| 1463 | 0, 0, /* No members */ |
| 1464 | 0 /* No specifics */ |
| 1465 | }; |
| 1466 | |
| 1467 | |
| 1468 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 1469 | |
| 1470 | #include <PER-Visible.h> |
| 1471 | |
| 1472 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1473 | |
| 1474 | |
| 1475 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 1476 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1477 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1478 | |
| 1479 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2; |
| 1480 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 1481 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 1482 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
| 1483 | asn_struct_print_f Not_PER_Visible_2_print; |
| 1484 | asn_struct_free_f Not_PER_Visible_2_free; |
| 1485 | |
| 1486 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 1487 | |
| 1488 | int |
| 1489 | Not_PER_Visible_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1490 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1491 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1492 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1493 | |
| 1494 | if(!sptr) { |
| 1495 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1496 | "%s: value not given (%s:%d)", |
| 1497 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1498 | return -1; |
| 1499 | } |
| 1500 | |
| 1501 | |
| 1502 | if(1 /* No applicable constraints whatsoever */) { |
| 1503 | /* Nothing is here. See below */ |
| 1504 | } |
| 1505 | |
| 1506 | /* Make the underlying type checker permanent */ |
| 1507 | td->check_constraints = asn1_DEF_PER_Visible.check_constraints; |
| 1508 | return td->check_constraints |
| 1509 | (td, sptr, app_errlog, app_key); |
| 1510 | } |
| 1511 | |
| 1512 | /* |
| 1513 | * This type is implemented using PER_Visible, |
| 1514 | * so adjust the DEF appropriately. |
| 1515 | */ |
| 1516 | static void |
| 1517 | Not_PER_Visible_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1518 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1519 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1520 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1521 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1522 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1523 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1524 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1525 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1526 | } |
| 1527 | |
| 1528 | ber_dec_rval_t |
| 1529 | Not_PER_Visible_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1530 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1531 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1532 | return td->ber_decoder(td, structure, |
| 1533 | bufptr, size, tag_mode); |
| 1534 | } |
| 1535 | |
| 1536 | der_enc_rval_t |
| 1537 | Not_PER_Visible_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 1538 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1539 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1540 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1541 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1542 | } |
| 1543 | |
| 1544 | int |
| 1545 | Not_PER_Visible_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1546 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1547 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1548 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1549 | } |
| 1550 | |
| 1551 | void |
| 1552 | Not_PER_Visible_2_free(asn1_TYPE_descriptor_t *td, |
| 1553 | void *struct_ptr, int contents_only) { |
| 1554 | Not_PER_Visible_2_inherit_TYPE_descriptor(td); |
| 1555 | td->free_struct(td, struct_ptr, contents_only); |
| 1556 | } |
| 1557 | |
| 1558 | |
| 1559 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 1560 | |
| 1561 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_2_tags[] = { |
| 1562 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1563 | }; |
| 1564 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_2 = { |
| 1565 | "Not-PER-Visible-2", |
| 1566 | Not_PER_Visible_2_constraint, |
| 1567 | Not_PER_Visible_2_decode_ber, |
| 1568 | Not_PER_Visible_2_encode_der, |
| 1569 | Not_PER_Visible_2_print, |
| 1570 | Not_PER_Visible_2_free, |
| 1571 | 0, /* Use generic outmost tag fetcher */ |
| 1572 | asn1_DEF_Not_PER_Visible_2_tags, |
| 1573 | sizeof(asn1_DEF_Not_PER_Visible_2_tags) |
| 1574 | /sizeof(asn1_DEF_Not_PER_Visible_2_tags[0]), /* 1 */ |
| 1575 | 1, /* Tags to skip */ |
| 1576 | -0, /* Unknown yet */ |
| 1577 | 0, 0, /* No members */ |
| 1578 | 0 /* No specifics */ |
| 1579 | }; |
| 1580 | |
| 1581 | |
| 1582 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 1583 | |
| 1584 | #include <PER-Visible.h> |
| 1585 | |
| 1586 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1587 | |
| 1588 | |
| 1589 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 1590 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1591 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 1592 | |
| 1593 | extern asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3; |
| 1594 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 1595 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 1596 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
| 1597 | asn_struct_print_f Not_PER_Visible_3_print; |
| 1598 | asn_struct_free_f Not_PER_Visible_3_free; |
| 1599 | |
| 1600 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 1601 | |
| 1602 | int |
| 1603 | Not_PER_Visible_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1604 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1605 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1606 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1607 | |
| 1608 | if(!sptr) { |
| 1609 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1610 | "%s: value not given (%s:%d)", |
| 1611 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1612 | return -1; |
| 1613 | } |
| 1614 | |
| 1615 | |
| 1616 | if(1 /* No applicable constraints whatsoever */) { |
| 1617 | /* Nothing is here. See below */ |
| 1618 | } |
| 1619 | |
| 1620 | /* Make the underlying type checker permanent */ |
| 1621 | td->check_constraints = asn1_DEF_PER_Visible.check_constraints; |
| 1622 | return td->check_constraints |
| 1623 | (td, sptr, app_errlog, app_key); |
| 1624 | } |
| 1625 | |
| 1626 | /* |
| 1627 | * This type is implemented using PER_Visible, |
| 1628 | * so adjust the DEF appropriately. |
| 1629 | */ |
| 1630 | static void |
| 1631 | Not_PER_Visible_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1632 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1633 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1634 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1635 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1636 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1637 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1638 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1639 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1640 | } |
| 1641 | |
| 1642 | ber_dec_rval_t |
| 1643 | Not_PER_Visible_3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1644 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1645 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1646 | return td->ber_decoder(td, structure, |
| 1647 | bufptr, size, tag_mode); |
| 1648 | } |
| 1649 | |
| 1650 | der_enc_rval_t |
| 1651 | Not_PER_Visible_3_encode_der(asn1_TYPE_descriptor_t *td, |
| 1652 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1653 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1654 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1655 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1656 | } |
| 1657 | |
| 1658 | int |
| 1659 | Not_PER_Visible_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1660 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1661 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1662 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1663 | } |
| 1664 | |
| 1665 | void |
| 1666 | Not_PER_Visible_3_free(asn1_TYPE_descriptor_t *td, |
| 1667 | void *struct_ptr, int contents_only) { |
| 1668 | Not_PER_Visible_3_inherit_TYPE_descriptor(td); |
| 1669 | td->free_struct(td, struct_ptr, contents_only); |
| 1670 | } |
| 1671 | |
| 1672 | |
| 1673 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 1674 | |
| 1675 | static ber_tlv_tag_t asn1_DEF_Not_PER_Visible_3_tags[] = { |
| 1676 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1677 | }; |
| 1678 | asn1_TYPE_descriptor_t asn1_DEF_Not_PER_Visible_3 = { |
| 1679 | "Not-PER-Visible-3", |
| 1680 | Not_PER_Visible_3_constraint, |
| 1681 | Not_PER_Visible_3_decode_ber, |
| 1682 | Not_PER_Visible_3_encode_der, |
| 1683 | Not_PER_Visible_3_print, |
| 1684 | Not_PER_Visible_3_free, |
| 1685 | 0, /* Use generic outmost tag fetcher */ |
| 1686 | asn1_DEF_Not_PER_Visible_3_tags, |
| 1687 | sizeof(asn1_DEF_Not_PER_Visible_3_tags) |
| 1688 | /sizeof(asn1_DEF_Not_PER_Visible_3_tags[0]), /* 1 */ |
| 1689 | 1, /* Tags to skip */ |
| 1690 | -0, /* Unknown yet */ |
| 1691 | 0, 0, /* No members */ |
| 1692 | 0 /* No specifics */ |
| 1693 | }; |
| 1694 | |
| 1695 | |
| 1696 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 1697 | |
| 1698 | #include <PER-Visible.h> |
| 1699 | |
| 1700 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1701 | |
| 1702 | |
| 1703 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 1704 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1705 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 1706 | |
| 1707 | extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM; |
| 1708 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 1709 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 1710 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
| 1711 | asn_struct_print_f SIZE_but_not_FROM_print; |
| 1712 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 1713 | |
| 1714 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 1715 | |
| 1716 | static int check_permitted_alphabet_6(const void *sptr) { |
| 1717 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1718 | const IA5String_t *st = sptr; |
| 1719 | const uint8_t *ch = st->buf; |
| 1720 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1721 | |
| 1722 | for(; ch < end; ch++) { |
| 1723 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1724 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1725 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1726 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1727 | } |
| 1728 | |
| 1729 | |
| 1730 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 1731 | |
| 1732 | int |
| 1733 | SIZE_but_not_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1734 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1735 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1736 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1737 | size_t size; |
| 1738 | |
| 1739 | if(!sptr) { |
| 1740 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1741 | "%s: value not given (%s:%d)", |
| 1742 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1743 | return -1; |
| 1744 | } |
| 1745 | |
| 1746 | size = st->size; |
| 1747 | |
| 1748 | if((size >= 1 && size <= 4) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 1749 | && !check_permitted_alphabet_6(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1750 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1751 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1752 | } else { |
| 1753 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1754 | "%s: constraint failed (%s:%d)", |
| 1755 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1756 | return -1; |
| 1757 | } |
| 1758 | } |
| 1759 | |
| 1760 | /* |
| 1761 | * This type is implemented using PER_Visible, |
| 1762 | * so adjust the DEF appropriately. |
| 1763 | */ |
| 1764 | static void |
| 1765 | SIZE_but_not_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1766 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1767 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1768 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1769 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1770 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1771 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1772 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1773 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1774 | } |
| 1775 | |
| 1776 | ber_dec_rval_t |
| 1777 | SIZE_but_not_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1778 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1779 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1780 | return td->ber_decoder(td, structure, |
| 1781 | bufptr, size, tag_mode); |
| 1782 | } |
| 1783 | |
| 1784 | der_enc_rval_t |
| 1785 | SIZE_but_not_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 1786 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1787 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1788 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1789 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1790 | } |
| 1791 | |
| 1792 | int |
| 1793 | SIZE_but_not_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1794 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1795 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1796 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1797 | } |
| 1798 | |
| 1799 | void |
| 1800 | SIZE_but_not_FROM_free(asn1_TYPE_descriptor_t *td, |
| 1801 | void *struct_ptr, int contents_only) { |
| 1802 | SIZE_but_not_FROM_inherit_TYPE_descriptor(td); |
| 1803 | td->free_struct(td, struct_ptr, contents_only); |
| 1804 | } |
| 1805 | |
| 1806 | |
| 1807 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 1808 | |
| 1809 | static ber_tlv_tag_t asn1_DEF_SIZE_but_not_FROM_tags[] = { |
| 1810 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1811 | }; |
| 1812 | asn1_TYPE_descriptor_t asn1_DEF_SIZE_but_not_FROM = { |
| 1813 | "SIZE-but-not-FROM", |
| 1814 | SIZE_but_not_FROM_constraint, |
| 1815 | SIZE_but_not_FROM_decode_ber, |
| 1816 | SIZE_but_not_FROM_encode_der, |
| 1817 | SIZE_but_not_FROM_print, |
| 1818 | SIZE_but_not_FROM_free, |
| 1819 | 0, /* Use generic outmost tag fetcher */ |
| 1820 | asn1_DEF_SIZE_but_not_FROM_tags, |
| 1821 | sizeof(asn1_DEF_SIZE_but_not_FROM_tags) |
| 1822 | /sizeof(asn1_DEF_SIZE_but_not_FROM_tags[0]), /* 1 */ |
| 1823 | 1, /* Tags to skip */ |
| 1824 | -0, /* Unknown yet */ |
| 1825 | 0, 0, /* No members */ |
| 1826 | 0 /* No specifics */ |
| 1827 | }; |
| 1828 | |
| 1829 | |
| 1830 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 1831 | |
| 1832 | #include <PER-Visible.h> |
| 1833 | |
| 1834 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 1835 | |
| 1836 | |
| 1837 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 1838 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1839 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 1840 | |
| 1841 | extern asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM; |
| 1842 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 1843 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 1844 | der_type_encoder_f SIZE_and_FROM_encode_der; |
| 1845 | asn_struct_print_f SIZE_and_FROM_print; |
| 1846 | asn_struct_free_f SIZE_and_FROM_free; |
| 1847 | |
| 1848 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 1849 | |
| 1850 | static int check_permitted_alphabet_7(const void *sptr) { |
| 1851 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1852 | const IA5String_t *st = sptr; |
| 1853 | const uint8_t *ch = st->buf; |
| 1854 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1855 | |
| 1856 | for(; ch < end; ch++) { |
| 1857 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1858 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1859 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1860 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1861 | } |
| 1862 | |
| 1863 | |
| 1864 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 1865 | |
| 1866 | int |
| 1867 | SIZE_and_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 1868 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 1869 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1870 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1871 | size_t size; |
| 1872 | |
| 1873 | if(!sptr) { |
| 1874 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1875 | "%s: value not given (%s:%d)", |
| 1876 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1877 | return -1; |
| 1878 | } |
| 1879 | |
| 1880 | size = st->size; |
| 1881 | |
| 1882 | if((size >= 1 && size <= 4) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 1883 | && !check_permitted_alphabet_7(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1884 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1885 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1886 | } else { |
| 1887 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 1888 | "%s: constraint failed (%s:%d)", |
| 1889 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1890 | return -1; |
| 1891 | } |
| 1892 | } |
| 1893 | |
| 1894 | /* |
| 1895 | * This type is implemented using PER_Visible, |
| 1896 | * so adjust the DEF appropriately. |
| 1897 | */ |
| 1898 | static void |
| 1899 | SIZE_and_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 1900 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 1901 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 1902 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 1903 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 1904 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 1905 | td->elements = asn1_DEF_PER_Visible.elements; |
| 1906 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 1907 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 1908 | } |
| 1909 | |
| 1910 | ber_dec_rval_t |
| 1911 | SIZE_and_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 1912 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 1913 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1914 | return td->ber_decoder(td, structure, |
| 1915 | bufptr, size, tag_mode); |
| 1916 | } |
| 1917 | |
| 1918 | der_enc_rval_t |
| 1919 | SIZE_and_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 1920 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1921 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 1922 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1923 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1924 | } |
| 1925 | |
| 1926 | int |
| 1927 | SIZE_and_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 1928 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 1929 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1930 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1931 | } |
| 1932 | |
| 1933 | void |
| 1934 | SIZE_and_FROM_free(asn1_TYPE_descriptor_t *td, |
| 1935 | void *struct_ptr, int contents_only) { |
| 1936 | SIZE_and_FROM_inherit_TYPE_descriptor(td); |
| 1937 | td->free_struct(td, struct_ptr, contents_only); |
| 1938 | } |
| 1939 | |
| 1940 | |
| 1941 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 1942 | |
| 1943 | static ber_tlv_tag_t asn1_DEF_SIZE_and_FROM_tags[] = { |
| 1944 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 1945 | }; |
| 1946 | asn1_TYPE_descriptor_t asn1_DEF_SIZE_and_FROM = { |
| 1947 | "SIZE-and-FROM", |
| 1948 | SIZE_and_FROM_constraint, |
| 1949 | SIZE_and_FROM_decode_ber, |
| 1950 | SIZE_and_FROM_encode_der, |
| 1951 | SIZE_and_FROM_print, |
| 1952 | SIZE_and_FROM_free, |
| 1953 | 0, /* Use generic outmost tag fetcher */ |
| 1954 | asn1_DEF_SIZE_and_FROM_tags, |
| 1955 | sizeof(asn1_DEF_SIZE_and_FROM_tags) |
| 1956 | /sizeof(asn1_DEF_SIZE_and_FROM_tags[0]), /* 1 */ |
| 1957 | 1, /* Tags to skip */ |
| 1958 | -0, /* Unknown yet */ |
| 1959 | 0, 0, /* No members */ |
| 1960 | 0 /* No specifics */ |
| 1961 | }; |
| 1962 | |
| 1963 | |
| 1964 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 1965 | |
| 1966 | #include <PER-Visible.h> |
| 1967 | |
| 1968 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 1969 | |
| 1970 | |
| 1971 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 1972 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1973 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 1974 | |
| 1975 | extern asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM; |
| 1976 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 1977 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 1978 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
| 1979 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
| 1980 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 1981 | |
| 1982 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 1983 | |
| 1984 | static int check_permitted_alphabet_8(const void *sptr) { |
| 1985 | /* The underlying type is IA5String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1986 | const IA5String_t *st = sptr; |
| 1987 | const uint8_t *ch = st->buf; |
| 1988 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1989 | |
| 1990 | for(; ch < end; ch++) { |
| 1991 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1992 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1993 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1994 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1995 | } |
| 1996 | |
| 1997 | |
| 1998 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 1999 | |
| 2000 | int |
| 2001 | Neither_SIZE_nor_FROM_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2002 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2003 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2004 | const PER_Visible_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2005 | |
| 2006 | if(!sptr) { |
| 2007 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2008 | "%s: value not given (%s:%d)", |
| 2009 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2010 | return -1; |
| 2011 | } |
| 2012 | |
| 2013 | |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 2014 | if(!check_permitted_alphabet_8(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2015 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2016 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2017 | } else { |
| 2018 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2019 | "%s: constraint failed (%s:%d)", |
| 2020 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2021 | return -1; |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | /* |
| 2026 | * This type is implemented using PER_Visible, |
| 2027 | * so adjust the DEF appropriately. |
| 2028 | */ |
| 2029 | static void |
| 2030 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2031 | td->ber_decoder = asn1_DEF_PER_Visible.ber_decoder; |
| 2032 | td->der_encoder = asn1_DEF_PER_Visible.der_encoder; |
| 2033 | td->free_struct = asn1_DEF_PER_Visible.free_struct; |
| 2034 | td->print_struct = asn1_DEF_PER_Visible.print_struct; |
| 2035 | td->last_tag_form = asn1_DEF_PER_Visible.last_tag_form; |
| 2036 | td->elements = asn1_DEF_PER_Visible.elements; |
| 2037 | td->elements_count = asn1_DEF_PER_Visible.elements_count; |
| 2038 | td->specifics = asn1_DEF_PER_Visible.specifics; |
| 2039 | } |
| 2040 | |
| 2041 | ber_dec_rval_t |
| 2042 | Neither_SIZE_nor_FROM_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2043 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2044 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2045 | return td->ber_decoder(td, structure, |
| 2046 | bufptr, size, tag_mode); |
| 2047 | } |
| 2048 | |
| 2049 | der_enc_rval_t |
| 2050 | Neither_SIZE_nor_FROM_encode_der(asn1_TYPE_descriptor_t *td, |
| 2051 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2052 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2053 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2054 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2055 | } |
| 2056 | |
| 2057 | int |
| 2058 | Neither_SIZE_nor_FROM_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2059 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2060 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2061 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2062 | } |
| 2063 | |
| 2064 | void |
| 2065 | Neither_SIZE_nor_FROM_free(asn1_TYPE_descriptor_t *td, |
| 2066 | void *struct_ptr, int contents_only) { |
| 2067 | Neither_SIZE_nor_FROM_inherit_TYPE_descriptor(td); |
| 2068 | td->free_struct(td, struct_ptr, contents_only); |
| 2069 | } |
| 2070 | |
| 2071 | |
| 2072 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2073 | |
| 2074 | static ber_tlv_tag_t asn1_DEF_Neither_SIZE_nor_FROM_tags[] = { |
| 2075 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2076 | }; |
| 2077 | asn1_TYPE_descriptor_t asn1_DEF_Neither_SIZE_nor_FROM = { |
| 2078 | "Neither-SIZE-nor-FROM", |
| 2079 | Neither_SIZE_nor_FROM_constraint, |
| 2080 | Neither_SIZE_nor_FROM_decode_ber, |
| 2081 | Neither_SIZE_nor_FROM_encode_der, |
| 2082 | Neither_SIZE_nor_FROM_print, |
| 2083 | Neither_SIZE_nor_FROM_free, |
| 2084 | 0, /* Use generic outmost tag fetcher */ |
| 2085 | asn1_DEF_Neither_SIZE_nor_FROM_tags, |
| 2086 | sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags) |
| 2087 | /sizeof(asn1_DEF_Neither_SIZE_nor_FROM_tags[0]), /* 1 */ |
| 2088 | 1, /* Tags to skip */ |
| 2089 | -0, /* Unknown yet */ |
| 2090 | 0, 0, /* No members */ |
| 2091 | 0 /* No specifics */ |
| 2092 | }; |
| 2093 | |
| 2094 | |
| 2095 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 2096 | |
| 2097 | #include <Utf8-2.h> |
| 2098 | |
| 2099 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 2100 | |
| 2101 | |
| 2102 | typedef Utf8_2_t Utf8_3_t; |
| 2103 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2104 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 2105 | |
| 2106 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_3; |
| 2107 | asn_constr_check_f Utf8_3_constraint; |
| 2108 | ber_type_decoder_f Utf8_3_decode_ber; |
| 2109 | der_type_encoder_f Utf8_3_encode_der; |
| 2110 | asn_struct_print_f Utf8_3_print; |
| 2111 | asn_struct_free_f Utf8_3_free; |
| 2112 | |
| 2113 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 2114 | |
| 2115 | static int permitted_alphabet_table_9[128] = { |
| 2116 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2117 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2118 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2119 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2120 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2121 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 2122 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2123 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2124 | }; |
| 2125 | |
| 2126 | static int check_permitted_alphabet_9(const void *sptr) { |
| 2127 | int *table = permitted_alphabet_table_9; |
| 2128 | /* The underlying type is UTF8String */ |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2129 | const UTF8String_t *st = sptr; |
| 2130 | const uint8_t *ch = st->buf; |
| 2131 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2132 | |
| 2133 | for(; ch < end; ch++) { |
| 2134 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2135 | if(cv >= 0x80) return -1; |
| 2136 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2137 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2138 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2139 | } |
| 2140 | |
| 2141 | |
| 2142 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 2143 | |
| 2144 | int |
| 2145 | Utf8_3_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2146 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2147 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2148 | const Utf8_2_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2149 | size_t size; |
| 2150 | |
| 2151 | if(!sptr) { |
| 2152 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2153 | "%s: value not given (%s:%d)", |
| 2154 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2155 | return -1; |
| 2156 | } |
| 2157 | |
| 2158 | size = UTF8String_length(st, td->name, app_errlog, app_key); |
| 2159 | if(size == (size_t)-1) return -1; |
| 2160 | |
| 2161 | if((size >= 1 && size <= 2) |
vlm | 7e20dfc | 2004-08-22 13:11:40 +0000 | [diff] [blame] | 2162 | && !check_permitted_alphabet_9(sptr)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2163 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2164 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2165 | } else { |
| 2166 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2167 | "%s: constraint failed (%s:%d)", |
| 2168 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2169 | return -1; |
| 2170 | } |
| 2171 | } |
| 2172 | |
| 2173 | /* |
| 2174 | * This type is implemented using Utf8_2, |
| 2175 | * so adjust the DEF appropriately. |
| 2176 | */ |
| 2177 | static void |
| 2178 | Utf8_3_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2179 | td->ber_decoder = asn1_DEF_Utf8_2.ber_decoder; |
| 2180 | td->der_encoder = asn1_DEF_Utf8_2.der_encoder; |
| 2181 | td->free_struct = asn1_DEF_Utf8_2.free_struct; |
| 2182 | td->print_struct = asn1_DEF_Utf8_2.print_struct; |
| 2183 | td->last_tag_form = asn1_DEF_Utf8_2.last_tag_form; |
| 2184 | td->elements = asn1_DEF_Utf8_2.elements; |
| 2185 | td->elements_count = asn1_DEF_Utf8_2.elements_count; |
| 2186 | td->specifics = asn1_DEF_Utf8_2.specifics; |
| 2187 | } |
| 2188 | |
| 2189 | ber_dec_rval_t |
| 2190 | Utf8_3_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2191 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2192 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2193 | return td->ber_decoder(td, structure, |
| 2194 | bufptr, size, tag_mode); |
| 2195 | } |
| 2196 | |
| 2197 | der_enc_rval_t |
| 2198 | Utf8_3_encode_der(asn1_TYPE_descriptor_t *td, |
| 2199 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2200 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2201 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2202 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2203 | } |
| 2204 | |
| 2205 | int |
| 2206 | Utf8_3_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2207 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2208 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2209 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2210 | } |
| 2211 | |
| 2212 | void |
| 2213 | Utf8_3_free(asn1_TYPE_descriptor_t *td, |
| 2214 | void *struct_ptr, int contents_only) { |
| 2215 | Utf8_3_inherit_TYPE_descriptor(td); |
| 2216 | td->free_struct(td, struct_ptr, contents_only); |
| 2217 | } |
| 2218 | |
| 2219 | |
| 2220 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 2221 | |
| 2222 | static ber_tlv_tag_t asn1_DEF_Utf8_3_tags[] = { |
| 2223 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2224 | }; |
| 2225 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_3 = { |
| 2226 | "Utf8-3", |
| 2227 | Utf8_3_constraint, |
| 2228 | Utf8_3_decode_ber, |
| 2229 | Utf8_3_encode_der, |
| 2230 | Utf8_3_print, |
| 2231 | Utf8_3_free, |
| 2232 | 0, /* Use generic outmost tag fetcher */ |
| 2233 | asn1_DEF_Utf8_3_tags, |
| 2234 | sizeof(asn1_DEF_Utf8_3_tags) |
| 2235 | /sizeof(asn1_DEF_Utf8_3_tags[0]), /* 1 */ |
| 2236 | 1, /* Tags to skip */ |
| 2237 | -0, /* Unknown yet */ |
| 2238 | 0, 0, /* No members */ |
| 2239 | 0 /* No specifics */ |
| 2240 | }; |
| 2241 | |
| 2242 | |
| 2243 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 2244 | |
| 2245 | #include <Utf8-1.h> |
| 2246 | |
| 2247 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 2248 | |
| 2249 | |
| 2250 | typedef Utf8_1_t Utf8_2_t; |
| 2251 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2252 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 2253 | |
| 2254 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_2; |
| 2255 | asn_constr_check_f Utf8_2_constraint; |
| 2256 | ber_type_decoder_f Utf8_2_decode_ber; |
| 2257 | der_type_encoder_f Utf8_2_encode_der; |
| 2258 | asn_struct_print_f Utf8_2_print; |
| 2259 | asn_struct_free_f Utf8_2_free; |
| 2260 | |
| 2261 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 2262 | |
| 2263 | int |
| 2264 | Utf8_2_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2265 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2266 | |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2267 | const Utf8_1_t *st = sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2268 | size_t size; |
| 2269 | |
| 2270 | if(!sptr) { |
| 2271 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2272 | "%s: value not given (%s:%d)", |
| 2273 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2274 | return -1; |
| 2275 | } |
| 2276 | |
| 2277 | size = UTF8String_length(st, td->name, app_errlog, app_key); |
| 2278 | if(size == (size_t)-1) return -1; |
| 2279 | |
| 2280 | if((size >= 1 && size <= 2)) { |
| 2281 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2282 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2283 | } else { |
| 2284 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame^] | 2285 | "%s: constraint failed (%s:%d)", |
| 2286 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2287 | return -1; |
| 2288 | } |
| 2289 | } |
| 2290 | |
| 2291 | /* |
| 2292 | * This type is implemented using Utf8_1, |
| 2293 | * so adjust the DEF appropriately. |
| 2294 | */ |
| 2295 | static void |
| 2296 | Utf8_2_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2297 | td->ber_decoder = asn1_DEF_Utf8_1.ber_decoder; |
| 2298 | td->der_encoder = asn1_DEF_Utf8_1.der_encoder; |
| 2299 | td->free_struct = asn1_DEF_Utf8_1.free_struct; |
| 2300 | td->print_struct = asn1_DEF_Utf8_1.print_struct; |
| 2301 | td->last_tag_form = asn1_DEF_Utf8_1.last_tag_form; |
| 2302 | td->elements = asn1_DEF_Utf8_1.elements; |
| 2303 | td->elements_count = asn1_DEF_Utf8_1.elements_count; |
| 2304 | td->specifics = asn1_DEF_Utf8_1.specifics; |
| 2305 | } |
| 2306 | |
| 2307 | ber_dec_rval_t |
| 2308 | Utf8_2_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2309 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2310 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2311 | return td->ber_decoder(td, structure, |
| 2312 | bufptr, size, tag_mode); |
| 2313 | } |
| 2314 | |
| 2315 | der_enc_rval_t |
| 2316 | Utf8_2_encode_der(asn1_TYPE_descriptor_t *td, |
| 2317 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2318 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2319 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2320 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2321 | } |
| 2322 | |
| 2323 | int |
| 2324 | Utf8_2_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2325 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2326 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2327 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2328 | } |
| 2329 | |
| 2330 | void |
| 2331 | Utf8_2_free(asn1_TYPE_descriptor_t *td, |
| 2332 | void *struct_ptr, int contents_only) { |
| 2333 | Utf8_2_inherit_TYPE_descriptor(td); |
| 2334 | td->free_struct(td, struct_ptr, contents_only); |
| 2335 | } |
| 2336 | |
| 2337 | |
| 2338 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 2339 | |
| 2340 | static ber_tlv_tag_t asn1_DEF_Utf8_2_tags[] = { |
| 2341 | (ASN_TAG_CLASS_UNIVERSAL | (0 << 2)) |
| 2342 | }; |
| 2343 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_2 = { |
| 2344 | "Utf8-2", |
| 2345 | Utf8_2_constraint, |
| 2346 | Utf8_2_decode_ber, |
| 2347 | Utf8_2_encode_der, |
| 2348 | Utf8_2_print, |
| 2349 | Utf8_2_free, |
| 2350 | 0, /* Use generic outmost tag fetcher */ |
| 2351 | asn1_DEF_Utf8_2_tags, |
| 2352 | sizeof(asn1_DEF_Utf8_2_tags) |
| 2353 | /sizeof(asn1_DEF_Utf8_2_tags[0]), /* 1 */ |
| 2354 | 1, /* Tags to skip */ |
| 2355 | -0, /* Unknown yet */ |
| 2356 | 0, 0, /* No members */ |
| 2357 | 0 /* No specifics */ |
| 2358 | }; |
| 2359 | |
| 2360 | |
| 2361 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 2362 | |
| 2363 | #include <UTF8String.h> |
| 2364 | |
| 2365 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 2366 | |
| 2367 | |
| 2368 | typedef UTF8String_t Utf8_1_t; |
| 2369 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2370 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 2371 | |
| 2372 | extern asn1_TYPE_descriptor_t asn1_DEF_Utf8_1; |
| 2373 | asn_constr_check_f Utf8_1_constraint; |
| 2374 | ber_type_decoder_f Utf8_1_decode_ber; |
| 2375 | der_type_encoder_f Utf8_1_encode_der; |
| 2376 | asn_struct_print_f Utf8_1_print; |
| 2377 | asn_struct_free_f Utf8_1_free; |
| 2378 | |
| 2379 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 2380 | |
| 2381 | int |
| 2382 | Utf8_1_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, |
| 2383 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 2384 | |
| 2385 | /* Make the underlying type checker permanent */ |
| 2386 | td->check_constraints = asn1_DEF_UTF8String.check_constraints; |
| 2387 | return td->check_constraints |
| 2388 | (td, sptr, app_errlog, app_key); |
| 2389 | } |
| 2390 | |
| 2391 | /* |
| 2392 | * This type is implemented using UTF8String, |
| 2393 | * so adjust the DEF appropriately. |
| 2394 | */ |
| 2395 | static void |
| 2396 | Utf8_1_inherit_TYPE_descriptor(asn1_TYPE_descriptor_t *td) { |
| 2397 | td->ber_decoder = asn1_DEF_UTF8String.ber_decoder; |
| 2398 | td->der_encoder = asn1_DEF_UTF8String.der_encoder; |
| 2399 | td->free_struct = asn1_DEF_UTF8String.free_struct; |
| 2400 | td->print_struct = asn1_DEF_UTF8String.print_struct; |
| 2401 | td->last_tag_form = asn1_DEF_UTF8String.last_tag_form; |
| 2402 | td->elements = asn1_DEF_UTF8String.elements; |
| 2403 | td->elements_count = asn1_DEF_UTF8String.elements_count; |
| 2404 | td->specifics = asn1_DEF_UTF8String.specifics; |
| 2405 | } |
| 2406 | |
| 2407 | ber_dec_rval_t |
| 2408 | Utf8_1_decode_ber(asn1_TYPE_descriptor_t *td, |
| 2409 | void **structure, void *bufptr, size_t size, int tag_mode) { |
| 2410 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2411 | return td->ber_decoder(td, structure, |
| 2412 | bufptr, size, tag_mode); |
| 2413 | } |
| 2414 | |
| 2415 | der_enc_rval_t |
| 2416 | Utf8_1_encode_der(asn1_TYPE_descriptor_t *td, |
| 2417 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2418 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 2419 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2420 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2421 | } |
| 2422 | |
| 2423 | int |
| 2424 | Utf8_1_print(asn1_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2425 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 2426 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2427 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2428 | } |
| 2429 | |
| 2430 | void |
| 2431 | Utf8_1_free(asn1_TYPE_descriptor_t *td, |
| 2432 | void *struct_ptr, int contents_only) { |
| 2433 | Utf8_1_inherit_TYPE_descriptor(td); |
| 2434 | td->free_struct(td, struct_ptr, contents_only); |
| 2435 | } |
| 2436 | |
| 2437 | |
| 2438 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 2439 | |
| 2440 | static ber_tlv_tag_t asn1_DEF_Utf8_1_tags[] = { |
| 2441 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 2442 | }; |
| 2443 | asn1_TYPE_descriptor_t asn1_DEF_Utf8_1 = { |
| 2444 | "Utf8-1", |
| 2445 | Utf8_1_constraint, |
| 2446 | Utf8_1_decode_ber, |
| 2447 | Utf8_1_encode_der, |
| 2448 | Utf8_1_print, |
| 2449 | Utf8_1_free, |
| 2450 | 0, /* Use generic outmost tag fetcher */ |
| 2451 | asn1_DEF_Utf8_1_tags, |
| 2452 | sizeof(asn1_DEF_Utf8_1_tags) |
| 2453 | /sizeof(asn1_DEF_Utf8_1_tags[0]), /* 1 */ |
| 2454 | 1, /* Tags to skip */ |
| 2455 | -0, /* Unknown yet */ |
| 2456 | 0, 0, /* No members */ |
| 2457 | 0 /* No specifics */ |
| 2458 | }; |
| 2459 | |