summaryrefslogtreecommitdiff
path: root/src/or/or.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-07-24 09:22:34 +0000
committerNick Mathewson <nickm@torproject.org>2008-07-24 09:22:34 +0000
commited781e69716248111ef1a2ddc1b9add671bd8d16 (patch)
treeb9ef93b7f1394413f78803d8626151e7cb3745bb /src/or/or.h
parentdff1ef7d06d1f7e540be2b10e66538ab7eac3f76 (diff)
downloadtor-ed781e69716248111ef1a2ddc1b9add671bd8d16.tar.gz
tor-ed781e69716248111ef1a2ddc1b9add671bd8d16.zip
r17338@aud-055: nickm | 2008-07-24 11:21:06 +0200
Refactor the router_choose_random_node interface: any function with 10 parameters, most of which are boolean and one of which is unused, should get refactored like this. svn:r16167
Diffstat (limited to 'src/or/or.h')
-rw-r--r--src/or/or.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/or/or.h b/src/or/or.h
index 7f606525ae..6975b16fd6 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4056,15 +4056,24 @@ 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. */
+
+/** Flags to be control router_choose_random_node */
+typedef enum {
+ CRN_NEED_UPTIME = 1<<0,
+ CRN_NEED_CAPACITY = 1<<1,
+ CRN_NEED_GUARD = 1<<2,
+ CRN_ALLOW_INVALID = 1<<3,
+ /* XXXX021 not used, apparently. */
+ CRN_STRICT_PREFERRED = 1<<4,
+ /* XXXX021 not used, apparently. */
+ CRN_WEIGHT_AS_EXIT = 1<<5
+} router_crn_flags_t;
+
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,
- int weight_for_exit);
+ router_crn_flags_t flags);
+
routerinfo_t *router_get_by_nickname(const char *nickname,
int warn_if_unnamed);
int router_digest_version_as_new_as(const char *digest, const char *cutoff);