a1999edc42f722d1570d6092bda9793471deb395
[sim/e2-interface.git] / e2sim / src / ASN1c / constr_CHOICE.h
1 /*
2  * Copyright (c) 2003-2017 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 <asn_application.h>
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 typedef struct asn_CHOICE_specifics_s {
15         /*
16          * Target structure description.
17          */
18         unsigned struct_size;       /* Size of the target structure. */
19         unsigned ctx_offset;        /* Offset of the asn_codec_ctx_t member */
20         unsigned pres_offset;       /* Identifier of the present member */
21         unsigned pres_size;         /* Size of the identifier (enum) */
22
23         /*
24          * Tags to members mapping table.
25          */
26         const asn_TYPE_tag2member_t *tag2el;
27         unsigned tag2el_count;
28
29         /* Canonical ordering of CHOICE elements, for PER */
30         const unsigned *to_canonical_order;
31         const unsigned *from_canonical_order;
32
33         /*
34          * Extensions-related stuff.
35          */
36         signed ext_start; /* First member of extensions, or -1 */
37 } asn_CHOICE_specifics_t;
38
39 /*
40  * A set specialized functions dealing with the CHOICE type.
41  */
42 asn_struct_free_f CHOICE_free;
43 asn_struct_print_f CHOICE_print;
44 asn_struct_compare_f CHOICE_compare;
45 asn_constr_check_f CHOICE_constraint;
46 ber_type_decoder_f CHOICE_decode_ber;
47 der_type_encoder_f CHOICE_encode_der;
48 xer_type_decoder_f CHOICE_decode_xer;
49 xer_type_encoder_f CHOICE_encode_xer;
50 oer_type_decoder_f CHOICE_decode_oer;
51 oer_type_encoder_f CHOICE_encode_oer;
52 per_type_decoder_f CHOICE_decode_uper;
53 per_type_encoder_f CHOICE_encode_uper;
54 per_type_decoder_f CHOICE_decode_aper;
55 per_type_encoder_f CHOICE_encode_aper;
56 asn_outmost_tag_f CHOICE_outmost_tag;
57 asn_random_fill_f CHOICE_random_fill;
58 extern asn_TYPE_operation_t asn_OP_CHOICE;
59
60 /*
61  * Return the 1-based choice variant presence index.
62  * Returns 0 in case of error.
63  */
64 unsigned CHOICE_variant_get_presence(const asn_TYPE_descriptor_t *td,
65                                      const void *structure_ptr);
66
67 /*
68  * Sets or resets the 1-based choice variant presence index.
69  * In case a previous index is not zero, the currently selected structure
70  * member is freed and zeroed-out first.
71  * Returns 0 on success and -1 on error.
72  */
73 int CHOICE_variant_set_presence(const asn_TYPE_descriptor_t *td,
74                                 void *structure_ptr, unsigned present);
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 #endif  /* _CONSTR_CHOICE_H_ */