aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-09-11 17:51:36 -0400
committerNick Mathewson <nickm@torproject.org>2012-09-11 17:51:36 -0400
commit75c9ccd4f851bac6d32cb08ded557ac207bc8002 (patch)
tree0edd289ca5453ebfad30d52bc55665bad1e76fe0 /src/or/routerlist.h
parentb8f93c5dd7a069c9e5ac3469d067a31c3992fa25 (diff)
parent9982122f3448293e80adf83cb28c7ab66bc04da9 (diff)
downloadtor-75c9ccd4f851bac6d32cb08ded557ac207bc8002.tar.gz
tor-75c9ccd4f851bac6d32cb08ded557ac207bc8002.zip
Merge remote-tracking branch 'public/bug6538'
Conflicts: configure.ac
Diffstat (limited to 'src/or/routerlist.h')
-rw-r--r--src/or/routerlist.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index e84b0405d4..ab58b9ee5a 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -216,5 +216,19 @@ int hex_digest_nickname_decode(const char *hexdigest,
char *nickname_qualifier_out,
char *nickname_out);
+#ifdef ROUTERLIST_PRIVATE
+/** Helper type for choosing routers by bandwidth: contains a union of
+ * double and uint64_t. Before we call scale_array_elements_to_u64, it holds
+ * a double; after, it holds a uint64_t. */
+typedef union u64_dbl_t {
+ uint64_t u64;
+ double dbl;
+} u64_dbl_t;
+
+int choose_array_element_by_weight(const u64_dbl_t *entries, int n_entries);
+void scale_array_elements_to_u64(u64_dbl_t *entries, int n_entries,
+ uint64_t *total_out);
+#endif
+
#endif