blob: 906c784a76a1ce58639dcefbdadd6ce82aa49aee [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001/*
2 * A Module definition structure used by the ASN.1 parser.
3 */
4#ifndef ASN1_PARSER_MODULE_H
5#define ASN1_PARSER_MODULE_H
6
7/*
8 * Flags specific to a module.
9 */
10typedef enum asn1p_module_flags {
11 MSF_NOFLAGS,
12 MSF_EXPLICIT_TAGS = 0x1,
13 MSF_IMPLICIT_TAGS = 0x2,
14 MSF_AUTOMATIC_TAGS = 0x4,
15 MSF_EXTENSIBILITY_IMPLIED = 0x8,
16} asn1p_module_flags_e;
17
18/*
19 * === EXAMPLE ===
20 * MySyntax DEFINITIONS AUTOMATIC TAGS ::=
21 * BEGIN
22 * ...
23 * END
24 * === EOF ===
25 */
26typedef struct asn1p_module_s {
27
28 /*
29 * Name of the source file.
30 */
31 char *source_file_name;
32
33 /*
34 * Human-readable module identifier.
35 */
36 char *Identifier; /* Module name */
37
38 /*
39 * Unique module identifier, OID.
40 */
41 asn1p_oid_t *module_oid; /* Optional OID of the module */
42
43 /*
44 * Module flags.
45 */
46 asn1p_module_flags_e module_flags; /* AUTOMATIC TAGS? */
47
48 /*
49 * List of everything that this module IMPORTS.
50 */
51 TQ_HEAD(struct asn1p_xports_s) imports;
52
53 /*
54 * List of everything that this module EXPORTS.
55 */
56 TQ_HEAD(struct asn1p_xports_s) exports;
57
58 /*
59 * List of everything that this module defines itself.
60 */
61 TQ_HEAD(struct asn1p_expr_s) members;
62
63 /*
64 * Next module in the list.
65 */
66 TQ_ENTRY(struct asn1p_module_s)
67 mod_next;
68
69} asn1p_module_t;
70
71/*
72 * Constructor and destructor.
73 */
74asn1p_module_t *asn1p_module_new(void);
75void asn1p_module_free(asn1p_module_t *mod);
76
77/*
78 * No more than a container for several modules.
79 */
80typedef struct asn1p_s {
81 TQ_HEAD(struct asn1p_module_s) modules;
82} asn1p_t;
83
84asn1p_t *asn1p_new(void);
85void asn1p_free(asn1p_t *asn);
86
87
88#endif /* ASN1_PARSER_MODULE_H */