summaryrefslogtreecommitdiff
path: root/src/or/voting_schedule.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-05-01 11:10:58 -0400
committerDavid Goulet <dgoulet@torproject.org>2018-05-01 11:43:23 -0400
commit711ff6cdf79c32921f587d389b6ac25630a39d80 (patch)
treeb1f5b99c7a88fb4acca993b62463dcc700b81076 /src/or/voting_schedule.h
parent6452fe78c2c461f5534d1f03a799fc5f11073b5f (diff)
downloadtor-711ff6cdf79c32921f587d389b6ac25630a39d80.tar.gz
tor-711ff6cdf79c32921f587d389b6ac25630a39d80.zip
Rename dirvote_common.{c|h} to voting_schedule.{c|h}
No code behavior change. Part of #25988 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/voting_schedule.h')
-rw-r--r--src/or/voting_schedule.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/or/voting_schedule.h b/src/or/voting_schedule.h
new file mode 100644
index 0000000000..b7c7f7ea93
--- /dev/null
+++ b/src/or/voting_schedule.h
@@ -0,0 +1,61 @@
+/* Copyright (c) 2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file voting_schedule.h
+ * \brief Header file for voting_schedule.c.
+ **/
+
+#ifndef TOR_VOTING_SCHEDULE_H
+#define TOR_VOTING_SCHEDULE_H
+
+#include "or.h"
+
+/* Dirauth module. */
+#include "dirauth/dirvote.h"
+
+/** Scheduling information for a voting interval. */
+typedef struct {
+ /** When do we generate and distribute our vote for this interval? */
+ time_t voting_starts;
+ /** When do we send an HTTP request for any votes that we haven't
+ * been posted yet?*/
+ time_t fetch_missing_votes;
+ /** When do we give up on getting more votes and generate a consensus? */
+ time_t voting_ends;
+ /** When do we send an HTTP request for any signatures we're expecting to
+ * see on the consensus? */
+ time_t fetch_missing_signatures;
+ /** When do we publish the consensus? */
+ time_t interval_starts;
+
+ /* True iff we have generated and distributed our vote. */
+ int have_voted;
+ /* True iff we've requested missing votes. */
+ int have_fetched_missing_votes;
+ /* True iff we have built a consensus and sent the signatures around. */
+ int have_built_consensus;
+ /* True iff we've fetched missing signatures. */
+ int have_fetched_missing_signatures;
+ /* True iff we have published our consensus. */
+ int have_published_consensus;
+
+ /* True iff this voting schedule was set on demand meaning not through the
+ * normal vote operation of a dirauth or when a consensus is set. This only
+ * applies to a directory authority that needs to recalculate the voting
+ * timings only for the first vote even though this object was initilized
+ * prior to voting. */
+ int created_on_demand;
+} voting_schedule_t;
+
+/* Public API. */
+
+extern voting_schedule_t voting_schedule;
+
+time_t dirvote_get_start_of_next_interval(time_t now,
+ int interval,
+ int offset);
+time_t dirvote_get_next_valid_after_time(void);
+
+#endif /* TOR_VOTING_SCHEDULE_H */
+