blob: b4c72f8b244ac1478abeb200aa20220192f2ba45 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * This is a parser of the ASN.1 grammar.
3 */
4#ifndef ASN1PARSER_H
5#define ASN1PARSER_H
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif /* HAVE_CONFIG_H */
10
11#ifdef HAVE_SYS_TYPES_H
12#include <sys/types.h>
13#endif /* HAVE_SYS_TYPES_H */
14#ifdef HAVE_INTTYPES_H
15#include <inttypes.h> /* POSIX 1003.1-2001, C99 */
16#else /* HAVE_INTTYPES_H */
17#ifdef HAVE_STDINT_H
18#include <stdint.h> /* SUSv2+ */
19#endif /* HAVE_STDINT_H */
20#endif /* HAVE_INTTYPES_H */
21
22/*
23 * Basic integer type used in numerous places.
24 * ASN.1 does not define any limits on this number, so it must be sufficiently
25 * large to accomodate typical inputs. It does not have to be a dynamically
26 * allocated type with potentially unlimited width: consider the width of
27 * an integer defined here as one of the "compiler limitations".
28 * NOTE: this is NOT a type for ASN.1 "INTEGER" type representation, this
29 * type is used by the compiler itself to handle large integer values
30 * specified inside ASN.1 grammar.
31 */
32typedef intmax_t asn1_integer_t;
33
34#include <asn1p_list.h>
35#include <asn1p_oid.h> /* Object identifiers (OIDs) */
36#include <asn1p_ref.h> /* References to custom types */
37#include <asn1p_value.h> /* Value definition */
38#include <asn1p_param.h> /* Parametrization */
39#include <asn1p_constr.h> /* Type Constraints */
40#include <asn1p_xports.h> /* IMports/EXports */
41#include <asn1p_module.h> /* ASN.1 definition module */
42#include <asn1p_class.h> /* CLASS-related stuff */
43#include <asn1p_expr.h> /* A single ASN.1 expression */
44
45/*
46 * Parser flags.
47 */
48enum asn1p_flags {
49 A1P_NOFLAGS,
50 /*
51 * Enable verbose debugging output from lexer.
52 */
53 A1P_LEXER_DEBUG = 0x0001,
54 /*
55 * Embedded types restricted to ASN.1:1988
56 */
57 A1P_TYPES_RESTRICT_TO_1988 = 0x0010,
58 /*
59 * Embedded constructs (concepts) restricted to ASN.1:1990
60 */
61 A1P_CONSTRUCTS_RESTRICT_TO_1990 = 0x0020,
62};
63
64/*
65 * Perform low-level parsing of ASN.1 module[s]
66 * and return a list of module trees.
67 */
68asn1p_t *asn1p_parse_file(const char *filename,
69 enum asn1p_flags);
70asn1p_t *asn1p_parse_buffer(const char *buffer, int size /* = -1 */,
71 enum asn1p_flags);
72
73#endif /* ASN1PARSER_H */