blob: e34ffde955a39472c1b1a85373baa6b407ee4955 [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,
vlm9283dbe2004-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,
vlmfa67ddc2004-06-03 03:38:44 +000019} asn1p_module_flags_e;
vlm9283dbe2004-08-18 04:59:12 +000020#define MSF_MASK_INSTRUCTIONS 0x0f
21#define MSF_MASK_TAGS 0xf0
vlmfa67ddc2004-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 /*
vlm931aeed2005-08-12 10:09:10 +000039 * Human-readable module reference.
vlmfa67ddc2004-06-03 03:38:44 +000040 */
vlm931aeed2005-08-12 10:09:10 +000041 char *ModuleName;
vlmfa67ddc2004-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
74} asn1p_module_t;
75
76/*
77 * Constructor and destructor.
78 */
79asn1p_module_t *asn1p_module_new(void);
80void asn1p_module_free(asn1p_module_t *mod);
81
82/*
83 * No more than a container for several modules.
84 */
85typedef struct asn1p_s {
86 TQ_HEAD(struct asn1p_module_s) modules;
87} asn1p_t;
88
89asn1p_t *asn1p_new(void);
90void asn1p_free(asn1p_t *asn);
91
92
93#endif /* ASN1_PARSER_MODULE_H */