blob: 0f1cfe668ff9e037590a90c3e63f4132c9ccf5f9 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * Generic reference to the yet unknown type defined elsewhere.
3 */
4#ifndef ASN1_PARSER_REFERENCE_H
5#define ASN1_PARSER_REFERENCE_H
6
7typedef struct asn1p_ref_s {
8
9 /*
10 * A set of reference name components.
11 * A reference name consists of several components separated by dots:
12 * "OBJECT-CLASS.&Algorithm.&id"
13 */
14 struct asn1p_ref_component_s {
15 enum asn1p_ref_lex_type_e {
16 RLT_UNKNOWN, /* Invalid? */
17 /*
18 * Object class reference "OCLASS1",
19 * type reference "Type1",
20 * value reference "id",
21 * type field reference "&Type1",
22 * value field reference "&id",
23 * "OBJECT-CLASS"
24 */
25 RLT_CAPITALS,
26 RLT_Uppercase,
27 RLT_lowercase,
28 RLT_AmpUppercase,
29 RLT_Amplowercase,
30 RLT_Atlowercase,
31 RLT_AtDotlowercase,
32 RLT_MAX
33 } lex_type; /* Inferred lexical type of the identifier */
34 char *name; /* An identifier */
35 } *components;
36
37 int comp_count; /* Number of the components in the reference name. */
38 int comp_size; /* Number of allocated structures */
39
Bi-Ruei, Chiu80fd3062017-05-07 21:00:51 +080040 struct asn1p_module_s *module; /* Defined in module */
Lev Walkinf15320b2004-06-03 03:38:44 +000041 int _lineno; /* Number of line in the file */
42} asn1p_ref_t;
43
44/*
45 * Constructor and destructor.
46 */
Bi-Ruei, Chiu80fd3062017-05-07 21:00:51 +080047asn1p_ref_t *asn1p_ref_new(int _lineno, asn1p_module_t *mod);
Lev Walkinf15320b2004-06-03 03:38:44 +000048void asn1p_ref_free(asn1p_ref_t *);
49
50asn1p_ref_t *asn1p_ref_clone(asn1p_ref_t *ref);
51
52/*
53 * Add a new reference component to the existing reference structure.
54 *
55 * RETURN VALUES:
56 * 0: All clear.
57 * -1/EINVAL: Invalid arguments
58 * -1/ENOMEM: Memory allocation failed
59 */
60int asn1p_ref_add_component(asn1p_ref_t *,
61 char *name, enum asn1p_ref_lex_type_e);
62
63#endif /* ASN1_PARSER_REFERENCE_H */