aboutsummaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-07-18 18:36:32 +0000
committerNick Mathewson <nickm@torproject.org>2008-07-18 18:36:32 +0000
commitc8160bce1ffa9ed050de7d3448ba16b013b7a0e0 (patch)
tree3e3175249c41cb92b7dea03eceb0a69b85913e9b /src/or/or.h
parentf2550a52d46a6269863ac2e17774798c3a8533fd (diff)
downloadtor-c8160bce1ffa9ed050de7d3448ba16b013b7a0e0.tar.gz
tor-c8160bce1ffa9ed050de7d3448ba16b013b7a0e0.zip
r17188@tombo: nickm | 2008-07-18 14:35:18 -0400
Add new ExcludeExitNodes option. Also add a new routerset type to handle Exclude[Exit]Nodes. It is optimized for O(1) membership tests, so as to make choosing a random router run in O(N_routers) time instead of in O(N_routers*N_Excluded_Routers). svn:r16061
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/or/or.h b/src/or/or.h
index e53923d97b..b81db6f7af 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2028,8 +2028,12 @@ typedef struct {
* stop building circuits? */
int StrictEntryNodes; /**< Boolean: When none of our EntryNodes are up, do we
* stop building circuits? */
- char *ExcludeNodes; /**< Comma-separated list of nicknames of ORs not to
- * use in circuits. */
+ struct routerset_t *ExcludeNodes; /**< Comma-separated list of nicknames of
+ * ORs not to use in circuits. */
+ struct routerset_t *ExcludeExitNodes; /**<DODOC */
+
+ /** Union of ExcludeNodes and ExcludeExitNodes */
+ struct routerset_t *_ExcludeExitNodesUnion;
char *RendNodes; /**< Comma-separated list of nicknames used as introduction
* points. */
@@ -4032,9 +4036,11 @@ typedef enum {
routerinfo_t *routerlist_sl_choose_by_bandwidth(smartlist_t *sl,
bandwidth_weight_rule_t rule);
routerstatus_t *routerstatus_sl_choose_by_bandwidth(smartlist_t *sl);
+/* XXXX021. This is a truly hideous interface. */
routerinfo_t *router_choose_random_node(const char *preferred,
const char *excluded,
smartlist_t *excludedsmartlist,
+ struct routerset_t *excludedset,
int need_uptime, int need_capacity,
int need_guard,
int allow_invalid, int strict,
@@ -4108,6 +4114,22 @@ void routerlist_assert_ok(routerlist_t *rl);
const char *esc_router_info(routerinfo_t *router);
void routers_sort_by_identity(smartlist_t *routers);
+typedef struct routerset_t routerset_t;
+
+routerset_t *routerset_new(void);
+int routerset_parse(routerset_t *target, const char *s,
+ const char *description);
+void routerset_union(routerset_t *target, const routerset_t *source);
+int routerset_contains_router(const routerset_t *set, routerinfo_t *ri);
+int routerset_contains_routerstatus(const routerset_t *set,
+ routerstatus_t *rs);
+void routerset_get_all_routers(smartlist_t *out, const routerset_t *routerset,
+ int running_only);
+void routerset_subtract_routers(smartlist_t *out,
+ const routerset_t *routerset);
+char *routerset_to_string(const routerset_t *routerset);
+void routerset_free(routerset_t *routerset);
+
int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
const char *id);
int hid_serv_acting_as_directory(void);