From 13116378b1a8118e277320e377a691064e54983a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 1 Jul 2018 14:58:29 -0400 Subject: [PATCH] Extract or_options_t from or.h I decided to have this file included from config.h, though, since it is used nearly everywhere. --- src/or/circuitmux_ewma.c | 2 +- src/or/config.h | 1 + src/or/control.h | 1 + src/or/hs_config.c | 1 + src/or/or.h | 1062 +------------------------------------ src/or/or_options_st.h | 1077 ++++++++++++++++++++++++++++++++++++++ src/or/policies.h | 1 + src/or/rendservice.h | 1 + 8 files changed, 1084 insertions(+), 1062 deletions(-) create mode 100644 src/or/or_options_st.h diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c index 1ee5f1f621..d600602a7e 100644 --- a/src/or/circuitmux_ewma.c +++ b/src/or/circuitmux_ewma.c @@ -39,6 +39,7 @@ #include "or/circuitmux_ewma.h" #include "lib/crypt_ops/crypto_rand.h" #include "or/networkstatus.h" +#include "or/or_options_st.h" /*** EWMA parameter #defines ***/ @@ -826,4 +827,3 @@ circuitmux_ewma_free_all(void) { ewma_ticks_initialized = 0; } - diff --git a/src/or/config.h b/src/or/config.h index 869499582e..5fdf7862ec 100644 --- a/src/or/config.h +++ b/src/or/config.h @@ -12,6 +12,7 @@ #ifndef TOR_CONFIG_H #define TOR_CONFIG_H +#include "or/or_options_st.h" #include "lib/testsupport/testsupport.h" #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(DARWIN) diff --git a/src/or/control.h b/src/or/control.h index 53ac871078..5c5fe8a917 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -184,6 +184,7 @@ int control_event_signal(uintptr_t signal); int init_control_cookie_authentication(int enabled); char *get_controller_cookie_file_name(void); +struct config_line_t; smartlist_t *decode_hashed_passwords(struct config_line_t *passwords); void disable_control_logging(void); void enable_control_logging(void); diff --git a/src/or/hs_config.c b/src/or/hs_config.c index 603cd6e74e..cb55faa9d5 100644 --- a/src/or/hs_config.c +++ b/src/or/hs_config.c @@ -30,6 +30,7 @@ #include "or/hs_service.h" #include "or/rendservice.h" #include "lib/encoding/confline.h" +#include "or/or_options_st.h" /* Using the given list of services, stage them into our global state. Every * service version are handled. This function can remove entries in the given diff --git a/src/or/or.h b/src/or/or.h index 0886517dda..4ed774389d 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -981,1067 +981,7 @@ typedef struct routerset_t routerset_t; * to pick its own port. */ #define CFG_AUTO_PORT 0xc4005e -/** Enumeration of outbound address configuration types: - * Exit-only, OR-only, or both */ -typedef enum {OUTBOUND_ADDR_EXIT, OUTBOUND_ADDR_OR, - OUTBOUND_ADDR_EXIT_AND_OR, - OUTBOUND_ADDR_MAX} outbound_addr_t; - -struct config_line_t; - -/** Configuration options for a Tor process. */ -typedef struct { - uint32_t magic_; - - /** What should the tor process actually do? */ - enum { - CMD_RUN_TOR=0, CMD_LIST_FINGERPRINT, CMD_HASH_PASSWORD, - CMD_VERIFY_CONFIG, CMD_RUN_UNITTESTS, CMD_DUMP_CONFIG, - CMD_KEYGEN, - CMD_KEY_EXPIRATION, - } command; - char *command_arg; /**< Argument for command-line option. */ - - struct config_line_t *Logs; /**< New-style list of configuration lines - * for logs */ - int LogTimeGranularity; /**< Log resolution in milliseconds. */ - - int LogMessageDomains; /**< Boolean: Should we log the domain(s) in which - * each log message occurs? */ - int TruncateLogFile; /**< Boolean: Should we truncate the log file - before we start writing? */ - char *SyslogIdentityTag; /**< Identity tag to add for syslog logging. */ - char *AndroidIdentityTag; /**< Identity tag to add for Android logging. */ - - char *DebugLogFile; /**< Where to send verbose log messages. */ - char *DataDirectory_option; /**< Where to store long-term data, as - * configured by the user. */ - char *DataDirectory; /**< Where to store long-term data, as modified. */ - int DataDirectoryGroupReadable; /**< Boolean: Is the DataDirectory g+r? */ - - char *KeyDirectory_option; /**< Where to store keys, as - * configured by the user. */ - char *KeyDirectory; /**< Where to store keys data, as modified. */ - int KeyDirectoryGroupReadable; /**< Boolean: Is the KeyDirectory g+r? */ - - char *CacheDirectory_option; /**< Where to store cached data, as - * configured by the user. */ - char *CacheDirectory; /**< Where to store cached data, as modified. */ - int CacheDirectoryGroupReadable; /**< Boolean: Is the CacheDirectory g+r? */ - - char *Nickname; /**< OR only: nickname of this onion router. */ - char *Address; /**< OR only: configured address for this onion router. */ - char *PidFile; /**< Where to store PID of Tor process. */ - - routerset_t *ExitNodes; /**< Structure containing nicknames, digests, - * country codes and IP address patterns of ORs to - * consider as exits. */ - routerset_t *EntryNodes;/**< Structure containing nicknames, digests, - * country codes and IP address patterns of ORs to - * consider as entry points. */ - int StrictNodes; /**< Boolean: When none of our EntryNodes or ExitNodes - * are up, or we need to access a node in ExcludeNodes, - * do we just fail instead? */ - routerset_t *ExcludeNodes;/**< Structure containing nicknames, digests, - * country codes and IP address patterns of ORs - * not to use in circuits. But see StrictNodes - * above. */ - routerset_t *ExcludeExitNodes;/**< Structure containing nicknames, digests, - * country codes and IP address patterns of - * ORs not to consider as exits. */ - - /** Union of ExcludeNodes and ExcludeExitNodes */ - routerset_t *ExcludeExitNodesUnion_; - - int DisableAllSwap; /**< Boolean: Attempt to call mlockall() on our - * process for all current and future memory. */ - - struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */ - int ExitPolicyRejectPrivate; /**< Should we not exit to reserved private - * addresses, and our own published addresses? - */ - int ExitPolicyRejectLocalInterfaces; /**< Should we not exit to local - * interface addresses? - * Includes OutboundBindAddresses and - * configured ports. */ - int ReducedExitPolicy; /**