blob: 70766e9d58742c2e9aa28b51fe88cccce689849f [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001/*-
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 */
13typedef 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 */
18 asn1_TYPE_descriptor_t
19 *type; /* Member type descriptor */
20 char *name; /* ASN.1 identifier of the element */
21} asn1_CHOICE_element_t;
22
23typedef struct asn1_CHOICE_tag2member_s {
24 ber_tlv_tag_t el_tag; /* Outmost tag of the member */
25 int el_no; /* Index of the associated member, base 0 */
26} asn1_CHOICE_tag2member_t;
27
28typedef struct asn1_CHOICE_specifics_s {
29 /*
30 * Target structure description.
31 */
32 int struct_size; /* Size of the target structure. */
33 int ctx_offset; /* Offset of the ber_dec_ctx_t member */
34 int pres_offset; /* Identifier of the present member */
35 int pres_size; /* Size of the identifier (enum) */
36
37 /*
38 * Members of the CHOICE structure.
39 */
40 asn1_CHOICE_element_t *elements;
41 int elements_count;
42
43 /*
44 * Tags to members mapping table.
45 */
46 asn1_CHOICE_tag2member_t *tag2el;
47 int tag2el_count;
48
49 /*
50 * Extensions-related stuff.
51 */
52 int extensible; /* Whether CHOICE is extensible */
53} asn1_CHOICE_specifics_t;
54
55/*
56 * A set specialized functions dealing with the CHOICE type.
57 */
58asn_constr_check_f CHOICE_constraint;
59ber_type_decoder_f CHOICE_decode_ber;
60der_type_encoder_f CHOICE_encode_der;
61asn_outmost_tag_f CHOICE_outmost_tag;
62asn_struct_print_f CHOICE_print;
63asn_struct_free_f CHOICE_free;
64
65#endif /* _CONSTR_CHOICE_H_ */