Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | #include "asn1fix_internal.h" |
| 2 | #include "asn1fix_export.h" |
| 3 | |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 4 | extern arg_t a1f_replace_me_with_proper_interface_arg; |
| 5 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 6 | static asn1p_t *asn1f_ssn_asn_; |
| 7 | |
| 8 | static void |
| 9 | _add_standard_namespaces(asn1_namespace_t *ns) { |
| 10 | asn1p_oid_t *uioc_oid; |
| 11 | asn1p_oid_arc_t arcs[] = {{1, "iso"}, {3, "org"}, |
| 12 | {6, "dod"}, {1, "internet"}, |
| 13 | {4, "private"}, {1, "enterprise"}, |
| 14 | {9363, "spelio"}, {1, "software"}, |
| 15 | {5, "asn1c"}, {3, "standard-modules"}, |
| 16 | {0, "auto-imported"}, {1, 0}}; |
| 17 | |
| 18 | uioc_oid = asn1p_oid_construct(arcs, sizeof(arcs) / sizeof(arcs[0])); |
| 19 | |
| 20 | asn1p_module_t *module = asn1f_lookup_module_ex( |
| 21 | asn1f_ssn_asn_, "ASN1C-UsefulInformationObjectClasses", uioc_oid); |
| 22 | asn1p_oid_free(uioc_oid); |
| 23 | |
| 24 | if(module) { |
| 25 | asn1_namespace_add_module(ns, module, 0); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | void |
| 30 | asn1f_use_standard_namespaces(asn1p_t *asn) { |
| 31 | asn1f_ssn_asn_ = asn; |
| 32 | asn1_namespace_add_standard_namespaces_callback(_add_standard_namespaces); |
| 33 | } |
| 34 | |
| 35 | asn1p_module_t * |
| 36 | asn1f_lookup_module_ex(asn1p_t *asn, const char *module_name, |
| 37 | const asn1p_oid_t *oid) { |
| 38 | arg_t arg; |
| 39 | |
| 40 | memset(&arg, 0, sizeof(arg)); |
| 41 | |
| 42 | arg.asn = asn; |
| 43 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 44 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
| 45 | return asn1f_lookup_module(&arg, module_name, oid); |
| 46 | } |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 47 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 48 | asn1p_expr_t * |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 49 | asn1f_lookup_symbol_ex(asn1p_t *asn, asn1_namespace_t *ns, asn1p_expr_t *expr, |
| 50 | const asn1p_ref_t *ref) { |
| 51 | arg_t arg; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 52 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 53 | memset(&arg, 0, sizeof(arg)); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 54 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 55 | arg.asn = asn; |
| 56 | arg.ns = ns; |
| 57 | arg.mod = expr->module; |
| 58 | arg.expr = expr; |
| 59 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 60 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 61 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 62 | return asn1f_lookup_symbol(&arg, expr->rhs_pspecs, ref); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | asn1p_expr_t * |
| 66 | asn1f_class_access_ex(asn1p_t *asn, |
| 67 | asn1p_module_t *mod, |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 68 | asn1_namespace_t *ns, |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 69 | asn1p_expr_t *expr, |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 70 | asn1p_expr_t *rhs_pspecs, |
Lev Walkin | ea6635b | 2017-08-06 23:23:04 -0700 | [diff] [blame] | 71 | const asn1p_ref_t *ref) { |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 72 | arg_t arg; |
| 73 | |
| 74 | memset(&arg, 0, sizeof(arg)); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 75 | |
| 76 | arg.asn = asn; |
| 77 | arg.mod = mod; |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 78 | arg.ns = ns; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 79 | arg.expr = expr; |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 80 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 81 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 82 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 83 | return asn1f_class_access(&arg, rhs_pspecs, ref); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | asn1p_expr_t * |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 87 | asn1f_find_terminal_type_ex(asn1p_t *asn, asn1_namespace_t *ns, |
| 88 | asn1p_expr_t *expr) { |
| 89 | arg_t arg; |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 90 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 91 | memset(&arg, 0, sizeof(arg)); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 92 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 93 | arg.asn = asn; |
| 94 | arg.ns = ns; |
| 95 | arg.mod = expr->module; |
| 96 | arg.expr = expr; |
| 97 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 98 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 99 | |
Lev Walkin | c0e03b9 | 2017-08-22 01:48:23 -0700 | [diff] [blame] | 100 | return asn1f_find_terminal_type(&arg, expr); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 101 | } |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 102 | |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 103 | asn1p_expr_t * |
| 104 | asn1f_find_ancestor_type_with_PER_constraint_ex(asn1p_t *asn, asn1p_expr_t *expr) { |
| 105 | arg_t arg; |
| 106 | |
| 107 | memset(&arg, 0, sizeof(arg)); |
| 108 | |
| 109 | arg.asn = asn; |
| 110 | arg.mod = expr->module; |
| 111 | arg.expr = expr; |
| 112 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 113 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
| 114 | |
| 115 | return asn1f_find_ancestor_type_with_PER_constraint(&arg, expr); |
| 116 | } |
| 117 | |
Lev Walkin | b45e067 | 2004-08-18 05:42:05 +0000 | [diff] [blame] | 118 | int |
| 119 | asn1f_fix_dereference_values_ex(asn1p_t *asn, asn1p_module_t *mod, |
| 120 | asn1p_expr_t *expr) { |
| 121 | arg_t arg; |
| 122 | |
| 123 | memset(&arg, 0, sizeof(arg)); |
| 124 | |
| 125 | arg.asn = asn; |
| 126 | arg.mod = mod; |
| 127 | arg.expr = expr; |
| 128 | arg.eh = a1f_replace_me_with_proper_interface_arg.eh; |
| 129 | arg.debug = a1f_replace_me_with_proper_interface_arg.debug; |
| 130 | |
| 131 | return asn1f_fix_dereference_values(&arg); |
| 132 | } |
| 133 | |