vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 10 | typedef enum asn1p_module_flags { |
| 11 | MSF_NOFLAGS, |
vlm | 9283dbe | 2004-08-18 04:59:12 +0000 | [diff] [blame] | 12 | 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, |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 19 | } asn1p_module_flags_e; |
vlm | 9283dbe | 2004-08-18 04:59:12 +0000 | [diff] [blame] | 20 | #define MSF_MASK_INSTRUCTIONS 0x0f |
| 21 | #define MSF_MASK_TAGS 0xf0 |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * === EXAMPLE === |
| 25 | * MySyntax DEFINITIONS AUTOMATIC TAGS ::= |
| 26 | * BEGIN |
| 27 | * ... |
| 28 | * END |
| 29 | * === EOF === |
| 30 | */ |
| 31 | typedef struct asn1p_module_s { |
| 32 | |
| 33 | /* |
| 34 | * Name of the source file. |
| 35 | */ |
| 36 | char *source_file_name; |
| 37 | |
| 38 | /* |
| 39 | * Human-readable module identifier. |
| 40 | */ |
| 41 | char *Identifier; /* Module name */ |
| 42 | |
| 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 | */ |
| 79 | asn1p_module_t *asn1p_module_new(void); |
| 80 | void asn1p_module_free(asn1p_module_t *mod); |
| 81 | |
| 82 | /* |
| 83 | * No more than a container for several modules. |
| 84 | */ |
| 85 | typedef struct asn1p_s { |
| 86 | TQ_HEAD(struct asn1p_module_s) modules; |
| 87 | } asn1p_t; |
| 88 | |
| 89 | asn1p_t *asn1p_new(void); |
| 90 | void asn1p_free(asn1p_t *asn); |
| 91 | |
| 92 | |
| 93 | #endif /* ASN1_PARSER_MODULE_H */ |