blob: 81439372453422f234cac870387a1d307142734a [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*
2 * Miscellaneous functions necessary for several other modules.
3 */
Lev Walkinc6cac8e2016-03-14 02:57:07 -07004#ifndef ASN1FIX_RETRIEVE_H
5#define ASN1FIX_RETRIEVE_H
Lev Walkinf15320b2004-06-03 03:38:44 +00006
7/*
8 * Simple search for the label in the descendants of the given node.
9 * ERRORS:
10 * NULL/ESRCH
11 */
12asn1p_expr_t *asn1f_lookup_child(asn1p_expr_t *tc, const char *name);
13
14/*
15 * Return a module which contain a specified name, as stated in appropriate
16 * IMPORTS section of the current module (arg->mod).
17 *
18 * RETURN VALUES:
19 * NULL/ESRCH: The name was not found in IMPORTS section.
20 * NULL/EPERM: The name was not found in EXPORTS section of the source module.
21 * Also, NULL with errno values defined by asn1f_lookup_module().
22 */
Lev Walkin225d8872004-09-15 11:48:47 +000023asn1p_module_t *asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name);
Lev Walkinf15320b2004-06-03 03:38:44 +000024
25/*
26 * Return a module by its name or optional OID.
27 *
28 * RETURN VALUES:
29 * NULL/ENOENT: No module was found by the specified name and oid
30 * NULL/ETOOMANYREFS: Several modules are matching the specified name and oid
31 */
32asn1p_module_t *asn1f_lookup_module(arg_t *arg,
33 const char *module_name,
Lev Walkinea6635b2017-08-06 23:23:04 -070034 const asn1p_oid_t *module_oid);
Lev Walkinf15320b2004-06-03 03:38:44 +000035
36/*
37 * Return the reference to a destination of the given reference,
38 * symbol lookup. Not a recursive function.
Lev Walkinf15320b2004-06-03 03:38:44 +000039 */
Lev Walkinc0e03b92017-08-22 01:48:23 -070040asn1p_expr_t *asn1f_lookup_symbol(arg_t *arg, asn1p_expr_t *rhs_pspecs,
41 const asn1p_ref_t *ref);
Lev Walkinf15320b2004-06-03 03:38:44 +000042
43/*
44 * Recursively find the original type for the given expression.
45 * i.e.:
46 * If the original specification defines
47 * v Type1 ::= 5
48 * Type1 ::= Type2 (1..5)
49 * Type3 ::= Type4 (2..7)
50 * Type4 ::= INTEGER (1..10)
51 * Then this function, given the the first expression as an argument,
52 * would return an expression for Type4.
53 * WARNING: No attempts are made to honor constraints at this moment.
54 */
Lev Walkin6fec44d2004-08-22 03:10:23 +000055asn1p_expr_t *asn1f_find_terminal_type(arg_t *arg, asn1p_expr_t *tc);
Lev Walkinf15320b2004-06-03 03:38:44 +000056
57/*
58 * Recursively find the original value for the given expression.
59 * i.e.:
60 * If the original specification defines
61 * v Type1 ::= value
62 * value Type2 ::= value2
63 * value2 Type3 ::= 3
64 * Then this function will return the expression for value2 if given
65 * the v as an argment.
66 */
Lev Walkin6fec44d2004-08-22 03:10:23 +000067asn1p_expr_t *asn1f_find_terminal_value(arg_t *arg, asn1p_expr_t *tc);
Lev Walkinf15320b2004-06-03 03:38:44 +000068
Bi-Ruei, Chiu1fa31c92016-05-16 13:50:09 +080069/*
70 * Recursively find the original type with constraint for the given
71 * expression.
72 */
73asn1p_expr_t *asn1f_find_ancestor_type_with_PER_constraint(arg_t *arg, asn1p_expr_t *tc);
74
75
Lev Walkinc6cac8e2016-03-14 02:57:07 -070076#endif /* ASN1FIX_RETRIEVE_H */