summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-29 01:47:28 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-29 01:47:28 +0000
commit870fd18b8fe880c6194415f6744b08a3989a0166 (patch)
treee277a75238db8b402462b1bbd0bd578e6247c6f1 /src/or/or.h
parent94507f1b6d563d301ef5ad284141105ebb3e9d2f (diff)
downloadtor-870fd18b8fe880c6194415f6744b08a3989a0166.tar.gz
tor-870fd18b8fe880c6194415f6744b08a3989a0166.zip
Refactor some exit-policy-related functions that showed up in oprofile.
Specifically, split compare_tor_addr_to_addr_policy() from a loop with a bunch of complicated ifs inside into some ifs, each with a simple loop. Rearrange router_find_exact_exit_enclave() to run a little faster. Bizarrely, router_policy_rejects_all() shows up on oprofile, so precalculate it per routerinfo. svn:r17802
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/or.h b/src/or/or.h
index 2d539e6b73..139cb133d6 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1418,6 +1418,8 @@ typedef struct {
* a hidden service directory. */
unsigned int is_hs_dir:1; /**< True iff this router is a hidden service
* directory according to the authorities. */
+ unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
+ * router rejects everything. */
/** Tor can use this router for general positions in circuits. */
#define ROUTER_PURPOSE_GENERAL 0
@@ -3852,14 +3854,14 @@ int policies_parse_from_options(or_options_t *options);
addr_policy_t *addr_policy_get_canonical_entry(addr_policy_t *ent);
int cmp_addr_policies(smartlist_t *a, smartlist_t *b);
addr_policy_result_t compare_tor_addr_to_addr_policy(const tor_addr_t *addr,
- uint16_t port, smartlist_t *policy);
+ uint16_t port, const smartlist_t *policy);
addr_policy_result_t compare_addr_to_addr_policy(uint32_t addr,
- uint16_t port, smartlist_t *policy);
+ uint16_t port, const smartlist_t *policy);
int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
int rejectprivate, const char *local_address);
void policies_set_router_exitpolicy_to_reject_all(routerinfo_t *exitrouter);
int exit_policy_is_general_exit(smartlist_t *policy);
-int policy_is_reject_star(smartlist_t *policy);
+int policy_is_reject_star(const smartlist_t *policy);
int getinfo_helper_policies(control_connection_t *conn,
const char *question, char **answer);
int policy_write_item(char *buf, size_t buflen, addr_policy_t *item,