summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/directory.c1
-rw-r--r--src/or/dirserv.c1
-rw-r--r--src/or/dirvote.c1
-rw-r--r--src/or/dirvote.h93
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/networkstatus.c1
-rw-r--r--src/or/or.h75
-rw-r--r--src/or/routerlist.c1
-rw-r--r--src/or/routerparse.c1
-rw-r--r--src/test/test_dir.c1
11 files changed, 102 insertions, 75 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 884a059b61..70cadaa0a1 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -20,6 +20,7 @@
#include "control.h"
#include "cpuworker.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "geoip.h"
#include "rendclient.h"
#include "rendservice.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 10d6ae7ce7..69700e8672 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -12,6 +12,7 @@
#include "control.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "geoip.h"
#include "rendclient.h"
#include "rendcommon.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 0a39b5d2cd..b9fc489d55 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -12,6 +12,7 @@
#include "control.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index a013c504e9..b0c467984b 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -8,6 +8,7 @@
#include "config.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
new file mode 100644
index 0000000000..e384dc53b3
--- /dev/null
+++ b/src/or/dirvote.h
@@ -0,0 +1,93 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file dirvote.h
+ * \brief Header file for dirvote.c.
+ **/
+
+#ifndef _TOR_DIRVOTE_H
+#define _TOR_DIRVOTE_H
+
+/** Lowest allowable value for VoteSeconds. */
+#define MIN_VOTE_SECONDS 20
+/** Lowest allowable value for DistSeconds. */
+#define MIN_DIST_SECONDS 20
+/** Smallest allowable voting interval. */
+#define MIN_VOTE_INTERVAL 300
+
+/** Precision multiplier for the Bw weights */
+#define BW_WEIGHT_SCALE 10000
+
+void dirvote_free_all(void);
+
+/* vote manipulation */
+char *networkstatus_compute_consensus(smartlist_t *votes,
+ int total_authorities,
+ crypto_pk_env_t *identity_key,
+ crypto_pk_env_t *signing_key,
+ const char *legacy_identity_key_digest,
+ crypto_pk_env_t *legacy_signing_key,
+ consensus_flavor_t flavor);
+int networkstatus_add_detached_signatures(networkstatus_t *target,
+ ns_detached_signatures_t *sigs,
+ const char **msg_out);
+char *networkstatus_get_detached_signatures(smartlist_t *consensuses);
+void ns_detached_signatures_free(ns_detached_signatures_t *s);
+
+/* cert manipulation */
+authority_cert_t *authority_cert_dup(authority_cert_t *cert);
+
+/* vote scheduling */
+void dirvote_get_preferred_voting_intervals(vote_timing_t *timing_out);
+time_t dirvote_get_start_of_next_interval(time_t now, int interval);
+void dirvote_recalculate_timing(or_options_t *options, time_t now);
+void dirvote_act(or_options_t *options, time_t now);
+
+/* invoked on timers and by outside triggers. */
+struct pending_vote_t * dirvote_add_vote(const char *vote_body,
+ const char **msg_out,
+ int *status_out);
+int dirvote_add_signatures(const char *detached_signatures_body,
+ const char *source,
+ const char **msg_out);
+
+/* Item access */
+const char *dirvote_get_pending_consensus(consensus_flavor_t flav);
+const char *dirvote_get_pending_detached_signatures(void);
+#define DGV_BY_ID 1
+#define DGV_INCLUDE_PENDING 2
+#define DGV_INCLUDE_PREVIOUS 4
+const cached_dir_t *dirvote_get_vote(const char *fp, int flags);
+void set_routerstatus_from_routerinfo(routerstatus_t *rs,
+ routerinfo_t *ri, time_t now,
+ int naming, int listbadexits,
+ int listbaddirs);
+void router_clear_status_flags(routerinfo_t *ri);
+networkstatus_t *
+dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
+ authority_cert_t *cert);
+
+microdesc_t *dirvote_create_microdescriptor(const routerinfo_t *ri);
+ssize_t dirvote_format_microdesc_vote_line(char *out, size_t out_len,
+ const microdesc_t *md);
+
+int vote_routerstatus_find_microdesc_hash(char *digest256_out,
+ const vote_routerstatus_t *vrs,
+ int method,
+ digest_algorithm_t alg);
+document_signature_t *voter_get_sig_by_algorithm(
+ const networkstatus_voter_info_t *voter,
+ digest_algorithm_t alg);
+
+#ifdef DIRVOTE_PRIVATE
+char *format_networkstatus_vote(crypto_pk_env_t *private_key,
+ networkstatus_t *v3_ns);
+char *dirvote_compute_params(smartlist_t *votes);
+#endif
+
+#endif
+
diff --git a/src/or/main.c b/src/or/main.c
index 89a8eac166..e77359c4df 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -25,6 +25,7 @@
#include "cpuworker.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "dnsserv.h"
#include "geoip.h"
#include "rendclient.h"
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 96c768704e..98af3a2843 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -17,6 +17,7 @@
#include "control.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/or.h b/src/or/or.h
index 47a0a90ae2..b56837200a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3189,35 +3189,6 @@ typedef struct measured_bw_line_t {
/********************************* dirvote.c ************************/
-/** Lowest allowable value for VoteSeconds. */
-#define MIN_VOTE_SECONDS 20
-/** Lowest allowable value for DistSeconds. */
-#define MIN_DIST_SECONDS 20
-/** Smallest allowable voting interval. */
-#define MIN_VOTE_INTERVAL 300
-
-/** Precision multiplier for the Bw weights */
-#define BW_WEIGHT_SCALE 10000
-
-void dirvote_free_all(void);
-
-/* vote manipulation */
-char *networkstatus_compute_consensus(smartlist_t *votes,
- int total_authorities,
- crypto_pk_env_t *identity_key,
- crypto_pk_env_t *signing_key,
- const char *legacy_identity_key_digest,
- crypto_pk_env_t *legacy_signing_key,
- consensus_flavor_t flavor);
-int networkstatus_add_detached_signatures(networkstatus_t *target,
- ns_detached_signatures_t *sigs,
- const char **msg_out);
-char *networkstatus_get_detached_signatures(smartlist_t *consensuses);
-void ns_detached_signatures_free(ns_detached_signatures_t *s);
-
-/* cert manipulation */
-authority_cert_t *authority_cert_dup(authority_cert_t *cert);
-
/** Describes the schedule by which votes should be generated. */
typedef struct vote_timing_t {
int vote_interval;
@@ -3225,52 +3196,6 @@ typedef struct vote_timing_t {
int vote_delay;
int dist_delay;
} vote_timing_t;
-/* vote scheduling */
-void dirvote_get_preferred_voting_intervals(vote_timing_t *timing_out);
-time_t dirvote_get_start_of_next_interval(time_t now, int interval);
-void dirvote_recalculate_timing(or_options_t *options, time_t now);
-void dirvote_act(or_options_t *options, time_t now);
-
-/* invoked on timers and by outside triggers. */
-struct pending_vote_t * dirvote_add_vote(const char *vote_body,
- const char **msg_out,
- int *status_out);
-int dirvote_add_signatures(const char *detached_signatures_body,
- const char *source,
- const char **msg_out);
-
-/* Item access */
-const char *dirvote_get_pending_consensus(consensus_flavor_t flav);
-const char *dirvote_get_pending_detached_signatures(void);
-#define DGV_BY_ID 1
-#define DGV_INCLUDE_PENDING 2
-#define DGV_INCLUDE_PREVIOUS 4
-const cached_dir_t *dirvote_get_vote(const char *fp, int flags);
-void set_routerstatus_from_routerinfo(routerstatus_t *rs,
- routerinfo_t *ri, time_t now,
- int naming, int listbadexits,
- int listbaddirs);
-void router_clear_status_flags(routerinfo_t *ri);
-networkstatus_t *
-dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
- authority_cert_t *cert);
-
-microdesc_t *dirvote_create_microdescriptor(const routerinfo_t *ri);
-ssize_t dirvote_format_microdesc_vote_line(char *out, size_t out_len,
- const microdesc_t *md);
-int vote_routerstatus_find_microdesc_hash(char *digest256_out,
- const vote_routerstatus_t *vrs,
- int method,
- digest_algorithm_t alg);
-document_signature_t *voter_get_sig_by_algorithm(
- const networkstatus_voter_info_t *voter,
- digest_algorithm_t alg);
-
-#ifdef DIRVOTE_PRIVATE
-char *format_networkstatus_vote(crypto_pk_env_t *private_key,
- networkstatus_t *v3_ns);
-char *dirvote_compute_params(smartlist_t *votes);
-#endif
/********************************* dns.c ***************************/
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f8c8bad047..85e2d14edc 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -18,6 +18,7 @@
#include "control.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "geoip.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 304509c312..6021ef2a90 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -12,6 +12,7 @@
#include "or.h"
#include "config.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "rendcommon.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 0379811ddb..206ee48073 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -10,6 +10,7 @@
#include "or.h"
#include "directory.h"
#include "dirserv.h"
+#include "dirvote.h"
#include "router.h"
#include "routerlist.h"
#include "test.h"