]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make server_port_cfg_t and port_cfg_t into separate headers.
authorNick Mathewson <nickm@torproject.org>
Thu, 14 Jun 2018 20:41:54 +0000 (16:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 14 Jun 2018 20:48:15 +0000 (16:48 -0400)
12 files changed:
src/or/config.c
src/or/connection.c
src/or/include.am
src/or/main.c
src/or/or.h
src/or/policies.c
src/or/port_cfg_st.h [new file with mode: 0644]
src/or/router.c
src/or/server_port_cfg_st.h [new file with mode: 0644]
src/test/test_config.c
src/test/test_dir.c
src/test/test_policy.c

index 94a58f348865979cb4f9b45b23dfa715213889d4..51ecca43181471704a048adf3c8f41e4efaa1c6c 100644 (file)
 #include "dirauth/dirvote.h"
 #include "dirauth/mode.h"
 
+#include "port_cfg_st.h"
+
 #ifdef HAVE_SYSTEMD
 #   if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
 /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse
index 5185b45b1436d1013bc318625f661a4e294438bb..0f64982251348ed00b65e61ef2c318cda4a46ca3 100644 (file)
 #include <sys/un.h>
 #endif
 
+#include "port_cfg_st.h"
+
 static connection_t *connection_listener_new(
                                const struct sockaddr *listensockaddr,
                                socklen_t listensocklen, int type,
index c38e677a61a73c0b2cbeeb19df5f035f929428a7..1dc6c79ca2635dd71af576de672a5d6a1eb2fdc0 100644 (file)
@@ -246,6 +246,7 @@ ORHEADERS = \
        src/or/transports.h                             \
        src/or/parsecommon.h                    \
        src/or/periodic.h                               \
+       src/or/port_cfg_st.h                            \
        src/or/policies.h                               \
        src/or/protover.h                               \
        src/or/proto_cell.h                             \
@@ -270,6 +271,7 @@ ORHEADERS = \
        src/or/routerset.h                              \
        src/or/routerparse.h                            \
        src/or/scheduler.h                              \
+       src/or/server_port_cfg_st.h                     \
        src/or/shared_random_client.h                   \
        src/or/statefile.h                              \
        src/or/status.h                                 \
index 9dce158b33073926edb08ccd40e1e4bf8f668127..1f6d16a19d02d018b324778ff0d3b4b0c0e4937e 100644 (file)
 #include "dirauth/mode.h"
 #include "dirauth/shared_random.h"
 
+#include "port_cfg_st.h"
+
 #ifdef HAVE_SYSTEMD
 #   if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
 /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse
index 5321c81c81b77d81f494669f550abf9bdb418ebc..6c54c2752048f3d6337a2e77eb4784ce403f3c5d 100644 (file)
@@ -1248,15 +1248,7 @@ typedef struct {
 
 typedef struct socks_request_t socks_request_t;
 typedef struct entry_port_cfg_t entry_port_cfg_t;
-
-typedef struct server_port_cfg_t {
-  /* Server port types (or, dir) only: */
-  unsigned int no_advertise : 1;
-  unsigned int no_listen : 1;
-  unsigned int all_addrs : 1;
-  unsigned int bind_ipv4_only : 1;
-  unsigned int bind_ipv6_only : 1;
-} server_port_cfg_t;
+typedef struct server_port_cfg_t server_port_cfg_t;
 
 /* Values for connection_t.magic: used to make sure that downcasts (casts from
 * connection_t to foo_connection_t) are safe. */
@@ -3585,27 +3577,7 @@ static inline const origin_circuit_t *CONST_TO_ORIGIN_CIRCUIT(
 /** First automatically allocated session group number */
 #define SESSION_GROUP_FIRST_AUTO -4
 
-/** Configuration for a single port that we're listening on. */
-typedef struct port_cfg_t {
-  tor_addr_t addr; /**< The actual IP to listen on, if !is_unix_addr. */
-  int port; /**< The configured port, or CFG_AUTO_PORT to tell Tor to pick its
-             * own port. */
-  uint8_t type; /**< One of CONN_TYPE_*_LISTENER */
-  unsigned is_unix_addr : 1; /**< True iff this is an AF_UNIX address. */
-
-  unsigned is_group_writable : 1;
-  unsigned is_world_writable : 1;
-  unsigned relax_dirmode_check : 1;
-
-  entry_port_cfg_t entry_cfg;
-
-  server_port_cfg_t server_cfg;
-
-  /* Unix sockets only: */
-  /** Path for an AF_UNIX address */
-  char unix_addr[FLEXIBLE_ARRAY_MEMBER];
-} port_cfg_t;
-
+typedef struct port_cfg_t port_cfg_t;
 typedef struct routerset_t routerset_t;
 
 /** A magic value for the (Socks|OR|...)Port options below, telling Tor
index 1210ca687d527b5c0e6ce4fdccc6e6c79c02cb29..a78e8a1c86696b595fc5193ea376e3190bbb6abc 100644 (file)
@@ -30,6 +30,8 @@
 #include "geoip.h"
 #include "ht.h"
 
+#include "port_cfg_st.h"
+
 /** Policy that addresses for incoming SOCKS connections must match. */
 static smartlist_t *socks_policy = NULL;
 /** Policy that addresses for incoming directory connections must match. */
diff --git a/src/or/port_cfg_st.h b/src/or/port_cfg_st.h
new file mode 100644 (file)
index 0000000..8b6b018
--- /dev/null
@@ -0,0 +1,35 @@
+/* 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 PORT_CFG_ST_H
+#define PORT_CFG_ST_H
+
+#include "entry_port_cfg_st.h"
+#include "server_port_cfg_st.h"
+
+/** Configuration for a single port that we're listening on. */
+struct port_cfg_t {
+  tor_addr_t addr; /**< The actual IP to listen on, if !is_unix_addr. */
+  int port; /**< The configured port, or CFG_AUTO_PORT to tell Tor to pick its
+             * own port. */
+  uint8_t type; /**< One of CONN_TYPE_*_LISTENER */
+  unsigned is_unix_addr : 1; /**< True iff this is an AF_UNIX address. */
+
+  unsigned is_group_writable : 1;
+  unsigned is_world_writable : 1;
+  unsigned relax_dirmode_check : 1;
+
+  entry_port_cfg_t entry_cfg;
+
+  server_port_cfg_t server_cfg;
+
+  /* Unix sockets only: */
+  /** Path for an AF_UNIX address */
+  char unix_addr[FLEXIBLE_ARRAY_MEMBER];
+};
+
+#endif
+
index 3879863e82aeddaba1b61647c3c21d41b43ddaf0..9eaef44605d51cbcb6a81dac75db6173e06ea0e5 100644 (file)
@@ -39,6 +39,8 @@
 
 #include "dirauth/mode.h"
 
+#include "port_cfg_st.h"
+
 /**
  * \file router.c
  * \brief Miscellaneous relay functionality, including RSA key maintenance,
diff --git a/src/or/server_port_cfg_st.h b/src/or/server_port_cfg_st.h
new file mode 100644 (file)
index 0000000..7a6a0a5
--- /dev/null
@@ -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 SERVER_PORT_CFG_ST_H
+#define SERVER_PORT_CFG_ST_H
+
+struct server_port_cfg_t {
+  /* Server port types (or, dir) only: */
+  unsigned int no_advertise : 1;
+  unsigned int no_listen : 1;
+  unsigned int all_addrs : 1;
+  unsigned int bind_ipv4_only : 1;
+  unsigned int bind_ipv6_only : 1;
+};
+
+#endif
+
index 461aa646d637d92b3ded08a9045a4ffd46fd7add..e8bfe9e12e4d13955ec7db873eff4ba5ed62a8fb 100644 (file)
@@ -43,6 +43,7 @@
 #include "statefile.h"
 
 #include "test_helpers.h"
+#include "port_cfg_st.h"
 
 static void
 test_config_addressmap(void *arg)
index 0106e40d970395016f5bdc88a0c096b2e5703e70..538fb8db15e371e22bec4813c3dd176384843bbc 100644 (file)
@@ -44,6 +44,8 @@
 #include "log_test_helpers.h"
 #include "voting_schedule.h"
 
+#include "port_cfg_st.h"
+
 #define NS_MODULE dir
 
 static void
index e89d49aaf5fcfa58a2dc81c80f73914f5802be88..e55452d3e487ef4be81b060dd842b333732db48e 100644 (file)
@@ -10,6 +10,8 @@
 #include "policies.h"
 #include "test.h"
 
+#include "port_cfg_st.h"
+
 /* Helper: assert that short_policy parses and writes back out as itself,
    or as <b>expected</b> if that's provided. */
 static void