mod: Move dirauth specific files to its own module

This is a pretty big commit but it only moves these files to src/or/dirauth:

  dircollate.c dirvote.c shared_random.c shared_random_state.c
  dircollate.h dirvote.h shared_random.h shared_random_state.h

Then many files are modified to change the include line for those header files
that have moved into a new directory.

Without using --disable-module-dirauth, everything builds fine. When using the
flag to disable the module, tor doesn't build due to linking errors. This will
be addressed in the next commit(s).

No code behavior change.

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2018-04-05 14:27:30 -04:00
parent 35d86b088d
commit 2115a54b4a
28 changed files with 51 additions and 42 deletions

View File

@ -79,7 +79,6 @@
#include "confparse.h" #include "confparse.h"
#include "cpuworker.h" #include "cpuworker.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "dns.h" #include "dns.h"
#include "dos.h" #include "dos.h"
#include "entrynodes.h" #include "entrynodes.h"
@ -110,6 +109,8 @@
#include "procmon.h" #include "procmon.h"
#include "dirauth/dirvote.h"
#ifdef HAVE_SYSTEMD #ifdef HAVE_SYSTEMD
# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse

View File

@ -76,7 +76,7 @@
#include "router.h" #include "router.h"
#include "routerlist.h" #include "routerlist.h"
#include "routerparse.h" #include "routerparse.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#ifndef _WIN32 #ifndef _WIN32
#include <pwd.h> #include <pwd.h>

View File

@ -91,7 +91,6 @@
#include "shared_random.h" #include "shared_random.h"
#include "config.h" #include "config.h"
#include "confparse.h" #include "confparse.h"
#include "dirvote.h"
#include "networkstatus.h" #include "networkstatus.h"
#include "routerkeys.h" #include "routerkeys.h"
#include "router.h" #include "router.h"
@ -99,6 +98,8 @@
#include "shared_random_state.h" #include "shared_random_state.h"
#include "util.h" #include "util.h"
#include "dirauth/dirvote.h"
/* String prefix of shared random values in votes/consensuses. */ /* String prefix of shared random values in votes/consensuses. */
static const char previous_srv_str[] = "shared-rand-previous-value"; static const char previous_srv_str[] = "shared-rand-previous-value";
static const char current_srv_str[] = "shared-rand-current-value"; static const char current_srv_str[] = "shared-rand-current-value";

View File

@ -14,11 +14,12 @@
#include "shared_random.h" #include "shared_random.h"
#include "config.h" #include "config.h"
#include "confparse.h" #include "confparse.h"
#include "dirvote.h"
#include "networkstatus.h" #include "networkstatus.h"
#include "router.h" #include "router.h"
#include "shared_random_state.h" #include "shared_random_state.h"
#include "dirauth/dirvote.h"
/* Default filename of the shared random state on disk. */ /* Default filename of the shared random state on disk. */
static const char default_fname[] = "sr-state"; static const char default_fname[] = "sr-state";

View File

@ -20,7 +20,6 @@
#include "compat.h" #include "compat.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "geoip.h" #include "geoip.h"
#include "hs_cache.h" #include "hs_cache.h"
@ -41,7 +40,7 @@
#include "routerlist.h" #include "routerlist.h"
#include "routerparse.h" #include "routerparse.h"
#include "routerset.h" #include "routerset.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
#if !defined(OpenBSD) #if !defined(OpenBSD)
@ -49,6 +48,8 @@
#endif #endif
#endif #endif
#include "dirauth/dirvote.h"
/** /**
* \file directory.c * \file directory.c
* \brief Code to send and fetch information from directory authorities and * \brief Code to send and fetch information from directory authorities and

View File

@ -18,7 +18,6 @@
#include "control.h" #include "control.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "hibernate.h" #include "hibernate.h"
#include "keypin.h" #include "keypin.h"
#include "main.h" #include "main.h"
@ -34,6 +33,8 @@
#include "routerset.h" #include "routerset.h"
#include "torcert.h" #include "torcert.h"
#include "dirauth/dirvote.h"
/** /**
* \file dirserv.c * \file dirserv.c
* \brief Directory server core implementation. Manages directory * \brief Directory server core implementation. Manages directory

View File

@ -28,8 +28,8 @@
#include "rendservice.h" #include "rendservice.h"
#include "routerset.h" #include "routerset.h"
#include "router.h" #include "router.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "shared_random_state.h" #include "dirauth/shared_random_state.h"
/* Trunnel */ /* Trunnel */
#include "ed25519_cert.h" #include "ed25519_cert.h"

View File

@ -24,7 +24,7 @@
#include "router.h" #include "router.h"
#include "routerkeys.h" #include "routerkeys.h"
#include "routerlist.h" #include "routerlist.h"
#include "shared_random_state.h" #include "dirauth/shared_random_state.h"
#include "statefile.h" #include "statefile.h"
#include "hs_circuit.h" #include "hs_circuit.h"

View File

@ -41,10 +41,8 @@ LIBTOR_A_SOURCES = \
src/or/consdiffmgr.c \ src/or/consdiffmgr.c \
src/or/control.c \ src/or/control.c \
src/or/cpuworker.c \ src/or/cpuworker.c \
src/or/dircollate.c \
src/or/directory.c \ src/or/directory.c \
src/or/dirserv.c \ src/or/dirserv.c \
src/or/dirvote.c \
src/or/dns.c \ src/or/dns.c \
src/or/dnsserv.c \ src/or/dnsserv.c \
src/or/dos.c \ src/or/dos.c \
@ -76,8 +74,6 @@ LIBTOR_A_SOURCES = \
src/or/onion.c \ src/or/onion.c \
src/or/onion_fast.c \ src/or/onion_fast.c \
src/or/onion_tap.c \ src/or/onion_tap.c \
src/or/shared_random.c \
src/or/shared_random_state.c \
src/or/transports.c \ src/or/transports.c \
src/or/parsecommon.c \ src/or/parsecommon.c \
src/or/periodic.c \ src/or/periodic.c \
@ -121,7 +117,11 @@ LIBTOR_A_SOURCES = \
# The Directory Authority module. # The Directory Authority module.
if BUILD_MODULE_DIRAUTH if BUILD_MODULE_DIRAUTH
#LIBTOR_A_SOURCES += LIBTOR_A_SOURCES += \
src/or/dirauth/dircollate.c \
src/or/dirauth/dirvote.c \
src/or/dirauth/shared_random.c \
src/or/dirauth/shared_random_state.c
endif endif
src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES) src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES)
@ -195,10 +195,8 @@ ORHEADERS = \
src/or/consdiffmgr.h \ src/or/consdiffmgr.h \
src/or/control.h \ src/or/control.h \
src/or/cpuworker.h \ src/or/cpuworker.h \
src/or/dircollate.h \
src/or/directory.h \ src/or/directory.h \
src/or/dirserv.h \ src/or/dirserv.h \
src/or/dirvote.h \
src/or/dns.h \ src/or/dns.h \
src/or/dns_structs.h \ src/or/dns_structs.h \
src/or/dnsserv.h \ src/or/dnsserv.h \
@ -235,8 +233,6 @@ ORHEADERS = \
src/or/onion_ntor.h \ src/or/onion_ntor.h \
src/or/onion_tap.h \ src/or/onion_tap.h \
src/or/or.h \ src/or/or.h \
src/or/shared_random.h \
src/or/shared_random_state.h \
src/or/transports.h \ src/or/transports.h \
src/or/parsecommon.h \ src/or/parsecommon.h \
src/or/periodic.h \ src/or/periodic.h \
@ -273,7 +269,11 @@ ORHEADERS = \
# properly compiled the entry points stub. # properly compiled the entry points stub.
# The Directory Authority module headers. # The Directory Authority module headers.
#ORHEADERS += ORHEADERS += \
src/or/dirauth/dircollate.h \
src/or/dirauth/dirvote.h \
src/or/dirauth/shared_random.h \
src/or/dirauth/shared_random_state.h
# This may someday want to be an installed file? # This may someday want to be an installed file?
noinst_HEADERS += src/or/tor_api.h noinst_HEADERS += src/or/tor_api.h

View File

@ -72,7 +72,6 @@
#include "crypto_s2k.h" #include "crypto_s2k.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "dns.h" #include "dns.h"
#include "dnsserv.h" #include "dnsserv.h"
#include "dos.h" #include "dos.h"
@ -103,7 +102,7 @@
#include "routerlist.h" #include "routerlist.h"
#include "routerparse.h" #include "routerparse.h"
#include "scheduler.h" #include "scheduler.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "statefile.h" #include "statefile.h"
#include "status.h" #include "status.h"
#include "tor_api.h" #include "tor_api.h"
@ -118,6 +117,8 @@
#include <event2/event.h> #include <event2/event.h>
#include "dirauth/dirvote.h"
#ifdef HAVE_SYSTEMD #ifdef HAVE_SYSTEMD
# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse /* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse

View File

@ -50,7 +50,6 @@
#include "control.h" #include "control.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "dos.h" #include "dos.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "hibernate.h" #include "hibernate.h"
@ -64,11 +63,13 @@
#include "routerlist.h" #include "routerlist.h"
#include "routerparse.h" #include "routerparse.h"
#include "scheduler.h" #include "scheduler.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "transports.h" #include "transports.h"
#include "torcert.h" #include "torcert.h"
#include "channelpadding.h" #include "channelpadding.h"
#include "dirauth/dirvote.h"
/** Most recently received and validated v3 "ns"-flavored consensus network /** Most recently received and validated v3 "ns"-flavored consensus network
* status. */ * status. */
STATIC networkstatus_t *current_ns_consensus = NULL; STATIC networkstatus_t *current_ns_consensus = NULL;

View File

@ -101,7 +101,6 @@
#include "control.h" #include "control.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "fp_pair.h" #include "fp_pair.h"
#include "geoip.h" #include "geoip.h"
@ -122,6 +121,8 @@
#include "sandbox.h" #include "sandbox.h"
#include "torcert.h" #include "torcert.h"
#include "dirauth/dirvote.h"
// #define DEBUG_ROUTERLIST // #define DEBUG_ROUTERLIST
/****************************************************************************/ /****************************************************************************/

View File

@ -59,7 +59,6 @@
#include "config.h" #include "config.h"
#include "circuitstats.h" #include "circuitstats.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h"
#include "parsecommon.h" #include "parsecommon.h"
#include "policies.h" #include "policies.h"
#include "protover.h" #include "protover.h"
@ -75,11 +74,13 @@
#include "entrynodes.h" #include "entrynodes.h"
#include "torcert.h" #include "torcert.h"
#include "sandbox.h" #include "sandbox.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#undef log #undef log
#include <math.h> #include <math.h>
#include "dirauth/dirvote.h"
/****************************************************************************/ /****************************************************************************/
/** List of tokens recognized in router descriptors */ /** List of tokens recognized in router descriptors */

View File

@ -24,7 +24,7 @@
#include "control.h" #include "control.h"
#include "cpuworker.h" #include "cpuworker.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "dns.h" #include "dns.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "transports.h" #include "transports.h"

View File

@ -25,7 +25,7 @@
#include "crypto_ed25519.h" #include "crypto_ed25519.h"
#include "directory.h" #include "directory.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "hibernate.h" #include "hibernate.h"
#include "memarea.h" #include "memarea.h"
@ -35,7 +35,7 @@
#include "routerlist.h" #include "routerlist.h"
#include "routerparse.h" #include "routerparse.h"
#include "routerset.h" #include "routerset.h"
#include "shared_random_state.h" #include "dirauth/shared_random_state.h"
#include "test.h" #include "test.h"
#include "test_dir_common.h" #include "test_dir_common.h"
#include "torcert.h" #include "torcert.h"

View File

@ -9,7 +9,7 @@
#include "test.h" #include "test.h"
#include "container.h" #include "container.h"
#include "or.h" #include "or.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "nodelist.h" #include "nodelist.h"
#include "routerlist.h" #include "routerlist.h"
#include "test_dir_common.h" #include "test_dir_common.h"

View File

@ -30,7 +30,7 @@
#include "proto_http.h" #include "proto_http.h"
#include "geoip.h" #include "geoip.h"
#include "dirserv.h" #include "dirserv.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "log_test_helpers.h" #include "log_test_helpers.h"
#ifdef _WIN32 #ifdef _WIN32

View File

@ -23,12 +23,12 @@
#include "config.h" #include "config.h"
#include "networkstatus.h" #include "networkstatus.h"
#include "directory.h" #include "directory.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "nodelist.h" #include "nodelist.h"
#include "routerlist.h" #include "routerlist.h"
#include "statefile.h" #include "statefile.h"
#include "circuitlist.h" #include "circuitlist.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "util.h" #include "util.h"
/** Test the validation of HS v3 addresses */ /** Test the validation of HS v3 addresses */

View File

@ -34,7 +34,7 @@
#include "circuitlist.h" #include "circuitlist.h"
#include "circuituse.h" #include "circuituse.h"
#include "crypto.h" #include "crypto.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "networkstatus.h" #include "networkstatus.h"
#include "nodelist.h" #include "nodelist.h"
#include "relay.h" #include "relay.h"
@ -51,7 +51,7 @@
#include "main.h" #include "main.h"
#include "rendservice.h" #include "rendservice.h"
#include "statefile.h" #include "statefile.h"
#include "shared_random_state.h" #include "dirauth/shared_random_state.h"
/* Trunnel */ /* Trunnel */
#include "hs/cell_establish_intro.h" #include "hs/cell_establish_intro.h"

View File

@ -6,7 +6,7 @@
#include "config.h" #include "config.h"
#define DIRVOTE_PRIVATE #define DIRVOTE_PRIVATE
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "microdesc.h" #include "microdesc.h"
#include "networkstatus.h" #include "networkstatus.h"
#include "routerlist.h" #include "routerlist.h"

View File

@ -19,7 +19,7 @@
#include "container.h" #include "container.h"
#include "control.h" #include "control.h"
#include "directory.h" #include "directory.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "entrynodes.h" #include "entrynodes.h"
#include "hibernate.h" #include "hibernate.h"
#include "microdesc.h" #include "microdesc.h"
@ -30,7 +30,7 @@
#include "routerlist.h" #include "routerlist.h"
#include "routerset.h" #include "routerset.h"
#include "routerparse.h" #include "routerparse.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "statefile.h" #include "statefile.h"
#include "test.h" #include "test.h"
#include "test_dir_common.h" #include "test_dir_common.h"

View File

@ -9,9 +9,9 @@
#include "or.h" #include "or.h"
#include "test.h" #include "test.h"
#include "config.h" #include "config.h"
#include "dirvote.h" #include "dirauth/dirvote.h"
#include "shared_random.h" #include "dirauth/shared_random.h"
#include "shared_random_state.h" #include "dirauth/shared_random_state.h"
#include "routerkeys.h" #include "routerkeys.h"
#include "routerlist.h" #include "routerlist.h"
#include "router.h" #include "router.h"