vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /*- |
| 2 | * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. |
| 3 | * Redistribution and modifications are permitted subject to BSD license. |
| 4 | */ |
| 5 | #ifndef _CONSTR_CHOICE_H_ |
| 6 | #define _CONSTR_CHOICE_H_ |
| 7 | |
| 8 | #include <constr_TYPE.h> |
| 9 | |
| 10 | /* |
| 11 | * A single element of the CHOICE type. |
| 12 | */ |
| 13 | typedef struct asn1_CHOICE_element_s { |
| 14 | int memb_offset; /* Offset of the element */ |
| 15 | int optional; /* Whether the element is optional */ |
| 16 | ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ |
| 17 | int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ |
vlm | 3147308 | 2004-06-06 07:20:02 +0000 | [diff] [blame] | 18 | asn1_TYPE_descriptor_t *type; /* Member type descriptor */ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 19 | char *name; /* ASN.1 identifier of the element */ |
| 20 | } asn1_CHOICE_element_t; |
| 21 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 22 | typedef struct asn1_CHOICE_specifics_s { |
| 23 | /* |
| 24 | * Target structure description. |
| 25 | */ |
| 26 | int struct_size; /* Size of the target structure. */ |
| 27 | int ctx_offset; /* Offset of the ber_dec_ctx_t member */ |
| 28 | int pres_offset; /* Identifier of the present member */ |
| 29 | int pres_size; /* Size of the identifier (enum) */ |
| 30 | |
| 31 | /* |
| 32 | * Members of the CHOICE structure. |
| 33 | */ |
| 34 | asn1_CHOICE_element_t *elements; |
| 35 | int elements_count; |
| 36 | |
| 37 | /* |
| 38 | * Tags to members mapping table. |
| 39 | */ |
vlm | 3147308 | 2004-06-06 07:20:02 +0000 | [diff] [blame] | 40 | asn1_TYPE_tag2member_t *tag2el; |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 41 | int tag2el_count; |
| 42 | |
| 43 | /* |
| 44 | * Extensions-related stuff. |
| 45 | */ |
| 46 | int extensible; /* Whether CHOICE is extensible */ |
| 47 | } asn1_CHOICE_specifics_t; |
| 48 | |
| 49 | /* |
| 50 | * A set specialized functions dealing with the CHOICE type. |
| 51 | */ |
| 52 | asn_constr_check_f CHOICE_constraint; |
| 53 | ber_type_decoder_f CHOICE_decode_ber; |
| 54 | der_type_encoder_f CHOICE_encode_der; |
| 55 | asn_outmost_tag_f CHOICE_outmost_tag; |
| 56 | asn_struct_print_f CHOICE_print; |
| 57 | asn_struct_free_f CHOICE_free; |
| 58 | |
| 59 | #endif /* _CONSTR_CHOICE_H_ */ |