aboutsummaryrefslogtreecommitdiff
path: root/src/or/dircollate.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-11-12 14:29:05 -0500
committerNick Mathewson <nickm@torproject.org>2015-05-28 10:42:29 -0400
commit6c564e6c081514bab56bacec89b1f6f9457a7022 (patch)
treedd61357bebc5b7a3290f6a214e80da25be95f8e2 /src/or/dircollate.h
parent525383c46d1430abf680133e486fc532050d7123 (diff)
downloadtor-6c564e6c081514bab56bacec89b1f6f9457a7022.tar.gz
tor-6c564e6c081514bab56bacec89b1f6f9457a7022.zip
Refactor code that matches up routers with the same identity in votes
This makes 'routerstatus collation' into a first-class concept, so we can change how that works for prop220.
Diffstat (limited to 'src/or/dircollate.h')
-rw-r--r--src/or/dircollate.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/or/dircollate.h b/src/or/dircollate.h
new file mode 100644
index 0000000000..073b6117e7
--- /dev/null
+++ b/src/or/dircollate.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2014, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file dirvote.h
+ * \brief Header file for dirvote.c.
+ **/
+
+#ifndef TOR_DIRCOLLATE_H
+#define TOR_DIRCOLLATE_H
+
+#include "testsupport.h"
+#include "or.h"
+
+typedef struct dircollator_s dircollator_t;
+
+dircollator_t *dircollator_new(int n_votes, int n_authorities);
+void dircollator_free(dircollator_t *obj);
+void dircollator_add_vote(dircollator_t *dc, networkstatus_t *v);
+
+void dircollator_collate(dircollator_t *dc);
+
+int dircollator_n_routers(dircollator_t *dc);
+vote_routerstatus_t **dircollator_get_votes_for_router(dircollator_t *dc,
+ int idx);
+
+#ifdef DIRCOLLATE_PRIVATE
+struct dircollator_s {
+ /**DOCDOC */
+ int is_collated;
+ int n_votes;
+ int n_authorities;
+
+ int next_vote_num;
+ digestmap_t *by_rsa_sha1;
+
+ smartlist_t *all_rsa_sha1_lst;
+};
+#endif
+
+#endif