]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Extract routerstatus_t into its own header.
authorNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 18:33:03 +0000 (14:33 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Jun 2018 18:33:03 +0000 (14:33 -0400)
29 files changed:
src/or/bridges.c
src/or/circuitbuild.c
src/or/dir_server_st.h
src/or/hs_common.c
src/or/hs_control.c
src/or/hs_service.c
src/or/include.am
src/or/microdesc.c
src/or/nodelist.c
src/or/or.h
src/or/policies.c
src/or/rendclient.c
src/or/rendcommon.c
src/or/rendservice.c
src/or/routerset.c
src/or/routerstatus_st.h [new file with mode: 0644]
src/or/vote_routerstatus_st.h
src/test/test_address_set.c
src/test/test_channel.c
src/test/test_channelpadding.c
src/test/test_dos.c
src/test/test_entrynodes.c
src/test/test_hs_common.c
src/test/test_hs_control.c
src/test/test_microdesc.c
src/test/test_nodelist.c
src/test/test_policy.c
src/test/test_routerlist.c
src/test/test_routerset.c

index d5a9d05b49d2b6de7b190e2e983028d2cbc88590..3108e1495140c8962824c76c6e66075ab965fec2 100644 (file)
@@ -28,6 +28,7 @@
 #include "transports.h"
 
 #include "node_st.h"
+#include "routerstatus_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
index 42ce1cfdaac0aaa8c445b3e1ecefa8c2263aeb3a..4944a70ce84b4bb391a7ac7c8087a434e23c0a12 100644 (file)
@@ -70,6 +70,7 @@
 #include "node_st.h"
 #include "or_circuit_st.h"
 #include "origin_circuit_st.h"
+#include "routerstatus_st.h"
 
 static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
                                             uint16_t port,
index d2222c26f8f95d5640bed616802dced886321b02..b9d3f1c5566c5e9612d746d6a8fe8b7ea2fc6ad4 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "torint.h"
 #include "or.h"
+#include "routerstatus_st.h"
 
 /** Represents information about a single trusted or fallback directory
  * server. */
index e5d15a1b1c4a03b883547c7ebefe869617f877f1..c63d4330d62f486290f3dba2d59643fd1049867b 100644 (file)
@@ -37,6 +37,7 @@
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "origin_circuit_st.h"
+#include "routerstatus_st.h"
 
 /* Trunnel */
 #include "ed25519_cert.h"
index 4f3dd62c6113233fa1a23dcd135875d90dc4b58e..3ad7fb151f50f0c9941189c59f6c52fac0c67c43 100644 (file)
@@ -16,6 +16,7 @@
 #include "nodelist.h"
 
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 /* Send on the control port the "HS_DESC REQUESTED [...]" event.
  *
index 007c84cafca5ab57444e8e2d668f566113f73e1b..ef809a69f4b10509748c7c081a520db80ed95eac 100644 (file)
@@ -44,6 +44,7 @@
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "origin_circuit_st.h"
+#include "routerstatus_st.h"
 
 /* Trunnel */
 #include "ed25519_cert.h"
index afacd7772f047814f44630ab1456958ed6e080fd..602b811bebe2f879a2d05dc92fb7e682213bfe18 100644 (file)
@@ -301,6 +301,7 @@ ORHEADERS = \
        src/or/routerkeys.h                             \
        src/or/routerset.h                              \
        src/or/routerparse.h                            \
+       src/or/routerstatus_st.h                        \
        src/or/scheduler.h                              \
        src/or/server_port_cfg_st.h                     \
        src/or/shared_random_client.h                   \
index 208f35b1ccd55262c29455e36bb8f7052a2d8d3e..f125cf40579f90c4eb057ea6f6f06b05a5266fba 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "networkstatus_st.h"
 #include "node_st.h"
+#include "routerstatus_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
index 26b1788a30ac9504be6d9d3045f3e90688f662ab..b542fd516642526bd5b68509c5b8a73ae31b4966 100644 (file)
@@ -72,6 +72,7 @@
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "routerlist_st.h"
+#include "routerstatus_st.h"
 
 static void nodelist_drop_node(node_t *node, int remove_from_ht);
 #define node_free(val) \
index d07e594d772c7802ad308b89210e8fe99f14ce79..0d564b1e2df102475782a3b181d6eb518e8b07e2 100644 (file)
@@ -1694,73 +1694,7 @@ typedef struct {
 } routerinfo_t;
 
 typedef struct extrainfo_t extrainfo_t;
-
-/** Contents of a single router entry in a network status object.
- */
-typedef struct routerstatus_t {
-  time_t published_on; /**< When was this router published? */
-  char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
-                                      * has. */
-  char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
-                                     * key. */
-  /** Digest of the router's most recent descriptor or microdescriptor.
-   * If it's a descriptor, we only use the first DIGEST_LEN bytes. */
-  char descriptor_digest[DIGEST256_LEN];
-  uint32_t addr; /**< IPv4 address for this router, in host order. */
-  uint16_t or_port; /**< IPv4 OR port for this router. */
-  uint16_t dir_port; /**< Directory port for this router. */
-  tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
-  uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
-  unsigned int is_authority:1; /**< True iff this router is an authority. */
-  unsigned int is_exit:1; /**< True iff this router is a good exit. */
-  unsigned int is_stable:1; /**< True iff this router stays up a long time. */
-  unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
-  /** True iff this router is called 'running' in the consensus. We give it
-   * this funny name so that we don't accidentally use this bit as a view of
-   * whether we think the router is *currently* running.  If that's what you
-   * want to know, look at is_running in node_t. */
-  unsigned int is_flagged_running:1;
-  unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
-  unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
-                              * router. */
-  unsigned int is_valid:1; /**< True iff this router isn't invalid. */
-  unsigned int is_possible_guard:1; /**< True iff this router would be a good
-                                     * choice as an entry guard. */
-  unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
-                               * an exit node. */
-  unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
-                             * service directory. */
-  unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
-                             * or it claims to accept tunnelled dir requests.
-                             */
-
-  unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
-  unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
-  unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
-                                    * the Unmeasured flag set. */
-
-  /** Flags to summarize the protocol versions for this routerstatus_t. */
-  protover_summary_flags_t pv;
-
-  uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
-                       * the vote/consensus, in kilobytes/sec. */
-
-  /** The consensus has guardfraction information for this router. */
-  unsigned int has_guardfraction:1;
-  /** The guardfraction value of this router. */
-  uint32_t guardfraction_percentage;
-
-  char *exitsummary; /**< exit policy summary -
-                      * XXX weasel: this probably should not stay a string. */
-
-  /* ---- The fields below aren't derived from the networkstatus; they
-   * hold local information only. */
-
-  time_t last_dir_503_at; /**< When did this router last tell us that it
-                           * was too busy to serve directory info? */
-  download_status_t dl_status;
-
-} routerstatus_t;
+typedef struct routerstatus_t routerstatus_t;
 
 /** A single entry in a parsed policy summary, describing a range of ports. */
 typedef struct short_policy_entry_t {
index 78cbcd5cd2bb8b41d6bdb1bd1dc576f51d121f76..0c1e3497eb34574f85c661abe18a49cb9bee55c9 100644 (file)
@@ -33,6 +33,7 @@
 #include "dir_server_st.h"
 #include "node_st.h"
 #include "port_cfg_st.h"
+#include "routerstatus_st.h"
 
 /** Policy that addresses for incoming SOCKS connections must match. */
 static smartlist_t *socks_policy = NULL;
index a48f83fa984bbdfa357206e288d73bf6a51218ab..3236127852c371ea01eedea9178b4bfe4721c258 100644 (file)
@@ -40,6 +40,7 @@
 #include "origin_circuit_st.h"
 #include "rend_intro_point_st.h"
 #include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
 
 static extend_info_t *rend_client_get_random_intro_impl(
                           const rend_cache_entry_t *rend_query,
index 694b52db1f4a9ace180ce4fb0ce37a9d1a12aec5..9049699465c173fd73366cf82d2421458a9edebd 100644 (file)
@@ -38,6 +38,7 @@
 #include "rend_encoded_v2_service_descriptor_st.h"
 #include "rend_intro_point_st.h"
 #include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
 
 /** Return 0 if one and two are the same service ids, else -1 or 1 */
 int
index 8552fedd3197a3c3e7f6fb38da5c785a17cece90..170d78147a7f4c96ce70974a68fdc6201822d25e 100644 (file)
@@ -46,6 +46,7 @@
 #include "rend_encoded_v2_service_descriptor_st.h"
 #include "rend_intro_point_st.h"
 #include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
 
 struct rend_service_t;
 static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
index 8a6ff3b582fc39fe96ccdf83225d85e9b0b14e88..1033702f3911ea4fcfd8b69562da3eebce87a184 100644 (file)
@@ -37,6 +37,7 @@
 #include "routerset.h"
 
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 /** Return a new empty routerset. */
 routerset_t *
diff --git a/src/or/routerstatus_st.h b/src/or/routerstatus_st.h
new file mode 100644 (file)
index 0000000..9c25e88
--- /dev/null
@@ -0,0 +1,78 @@
+/* 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 ROUTERSTATUS_ST_H
+#define ROUTERSTATUS_ST_H
+
+/** Contents of a single router entry in a network status object.
+ */
+struct routerstatus_t {
+  time_t published_on; /**< When was this router published? */
+  char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
+                                      * has. */
+  char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
+                                     * key. */
+  /** Digest of the router's most recent descriptor or microdescriptor.
+   * If it's a descriptor, we only use the first DIGEST_LEN bytes. */
+  char descriptor_digest[DIGEST256_LEN];
+  uint32_t addr; /**< IPv4 address for this router, in host order. */
+  uint16_t or_port; /**< IPv4 OR port for this router. */
+  uint16_t dir_port; /**< Directory port for this router. */
+  tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
+  uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
+  unsigned int is_authority:1; /**< True iff this router is an authority. */
+  unsigned int is_exit:1; /**< True iff this router is a good exit. */
+  unsigned int is_stable:1; /**< True iff this router stays up a long time. */
+  unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
+  /** True iff this router is called 'running' in the consensus. We give it
+   * this funny name so that we don't accidentally use this bit as a view of
+   * whether we think the router is *currently* running.  If that's what you
+   * want to know, look at is_running in node_t. */
+  unsigned int is_flagged_running:1;
+  unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
+  unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
+                              * router. */
+  unsigned int is_valid:1; /**< True iff this router isn't invalid. */
+  unsigned int is_possible_guard:1; /**< True iff this router would be a good
+                                     * choice as an entry guard. */
+  unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
+                               * an exit node. */
+  unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
+                             * service directory. */
+  unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
+                             * or it claims to accept tunnelled dir requests.
+                             */
+
+  unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
+  unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
+  unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
+                                    * the Unmeasured flag set. */
+
+  /** Flags to summarize the protocol versions for this routerstatus_t. */
+  protover_summary_flags_t pv;
+
+  uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
+                       * the vote/consensus, in kilobytes/sec. */
+
+  /** The consensus has guardfraction information for this router. */
+  unsigned int has_guardfraction:1;
+  /** The guardfraction value of this router. */
+  uint32_t guardfraction_percentage;
+
+  char *exitsummary; /**< exit policy summary -
+                      * XXX weasel: this probably should not stay a string. */
+
+  /* ---- The fields below aren't derived from the networkstatus; they
+   * hold local information only. */
+
+  time_t last_dir_503_at; /**< When did this router last tell us that it
+                           * was too busy to serve directory info? */
+  download_status_t dl_status;
+
+};
+
+#endif
+
index 71c204fad363bc5e5a925dde47bb5f9d6beb4a6f..7ac9a60034bbaeea50e717d81494359fd2fc98bd 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef VOTE_ROUTERSTATUS_ST_H
 #define VOTE_ROUTERSTATUS_ST_H
 
+#include "routerstatus_st.h"
+
 /** The claim about a single router, made in a vote. */
 struct vote_routerstatus_t {
   routerstatus_t status; /**< Underlying 'status' object for this router.
index 441d14927ddd8b361c01cfbc467276363adf854d..a704e6fb3e6ca08a645adbea20c80ce5ba6a9c12 100644 (file)
@@ -11,6 +11,7 @@
 #include "torcert.h"
 
 #include "networkstatus_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"
 
index 8177f92a1af3cd8e6cc479aef711c85fe1c98ca8..fbc964ecc0fbecc8466db4004b89cf0223e92d6c 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "networkstatus_st.h"
 #include "origin_circuit_st.h"
+#include "routerstatus_st.h"
 
 /* Test suite stuff */
 #include "log_test_helpers.h"
index 2b4ff59a32300f80c1a059b8e8490f1f07d3598d..206b57ad1aa9843e1c673482af9711a20454c884 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "networkstatus_st.h"
 #include "or_connection_st.h"
+#include "routerstatus_st.h"
 
 int channelpadding_get_netflow_inactive_timeout_ms(channel_t *chan);
 int64_t channelpadding_compute_time_until_pad_for_netflow(channel_t *chan);
index 714533908492aac764a1eb4807b0fa767606949f..bc77bd8cd6dc91d7a146922d5b4bc2695fe67f3d 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "networkstatus_st.h"
 #include "or_connection_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"
 #include "log_test_helpers.h"
index 5722637735cecc4bc6fa569e293b0eac17fd0712..d16af591d48df3786967ccc7436ad41024aea361 100644 (file)
@@ -36,6 +36,7 @@
 #include "networkstatus_st.h"
 #include "node_st.h"
 #include "origin_circuit_st.h"
+#include "routerstatus_st.h"
 
 #include "test_helpers.h"
 #include "log_test_helpers.h"
index 1cfa4a2409325543b090b25bbfeed9358a35b7e1..ea5fb497929bf41a1800e65563d6e2329b8bc242 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "networkstatus_st.h"
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 /** Test the validation of HS v3 addresses */
 static void
index 1fcea44f4b0f6f2c28f8f78ecd719fc8a387c804..f720373375bc3a6d1c32a739131293f22fc7b474 100644 (file)
@@ -17,6 +17,7 @@
 #include "nodelist.h"
 
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 #include "test_helpers.h"
 
index 27fdf4a9d0003b75dc90333bc1c8dfa79f7dd824..1fdac092431e9ea0c85d0c0d569027d5176818e5 100644 (file)
@@ -14,6 +14,7 @@
 #include "torcert.h"
 
 #include "networkstatus_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"
 
index 4a876f3557717d9a43758edcd6f7bf7d3309b6c2..018f109e5c8f919e56eeaed60b06723847fe72ad 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "networkstatus_st.h"
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"
 
index 673336eaeb3179d92e838d746b5e23de9f151f1d..71c623070249a8495616ee79594e5259e835f97f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "node_st.h"
 #include "port_cfg_st.h"
+#include "routerstatus_st.h"
 
 /* Helper: assert that short_policy parses and writes back out as itself,
    or as <b>expected</b> if that's provided. */
index 1c2ba9d67330752d64cbe6c78691d5c983195082..41f7c09bde202338594902c4c4cf009c8dff3e39 100644 (file)
@@ -38,6 +38,7 @@
 #include "dir_connection_st.h"
 #include "networkstatus_st.h"
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"
 #include "test_dir_common.h"
index 0e1ad3fdfa2f0ee9f6fb9974b6a6e46bdcf458bf..21db9bb3ba8c8bc52f21e5b124c10a0ea479359d 100644 (file)
@@ -11,6 +11,7 @@
 #include "nodelist.h"
 
 #include "node_st.h"
+#include "routerstatus_st.h"
 
 #include "test.h"