2 * Generic reference to the yet unknown type defined elsewhere.
4 #ifndef ASN1_REFERENCE_H
5 #define ASN1_REFERENCE_H
9 typedef struct asn1p_ref_s {
12 * A set of reference name components.
13 * A reference name consists of several components separated by dots:
14 * "OBJECT-CLASS.&Algorithm.&id"
16 struct asn1p_ref_component_s {
17 enum asn1p_ref_lex_type_e {
18 RLT_UNKNOWN, /* Invalid? */
20 * Object class reference "OCLASS1",
21 * type reference "Type1",
22 * value reference "id",
23 * type field reference "&Type1",
24 * value field reference "&id",
35 } lex_type; /* Inferred lexical type of the identifier */
36 char *name; /* An identifier */
39 size_t comp_count; /* Number of the components in the reference name. */
40 size_t comp_size; /* Number of allocated structures */
42 struct asn1p_module_s *module; /* Defined in module */
43 int _lineno; /* Number of line in the file */
47 * Constructor and destructor.
49 asn1p_ref_t *asn1p_ref_new(int _lineno, struct asn1p_module_s *mod);
50 void asn1p_ref_free(asn1p_ref_t *);
52 asn1p_ref_t *asn1p_ref_clone(asn1p_ref_t *ref);
54 void asn1p_ref_set_source(asn1p_ref_t *, struct asn1p_module_s *module,
59 * Lexicographically compare references.
61 int asn1p_ref_compare(const asn1p_ref_t *, const asn1p_ref_t *);
64 * Return a pointer to a statically allocated buffer representing the
67 const char *asn1p_ref_string(const asn1p_ref_t *);
70 * Add a new reference component to the existing reference structure.
74 * -1/EINVAL: Invalid arguments
75 * -1/ENOMEM: Memory allocation failed
77 int asn1p_ref_add_component(asn1p_ref_t *,
78 const char *name, enum asn1p_ref_lex_type_e);
80 #endif /* ASN1_REFERENCE_H */