]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move dir_server_t into its own header.
authorNick Mathewson <nickm@torproject.org>
Thu, 14 Jun 2018 20:58:01 +0000 (16:58 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 14 Jun 2018 20:58:01 +0000 (16:58 -0400)
13 files changed:
src/or/dir_server_st.h [new file with mode: 0644]
src/or/dirauth/dirvote.c
src/or/directory.c
src/or/include.am
src/or/networkstatus.c
src/or/nodelist.c
src/or/or.h
src/or/policies.c
src/or/router.c
src/or/routerlist.c
src/test/test_config.c
src/test/test_dir_handle_get.c
src/test/test_shared_random.c

diff --git a/src/or/dir_server_st.h b/src/or/dir_server_st.h
new file mode 100644 (file)
index 0000000..d2222c2
--- /dev/null
@@ -0,0 +1,54 @@
+/* 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 DIR_SERVER_ST_H
+#define DIR_SERVER_ST_H
+
+#include "torint.h"
+#include "or.h"
+
+/** Represents information about a single trusted or fallback directory
+ * server. */
+typedef struct dir_server_t {
+  char *description;
+  char *nickname;
+  char *address; /**< Hostname. */
+  /* XX/teor - why do we duplicate the address and port fields here and in
+   *           fake_status? Surely we could just use fake_status (#17867). */
+  tor_addr_t ipv6_addr; /**< IPv6 address if present; AF_UNSPEC if not */
+  uint32_t addr; /**< IPv4 address. */
+  uint16_t dir_port; /**< Directory port. */
+  uint16_t or_port; /**< OR port: Used for tunneling connections. */
+  uint16_t ipv6_orport; /**< OR port corresponding to ipv6_addr. */
+  double weight; /** Weight used when selecting this node at random */
+  char digest[DIGEST_LEN]; /**< Digest of identity key. */
+  char v3_identity_digest[DIGEST_LEN]; /**< Digest of v3 (authority only,
+                                        * high-security) identity key. */
+
+  unsigned int is_running:1; /**< True iff we think this server is running. */
+  unsigned int is_authority:1; /**< True iff this is a directory authority
+                                * of some kind. */
+
+  /** True iff this server has accepted the most recent server descriptor
+   * we tried to upload to it. */
+  unsigned int has_accepted_serverdesc:1;
+
+  /** What kind of authority is this? (Bitfield.) */
+  dirinfo_type_t type;
+
+  time_t addr_current_at; /**< When was the document that we derived the
+                           * address information from published? */
+
+  routerstatus_t fake_status; /**< Used when we need to pass this trusted
+                               * dir_server_t to
+                               * directory_request_set_routerstatus.
+                               * as a routerstatus_t.  Not updated by the
+                               * router-status management code!
+                               **/
+} dir_server_t;
+
+#endif
+
index b097b10cf9b7e9d5c35c1d6f6d0b5e72499ce3ae..3a2df5ee67ea106257718c988f0224a400109df6 100644 (file)
@@ -28,6 +28,8 @@
 #include "dirauth/mode.h"
 #include "dirauth/shared_random_state.h"
 
+#include "dir_server_st.h"
+
 /**
  * \file dirvote.c
  * \brief Functions to compute directory consensus, and schedule voting.
index c7da804909defa05733b7d9857aa0a6065c1b004..a65f1fb14a76330e257a1dec5ad4cd7dda6c73ab 100644 (file)
@@ -53,6 +53,8 @@
 #include "dirauth/mode.h"
 #include "dirauth/shared_random.h"
 
+#include "dir_server_st.h"
+
 /**
  * \file directory.c
  * \brief Code to send and fetch information from directory authorities and
index 1dc6c79ca2635dd71af576de672a5d6a1eb2fdc0..b6e8e6daf820074830b6a74aa3a5d82e9637f65d 100644 (file)
@@ -206,6 +206,7 @@ ORHEADERS = \
        src/or/cpuworker.h                              \
        src/or/directory.h                              \
        src/or/dirserv.h                                \
+       src/or/dir_server_st.h                          \
        src/or/dns.h                                    \
        src/or/dns_structs.h                            \
        src/or/dnsserv.h                                \
index 998eaf74e6abda97e216193a521a82d7f66acf74..3ed6e3d6c9cf394ecebe3092c40bc48c9b96725b 100644 (file)
@@ -74,6 +74,8 @@
 #include "dirauth/mode.h"
 #include "dirauth/shared_random.h"
 
+#include "dir_server_st.h"
+
 /** Most recently received and validated v3 "ns"-flavored consensus network
  * status. */
 STATIC networkstatus_t *current_ns_consensus = NULL;
index bc9a79940b31514cfc729fe6b6f7ecaacdd2c147..4d67904c8157d667f196c085789a024cfb8f0bdf 100644 (file)
@@ -68,6 +68,8 @@
 
 #include "dirauth/mode.h"
 
+#include "dir_server_st.h"
+
 static void nodelist_drop_node(node_t *node, int remove_from_ht);
 #define node_free(val) \
   FREE_AND_NULL(node_t, node_free_, (val))
index 6c54c2752048f3d6337a2e77eb4784ce403f3c5d..bf2efd14715a64227d2e3bbd9ecbc879ccbd378f 100644 (file)
@@ -5314,45 +5314,7 @@ typedef struct rend_service_descriptor_t {
 
 /********************************* routerlist.c ***************************/
 
-/** Represents information about a single trusted or fallback directory
- * server. */
-typedef struct dir_server_t {
-  char *description;
-  char *nickname;
-  char *address; /**< Hostname. */
-  /* XX/teor - why do we duplicate the address and port fields here and in
-   *           fake_status? Surely we could just use fake_status (#17867). */
-  tor_addr_t ipv6_addr; /**< IPv6 address if present; AF_UNSPEC if not */
-  uint32_t addr; /**< IPv4 address. */
-  uint16_t dir_port; /**< Directory port. */
-  uint16_t or_port; /**< OR port: Used for tunneling connections. */
-  uint16_t ipv6_orport; /**< OR port corresponding to ipv6_addr. */
-  double weight; /** Weight used when selecting this node at random */
-  char digest[DIGEST_LEN]; /**< Digest of identity key. */
-  char v3_identity_digest[DIGEST_LEN]; /**< Digest of v3 (authority only,
-                                        * high-security) identity key. */
-
-  unsigned int is_running:1; /**< True iff we think this server is running. */
-  unsigned int is_authority:1; /**< True iff this is a directory authority
-                                * of some kind. */
-
-  /** True iff this server has accepted the most recent server descriptor
-   * we tried to upload to it. */
-  unsigned int has_accepted_serverdesc:1;
-
-  /** What kind of authority is this? (Bitfield.) */
-  dirinfo_type_t type;
-
-  time_t addr_current_at; /**< When was the document that we derived the
-                           * address information from published? */
-
-  routerstatus_t fake_status; /**< Used when we need to pass this trusted
-                               * dir_server_t to
-                               * directory_request_set_routerstatus.
-                               * as a routerstatus_t.  Not updated by the
-                               * router-status management code!
-                               **/
-} dir_server_t;
+typedef struct dir_server_t dir_server_t;
 
 #define RELAY_REQUIRED_MIN_BANDWIDTH (75*1024)
 #define BRIDGE_REQUIRED_MIN_BANDWIDTH (50*1024)
index a78e8a1c86696b595fc5193ea376e3190bbb6abc..51dc83827ef49afb82965517d4e827a017c34025 100644 (file)
@@ -30,6 +30,7 @@
 #include "geoip.h"
 #include "ht.h"
 
+#include "dir_server_st.h"
 #include "port_cfg_st.h"
 
 /** Policy that addresses for incoming SOCKS connections must match. */
index 9eaef44605d51cbcb6a81dac75db6173e06ea0e5..c361e21a5fc761cf0e0f16a68476745e7da799d7 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "dirauth/mode.h"
 
+#include "dir_server_st.h"
 #include "port_cfg_st.h"
 
 /**
index 8788dc0190eb4e2d87fb22025123c279de78ae0b..015b1012a80d9dab6f2efdf2aca210b5ffa1660d 100644 (file)
 #include "dirauth/dirvote.h"
 #include "dirauth/mode.h"
 
+#include "dir_server_st.h"
+
 // #define DEBUG_ROUTERLIST
 
 /****************************************************************************/
index e8bfe9e12e4d13955ec7db873eff4ba5ed62a8fb..2b761d2baea52b5468bf6ae0aec39dbeb26fc56f 100644 (file)
@@ -43,6 +43,8 @@
 #include "statefile.h"
 
 #include "test_helpers.h"
+
+#include "dir_server_st.h"
 #include "port_cfg_st.h"
 
 static void
index 688d26bdc17bf14e48eaab825cdc79c8a9b49d9b..4338bba657241918ff26a1ba8bb35044e3091b22 100644 (file)
@@ -34,6 +34,8 @@
 #include "log_test_helpers.h"
 #include "voting_schedule.h"
 
+#include "dir_server_st.h"
+
 #ifdef _WIN32
 /* For mkdir() */
 #include <direct.h>
index f6ab0dfabd8b895c3c48098ffdbf3abb9f8797d2..baafb9813b75645e09b28ddb7b05776a9c8c1d44 100644 (file)
@@ -22,6 +22,8 @@
 #include "shared_random_client.h"
 #include "voting_schedule.h"
 
+#include "dir_server_st.h"
+
 static authority_cert_t *mock_cert;
 
 static authority_cert_t *