]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Extract cpath_build_state into its own header.
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 16:07:20 +0000 (12:07 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 16:07:20 +0000 (12:07 -0400)
More modules use this than I had expected!

20 files changed:
src/or/circpathbias.c
src/or/circuitbuild.c
src/or/circuitlist.c
src/or/circuituse.c
src/or/connection_edge.c
src/or/control.c
src/or/cpath_build_state_st.h [new file with mode: 0644]
src/or/hs_circuit.c
src/or/hs_client.c
src/or/include.am
src/or/or.h
src/or/relay.c
src/or/rendclient.c
src/or/rendcommon.c
src/or/rendservice.c
src/test/test_circuitstats.c
src/test/test_circuituse.c
src/test/test_entrynodes.c
src/test/test_hs_client.c
src/test/test_hs_service.c

index d1bdaedc3c7f077ee0c410e990d565c7bedd7409..9ca45df273a340d1382ef1695a5b0fefaaf0aebf 100644 (file)
@@ -35,6 +35,7 @@
 #include "networkstatus.h"
 #include "relay.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "origin_circuit_st.h"
 
index c5d1c65f59a167705c12163c6098d6ff255d5baa..0df616a5ac14fb7947f97dd0afac0b17ff295b31 100644 (file)
@@ -65,6 +65,7 @@
 #include "routerset.h"
 #include "transports.h"
 
+#include "cpath_build_state_st.h"
 #include "entry_connection_st.h"
 #include "or_circuit_st.h"
 #include "origin_circuit_st.h"
index 3f03ae2f4eb1e15f54e29848db1196afb396f815..46974aea433b428cecaa1059f22246510d15f8a8 100644 (file)
@@ -92,6 +92,7 @@
 
 #include "ht.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_reference_st.h"
 #include "dir_connection_st.h"
 #include "edge_connection_st.h"
index 3a18c3403879d2ce617d68098a75955cb5806a7e..626aff7bb7c17eaa60963811e2d10f259d7ad7e4 100644 (file)
@@ -57,6 +57,7 @@
 #include "router.h"
 #include "routerlist.h"
 
+#include "cpath_build_state_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
 #include "or_circuit_st.h"
index b972724a805c826e0b29f34c632eb63be930b700..27ee0ea279d7142f7c562bb9ba45b41ae829e7b7 100644 (file)
@@ -97,6 +97,7 @@
 #include "routerset.h"
 #include "circuitbuild.h"
 
+#include "cpath_build_state_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
 #include "or_circuit_st.h"
index 18377880197be02fea22c9eb12d6ebc1d3cfe9f7..972462e38aaf438140afa8526652f43e4215f046 100644 (file)
@@ -82,6 +82,7 @@
 #include "shared_random_client.h"
 
 #include "control_connection_st.h"
+#include "cpath_build_state_st.h"
 #include "entry_connection_st.h"
 #include "or_connection_st.h"
 #include "or_circuit_st.h"
diff --git a/src/or/cpath_build_state_st.h b/src/or/cpath_build_state_st.h
new file mode 100644 (file)
index 0000000..504f638
--- /dev/null
@@ -0,0 +1,38 @@
+/* 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 CIRCUIT_BUILD_STATE_ST_ST_H
+#define CIRCUIT_BUILD_STATE_ST_ST_H
+
+/** Information used to build a circuit. */
+struct cpath_build_state_t {
+  /** Intended length of the final circuit. */
+  int desired_path_len;
+  /** How to extend to the planned exit node. */
+  extend_info_t *chosen_exit;
+  /** Whether every node in the circ must have adequate uptime. */
+  unsigned int need_uptime : 1;
+  /** Whether every node in the circ must have adequate capacity. */
+  unsigned int need_capacity : 1;
+  /** Whether the last hop was picked with exiting in mind. */
+  unsigned int is_internal : 1;
+  /** Did we pick this as a one-hop tunnel (not safe for other streams)?
+   * These are for encrypted dir conns that exit to this router, not
+   * for arbitrary exits from the circuit. */
+  unsigned int onehop_tunnel : 1;
+  /** The crypt_path_t to append after rendezvous: used for rendezvous. */
+  crypt_path_t *pending_final_cpath;
+  /** A ref-counted reference to the crypt_path_t to append after
+   * rendezvous; used on the service side. */
+  crypt_path_reference_t *service_pending_final_cpath_ref;
+  /** How many times has building a circuit for this task failed? */
+  int failure_count;
+  /** At what time should we give up on this task? */
+  time_t expiry_time;
+};
+
+#endif
+
index 56ae4a152efac52ffe1704ec1048e02afd4f7368..b5ac7184a0ed7308c50ec1189562119e6b33c31d 100644 (file)
@@ -33,6 +33,7 @@
 #include "hs/cell_common.h"
 #include "hs/cell_establish_intro.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "origin_circuit_st.h"
 
index c4db60e527de36e22b836da81ec5ded1f6359f35..18276bfb84e40b87fe21efc2e10e62f90912be97 100644 (file)
@@ -35,6 +35,7 @@
 #include "router.h"
 #include "routerset.h"
 
+#include "cpath_build_state_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
 #include "origin_circuit_st.h"
index e15b58c389460b88ac8cfbf0cadcbcc22eb01817..e38013f02bb8f95215f730b70ebcfe551cb290af 100644 (file)
@@ -206,6 +206,7 @@ ORHEADERS = \
        src/or/consdiffmgr.h                            \
        src/or/control_connection_st.h                  \
        src/or/control.h                                \
+       src/or/cpath_build_state_st.h                   \
        src/or/crypt_path_st.h                          \
        src/or/crypt_path_reference_st.h                \
        src/or/cpuworker.h                              \
index 5c8267cf52116cdcc1eba7edd6b2459a3d46aebe..4403aae83d665876c1211da255333fe80bc81154 100644 (file)
@@ -2286,32 +2286,7 @@ typedef struct crypt_path_reference_t crypt_path_reference_t;
 
 #define DH_KEY_LEN DH_BYTES
 
-/** Information used to build a circuit. */
-typedef struct {
-  /** Intended length of the final circuit. */
-  int desired_path_len;
-  /** How to extend to the planned exit node. */
-  extend_info_t *chosen_exit;
-  /** Whether every node in the circ must have adequate uptime. */
-  unsigned int need_uptime : 1;
-  /** Whether every node in the circ must have adequate capacity. */
-  unsigned int need_capacity : 1;
-  /** Whether the last hop was picked with exiting in mind. */
-  unsigned int is_internal : 1;
-  /** Did we pick this as a one-hop tunnel (not safe for other streams)?
-   * These are for encrypted dir conns that exit to this router, not
-   * for arbitrary exits from the circuit. */
-  unsigned int onehop_tunnel : 1;
-  /** The crypt_path_t to append after rendezvous: used for rendezvous. */
-  crypt_path_t *pending_final_cpath;
-  /** A ref-counted reference to the crypt_path_t to append after
-   * rendezvous; used on the service side. */
-  crypt_path_reference_t *service_pending_final_cpath_ref;
-  /** How many times has building a circuit for this task failed? */
-  int failure_count;
-  /** At what time should we give up on this task? */
-  time_t expiry_time;
-} cpath_build_state_t;
+typedef struct cpath_build_state_t cpath_build_state_t;
 
 /** "magic" value for an origin_circuit_t */
 #define ORIGIN_CIRCUIT_MAGIC 0x35315243u
index 55c2abd121003e96aafb7c64e0b4b89cdbd0d81e..127609a2b94f08c9fe47f874c8b11323c8e4748a 100644 (file)
@@ -82,6 +82,7 @@
 #include "scheduler.h"
 #include "rephist.h"
 
+#include "cpath_build_state_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
 #include "or_circuit_st.h"
index 8e621562ad59b51c83852be702f7efe83510a99b..c55f63c33f08ef4786201a218f9f6432eec39be6 100644 (file)
@@ -33,6 +33,7 @@
 #include "routerlist.h"
 #include "routerset.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
index 116ca730f991bc6289af4ea9b6ec4344b64269a0..719a1537c9a67c565673c4bb66caaff4e0d06d0a 100644 (file)
@@ -31,6 +31,7 @@
 #include "routerlist.h"
 #include "routerparse.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "origin_circuit_st.h"
 
index 20a4288af09a7d1cc76ab10e3fe7c39731f3f549..ef46ff6ced8fdb2e2e44516a14105da8f7f4f94d 100644 (file)
@@ -36,6 +36,7 @@
 #include "routerparse.h"
 #include "routerset.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "crypt_path_reference_st.h"
 #include "edge_connection_st.h"
index 8efde6f844af5beb34a25ae12c1a762a4df56362..9f6f4626da14c4748ff89bf1fe95c5efa4a04e50 100644 (file)
@@ -17,6 +17,7 @@
 #include "circuituse.h"
 #include "channel.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "origin_circuit_st.h"
 
index 7d1b1d9b00ba814866f918c18fd043117dd4dc21..16ae84380ad03cf3825daa3abb9c3e730cc75637 100644 (file)
@@ -14,6 +14,7 @@
 #include "circuitbuild.h"
 #include "nodelist.h"
 
+#include "cpath_build_state_st.h"
 #include "origin_circuit_st.h"
 
 static void
index 83a3ecbfc0f7c21475bc59e0af53ee337b632739..bff6a40bd398592c13a2b275e0bf619a88a958bd 100644 (file)
@@ -30,6 +30,7 @@
 #include "statefile.h"
 #include "util.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "dir_connection_st.h"
 #include "origin_circuit_st.h"
index 4443bd922b49b37cc05d16aa5c4c062720e11056..98e95be09a7f374b3d63d29ff8d87292a378524f 100644 (file)
@@ -37,6 +37,7 @@
 #include "connection_edge.h"
 #include "networkstatus.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "dir_connection_st.h"
 #include "entry_connection_st.h"
index 947243e678ac3ca35d0dc8c6637332392b79b9f4..3487785500ec0097993c1a1cf202f113c9781f44 100644 (file)
@@ -53,6 +53,7 @@
 #include "dirauth/shared_random_state.h"
 #include "voting_schedule.h"
 
+#include "cpath_build_state_st.h"
 #include "crypt_path_st.h"
 #include "origin_circuit_st.h"