2 * A Module definition structure used by the ASN.1 parser.
4 #ifndef ASN1_PARSER_MODULE_H
5 #define ASN1_PARSER_MODULE_H
10 * A simple container for several modules.
12 typedef struct asn1p_s {
13 TQ_HEAD(struct asn1p_module_s) modules;
16 asn1p_t *asn1p_new(void);
17 void asn1p_delete(asn1p_t *asn);
19 struct genhash_s; /* Forward declaration */
22 * Flags specific to a module.
24 typedef enum asn1p_module_flags {
26 MSF_unk_INSTRUCTIONS = 0x001,
27 MSF_TAG_INSTRUCTIONS = 0x002,
28 MSF_XER_INSTRUCTIONS = 0x004,
29 MSF_EXPLICIT_TAGS = 0x010,
30 MSF_IMPLICIT_TAGS = 0x020,
31 MSF_AUTOMATIC_TAGS = 0x040,
32 MSF_EXTENSIBILITY_IMPLIED = 0x100,
33 } asn1p_module_flags_e;
34 #define MSF_MASK_INSTRUCTIONS 0x0f
35 #define MSF_MASK_TAGS 0xf0
39 * MySyntax DEFINITIONS AUTOMATIC TAGS ::=
45 typedef struct asn1p_module_s {
48 * Human-readable module reference.
50 char *ModuleName; /* Must be the first field */
53 * Name of the source file.
55 char *source_file_name;
58 * Unique module identifier, OID.
60 asn1p_oid_t *module_oid; /* Optional OID of the module */
65 asn1p_module_flags_e module_flags; /* AUTOMATIC TAGS? */
68 * List of everything that this module EXPORTS.
70 TQ_HEAD(struct asn1p_xports_s) exports;
73 * List of everything that this module IMPORTS.
75 TQ_HEAD(struct asn1p_xports_s) imports;
78 * List of everything that this module defines itself.
80 TQ_HEAD(struct asn1p_expr_s) members; /* Do not access directly */
81 struct genhash_s *members_hash;
84 * Next module in the list.
86 TQ_ENTRY(struct asn1p_module_s)
93 * Internally useful properties.
96 MT_STANDARD_MODULE = 0x01, /* Module came from standard-modules */
101 * Constructor and destructor.
103 asn1p_module_t *asn1p_module_new(void);
104 void asn1p_module_free(asn1p_module_t *mod);
106 void asn1p_module_move_members(asn1p_module_t *to, asn1p_module_t *from);
107 void asn1p_module_member_add(asn1p_module_t *mod, struct asn1p_expr_s *expr);
110 #endif /* ASN1_PARSER_MODULE_H */