blob: 5e7ce15dc554767a6305dfc019cd9aa988349812 [file] [log] [blame]
Lev Walkinf15320b2004-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,
Lev Walkinf59d0752004-08-18 04:59:12 +000012 MSF_unk_INSTRUCTIONS = 0x001,
13 MSF_TAG_INSTRUCTIONS = 0x002,
14 MSF_XER_INSTRUCTIONS = 0x004,
15 MSF_EXPLICIT_TAGS = 0x010,
16 MSF_IMPLICIT_TAGS = 0x020,
17 MSF_AUTOMATIC_TAGS = 0x040,
18 MSF_EXTENSIBILITY_IMPLIED = 0x100,
Lev Walkinf15320b2004-06-03 03:38:44 +000019} asn1p_module_flags_e;
Lev Walkinf59d0752004-08-18 04:59:12 +000020#define MSF_MASK_INSTRUCTIONS 0x0f
21#define MSF_MASK_TAGS 0xf0
Lev Walkinf15320b2004-06-03 03:38:44 +000022
23/*
24 * === EXAMPLE ===
25 * MySyntax DEFINITIONS AUTOMATIC TAGS ::=
26 * BEGIN
27 * ...
28 * END
29 * === EOF ===
30 */
31typedef struct asn1p_module_s {
32
33 /*
34 * Name of the source file.
35 */
36 char *source_file_name;
37
38 /*
Lev Walkinb36317c2005-08-12 10:09:10 +000039 * Human-readable module reference.
Lev Walkinf15320b2004-06-03 03:38:44 +000040 */
Lev Walkinb36317c2005-08-12 10:09:10 +000041 char *ModuleName;
Lev Walkinf15320b2004-06-03 03:38:44 +000042
43 /*
44 * Unique module identifier, OID.
45 */
46 asn1p_oid_t *module_oid; /* Optional OID of the module */
47
48 /*
49 * Module flags.
50 */
51 asn1p_module_flags_e module_flags; /* AUTOMATIC TAGS? */
52
53 /*
54 * List of everything that this module IMPORTS.
55 */
56 TQ_HEAD(struct asn1p_xports_s) imports;
57
58 /*
59 * List of everything that this module EXPORTS.
60 */
61 TQ_HEAD(struct asn1p_xports_s) exports;
62
63 /*
64 * List of everything that this module defines itself.
65 */
66 TQ_HEAD(struct asn1p_expr_s) members;
67
68 /*
69 * Next module in the list.
70 */
71 TQ_ENTRY(struct asn1p_module_s)
72 mod_next;
73
Lev Walkin46499872006-03-06 13:05:34 +000074 /*
75 * Internally useful properties.
76 */
77 enum {
78 MT_STANDARD_MODULE = 0x01, /* Module came from standard-modules */
79 } _tags;
Lev Walkinf15320b2004-06-03 03:38:44 +000080} asn1p_module_t;
81
82/*
83 * Constructor and destructor.
84 */
85asn1p_module_t *asn1p_module_new(void);
86void asn1p_module_free(asn1p_module_t *mod);
87
88/*
89 * No more than a container for several modules.
90 */
91typedef struct asn1p_s {
92 TQ_HEAD(struct asn1p_module_s) modules;
93} asn1p_t;
94
95asn1p_t *asn1p_new(void);
Lev Walkin9b5df842006-09-12 04:21:30 +000096void asn1p_delete(asn1p_t *asn);
Lev Walkinf15320b2004-06-03 03:38:44 +000097
98
99#endif /* ASN1_PARSER_MODULE_H */