Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Miscellaneous functions necessary for several other modules. |
| 3 | */ |
| 4 | #ifndef _ASN1FIX_RETRIEVE_H_ |
| 5 | #define _ASN1FIX_RETRIEVE_H_ |
| 6 | |
| 7 | /* |
| 8 | * Simple search for the label in the descendants of the given node. |
| 9 | * ERRORS: |
| 10 | * NULL/ESRCH |
| 11 | */ |
| 12 | asn1p_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 Walkin | 225d887 | 2004-09-15 11:48:47 +0000 | [diff] [blame] | 23 | asn1p_module_t *asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 24 | |
| 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 | */ |
| 32 | asn1p_module_t *asn1f_lookup_module(arg_t *arg, |
| 33 | const char *module_name, |
| 34 | asn1p_oid_t *module_oid); |
| 35 | |
| 36 | /* |
| 37 | * Return the reference to a destination of the given reference, |
| 38 | * symbol lookup. Not a recursive function. |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 39 | */ |
Lev Walkin | 6fec44d | 2004-08-22 03:10:23 +0000 | [diff] [blame] | 40 | asn1p_expr_t *asn1f_lookup_symbol(arg_t *arg, |
| 41 | asn1p_module_t *mod, |
| 42 | asn1p_ref_t *ref); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 43 | |
| 44 | /* |
| 45 | * Recursively find the original type for the given expression. |
| 46 | * i.e.: |
| 47 | * If the original specification defines |
| 48 | * v Type1 ::= 5 |
| 49 | * Type1 ::= Type2 (1..5) |
| 50 | * Type3 ::= Type4 (2..7) |
| 51 | * Type4 ::= INTEGER (1..10) |
| 52 | * Then this function, given the the first expression as an argument, |
| 53 | * would return an expression for Type4. |
| 54 | * WARNING: No attempts are made to honor constraints at this moment. |
| 55 | */ |
Lev Walkin | 6fec44d | 2004-08-22 03:10:23 +0000 | [diff] [blame] | 56 | asn1p_expr_t *asn1f_find_terminal_type(arg_t *arg, asn1p_expr_t *tc); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * Recursively find the original value for the given expression. |
| 60 | * i.e.: |
| 61 | * If the original specification defines |
| 62 | * v Type1 ::= value |
| 63 | * value Type2 ::= value2 |
| 64 | * value2 Type3 ::= 3 |
| 65 | * Then this function will return the expression for value2 if given |
| 66 | * the v as an argment. |
| 67 | */ |
Lev Walkin | 6fec44d | 2004-08-22 03:10:23 +0000 | [diff] [blame] | 68 | asn1p_expr_t *asn1f_find_terminal_value(arg_t *arg, asn1p_expr_t *tc); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 69 | |
| 70 | #endif /* _ASN1FIX_RETRIEVE_H_ */ |