tor-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 16 participants
- 2190 discussions

[tor/master] Move network_liveness_t into circuitstats.h and make it private
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit ad52fe7e88754fd8c7c1eb3da9bbf593d7752af9
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 12:56:54 2018 -0400
Move network_liveness_t into circuitstats.h and make it private
This type is only used in one place and never exposed.
---
src/or/circuitstats.h | 15 +++++++++++++++
src/or/or.h | 15 ---------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/or/circuitstats.h b/src/or/circuitstats.h
index 86116cb7f..5fe80acfe 100644
--- a/src/or/circuitstats.h
+++ b/src/or/circuitstats.h
@@ -73,6 +73,21 @@ int circuit_build_times_network_check_live(const circuit_build_times_t *cbt);
void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
#ifdef CIRCUITSTATS_PRIVATE
+/** Information about the state of our local network connection */
+typedef struct {
+ /** The timestamp we last completed a TLS handshake or received a cell */
+ time_t network_last_live;
+ /** If the network is not live, how many timeouts has this caused? */
+ int nonlive_timeouts;
+ /** Circular array of circuits that have made it to the first hop. Slot is
+ * 1 if circuit timed out, 0 if circuit succeeded */
+ int8_t *timeouts_after_firsthop;
+ /** Number of elements allocated for the above array */
+ int num_recent_circs;
+ /** Index into circular array. */
+ int after_firsthop_idx;
+} network_liveness_t;
+
/** Structure for circuit build times history */
struct circuit_build_times_s {
/** The circular array of recorded build times in milliseconds */
diff --git a/src/or/or.h b/src/or/or.h
index 3d0611c63..5707e0202 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3733,21 +3733,6 @@ int32_t circuit_build_times_initial_timeout(void);
#error "RECENT_CIRCUITS is set too low."
#endif
-/** Information about the state of our local network connection */
-typedef struct {
- /** The timestamp we last completed a TLS handshake or received a cell */
- time_t network_last_live;
- /** If the network is not live, how many timeouts has this caused? */
- int nonlive_timeouts;
- /** Circular array of circuits that have made it to the first hop. Slot is
- * 1 if circuit timed out, 0 if circuit succeeded */
- int8_t *timeouts_after_firsthop;
- /** Number of elements allocated for the above array */
- int num_recent_circs;
- /** Index into circular array. */
- int after_firsthop_idx;
-} network_liveness_t;
-
typedef struct circuit_build_times_s circuit_build_times_t;
/********************************* config.c ***************************/
1
0
commit d2942d127da454a1ffb69da176582b5d74918bb1
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:13:33 2018 -0400
Extract node_t into its own header.
---
src/or/bridges.c | 2 +
src/or/circuitbuild.c | 1 +
src/or/connection_edge.c | 1 +
src/or/control.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/directory.c | 1 +
src/or/dirserv.c | 1 +
src/or/entrynodes.c | 1 +
src/or/hs_circuit.c | 1 +
src/or/hs_common.c | 1 +
src/or/hs_control.c | 2 +
src/or/hs_service.c | 1 +
src/or/include.am | 1 +
src/or/microdesc.c | 2 +
src/or/networkstatus.c | 1 +
src/or/node_st.h | 100 +++++++++++++++++++++++++++++++++++++++++++++
src/or/nodelist.c | 9 ++++
src/or/nodelist.h | 1 +
src/or/or.h | 97 +------------------------------------------
src/or/policies.c | 1 +
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerset.c | 2 +
src/test/test_connection.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_helpers.c | 1 +
src/test/test_hs.c | 1 +
src/test/test_hs_common.c | 2 +
src/test/test_hs_control.c | 11 ++---
src/test/test_hs_service.c | 1 +
src/test/test_nodelist.c | 3 ++
src/test/test_policy.c | 1 +
src/test/test_routerlist.c | 1 +
src/test/test_routerset.c | 3 ++
34 files changed, 152 insertions(+), 104 deletions(-)
diff --git a/src/or/bridges.c b/src/or/bridges.c
index 699e030e6..d5a9d05b4 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -27,6 +27,8 @@
#include "routerset.h"
#include "transports.h"
+#include "node_st.h"
+
/** Information about a configured bridge. Currently this just matches the
* ones in the torrc file, but one day we may be able to learn about new
* bridges on our own, and remember them in the state file. */
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0df616a5a..42ce1cfda 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -67,6 +67,7 @@
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
+#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index ce018e874..e177b0ee2 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -100,6 +100,7 @@
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
#include "socks_request_st.h"
diff --git a/src/or/control.c b/src/or/control.c
index 20da12259..ee79dfcd5 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -84,6 +84,7 @@
#include "control_connection_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
+#include "node_st.h"
#include "or_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index ae2de57a8..41acc21d6 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -29,6 +29,7 @@
#include "dirauth/shared_random_state.h"
#include "dir_server_st.h"
+#include "node_st.h"
#include "vote_timing_st.h"
/**
diff --git a/src/or/directory.c b/src/or/directory.c
index 00605c054..8392dd81f 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -57,6 +57,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "entry_connection_st.h"
+#include "node_st.h"
#include "rend_service_descriptor_st.h"
/**
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 038b47e01..3af057c6c 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -37,6 +37,7 @@
#include "dirauth/dirvote.h"
#include "dir_connection_st.h"
+#include "node_st.h"
#include "tor_version_st.h"
/**
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 8aac07451..62a65f249 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -139,6 +139,7 @@
#include "transports.h"
#include "statefile.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
/** A list of existing guard selection contexts. */
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index b5ac7184a..761edd621 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -35,6 +35,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
/* A circuit is about to become an e2e rendezvous circuit. Check
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index afe80467a..c5f59059e 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -34,6 +34,7 @@
#include "dirauth/shared_random_state.h"
#include "edge_connection_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
/* Trunnel */
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index 6b9b95c6d..4f3dd62c6 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -15,6 +15,8 @@
#include "hs_service.h"
#include "nodelist.h"
+#include "node_st.h"
+
/* Send on the control port the "HS_DESC REQUESTED [...]" event.
*
* The onion_pk is the onion service public key, base64_blinded_pk is the
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 6c2c16734..90e607225 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -41,6 +41,7 @@
#include "dir_connection_st.h"
#include "edge_connection_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
/* Trunnel */
diff --git a/src/or/include.am b/src/or/include.am
index 4e0e1e9a4..ee1ee562c 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -248,6 +248,7 @@ ORHEADERS = \
src/or/microdesc.h \
src/or/networkstatus.h \
src/or/nodelist.h \
+ src/or/node_st.h \
src/or/ntmain.h \
src/or/onion.h \
src/or/onion_fast.h \
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index b4a934e09..f06c4bd2a 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -22,6 +22,8 @@
#include "routerlist.h"
#include "routerparse.h"
+#include "node_st.h"
+
/** A data structure to hold a bunch of cached microdescriptors. There are
* two active files in the cache: a "cache file" that we mmap, and a "journal
* file" that we append to. Periodically, we rebuild the cache file to hold
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 3694da49d..4ac2034cd 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -76,6 +76,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "node_st.h"
/** Most recently received and validated v3 "ns"-flavored consensus network
* status. */
diff --git a/src/or/node_st.h b/src/or/node_st.h
new file mode 100644
index 000000000..511e23ad1
--- /dev/null
+++ b/src/or/node_st.h
@@ -0,0 +1,100 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NODE_ST_H
+#define NODE_ST_H
+
+/** A node_t represents a Tor router.
+ *
+ * Specifically, a node_t is a Tor router as we are using it: a router that
+ * we are considering for circuits, connections, and so on. A node_t is a
+ * thin wrapper around the routerstatus, routerinfo, and microdesc for a
+ * single router, and provides a consistent interface for all of them.
+ *
+ * Also, a node_t has mutable state. While a routerinfo, a routerstatus,
+ * and a microdesc have[*] only the information read from a router
+ * descriptor, a consensus entry, and a microdescriptor (respectively)...
+ * a node_t has flags based on *our own current opinion* of the node.
+ *
+ * [*] Actually, there is some leftover information in each that is mutable.
+ * We should try to excise that.
+ */
+struct node_t {
+ /* Indexing information */
+
+ /** Used to look up the node_t by its identity digest. */
+ HT_ENTRY(node_t) ht_ent;
+ /** Used to look up the node_t by its ed25519 identity digest. */
+ HT_ENTRY(node_t) ed_ht_ent;
+ /** Position of the node within the list of nodes */
+ int nodelist_idx;
+
+ /** The identity digest of this node_t. No more than one node_t per
+ * identity may exist at a time. */
+ char identity[DIGEST_LEN];
+
+ /** The ed25519 identity of this node_t. This field is nonzero iff we
+ * currently have an ed25519 identity for this node in either md or ri,
+ * _and_ this node has been inserted to the ed25519-to-node map in the
+ * nodelist.
+ */
+ ed25519_public_key_t ed25519_id;
+
+ microdesc_t *md;
+ routerinfo_t *ri;
+ routerstatus_t *rs;
+
+ /* local info: copied from routerstatus, then possibly frobbed based
+ * on experience. Authorities set this stuff directly. Note that
+ * these reflect knowledge of the primary (IPv4) OR port only. */
+
+ unsigned int is_running:1; /**< As far as we know, is this OR currently
+ * running? */
+ unsigned int is_valid:1; /**< Has a trusted dirserver validated this OR?
+ * (For Authdir: Have we validated this OR?) */
+ unsigned int is_fast:1; /** Do we think this is a fast OR? */
+ unsigned int is_stable:1; /** Do we think this is a stable OR? */
+ unsigned int is_possible_guard:1; /**< Do we think this is an OK guard? */
+ unsigned int is_exit:1; /**< Do we think this is an OK exit? */
+ unsigned int is_bad_exit:1; /**< Do we think this exit is censored, borked,
+ * or otherwise nasty? */
+ unsigned int is_hs_dir:1; /**< True iff this router is a hidden service
+ * directory according to the authorities. */
+
+ /* Local info: warning state. */
+
+ unsigned int name_lookup_warned:1; /**< Have we warned the user for referring
+ * to this (unnamed) router by nickname?
+ */
+
+ /** Local info: we treat this node as if it rejects everything */
+ unsigned int rejects_all:1;
+
+ /* Local info: derived. */
+
+ /** True if the IPv6 OR port is preferred over the IPv4 OR port.
+ * XX/teor - can this become out of date if the torrc changes? */
+ unsigned int ipv6_preferred:1;
+
+ /** According to the geoip db what country is this router in? */
+ /* XXXprop186 what is this suppose to mean with multiple OR ports? */
+ country_t country;
+
+ /* The below items are used only by authdirservers for
+ * reachability testing. */
+
+ /** When was the last time we could reach this OR? */
+ time_t last_reachable; /* IPv4. */
+ time_t last_reachable6; /* IPv6. */
+
+ /* Hidden service directory index data. This is used by a service or client
+ * in order to know what's the hs directory index for this node at the time
+ * the consensus is set. */
+ struct hsdir_index_t hsdir_index;
+};
+
+#endif
+
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 4d67904c8..2c78c35ab 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -69,6 +69,7 @@
#include "dirauth/mode.h"
#include "dir_server_st.h"
+#include "node_st.h"
static void nodelist_drop_node(node_t *node, int remove_from_ht);
#define node_free(val) \
@@ -634,6 +635,14 @@ nodelist_set_consensus(networkstatus_t *ns)
}
}
+/** Return 1 iff <b>node</b> has Exit flag and no BadExit flag.
+ * Otherwise, return 0.
+ */
+int node_is_good_exit(const node_t *node)
+{
+ return node->is_exit && ! node->is_bad_exit;
+}
+
/** Helper: return true iff a node has a usable amount of information*/
static inline int
node_is_usable(const node_t *node)
diff --git a/src/or/nodelist.h b/src/or/nodelist.h
index 1ffba2e8d..fd91a2683 100644
--- a/src/or/nodelist.h
+++ b/src/or/nodelist.h
@@ -46,6 +46,7 @@ void node_get_verbose_nickname(const node_t *node,
void node_get_verbose_nickname_by_id(const char *id_digest,
char *verbose_name_out);
int node_is_dir(const node_t *node);
+int node_is_good_exit(const node_t *node);
int node_has_any_descriptor(const node_t *node);
int node_has_preferred_descriptor(const node_t *node,
int for_direct_connect);
diff --git a/src/or/or.h b/src/or/or.h
index 19d0bb2ab..f2de729ec 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1857,94 +1857,7 @@ typedef struct microdesc_t {
} microdesc_t;
-/** A node_t represents a Tor router.
- *
- * Specifically, a node_t is a Tor router as we are using it: a router that
- * we are considering for circuits, connections, and so on. A node_t is a
- * thin wrapper around the routerstatus, routerinfo, and microdesc for a
- * single router, and provides a consistent interface for all of them.
- *
- * Also, a node_t has mutable state. While a routerinfo, a routerstatus,
- * and a microdesc have[*] only the information read from a router
- * descriptor, a consensus entry, and a microdescriptor (respectively)...
- * a node_t has flags based on *our own current opinion* of the node.
- *
- * [*] Actually, there is some leftover information in each that is mutable.
- * We should try to excise that.
- */
-typedef struct node_t {
- /* Indexing information */
-
- /** Used to look up the node_t by its identity digest. */
- HT_ENTRY(node_t) ht_ent;
- /** Used to look up the node_t by its ed25519 identity digest. */
- HT_ENTRY(node_t) ed_ht_ent;
- /** Position of the node within the list of nodes */
- int nodelist_idx;
-
- /** The identity digest of this node_t. No more than one node_t per
- * identity may exist at a time. */
- char identity[DIGEST_LEN];
-
- /** The ed25519 identity of this node_t. This field is nonzero iff we
- * currently have an ed25519 identity for this node in either md or ri,
- * _and_ this node has been inserted to the ed25519-to-node map in the
- * nodelist.
- */
- ed25519_public_key_t ed25519_id;
-
- microdesc_t *md;
- routerinfo_t *ri;
- routerstatus_t *rs;
-
- /* local info: copied from routerstatus, then possibly frobbed based
- * on experience. Authorities set this stuff directly. Note that
- * these reflect knowledge of the primary (IPv4) OR port only. */
-
- unsigned int is_running:1; /**< As far as we know, is this OR currently
- * running? */
- unsigned int is_valid:1; /**< Has a trusted dirserver validated this OR?
- * (For Authdir: Have we validated this OR?) */
- unsigned int is_fast:1; /** Do we think this is a fast OR? */
- unsigned int is_stable:1; /** Do we think this is a stable OR? */
- unsigned int is_possible_guard:1; /**< Do we think this is an OK guard? */
- unsigned int is_exit:1; /**< Do we think this is an OK exit? */
- unsigned int is_bad_exit:1; /**< Do we think this exit is censored, borked,
- * or otherwise nasty? */
- unsigned int is_hs_dir:1; /**< True iff this router is a hidden service
- * directory according to the authorities. */
-
- /* Local info: warning state. */
-
- unsigned int name_lookup_warned:1; /**< Have we warned the user for referring
- * to this (unnamed) router by nickname?
- */
-
- /** Local info: we treat this node as if it rejects everything */
- unsigned int rejects_all:1;
-
- /* Local info: derived. */
-
- /** True if the IPv6 OR port is preferred over the IPv4 OR port.
- * XX/teor - can this become out of date if the torrc changes? */
- unsigned int ipv6_preferred:1;
-
- /** According to the geoip db what country is this router in? */
- /* XXXprop186 what is this suppose to mean with multiple OR ports? */
- country_t country;
-
- /* The below items are used only by authdirservers for
- * reachability testing. */
-
- /** When was the last time we could reach this OR? */
- time_t last_reachable; /* IPv4. */
- time_t last_reachable6; /* IPv6. */
-
- /* Hidden service directory index data. This is used by a service or client
- * in order to know what's the hs directory index for this node at the time
- * the consensus is set. */
- struct hsdir_index_t hsdir_index;
-} node_t;
+typedef struct node_t node_t;
/** Linked list of microdesc hash lines for a single router in a directory
* vote.
@@ -2385,14 +2298,6 @@ typedef enum {
/** Convert a circuit subtype to a circuit_t. */
#define TO_CIRCUIT(x) (&((x)->base_))
-/** Return 1 iff <b>node</b> has Exit flag and no BadExit flag.
- * Otherwise, return 0.
- */
-static inline int node_is_good_exit(const node_t *node)
-{
- return node->is_exit && ! node->is_bad_exit;
-}
-
/* limits for TCP send and recv buffer size used for constrained sockets */
#define MIN_CONSTRAINED_TCP_BUFFER 2048
#define MAX_CONSTRAINED_TCP_BUFFER 262144 /* 256k */
diff --git a/src/or/policies.c b/src/or/policies.c
index 51dc83827..78cbcd5cd 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -31,6 +31,7 @@
#include "ht.h"
#include "dir_server_st.h"
+#include "node_st.h"
#include "port_cfg_st.h"
/** Policy that addresses for incoming SOCKS connections must match. */
diff --git a/src/or/router.c b/src/or/router.c
index 2d0305889..6d8f61d71 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -42,6 +42,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
#include "port_cfg_st.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 970eac8d3..313685784 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -127,6 +127,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "node_st.h"
// #define DEBUG_ROUTERLIST
diff --git a/src/or/routerset.c b/src/or/routerset.c
index a2599b316..8a6ff3b58 100644
--- a/src/or/routerset.c
+++ b/src/or/routerset.c
@@ -36,6 +36,8 @@
#include "routerparse.h"
#include "routerset.h"
+#include "node_st.h"
+
/** Return a new empty routerset. */
routerset_t *
routerset_new(void)
diff --git a/src/test/test_connection.c b/src/test/test_connection.c
index 93d5dc846..6f9c2706c 100644
--- a/src/test/test_connection.c
+++ b/src/test/test_connection.c
@@ -26,6 +26,7 @@
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "node_st.h"
#include "or_connection_st.h"
#include "socks_request_st.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index bff6a40bd..cf9da232c 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -33,6 +33,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
#include "dir_connection_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
#include "test_helpers.h"
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index 91cc7d4d2..78d10b261 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -25,6 +25,7 @@
#include "routerlist.h"
#include "connection_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
#include "test.h"
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 9343d131f..c546af2fe 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -22,6 +22,7 @@
#include "routerset.h"
#include "circuitbuild.h"
+#include "node_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 8bcb2c7e4..21a109d2b 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -33,6 +33,8 @@
#include "util.h"
#include "voting_schedule.h"
+#include "node_st.h"
+
/** Test the validation of HS v3 addresses */
static void
test_validate_address(void *arg)
diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c
index 308843e9b..1fcea44f4 100644
--- a/src/test/test_hs_control.c
+++ b/src/test/test_hs_control.c
@@ -7,10 +7,6 @@
**/
#define CONTROL_PRIVATE
-#define CIRCUITBUILD_PRIVATE
-#define RENDCOMMON_PRIVATE
-#define RENDSERVICE_PRIVATE
-#define HS_SERVICE_PRIVATE
#include "or.h"
#include "test.h"
@@ -19,10 +15,9 @@
#include "hs_common.h"
#include "hs_control.h"
#include "nodelist.h"
-//#include "rendcommon.h"
-//#include "rendservice.h"
-//#include "routerset.h"
-//#include "circuitbuild.h"
+
+#include "node_st.h"
+
#include "test_helpers.h"
/* mock ID digest and longname for node that's in nodelist */
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 348778550..83a9d3cb5 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -55,6 +55,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "node_st.h"
#include "origin_circuit_st.h"
/* Trunnel */
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index 9499fd038..a3f2de29f 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -11,6 +11,9 @@
#include "networkstatus.h"
#include "nodelist.h"
#include "torcert.h"
+
+#include "node_st.h"
+
#include "test.h"
/** Test the case when node_get_by_id() returns NULL,
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index e55452d3e..673336eae 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -10,6 +10,7 @@
#include "policies.h"
#include "test.h"
+#include "node_st.h"
#include "port_cfg_st.h"
/* Helper: assert that short_policy parses and writes back out as itself,
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index d66f8933d..bf97499ee 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -35,6 +35,7 @@
#include "statefile.h"
#include "dir_connection_st.h"
+#include "node_st.h"
#include "test.h"
#include "test_dir_common.h"
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index c54132467..0e1ad3fdf 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -9,6 +9,9 @@
#include "routerparse.h"
#include "policies.h"
#include "nodelist.h"
+
+#include "node_st.h"
+
#include "test.h"
#define NS_MODULE routerset
1
0

18 Jun '18
commit f901ca958a69efab6cbc2b7e7908e6dffbd0b614
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:23:44 2018 -0400
fixup! Extract node_t into its own header.
---
src/or/nodelist.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 2c78c35ab..72eada57c 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -638,7 +638,8 @@ nodelist_set_consensus(networkstatus_t *ns)
/** Return 1 iff <b>node</b> has Exit flag and no BadExit flag.
* Otherwise, return 0.
*/
-int node_is_good_exit(const node_t *node)
+int
+node_is_good_exit(const node_t *node)
{
return node->is_exit && ! node->is_bad_exit;
}
1
0

18 Jun '18
commit 80c9e1e58511de04eeffdc47d3801697b4952e6d
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:27:11 2018 -0400
Move document_signature_t into its own header.
---
src/or/dirauth/dirvote.c | 1 +
src/or/document_signature_st.h | 29 +++++++++++++++++++++++++++++
src/or/include.am | 1 +
src/or/networkstatus.c | 1 +
src/or/or.h | 19 +------------------
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test_dir.c | 1 +
8 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index c702ca697..12ab5f328 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -29,6 +29,7 @@
#include "dirauth/shared_random_state.h"
#include "dir_server_st.h"
+#include "document_signature_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/document_signature_st.h b/src/or/document_signature_st.h
new file mode 100644
index 000000000..ec0b1ba1b
--- /dev/null
+++ b/src/or/document_signature_st.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef DOCUMENT_SIGNATURE_ST_H
+#define DOCUMENT_SIGNATURE_ST_H
+
+/** A signature of some document by an authority. */
+struct document_signature_t {
+ /** Declared SHA-1 digest of this voter's identity key */
+ char identity_digest[DIGEST_LEN];
+ /** Declared SHA-1 digest of signing key used by this voter. */
+ char signing_key_digest[DIGEST_LEN];
+ /** Algorithm used to compute the digest of the document. */
+ digest_algorithm_t alg;
+ /** Signature of the signed thing. */
+ char *signature;
+ /** Length of <b>signature</b> */
+ int signature_len;
+ unsigned int bad_signature : 1; /**< Set to true if we've tried to verify
+ * the sig, and we know it's bad. */
+ unsigned int good_signature : 1; /**< Set to true if we've verified the sig
+ * as good. */
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index d9eeb15f3..611b1adbc 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -214,6 +214,7 @@ ORHEADERS = \
src/or/dirserv.h \
src/or/dir_connection_st.h \
src/or/dir_server_st.h \
+ src/or/document_signature_st.h \
src/or/dns.h \
src/or/dns_structs.h \
src/or/dnsserv.h \
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 3f90fea4e..1bea0d774 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -76,6 +76,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "document_signature_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/or.h b/src/or/or.h
index 23f565857..ab1ae5742 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1860,24 +1860,7 @@ typedef struct microdesc_t {
typedef struct node_t node_t;
typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
typedef struct vote_routerstatus_t vote_routerstatus_t;
-
-/** A signature of some document by an authority. */
-typedef struct document_signature_t {
- /** Declared SHA-1 digest of this voter's identity key */
- char identity_digest[DIGEST_LEN];
- /** Declared SHA-1 digest of signing key used by this voter. */
- char signing_key_digest[DIGEST_LEN];
- /** Algorithm used to compute the digest of the document. */
- digest_algorithm_t alg;
- /** Signature of the signed thing. */
- char *signature;
- /** Length of <b>signature</b> */
- int signature_len;
- unsigned int bad_signature : 1; /**< Set to true if we've tried to verify
- * the sig, and we know it's bad. */
- unsigned int good_signature : 1; /**< Set to true if we've verified the sig
- * as good. */
-} document_signature_t;
+typedef struct document_signature_t document_signature_t;
/** Information about a single voter in a vote or a consensus. */
typedef struct networkstatus_voter_info_t {
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 4d02c42a4..68def1c85 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -127,6 +127,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "document_signature_st.h"
#include "node_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index b7d50a1da..2ae005569 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -81,6 +81,7 @@
#include "dirauth/dirvote.h"
+#include "document_signature_st.h"
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 963d97a32..c3d00a81f 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -45,6 +45,7 @@
#include "log_test_helpers.h"
#include "voting_schedule.h"
+#include "document_signature_st.h"
#include "port_cfg_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
1
0

[tor/master] Extract networkstatus_vote_info_t into its own header.
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit 89aefb0319778af419abed11707a7bf84648288c
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:31:47 2018 -0400
Extract networkstatus_vote_info_t into its own header.
---
src/or/consdiffmgr.c | 2 ++
src/or/dirauth/dirvote.c | 1 +
src/or/include.am | 1 +
src/or/networkstatus.c | 1 +
src/or/networkstatus_voter_info_st.h | 31 +++++++++++++++++++++++++++++++
src/or/or.h | 21 +--------------------
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test_dir.c | 1 +
src/test/test_dir_common.c | 1 +
10 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index 323f4f9ca..b90660e6c 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -23,6 +23,8 @@
#include "routerparse.h"
#include "workqueue.h"
+#include "networkstatus_voter_info_st.h"
+
/**
* Labels to apply to items in the conscache object.
*
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 12ab5f328..5dee8a879 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -30,6 +30,7 @@
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 611b1adbc..6ced3e155 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -248,6 +248,7 @@ ORHEADERS = \
src/or/main.h \
src/or/microdesc.h \
src/or/networkstatus.h \
+ src/or/networkstatus_voter_info_st.h \
src/or/nodelist.h \
src/or/node_st.h \
src/or/ntmain.h \
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 1bea0d774..11021a7ea 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -77,6 +77,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/networkstatus_voter_info_st.h b/src/or/networkstatus_voter_info_st.h
new file mode 100644
index 000000000..32ea597bd
--- /dev/null
+++ b/src/or/networkstatus_voter_info_st.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NETWORKSTATUS_VOTER_INFO_ST_H
+#define NETWORKSTATUS_VOTER_INFO_ST_H
+
+/** Information about a single voter in a vote or a consensus. */
+typedef struct networkstatus_voter_info_t {
+ /** Declared SHA-1 digest of this voter's identity key */
+ char identity_digest[DIGEST_LEN];
+ char *nickname; /**< Nickname of this voter */
+ /** Digest of this voter's "legacy" identity key, if any. In vote only; for
+ * consensuses, we treat legacy keys as additional signers. */
+ char legacy_id_digest[DIGEST_LEN];
+ char *address; /**< Address of this voter, in string format. */
+ uint32_t addr; /**< Address of this voter, in IPv4, in host order. */
+ uint16_t dir_port; /**< Directory port of this voter */
+ uint16_t or_port; /**< OR port of this voter */
+ char *contact; /**< Contact information for this voter. */
+ char vote_digest[DIGEST_LEN]; /**< Digest of this voter's vote, as signed. */
+
+ /* Nothing from here on is signed. */
+ /** The signature of the document and the signature's status. */
+ smartlist_t *sigs;
+} networkstatus_voter_info_t;
+
+#endif
+
diff --git a/src/or/or.h b/src/or/or.h
index ab1ae5742..1069e30d0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1861,26 +1861,7 @@ typedef struct node_t node_t;
typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
typedef struct vote_routerstatus_t vote_routerstatus_t;
typedef struct document_signature_t document_signature_t;
-
-/** Information about a single voter in a vote or a consensus. */
-typedef struct networkstatus_voter_info_t {
- /** Declared SHA-1 digest of this voter's identity key */
- char identity_digest[DIGEST_LEN];
- char *nickname; /**< Nickname of this voter */
- /** Digest of this voter's "legacy" identity key, if any. In vote only; for
- * consensuses, we treat legacy keys as additional signers. */
- char legacy_id_digest[DIGEST_LEN];
- char *address; /**< Address of this voter, in string format. */
- uint32_t addr; /**< Address of this voter, in IPv4, in host order. */
- uint16_t dir_port; /**< Directory port of this voter */
- uint16_t or_port; /**< OR port of this voter */
- char *contact; /**< Contact information for this voter. */
- char vote_digest[DIGEST_LEN]; /**< Digest of this voter's vote, as signed. */
-
- /* Nothing from here on is signed. */
- /** The signature of the document and the signature's status. */
- smartlist_t *sigs;
-} networkstatus_voter_info_t;
+typedef struct networkstatus_voter_info_t networkstatus_voter_info_t;
typedef struct networkstatus_sr_info_t {
/* Indicate if the dirauth partitipates in the SR protocol with its vote.
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 68def1c85..5a8d19f6f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -128,6 +128,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 2ae005569..73721bf23 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -82,6 +82,7 @@
#include "dirauth/dirvote.h"
#include "document_signature_st.h"
+#include "networkstatus_voter_info_st.h"
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index c3d00a81f..f5a3b6f65 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -46,6 +46,7 @@
#include "voting_schedule.h"
#include "document_signature_st.h"
+#include "networkstatus_voter_info_st.h"
#include "port_cfg_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index 4b36025b5..fca132c9f 100644
--- a/src/test/test_dir_common.c
+++ b/src/test/test_dir_common.c
@@ -14,6 +14,7 @@
#include "test_dir_common.h"
#include "voting_schedule.h"
+#include "networkstatus_voter_info_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
1
0

[tor/master] Extract networkstatus_t and ..sr_info_t into their own headers
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit 50369f8981e8ce0894753daeea3dc28ab01f2667
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:45:15 2018 -0400
Extract networkstatus_t and ..sr_info_t into their own headers
---
src/or/consdiffmgr.c | 1 +
src/or/control.c | 1 +
src/or/dirauth/dircollate.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/dirauth/shared_random.c | 2 +
src/or/directory.c | 1 +
src/or/hs_cache.c | 2 +
src/or/hs_common.c | 1 +
src/or/hs_service.c | 1 +
src/or/include.am | 2 +
src/or/main.c | 1 +
src/or/microdesc.c | 1 +
src/or/networkstatus.c | 1 +
src/or/networkstatus_sr_info_st.h | 23 ++++++++++
src/or/networkstatus_st.h | 95 +++++++++++++++++++++++++++++++++++++++
src/or/nodelist.c | 1 +
src/or/or.h | 95 +--------------------------------------
src/or/rendcommon.c | 1 +
src/or/rendservice.c | 1 +
src/or/rephist.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/or/shared_random_client.c | 2 +
src/or/voting_schedule.c | 2 +
src/test/fuzz/fuzz_vrs.c | 1 +
src/test/test_address_set.c | 2 +
src/test/test_channel.c | 1 +
src/test/test_channelpadding.c | 1 +
src/test/test_consdiffmgr.c | 2 +
src/test/test_dir.c | 1 +
src/test/test_dir_common.c | 1 +
src/test/test_dir_handle_get.c | 1 +
src/test/test_dos.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_guardfraction.c | 1 +
src/test/test_hs_cache.c | 1 +
src/test/test_hs_client.c | 1 +
src/test/test_hs_common.c | 1 +
src/test/test_hs_service.c | 1 +
src/test/test_microdesc.c | 2 +
src/test/test_nodelist.c | 1 +
src/test/test_routerlist.c | 1 +
src/test/test_shared_random.c | 1 +
43 files changed, 168 insertions(+), 93 deletions(-)
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index b90660e6c..f1b7601ca 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -23,6 +23,7 @@
#include "routerparse.h"
#include "workqueue.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
/**
diff --git a/src/or/control.c b/src/or/control.c
index ee79dfcd5..0afd6cf97 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -84,6 +84,7 @@
#include "control_connection_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "or_connection_st.h"
#include "or_circuit_st.h"
diff --git a/src/or/dirauth/dircollate.c b/src/or/dirauth/dircollate.c
index 388885fe0..81f0bf31e 100644
--- a/src/or/dirauth/dircollate.c
+++ b/src/or/dirauth/dircollate.c
@@ -25,6 +25,7 @@
#include "dircollate.h"
#include "dirvote.h"
+#include "networkstatus_st.h"
#include "vote_routerstatus_st.h"
static void dircollator_collate_by_ed25519(dircollator_t *dc);
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 5dee8a879..aa30a11f5 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -30,6 +30,7 @@
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c
index 6dd1f330e..137f695db 100644
--- a/src/or/dirauth/shared_random.c
+++ b/src/or/dirauth/shared_random.c
@@ -105,6 +105,8 @@
#include "dirauth/dirvote.h"
#include "dirauth/mode.h"
+#include "networkstatus_st.h"
+
/* String prefix of shared random values in votes/consensuses. */
static const char previous_srv_str[] = "shared-rand-previous-value";
static const char current_srv_str[] = "shared-rand-current-value";
diff --git a/src/or/directory.c b/src/or/directory.c
index 8392dd81f..b5a07f6b3 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -57,6 +57,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c
index ecc845d17..092d944b8 100644
--- a/src/or/hs_cache.c
+++ b/src/or/hs_cache.c
@@ -21,6 +21,8 @@
#include "hs_cache.h"
+#include "networkstatus_st.h"
+
static int cached_client_descriptor_has_expired(time_t now,
const hs_cache_client_descriptor_t *cached_desc);
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index c5f59059e..e5d15a1b1 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -34,6 +34,7 @@
#include "dirauth/shared_random_state.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 90e607225..007c84caf 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -41,6 +41,7 @@
#include "dir_connection_st.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 6ced3e155..e6f23e916 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -248,6 +248,8 @@ ORHEADERS = \
src/or/main.h \
src/or/microdesc.h \
src/or/networkstatus.h \
+ src/or/networkstatus_st.h \
+ src/or/networkstatus_sr_info_st.h \
src/or/networkstatus_voter_info_st.h \
src/or/nodelist.h \
src/or/node_st.h \
diff --git a/src/or/main.c b/src/or/main.c
index 0daebfc4f..73c23ee98 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -123,6 +123,7 @@
#include "dirauth/shared_random.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "port_cfg_st.h"
#include "socks_request_st.h"
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index f06c4bd2a..208f35b1c 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -22,6 +22,7 @@
#include "routerlist.h"
#include "routerparse.h"
+#include "networkstatus_st.h"
#include "node_st.h"
/** A data structure to hold a bunch of cached microdescriptors. There are
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 11021a7ea..8ad1bb25b 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -77,6 +77,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/or/networkstatus_sr_info_st.h b/src/or/networkstatus_sr_info_st.h
new file mode 100644
index 000000000..3b2690f0a
--- /dev/null
+++ b/src/or/networkstatus_sr_info_st.h
@@ -0,0 +1,23 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NETWORKSTATUS_SR_INFO_ST_H
+#define NETWORKSTATUS_SR_INFO_ST_H
+
+struct networkstatus_sr_info_t {
+ /* Indicate if the dirauth partitipates in the SR protocol with its vote.
+ * This is tied to the SR flag in the vote. */
+ unsigned int participate:1;
+ /* Both vote and consensus: Current and previous SRV. If list is empty,
+ * this means none were found in either the consensus or vote. */
+ struct sr_srv_t *previous_srv;
+ struct sr_srv_t *current_srv;
+ /* Vote only: List of commitments. */
+ smartlist_t *commits;
+};
+
+#endif
+
diff --git a/src/or/networkstatus_st.h b/src/or/networkstatus_st.h
new file mode 100644
index 000000000..81965395a
--- /dev/null
+++ b/src/or/networkstatus_st.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NETWORKSTATUS_ST_H
+#define NETWORKSTATUS_ST_H
+
+#include "networkstatus_sr_info_st.h"
+
+/** A common structure to hold a v3 network status vote, or a v3 network
+ * status consensus. */
+struct networkstatus_t {
+ networkstatus_type_t type; /**< Vote, consensus, or opinion? */
+ consensus_flavor_t flavor; /**< If a consensus, what kind? */
+ unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
+ * measured= bandwidth values. */
+
+ time_t published; /**< Vote only: Time when vote was written. */
+ time_t valid_after; /**< Time after which this vote or consensus applies. */
+ time_t fresh_until; /**< Time before which this is the most recent vote or
+ * consensus. */
+ time_t valid_until; /**< Time after which this vote or consensus should not
+ * be used. */
+
+ /** Consensus only: what method was used to produce this consensus? */
+ int consensus_method;
+ /** Vote only: what methods is this voter willing to use? */
+ smartlist_t *supported_methods;
+
+ /** List of 'package' lines describing hashes of downloadable packages */
+ smartlist_t *package_lines;
+
+ /** How long does this vote/consensus claim that authorities take to
+ * distribute their votes to one another? */
+ int vote_seconds;
+ /** How long does this vote/consensus claim that authorities take to
+ * distribute their consensus signatures to one another? */
+ int dist_seconds;
+
+ /** Comma-separated list of recommended client software, or NULL if this
+ * voter has no opinion. */
+ char *client_versions;
+ char *server_versions;
+
+ /** Lists of subprotocol versions which are _recommended_ for relays and
+ * clients, or which are _require_ for relays and clients. Tor shouldn't
+ * make any more network connections if a required protocol is missing.
+ */
+ char *recommended_relay_protocols;
+ char *recommended_client_protocols;
+ char *required_relay_protocols;
+ char *required_client_protocols;
+
+ /** List of flags that this vote/consensus applies to routers. If a flag is
+ * not listed here, the voter has no opinion on what its value should be. */
+ smartlist_t *known_flags;
+
+ /** List of key=value strings for the parameters in this vote or
+ * consensus, sorted by key. */
+ smartlist_t *net_params;
+
+ /** List of key=value strings for the bw weight parameters in the
+ * consensus. */
+ smartlist_t *weight_params;
+
+ /** List of networkstatus_voter_info_t. For a vote, only one element
+ * is included. For a consensus, one element is included for every voter
+ * whose vote contributed to the consensus. */
+ smartlist_t *voters;
+
+ struct authority_cert_t *cert; /**< Vote only: the voter's certificate. */
+
+ /** Digests of this document, as signed. */
+ common_digests_t digests;
+ /** A SHA3-256 digest of the document, not including signatures: used for
+ * consensus diffs */
+ uint8_t digest_sha3_as_signed[DIGEST256_LEN];
+
+ /** List of router statuses, sorted by identity digest. For a vote,
+ * the elements are vote_routerstatus_t; for a consensus, the elements
+ * are routerstatus_t. */
+ smartlist_t *routerstatus_list;
+
+ /** If present, a map from descriptor digest to elements of
+ * routerstatus_list. */
+ digestmap_t *desc_digest_map;
+
+ /** Contains the shared random protocol data from a vote or consensus. */
+ networkstatus_sr_info_t sr_info;
+};
+
+#endif
+
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 72eada57c..45a63388f 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -69,6 +69,7 @@
#include "dirauth/mode.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
static void nodelist_drop_node(node_t *node, int remove_from_ht);
diff --git a/src/or/or.h b/src/or/or.h
index 1069e30d0..43fe09f23 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1862,18 +1862,7 @@ typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
typedef struct vote_routerstatus_t vote_routerstatus_t;
typedef struct document_signature_t document_signature_t;
typedef struct networkstatus_voter_info_t networkstatus_voter_info_t;
-
-typedef struct networkstatus_sr_info_t {
- /* Indicate if the dirauth partitipates in the SR protocol with its vote.
- * This is tied to the SR flag in the vote. */
- unsigned int participate:1;
- /* Both vote and consensus: Current and previous SRV. If list is empty,
- * this means none were found in either the consensus or vote. */
- struct sr_srv_t *previous_srv;
- struct sr_srv_t *current_srv;
- /* Vote only: List of commitments. */
- smartlist_t *commits;
-} networkstatus_sr_info_t;
+typedef struct networkstatus_sr_info_t networkstatus_sr_info_t;
/** Enumerates the possible seriousness values of a networkstatus document. */
typedef enum {
@@ -1893,87 +1882,7 @@ typedef enum {
/** How many different consensus flavors are there? */
#define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1)
-/** A common structure to hold a v3 network status vote, or a v3 network
- * status consensus. */
-typedef struct networkstatus_t {
- networkstatus_type_t type; /**< Vote, consensus, or opinion? */
- consensus_flavor_t flavor; /**< If a consensus, what kind? */
- unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
- * measured= bandwidth values. */
-
- time_t published; /**< Vote only: Time when vote was written. */
- time_t valid_after; /**< Time after which this vote or consensus applies. */
- time_t fresh_until; /**< Time before which this is the most recent vote or
- * consensus. */
- time_t valid_until; /**< Time after which this vote or consensus should not
- * be used. */
-
- /** Consensus only: what method was used to produce this consensus? */
- int consensus_method;
- /** Vote only: what methods is this voter willing to use? */
- smartlist_t *supported_methods;
-
- /** List of 'package' lines describing hashes of downloadable packages */
- smartlist_t *package_lines;
-
- /** How long does this vote/consensus claim that authorities take to
- * distribute their votes to one another? */
- int vote_seconds;
- /** How long does this vote/consensus claim that authorities take to
- * distribute their consensus signatures to one another? */
- int dist_seconds;
-
- /** Comma-separated list of recommended client software, or NULL if this
- * voter has no opinion. */
- char *client_versions;
- char *server_versions;
-
- /** Lists of subprotocol versions which are _recommended_ for relays and
- * clients, or which are _require_ for relays and clients. Tor shouldn't
- * make any more network connections if a required protocol is missing.
- */
- char *recommended_relay_protocols;
- char *recommended_client_protocols;
- char *required_relay_protocols;
- char *required_client_protocols;
-
- /** List of flags that this vote/consensus applies to routers. If a flag is
- * not listed here, the voter has no opinion on what its value should be. */
- smartlist_t *known_flags;
-
- /** List of key=value strings for the parameters in this vote or
- * consensus, sorted by key. */
- smartlist_t *net_params;
-
- /** List of key=value strings for the bw weight parameters in the
- * consensus. */
- smartlist_t *weight_params;
-
- /** List of networkstatus_voter_info_t. For a vote, only one element
- * is included. For a consensus, one element is included for every voter
- * whose vote contributed to the consensus. */
- smartlist_t *voters;
-
- struct authority_cert_t *cert; /**< Vote only: the voter's certificate. */
-
- /** Digests of this document, as signed. */
- common_digests_t digests;
- /** A SHA3-256 digest of the document, not including signatures: used for
- * consensus diffs */
- uint8_t digest_sha3_as_signed[DIGEST256_LEN];
-
- /** List of router statuses, sorted by identity digest. For a vote,
- * the elements are vote_routerstatus_t; for a consensus, the elements
- * are routerstatus_t. */
- smartlist_t *routerstatus_list;
-
- /** If present, a map from descriptor digest to elements of
- * routerstatus_list. */
- digestmap_t *desc_digest_map;
-
- /** Contains the shared random protocol data from a vote or consensus. */
- networkstatus_sr_info_t sr_info;
-} networkstatus_t;
+typedef struct networkstatus_t networkstatus_t;
/** A set of signatures for a networkstatus consensus. Unless otherwise
* noted, all fields are as for networkstatus_t. */
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 0ab42fb42..694b52db1 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -33,6 +33,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 4a8b7a0e1..8552fedd3 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -40,6 +40,7 @@
#include "crypt_path_st.h"
#include "crypt_path_reference_st.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_authorized_client_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 909cd043b..efc338c5e 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -89,6 +89,7 @@
#include "connection_or.h"
#include "statefile.h"
+#include "networkstatus_st.h"
#include "or_circuit_st.h"
static void bw_arrays_init(void);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 5a8d19f6f..0f9318153 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -128,6 +128,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 73721bf23..ab64b1c82 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -82,6 +82,7 @@
#include "dirauth/dirvote.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/or/shared_random_client.c b/src/or/shared_random_client.c
index 3aef83cef..14997b21b 100644
--- a/src/or/shared_random_client.c
+++ b/src/or/shared_random_client.c
@@ -17,6 +17,8 @@
#include "util.h"
#include "util_format.h"
+#include "networkstatus_st.h"
+
/* Convert a given srv object to a string for the control port. This doesn't
* fail and the srv object MUST be valid. */
static char *
diff --git a/src/or/voting_schedule.c b/src/or/voting_schedule.c
index 1d66b5e22..983cabbbf 100644
--- a/src/or/voting_schedule.c
+++ b/src/or/voting_schedule.c
@@ -15,6 +15,8 @@
#include "config.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
+
/* =====
* Vote scheduling
* ===== */
diff --git a/src/test/fuzz/fuzz_vrs.c b/src/test/fuzz/fuzz_vrs.c
index 7225fd545..a59767494 100644
--- a/src/test/fuzz/fuzz_vrs.c
+++ b/src/test/fuzz/fuzz_vrs.c
@@ -8,6 +8,7 @@
#include "microdesc.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "vote_routerstatus_st.h"
#include "fuzzing.h"
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index f7441a649..441d14927 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -10,6 +10,8 @@
#include "routerlist.h"
#include "torcert.h"
+#include "networkstatus_st.h"
+
#include "test.h"
static networkstatus_t *dummy_ns = NULL;
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index c41afff5d..8177f92a1 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -20,6 +20,7 @@
#include "scheduler.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
/* Test suite stuff */
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index b8e3492ea..2b4ff59a3 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -20,6 +20,7 @@
#include "networkstatus.h"
#include "log_test_helpers.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
int channelpadding_get_netflow_inactive_timeout_ms(channel_t *chan);
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index 3b91baca3..dc223274b 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -14,6 +14,8 @@
#include "routerparse.h"
#include "workqueue.h"
+#include "networkstatus_st.h"
+
#include "test.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index f5a3b6f65..10169a70c 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -46,6 +46,7 @@
#include "voting_schedule.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "port_cfg_st.h"
#include "tor_version_st.h"
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index fca132c9f..3fad1c3af 100644
--- a/src/test/test_dir_common.c
+++ b/src/test/test_dir_common.c
@@ -14,6 +14,7 @@
#include "test_dir_common.h"
#include "voting_schedule.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index ff9740b91..2e9eb3b74 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -36,6 +36,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#ifdef _WIN32
diff --git a/src/test/test_dos.c b/src/test/test_dos.c
index fcc537499..714533908 100644
--- a/src/test/test_dos.c
+++ b/src/test/test_dos.c
@@ -16,6 +16,7 @@
#include "nodelist.h"
#include "routerlist.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "test.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index cf9da232c..572263773 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -33,6 +33,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c
index 24bf58f94..38f237c5d 100644
--- a/src/test/test_guardfraction.c
+++ b/src/test/test_guardfraction.c
@@ -15,6 +15,7 @@
#include "routerparse.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index b2f892c7f..415f6f30e 100644
--- a/src/test/test_hs_cache.c
+++ b/src/test/test_hs_cache.c
@@ -19,6 +19,7 @@
#include "proto_http.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "hs_test_helpers.h"
#include "test_helpers.h"
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index b75e743d3..ca87d5e92 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -41,6 +41,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "socks_request_st.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 21a109d2b..1cfa4a240 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -33,6 +33,7 @@
#include "util.h"
#include "voting_schedule.h"
+#include "networkstatus_st.h"
#include "node_st.h"
/** Test the validation of HS v3 addresses */
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 83a9d3cb5..ab27b4dc4 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -55,6 +55,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 4b168f49e..27fdf4a9d 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -13,6 +13,8 @@
#include "routerparse.h"
#include "torcert.h"
+#include "networkstatus_st.h"
+
#include "test.h"
#ifdef _WIN32
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index a3f2de29f..4a876f355 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -12,6 +12,7 @@
#include "nodelist.h"
#include "torcert.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "test.h"
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index bf97499ee..45d63a806 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -35,6 +35,7 @@
#include "statefile.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "test.h"
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index baafb9813..a1b4d60a2 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -23,6 +23,7 @@
#include "voting_schedule.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
static authority_cert_t *mock_cert;
1
0

[tor/master] Extract ns_detached_signatures_st into its own header.
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit 62315dab8420e44d8d469f858e88b7b4fe384122
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:49:30 2018 -0400
Extract ns_detached_signatures_st into its own header.
---
src/or/dirauth/dirvote.c | 1 +
src/or/include.am | 1 +
src/or/networkstatus.c | 1 +
src/or/ns_detached_signatures_st.h | 22 ++++++++++++++++++++++
src/or/or.h | 12 +-----------
src/or/routerparse.c | 1 +
src/test/test_dir.c | 1 +
7 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index aa30a11f5..c402bcb79 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -33,6 +33,7 @@
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
+#include "ns_detached_signatures_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
#include "vote_timing_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index e6f23e916..7dcb72573 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -253,6 +253,7 @@ ORHEADERS = \
src/or/networkstatus_voter_info_st.h \
src/or/nodelist.h \
src/or/node_st.h \
+ src/or/ns_detached_signatures_st.h \
src/or/ntmain.h \
src/or/onion.h \
src/or/onion_fast.h \
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 8ad1bb25b..0c351f0e4 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -79,6 +79,7 @@
#include "document_signature_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
+#include "ns_detached_signatures_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/ns_detached_signatures_st.h b/src/or/ns_detached_signatures_st.h
new file mode 100644
index 000000000..4cb37de63
--- /dev/null
+++ b/src/or/ns_detached_signatures_st.h
@@ -0,0 +1,22 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NS_DETACHED_SIGNATURES_ST_H
+#define NS_DETACHED_SIGNATURES_ST_H
+
+/** A set of signatures for a networkstatus consensus. Unless otherwise
+ * noted, all fields are as for networkstatus_t. */
+struct ns_detached_signatures_t {
+ time_t valid_after;
+ time_t fresh_until;
+ time_t valid_until;
+ strmap_t *digests; /**< Map from flavor name to digestset_t */
+ strmap_t *signatures; /**< Map from flavor name to list of
+ * document_signature_t */
+};
+
+#endif
+
diff --git a/src/or/or.h b/src/or/or.h
index 43fe09f23..d6a42bd9d 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1883,17 +1883,7 @@ typedef enum {
#define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1)
typedef struct networkstatus_t networkstatus_t;
-
-/** A set of signatures for a networkstatus consensus. Unless otherwise
- * noted, all fields are as for networkstatus_t. */
-typedef struct ns_detached_signatures_t {
- time_t valid_after;
- time_t fresh_until;
- time_t valid_until;
- strmap_t *digests; /**< Map from flavor name to digestset_t */
- strmap_t *signatures; /**< Map from flavor name to list of
- * document_signature_t */
-} ns_detached_signatures_t;
+typedef struct ns_detached_signatures_t ns_detached_signatures_t;
/** Allowable types of desc_store_t. */
typedef enum store_type_t {
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index ab64b1c82..be6ed00e2 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -84,6 +84,7 @@
#include "document_signature_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
+#include "ns_detached_signatures_st.h"
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 10169a70c..76f3b13f6 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -48,6 +48,7 @@
#include "document_signature_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
+#include "ns_detached_signatures_st.h"
#include "port_cfg_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
1
0

18 Jun '18
commit fde868ffe3ace818d67374858c54418296a62e79
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 15:27:46 2018 -0400
Extract cell type and their queues into new headers
Since packed_cell and destroy_cell exist only to be queued, they go
in the same headers as the queues.
---
src/or/cell_queue_st.h | 28 ++++++++++++++++++++
src/or/cell_st.h | 20 ++++++++++++++
src/or/channel.c | 2 ++
src/or/channelpadding.c | 1 +
src/or/channeltls.c | 3 +++
src/or/circpathbias.c | 1 +
src/or/circuit_st.h | 2 ++
src/or/circuitbuild.c | 1 +
src/or/circuitmux.c | 2 ++
src/or/command.c | 2 ++
src/or/connection_edge.c | 1 +
src/or/connection_or.c | 3 +++
src/or/destroy_cell_queue_st.h | 27 +++++++++++++++++++
src/or/include.am | 4 +++
src/or/main.c | 1 +
src/or/onion.c | 1 +
src/or/or.h | 59 +++++-------------------------------------
src/or/proto_cell.c | 2 ++
src/or/relay.c | 3 +++
src/or/relay_crypto.c | 1 +
src/or/var_cell_st.h | 23 ++++++++++++++++
src/test/bench.c | 1 +
src/test/test_cell_formats.c | 5 ++++
src/test/test_cell_queue.c | 2 ++
src/test/test_channel.c | 2 ++
src/test/test_channelpadding.c | 1 +
src/test/test_circuitmux.c | 2 ++
src/test/test_helpers.c | 1 +
src/test/test_link_handshake.c | 1 +
src/test/test_oom.c | 1 +
src/test/test_proto_misc.c | 2 ++
src/test/test_relay.c | 1 +
src/test/test_relaycell.c | 1 +
src/test/test_relaycrypt.c | 1 +
34 files changed, 155 insertions(+), 53 deletions(-)
diff --git a/src/or/cell_queue_st.h b/src/or/cell_queue_st.h
new file mode 100644
index 000000000..6c429eacc
--- /dev/null
+++ b/src/or/cell_queue_st.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef PACKED_CELL_ST_H
+#define PACKED_CELL_ST_H
+
+/** A cell as packed for writing to the network. */
+struct packed_cell_t {
+ /** Next cell queued on this circuit. */
+ TOR_SIMPLEQ_ENTRY(packed_cell_t) next;
+ char body[CELL_MAX_NETWORK_SIZE]; /**< Cell as packed for network. */
+ uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
+ * was inserted */
+};
+
+/** A queue of cells on a circuit, waiting to be added to the
+ * or_connection_t's outbuf. */
+struct cell_queue_t {
+ /** Linked list of packed_cell_t*/
+ TOR_SIMPLEQ_HEAD(cell_simpleq, packed_cell_t) head;
+ int n; /**< The number of cells in the queue. */
+};
+
+#endif
+
diff --git a/src/or/cell_st.h b/src/or/cell_st.h
new file mode 100644
index 000000000..08ed29087
--- /dev/null
+++ b/src/or/cell_st.h
@@ -0,0 +1,20 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef CELL_ST_H
+#define CELL_ST_H
+
+/** Parsed onion routing cell. All communication between nodes
+ * is via cells. */
+struct cell_t {
+ circid_t circ_id; /**< Circuit which received the cell. */
+ uint8_t command; /**< Type of the cell: one of CELL_PADDING, CELL_CREATE,
+ * CELL_DESTROY, etc */
+ uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
+};
+
+#endif
+
diff --git a/src/or/channel.c b/src/or/channel.c
index c30e50801..d53e0d2e3 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -80,6 +80,8 @@
#include "networkstatus.h"
#include "rendservice.h"
+#include "cell_queue_st.h"
+
/* Global lists of channels */
/* All channel_t instances */
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 7eb0cc282..e3aa2dc10 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -23,6 +23,7 @@
#include "compat_time.h"
#include "rendservice.h"
+#include "cell_st.h"
#include "or_connection_st.h"
STATIC int32_t channelpadding_get_netflow_inactive_timeout_ms(
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index dd0c1628c..e2b6cabd4 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -60,10 +60,13 @@
#include "channelpadding_negotiation.h"
#include "channelpadding.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
#include "routerinfo_st.h"
+#include "var_cell_st.h"
/** How many CELL_PADDING cells have we received, ever? */
uint64_t stats_n_padding_cells_processed = 0;
diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c
index 9ca45df27..a36d67526 100644
--- a/src/or/circpathbias.c
+++ b/src/or/circpathbias.c
@@ -35,6 +35,7 @@
#include "networkstatus.h"
#include "relay.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/circuit_st.h b/src/or/circuit_st.h
index 2c4f72a72..f977d542d 100644
--- a/src/or/circuit_st.h
+++ b/src/or/circuit_st.h
@@ -9,6 +9,8 @@
#include "or.h"
+#include "cell_queue_st.h"
+
/**
* A circuit is a path over the onion routing
* network. Applications can connect to one end of the circuit, and can
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 103dd6eb9..41afb7543 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -65,6 +65,7 @@
#include "routerset.h"
#include "transports.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
#include "node_st.h"
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 5f7f002f4..e07331175 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -75,6 +75,8 @@
#include "circuitmux.h"
#include "relay.h"
+#include "cell_queue_st.h"
+#include "destroy_cell_queue_st.h"
#include "or_circuit_st.h"
/*
diff --git a/src/or/command.c b/src/or/command.c
index 148578a26..39136966e 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -56,8 +56,10 @@
#include "router.h"
#include "routerlist.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "var_cell_st.h"
/** How many CELL_CREATE cells have we received, ever? */
uint64_t stats_n_create_cells_processed = 0;
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e177b0ee2..4f1b5d2d5 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -97,6 +97,7 @@
#include "routerset.h"
#include "circuitbuild.h"
+#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 1810c3954..bbd6fa0ed 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -61,10 +61,13 @@
#include "torcert.h"
#include "channelpadding.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
#include "routerinfo_st.h"
+#include "var_cell_st.h"
static int connection_tls_finish_handshake(or_connection_t *conn);
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
diff --git a/src/or/destroy_cell_queue_st.h b/src/or/destroy_cell_queue_st.h
new file mode 100644
index 000000000..67c25935e
--- /dev/null
+++ b/src/or/destroy_cell_queue_st.h
@@ -0,0 +1,27 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef DESTROY_CELL_QUEUE_ST_H
+#define DESTROY_CELL_QUEUE_ST_H
+
+/** A single queued destroy cell. */
+struct destroy_cell_t {
+ TOR_SIMPLEQ_ENTRY(destroy_cell_t) next;
+ circid_t circid;
+ uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
+ * was inserted */
+ uint8_t reason;
+};
+
+/** A queue of destroy cells on a channel. */
+struct destroy_cell_queue_t {
+ /** Linked list of packed_cell_t */
+ TOR_SIMPLEQ_HEAD(dcell_simpleq, destroy_cell_t) head;
+ int n; /**< The number of cells in the queue. */
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index cc059ef51..ec8e27556 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -184,6 +184,8 @@ ORHEADERS = \
src/or/authority_cert_st.h \
src/or/auth_dirs.inc \
src/or/bridges.h \
+ src/or/cell_st.h \
+ src/or/cell_queue_st.h \
src/or/channel.h \
src/or/channelpadding.h \
src/or/channeltls.h \
@@ -213,6 +215,7 @@ ORHEADERS = \
src/or/crypt_path_reference_st.h \
src/or/cpuworker.h \
src/or/desc_store_st.h \
+ src/or/destroy_cell_queue_st.h \
src/or/directory.h \
src/or/dirserv.h \
src/or/dir_connection_st.h \
@@ -316,6 +319,7 @@ ORHEADERS = \
src/or/torcert.h \
src/or/tor_api_internal.h \
src/or/tor_version_st.h \
+ src/or/var_cell_st.h \
src/or/vote_microdesc_hash_st.h \
src/or/vote_routerstatus_st.h \
src/or/vote_timing_st.h \
diff --git a/src/or/main.c b/src/or/main.c
index 664105046..bb5aaaf60 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -122,6 +122,7 @@
#include "dirauth/mode.h"
#include "dirauth/shared_random.h"
+#include "cell_st.h"
#include "entry_connection_st.h"
#include "networkstatus_st.h"
#include "or_connection_st.h"
diff --git a/src/or/onion.c b/src/or/onion.c
index 813ad265e..ac2f40a55 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -77,6 +77,7 @@
#include "rephist.h"
#include "router.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
// trunnel
diff --git a/src/or/or.h b/src/or/or.h
index 958c1e2bb..66c863a82 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1176,26 +1176,12 @@ typedef struct channel_tls_s channel_tls_t;
typedef struct circuitmux_s circuitmux_t;
-/** Parsed onion routing cell. All communication between nodes
- * is via cells. */
-typedef struct cell_t {
- circid_t circ_id; /**< Circuit which received the cell. */
- uint8_t command; /**< Type of the cell: one of CELL_PADDING, CELL_CREATE,
- * CELL_DESTROY, etc */
- uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
-} cell_t;
-
-/** Parsed variable-length onion routing cell. */
-typedef struct var_cell_t {
- /** Type of the cell: CELL_VERSIONS, etc. */
- uint8_t command;
- /** Circuit thich received the cell */
- circid_t circ_id;
- /** Number of bytes actually stored in <b>payload</b> */
- uint16_t payload_len;
- /** Payload of this cell */
- uint8_t payload[FLEXIBLE_ARRAY_MEMBER];
-} var_cell_t;
+typedef struct cell_t cell_t;
+typedef struct var_cell_t var_cell_t;
+typedef struct packed_cell_t packed_cell_t;
+typedef struct cell_queue_t cell_queue_t;
+typedef struct destroy_cell_t destroy_cell_t;
+typedef struct destroy_cell_queue_t destroy_cell_queue_t;
/** A parsed Extended ORPort message. */
typedef struct ext_or_cmd_t {
@@ -1204,39 +1190,6 @@ typedef struct ext_or_cmd_t {
char body[FLEXIBLE_ARRAY_MEMBER]; /** Message body */
} ext_or_cmd_t;
-/** A cell as packed for writing to the network. */
-typedef struct packed_cell_t {
- /** Next cell queued on this circuit. */
- TOR_SIMPLEQ_ENTRY(packed_cell_t) next;
- char body[CELL_MAX_NETWORK_SIZE]; /**< Cell as packed for network. */
- uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
- * was inserted */
-} packed_cell_t;
-
-/** A queue of cells on a circuit, waiting to be added to the
- * or_connection_t's outbuf. */
-typedef struct cell_queue_t {
- /** Linked list of packed_cell_t*/
- TOR_SIMPLEQ_HEAD(cell_simpleq, packed_cell_t) head;
- int n; /**< The number of cells in the queue. */
-} cell_queue_t;
-
-/** A single queued destroy cell. */
-typedef struct destroy_cell_t {
- TOR_SIMPLEQ_ENTRY(destroy_cell_t) next;
- circid_t circid;
- uint32_t inserted_timestamp; /**< Time (in timestamp units) when this cell
- * was inserted */
- uint8_t reason;
-} destroy_cell_t;
-
-/** A queue of destroy cells on a channel. */
-typedef struct destroy_cell_queue_t {
- /** Linked list of packed_cell_t */
- TOR_SIMPLEQ_HEAD(dcell_simpleq, destroy_cell_t) head;
- int n; /**< The number of cells in the queue. */
-} destroy_cell_queue_t;
-
/** Beginning of a RELAY cell payload. */
typedef struct {
uint8_t command; /**< The end-to-end relay command. */
diff --git a/src/or/proto_cell.c b/src/or/proto_cell.c
index 75eb2a7e7..84620ce37 100644
--- a/src/or/proto_cell.c
+++ b/src/or/proto_cell.c
@@ -10,6 +10,8 @@
#include "connection_or.h"
+#include "var_cell_st.h"
+
/** True iff the cell command <b>command</b> is one that implies a
* variable-length cell in Tor link protocol <b>linkproto</b>. */
static inline int
diff --git a/src/or/relay.c b/src/or/relay.c
index ff97b5266..62c9204db 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -82,8 +82,11 @@
#include "scheduler.h"
#include "rephist.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
+#include "destroy_cell_queue_st.h"
#include "entry_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/relay_crypto.c b/src/or/relay_crypto.c
index 7603d3b4e..82ff9aca8 100644
--- a/src/or/relay_crypto.c
+++ b/src/or/relay_crypto.c
@@ -12,6 +12,7 @@
#include "relay.h"
#include "relay_crypto.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/var_cell_st.h b/src/or/var_cell_st.h
new file mode 100644
index 000000000..1a9ea0759
--- /dev/null
+++ b/src/or/var_cell_st.h
@@ -0,0 +1,23 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef VAR_CELL_ST_H
+#define VAR_CELL_ST_H
+
+/** Parsed variable-length onion routing cell. */
+struct var_cell_t {
+ /** Type of the cell: CELL_VERSIONS, etc. */
+ uint8_t command;
+ /** Circuit thich received the cell */
+ circid_t circ_id;
+ /** Number of bytes actually stored in <b>payload</b> */
+ uint16_t payload_len;
+ /** Payload of this cell */
+ uint8_t payload[FLEXIBLE_ARRAY_MEMBER];
+};
+
+#endif
+
diff --git a/src/test/bench.c b/src/test/bench.c
index 784bcf326..cce94a1ce 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -26,6 +26,7 @@
#include "crypto_rand.h"
#include "consdiff.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c
index 54d971678..fe9cfaf4a 100644
--- a/src/test/test_cell_formats.c
+++ b/src/test/test_cell_formats.c
@@ -18,6 +18,11 @@
#include "onion_fast.h"
#include "onion_ntor.h"
#include "relay.h"
+
+#include "cell_st.h"
+#include "cell_queue_st.h"
+#include "var_cell_st.h"
+
#include "test.h"
#include <stdlib.h>
diff --git a/src/test/test_cell_queue.c b/src/test/test_cell_queue.c
index b41f7ac38..a333fc55e 100644
--- a/src/test/test_cell_queue.c
+++ b/src/test/test_cell_queue.c
@@ -8,6 +8,8 @@
#include "relay.h"
#include "test.h"
+#include "cell_st.h"
+#include "cell_queue_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index fbc964ecc..ba9d8bfb2 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -20,9 +20,11 @@
#include "scheduler.h"
#include "networkstatus.h"
+#include "cell_st.h"
#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "routerstatus_st.h"
+#include "var_cell_st.h"
/* Test suite stuff */
#include "log_test_helpers.h"
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 206b57ad1..b2b9dc8d3 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -20,6 +20,7 @@
#include "networkstatus.h"
#include "log_test_helpers.h"
+#include "cell_st.h"
#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c
index 14c759870..85d91ab8b 100644
--- a/src/test/test_circuitmux.c
+++ b/src/test/test_circuitmux.c
@@ -13,6 +13,8 @@
#include "scheduler.h"
#include "test.h"
+#include "destroy_cell_queue_st.h"
+
/* XXXX duplicated function from test_circuitlist.c */
static channel_t *
new_fake_channel(void)
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index fc32665a1..7b6aa25e6 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -24,6 +24,7 @@
#include "relay.h"
#include "routerlist.h"
+#include "cell_st.h"
#include "connection_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index 1c2e91b83..1447d0435 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -24,6 +24,7 @@
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
+#include "var_cell_st.h"
#include "test.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_oom.c b/src/test/test_oom.c
index fcee7cc73..8d506271a 100644
--- a/src/test/test_oom.c
+++ b/src/test/test_oom.c
@@ -18,6 +18,7 @@
#include "test.h"
#include "test_helpers.h"
+#include "cell_st.h"
#include "entry_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_proto_misc.c b/src/test/test_proto_misc.c
index 263ca4744..e2d063a77 100644
--- a/src/test/test_proto_misc.c
+++ b/src/test/test_proto_misc.c
@@ -15,6 +15,8 @@
#include "proto_control0.h"
#include "proto_ext_or.h"
+#include "var_cell_st.h"
+
static void
test_proto_var_cell(void *arg)
{
diff --git a/src/test/test_relay.c b/src/test/test_relay.c
index 4a526671b..df1cfd79a 100644
--- a/src/test/test_relay.c
+++ b/src/test/test_relay.c
@@ -9,6 +9,7 @@
/* For init/free stuff */
#include "scheduler.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
/* Test suite stuff */
diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c
index b5aba766d..dc42709e0 100644
--- a/src/test/test_relaycell.c
+++ b/src/test/test_relaycell.c
@@ -16,6 +16,7 @@
#include "relay.h"
#include "test.h"
+#include "cell_st.h"
#include "crypt_path_st.h"
#include "entry_connection_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_relaycrypt.c b/src/test/test_relaycrypt.c
index 62bcedabc..9f6b5bbe6 100644
--- a/src/test/test_relaycrypt.c
+++ b/src/test/test_relaycrypt.c
@@ -11,6 +11,7 @@
#include "relay.h"
#include "relay_crypto.h"
+#include "cell_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
1
0

18 Jun '18
commit f85d731e3af16e72682f68be4f598f08ed227618
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:58:43 2018 -0400
Extract download_status_t into its own header.
---
src/or/directory.c | 21 ++++++++++++++
src/or/directory.h | 25 ++---------------
src/or/download_status_st.h | 65 +++++++++++++++++++++++++++++++++++++++++++
src/or/include.am | 1 +
src/or/or.h | 54 +----------------------------------
src/or/routerstatus_st.h | 2 ++
src/or/signed_descriptor_st.h | 2 ++
src/test/test_controller.c | 1 +
8 files changed, 95 insertions(+), 76 deletions(-)
diff --git a/src/or/directory.c b/src/or/directory.c
index 4e2e96886..f6d6d28d4 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -5632,6 +5632,27 @@ download_status_reset(download_status_t *dls)
/* Don't reset dls->want_authority or dls->increment_on */
}
+/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
+ * ready to get its download reattempted. */
+int
+download_status_is_ready(download_status_t *dls, time_t now)
+{
+ /* dls wasn't reset before it was used */
+ if (dls->next_attempt_at == 0) {
+ download_status_reset(dls);
+ }
+
+ return download_status_get_next_attempt_at(dls) <= now;
+}
+
+/** Mark <b>dl</b> as never downloadable. */
+void
+download_status_mark_impossible(download_status_t *dl)
+{
+ dl->n_download_failures = IMPOSSIBLE_TO_DOWNLOAD;
+ dl->n_download_attempts = IMPOSSIBLE_TO_DOWNLOAD;
+}
+
/** Return the number of failures on <b>dls</b> since the last success (if
* any). */
int
diff --git a/src/or/directory.h b/src/or/directory.h
index 8823de4d9..27dc986a0 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -134,30 +134,9 @@ time_t download_status_increment_attempt(download_status_t *dls,
time(NULL))
void download_status_reset(download_status_t *dls);
-static int download_status_is_ready(download_status_t *dls, time_t now);
+int download_status_is_ready(download_status_t *dls, time_t now);
time_t download_status_get_next_attempt_at(const download_status_t *dls);
-
-/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
- * ready to get its download reattempted. */
-static inline int
-download_status_is_ready(download_status_t *dls, time_t now)
-{
- /* dls wasn't reset before it was used */
- if (dls->next_attempt_at == 0) {
- download_status_reset(dls);
- }
-
- return download_status_get_next_attempt_at(dls) <= now;
-}
-
-static void download_status_mark_impossible(download_status_t *dl);
-/** Mark <b>dl</b> as never downloadable. */
-static inline void
-download_status_mark_impossible(download_status_t *dl)
-{
- dl->n_download_failures = IMPOSSIBLE_TO_DOWNLOAD;
- dl->n_download_attempts = IMPOSSIBLE_TO_DOWNLOAD;
-}
+void download_status_mark_impossible(download_status_t *dl);
int download_status_get_n_failures(const download_status_t *dls);
int download_status_get_n_attempts(const download_status_t *dls);
diff --git a/src/or/download_status_st.h b/src/or/download_status_st.h
new file mode 100644
index 000000000..8ed77aaa7
--- /dev/null
+++ b/src/or/download_status_st.h
@@ -0,0 +1,65 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef DOWNLOAD_STATUS_ST_H
+#define DOWNLOAD_STATUS_ST_H
+
+/** Information about our plans for retrying downloads for a downloadable
+ * directory object.
+ * Each type of downloadable directory object has a corresponding retry
+ * <b>schedule</b>, which can be different depending on whether the object is
+ * being downloaded from an authority or a mirror (<b>want_authority</b>).
+ * <b>next_attempt_at</b> contains the next time we will attempt to download
+ * the object.
+ * For schedules that <b>increment_on</b> failure, <b>n_download_failures</b>
+ * is used to determine the position in the schedule. (Each schedule is a
+ * smartlist of integer delays, parsed from a CSV option.) Every time a
+ * connection attempt fails, <b>n_download_failures</b> is incremented,
+ * the new delay value is looked up from the schedule, and
+ * <b>next_attempt_at</b> is set delay seconds from the time the previous
+ * connection failed. Therefore, at most one failure-based connection can be
+ * in progress for each download_status_t.
+ * For schedules that <b>increment_on</b> attempt, <b>n_download_attempts</b>
+ * is used to determine the position in the schedule. Every time a
+ * connection attempt is made, <b>n_download_attempts</b> is incremented,
+ * the new delay value is looked up from the schedule, and
+ * <b>next_attempt_at</b> is set delay seconds from the time the previous
+ * connection was attempted. Therefore, multiple concurrent attempted-based
+ * connections can be in progress for each download_status_t.
+ * After an object is successfully downloaded, any other concurrent connections
+ * are terminated. A new schedule which starts at position 0 is used for
+ * subsequent downloads of the same object.
+ */
+struct download_status_t {
+ time_t next_attempt_at; /**< When should we try downloading this object
+ * again? */
+ uint8_t n_download_failures; /**< Number of failed downloads of the most
+ * recent object, since the last success. */
+ uint8_t n_download_attempts; /**< Number of (potentially concurrent) attempts
+ * to download the most recent object, since
+ * the last success. */
+ download_schedule_bitfield_t schedule : 8; /**< What kind of object is being
+ * downloaded? This determines the
+ * schedule used for the download.
+ */
+ download_want_authority_bitfield_t want_authority : 1; /**< Is the download
+ * happening from an authority
+ * or a mirror? This determines
+ * the schedule used for the
+ * download. */
+ download_schedule_increment_bitfield_t increment_on : 1; /**< does this
+ * schedule increment on each attempt,
+ * or after each failure? */
+ uint8_t last_backoff_position; /**< number of attempts/failures, depending
+ * on increment_on, when we last recalculated
+ * the delay. Only updated if backoff
+ * == 1. */
+ int last_delay_used; /**< last delay used for random exponential backoff;
+ * only updated if backoff == 1 */
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index cb9f4994e..c28e95f05 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -217,6 +217,7 @@ ORHEADERS = \
src/or/dir_connection_st.h \
src/or/dir_server_st.h \
src/or/document_signature_st.h \
+ src/or/download_status_st.h \
src/or/dns.h \
src/or/dns_structs.h \
src/or/dnsserv.h \
diff --git a/src/or/or.h b/src/or/or.h
index 3dd1b6fe5..9668760cc 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1449,59 +1449,7 @@ typedef enum {
#define download_schedule_increment_bitfield_t \
ENUM_BF(download_schedule_increment_t)
-/** Information about our plans for retrying downloads for a downloadable
- * directory object.
- * Each type of downloadable directory object has a corresponding retry
- * <b>schedule</b>, which can be different depending on whether the object is
- * being downloaded from an authority or a mirror (<b>want_authority</b>).
- * <b>next_attempt_at</b> contains the next time we will attempt to download
- * the object.
- * For schedules that <b>increment_on</b> failure, <b>n_download_failures</b>
- * is used to determine the position in the schedule. (Each schedule is a
- * smartlist of integer delays, parsed from a CSV option.) Every time a
- * connection attempt fails, <b>n_download_failures</b> is incremented,
- * the new delay value is looked up from the schedule, and
- * <b>next_attempt_at</b> is set delay seconds from the time the previous
- * connection failed. Therefore, at most one failure-based connection can be
- * in progress for each download_status_t.
- * For schedules that <b>increment_on</b> attempt, <b>n_download_attempts</b>
- * is used to determine the position in the schedule. Every time a
- * connection attempt is made, <b>n_download_attempts</b> is incremented,
- * the new delay value is looked up from the schedule, and
- * <b>next_attempt_at</b> is set delay seconds from the time the previous
- * connection was attempted. Therefore, multiple concurrent attempted-based
- * connections can be in progress for each download_status_t.
- * After an object is successfully downloaded, any other concurrent connections
- * are terminated. A new schedule which starts at position 0 is used for
- * subsequent downloads of the same object.
- */
-typedef struct download_status_t {
- time_t next_attempt_at; /**< When should we try downloading this object
- * again? */
- uint8_t n_download_failures; /**< Number of failed downloads of the most
- * recent object, since the last success. */
- uint8_t n_download_attempts; /**< Number of (potentially concurrent) attempts
- * to download the most recent object, since
- * the last success. */
- download_schedule_bitfield_t schedule : 8; /**< What kind of object is being
- * downloaded? This determines the
- * schedule used for the download.
- */
- download_want_authority_bitfield_t want_authority : 1; /**< Is the download
- * happening from an authority
- * or a mirror? This determines
- * the schedule used for the
- * download. */
- download_schedule_increment_bitfield_t increment_on : 1; /**< does this
- * schedule increment on each attempt,
- * or after each failure? */
- uint8_t last_backoff_position; /**< number of attempts/failures, depending
- * on increment_on, when we last recalculated
- * the delay. Only updated if backoff
- * == 1. */
- int last_delay_used; /**< last delay used for random exponential backoff;
- * only updated if backoff == 1 */
-} download_status_t;
+typedef struct download_status_t download_status_t;
/** If n_download_failures is this high, the download can never happen. */
#define IMPOSSIBLE_TO_DOWNLOAD 255
diff --git a/src/or/routerstatus_st.h b/src/or/routerstatus_st.h
index 9c25e88b6..f8a27ccac 100644
--- a/src/or/routerstatus_st.h
+++ b/src/or/routerstatus_st.h
@@ -7,6 +7,8 @@
#ifndef ROUTERSTATUS_ST_H
#define ROUTERSTATUS_ST_H
+#include "download_status_st.h"
+
/** Contents of a single router entry in a network status object.
*/
struct routerstatus_t {
diff --git a/src/or/signed_descriptor_st.h b/src/or/signed_descriptor_st.h
index 0159e9176..c057c5ddc 100644
--- a/src/or/signed_descriptor_st.h
+++ b/src/or/signed_descriptor_st.h
@@ -7,6 +7,8 @@
#ifndef SIGNED_DESCRIPTOR_ST_H
#define SIGNED_DESCRIPTOR_ST_H
+#include "download_status_st.h"
+
/** Information need to cache an onion router's descriptor. */
struct signed_descriptor_t {
/** Pointer to the raw server descriptor, preceded by annotations. Not
diff --git a/src/test/test_controller.c b/src/test/test_controller.c
index 6b8edc57c..958874fcb 100644
--- a/src/test/test_controller.c
+++ b/src/test/test_controller.c
@@ -14,6 +14,7 @@
#include "test_helpers.h"
#include "control_connection_st.h"
+#include "download_status_st.h"
static void
test_add_onion_helper_keyarg_v3(void *arg)
1
0

[tor/master] Extract desc_store_t and routerlist_t into their own headers.
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit b8ae4111e38bc9cf6ac395b78601c150f710936f
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:07:17 2018 -0400
Extract desc_store_t and routerlist_t into their own headers.
---
src/or/control.c | 1 +
src/or/desc_store_st.h | 34 ++++++++++++++++++++++++++++
src/or/dirauth/dirvote.c | 1 +
src/or/dirserv.c | 1 +
src/or/include.am | 2 ++
src/or/networkstatus.c | 1 +
src/or/nodelist.c | 1 +
src/or/or.h | 51 ++----------------------------------------
src/or/routerlist.c | 1 +
src/or/routerlist_st.h | 40 +++++++++++++++++++++++++++++++++
src/or/routerparse.c | 1 +
src/or/routerparse.h | 1 +
src/test/test_dir.c | 1 +
src/test/test_dir_handle_get.c | 1 +
src/test/test_helpers.c | 1 +
15 files changed, 89 insertions(+), 49 deletions(-)
diff --git a/src/or/control.c b/src/or/control.c
index 0afd6cf97..55670e65e 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -92,6 +92,7 @@
#include "rend_authorized_client_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerlist_st.h"
#include "socks_request_st.h"
#ifndef _WIN32
diff --git a/src/or/desc_store_st.h b/src/or/desc_store_st.h
new file mode 100644
index 000000000..40238f4ce
--- /dev/null
+++ b/src/or/desc_store_st.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef DESC_STORE_ST_H
+#define DESC_STORE_ST_H
+
+/** A 'store' is a set of descriptors saved on disk, with accompanying
+ * journal, mmaped as needed, rebuilt as needed. */
+struct desc_store_t {
+ /** Filename (within DataDir) for the store. We append .tmp to this
+ * filename for a temporary file when rebuilding the store, and .new to this
+ * filename for the journal. */
+ const char *fname_base;
+ /** Human-readable description of what this store contains. */
+ const char *description;
+
+ tor_mmap_t *mmap; /**< A mmap for the main file in the store. */
+
+ store_type_t type; /**< What's stored in this store? */
+
+ /** The size of the router log, in bytes. */
+ size_t journal_len;
+ /** The size of the router store, in bytes. */
+ size_t store_len;
+ /** Total bytes dropped since last rebuild: this is space currently
+ * used in the cache and the journal that could be freed by a rebuild. */
+ size_t bytes_dropped;
+};
+
+#endif
+
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index c402bcb79..1f95b985c 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -34,6 +34,7 @@
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "ns_detached_signatures_st.h"
+#include "routerlist_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
#include "vote_timing_st.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index c4edb94af..d92bc8e1f 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -38,6 +38,7 @@
#include "dir_connection_st.h"
#include "node_st.h"
+#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 7dcb72573..396cfea5a 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -210,6 +210,7 @@ ORHEADERS = \
src/or/crypt_path_st.h \
src/or/crypt_path_reference_st.h \
src/or/cpuworker.h \
+ src/or/desc_store_st.h \
src/or/directory.h \
src/or/dirserv.h \
src/or/dir_connection_st.h \
@@ -294,6 +295,7 @@ ORHEADERS = \
src/or/router.h \
src/or/routerkeys.h \
src/or/routerlist.h \
+ src/or/routerlist_st.h \
src/or/routerkeys.h \
src/or/routerset.h \
src/or/routerparse.h \
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 0c351f0e4..6f7223b60 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -81,6 +81,7 @@
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
#include "node_st.h"
+#include "routerlist_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 45a63388f..26b1788a3 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -71,6 +71,7 @@
#include "dir_server_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerlist_st.h"
static void nodelist_drop_node(node_t *node, int remove_from_ht);
#define node_free(val) \
diff --git a/src/or/or.h b/src/or/or.h
index d6a42bd9d..a8ddcd240 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1891,55 +1891,8 @@ typedef enum store_type_t {
EXTRAINFO_STORE = 1
} store_type_t;
-/** A 'store' is a set of descriptors saved on disk, with accompanying
- * journal, mmaped as needed, rebuilt as needed. */
-typedef struct desc_store_t {
- /** Filename (within DataDir) for the store. We append .tmp to this
- * filename for a temporary file when rebuilding the store, and .new to this
- * filename for the journal. */
- const char *fname_base;
- /** Human-readable description of what this store contains. */
- const char *description;
-
- tor_mmap_t *mmap; /**< A mmap for the main file in the store. */
-
- store_type_t type; /**< What's stored in this store? */
-
- /** The size of the router log, in bytes. */
- size_t journal_len;
- /** The size of the router store, in bytes. */
- size_t store_len;
- /** Total bytes dropped since last rebuild: this is space currently
- * used in the cache and the journal that could be freed by a rebuild. */
- size_t bytes_dropped;
-} desc_store_t;
-
-/** Contents of a directory of onion routers. */
-typedef struct {
- /** Map from server identity digest to a member of routers. */
- struct digest_ri_map_t *identity_map;
- /** Map from server descriptor digest to a signed_descriptor_t from
- * routers or old_routers. */
- struct digest_sd_map_t *desc_digest_map;
- /** Map from extra-info digest to an extrainfo_t. Only exists for
- * routers in routers or old_routers. */
- struct digest_ei_map_t *extra_info_map;
- /** Map from extra-info digests to a signed_descriptor_t for a router
- * descriptor having that extra-info digest. Only exists for
- * routers in routers or old_routers. */
- struct digest_sd_map_t *desc_by_eid_map;
- /** List of routerinfo_t for all currently live routers we know. */
- smartlist_t *routers;
- /** List of signed_descriptor_t for older router descriptors we're
- * caching. */
- smartlist_t *old_routers;
- /** Store holding server descriptors. If present, any router whose
- * cache_info.saved_location == SAVED_IN_CACHE is stored in this file
- * starting at cache_info.saved_offset */
- desc_store_t desc_store;
- /** Store holding extra-info documents. */
- desc_store_t extrainfo_store;
-} routerlist_t;
+typedef struct desc_store_t desc_store_t;
+typedef struct routerlist_t routerlist_t;
/** Information on router used when extending a circuit. We don't need a
* full routerinfo_t to extend: we only need addr:port:keyid to build an OR
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 0f9318153..102f3125a 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -131,6 +131,7 @@
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
+#include "routerlist_st.h"
#include "vote_routerstatus_st.h"
// #define DEBUG_ROUTERLIST
diff --git a/src/or/routerlist_st.h b/src/or/routerlist_st.h
new file mode 100644
index 000000000..6dfecf4d8
--- /dev/null
+++ b/src/or/routerlist_st.h
@@ -0,0 +1,40 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef ROUTERLIST_ST_H
+#define ROUTERLIST_ST_H
+
+#include "desc_store_st.h"
+
+/** Contents of a directory of onion routers. */
+struct routerlist_t {
+ /** Map from server identity digest to a member of routers. */
+ struct digest_ri_map_t *identity_map;
+ /** Map from server descriptor digest to a signed_descriptor_t from
+ * routers or old_routers. */
+ struct digest_sd_map_t *desc_digest_map;
+ /** Map from extra-info digest to an extrainfo_t. Only exists for
+ * routers in routers or old_routers. */
+ struct digest_ei_map_t *extra_info_map;
+ /** Map from extra-info digests to a signed_descriptor_t for a router
+ * descriptor having that extra-info digest. Only exists for
+ * routers in routers or old_routers. */
+ struct digest_sd_map_t *desc_by_eid_map;
+ /** List of routerinfo_t for all currently live routers we know. */
+ smartlist_t *routers;
+ /** List of signed_descriptor_t for older router descriptors we're
+ * caching. */
+ smartlist_t *old_routers;
+ /** Store holding server descriptors. If present, any router whose
+ * cache_info.saved_location == SAVED_IN_CACHE is stored in this file
+ * starting at cache_info.saved_offset */
+ desc_store_t desc_store;
+ /** Store holding extra-info documents. */
+ desc_store_t extrainfo_store;
+};
+
+#endif
+
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index be6ed00e2..ea1320de7 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -88,6 +88,7 @@
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index 418fd3acd..663c80fb8 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -43,6 +43,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s, const char *end,
int allow_annotations,
const char *prepend_annotations,
int *can_dl_again_out);
+struct digest_ri_map_t;
extrainfo_t *extrainfo_parse_entry_from_string(const char *s, const char *end,
int cache_copy, struct digest_ri_map_t *routermap,
int *can_dl_again_out);
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 76f3b13f6..9412f879d 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -50,6 +50,7 @@
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
#include "port_cfg_st.h"
+#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index 2e9eb3b74..c8704505e 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -38,6 +38,7 @@
#include "dir_server_st.h"
#include "networkstatus_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
+#include "routerlist_st.h"
#ifdef _WIN32
/* For mkdir() */
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index 78d10b261..fc32665a1 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -27,6 +27,7 @@
#include "connection_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerlist_st.h"
#include "test.h"
#include "test_helpers.h"
1
0