Commit 8b0920bb authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

Merge branch 'split_or_directory'

parents 4eac5c6c 50963f36
......@@ -206,16 +206,15 @@ uptime-*.json
/src/lib/libtor-wallclock.a
/src/lib/libtor-wallclock-testing.a
# /src/or/
/src/or/Makefile
/src/or/Makefile.in
/src/or/tor
/src/or/tor.exe
/src/or/tor-cov
/src/or/tor-cov.exe
/src/or/libtor-app.a
/src/or/libtor-app-testing.a
/src/or/libtor.lib
# /src/tor
/src/core/libtor-app.a
/src/core/libtor-app-testing.a
# /src/app
/src/app/tor
/src/app/tor.exe
/src/app/tor-cov
/src/app/tor-cov.exe
# /src/rust
/src/rust/.cargo/config
......
This diff is collapsed.
......@@ -25,9 +25,9 @@ AM_CFLAGS=@TOR_SYSTEMD_CFLAGS@ @CFLAGS_BUGTRAP@ @TOR_LZMA_CFLAGS@ @TOR_ZSTD_CFLA
SHELL=@SHELL@
if COVERAGE_ENABLED
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor-cov$(EXEEXT)
TESTING_TOR_BINARY=$(top_builddir)/src/app/tor-cov$(EXEEXT)
else
TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
TESTING_TOR_BINARY=$(top_builddir)/src/app/tor$(EXEEXT)
endif
if USE_RUST
......@@ -108,7 +108,7 @@ TOR_CRYPTO_TESTING_LIBS = \
# All static libraries used to link tor.
TOR_INTERNAL_LIBS = \
src/or/libtor-app.a \
src/core/libtor-app.a \
src/lib/libtor-compress.a \
src/lib/libtor-evloop.a \
$(TOR_CRYPTO_LIBS) \
......@@ -119,7 +119,7 @@ TOR_INTERNAL_LIBS = \
# Variants of the above for linking the testing variant of tor (for coverage
# and tests)
TOR_INTERNAL_TESTING_LIBS = \
src/or/libtor-app-testing.a \
src/core/libtor-app-testing.a \
src/lib/libtor-compress-testing.a \
src/lib/libtor-evloop-testing.a \
$(TOR_CRYPTO_TESTING_LIBS) \
......@@ -302,10 +302,10 @@ coverage-html-full: all
check-spaces:
if USE_PERL
$(PERL) $(top_srcdir)/scripts/maint/checkSpace.pl -C \
$(top_srcdir)/src/common/*.[ch] \
$(top_srcdir)/src/lib/*/*.[ch] \
$(top_srcdir)/src/or/*.[ch] \
$(top_srcdir)/src/or/*/*.[ch] \
$(top_srcdir)/src/core/*/*.[ch] \
$(top_srcdir)/src/feature/*/*.[ch] \
$(top_srcdir)/src/app/*/*.[ch] \
$(top_srcdir)/src/test/*.[ch] \
$(top_srcdir)/src/test/*/*.[ch] \
$(top_srcdir)/src/tools/*.[ch]
......
......@@ -5,7 +5,7 @@ dnl See LICENSE for licensing information
AC_PREREQ([2.63])
AC_INIT([tor],[0.3.5.0-alpha-dev])
AC_CONFIG_SRCDIR([src/or/main.c])
AC_CONFIG_SRCDIR([src/app/main/tor_main.c])
AC_CONFIG_MACRO_DIR([m4])
# "foreign" means we don't follow GNU package layout standards
......
......@@ -10,7 +10,6 @@ EXTRA_DIST+= \
contrib/operator-tools/linux-tor-prio.sh \
contrib/operator-tools/tor-exit-notice.html \
contrib/or-tools/exitlist \
contrib/win32build/package_nsis-mingw.sh \
contrib/win32build/tor-mingw.nsi.in \
contrib/win32build/tor.ico \
contrib/win32build/tor.nsi.in
......
#!/bin/sh
#
# ===============================================================================
# package_nsis-ming.sh is distributed under this license:
# Copyright (c) 2006-2007 Andrew Lewman
# Copyright (c) 2008 The Tor Project, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the names of the copyright owners nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ===============================================================================
# Script to package a Tor installer on win32. This script assumes that
# you have already built Tor, that you are running msys/mingw, and that
# you know what you are doing.
# Start in the tor source directory after you've compiled tor.exe
# This means start as ./contrib/win32build/package_nsis-mingw.sh
rm -rf win_tmp
mkdir win_tmp
mkdir win_tmp/bin
mkdir win_tmp/contrib
mkdir win_tmp/doc
mkdir win_tmp/doc/spec
mkdir win_tmp/doc/design-paper
mkdir win_tmp/doc/contrib
mkdir win_tmp/src
mkdir win_tmp/src/config
mkdir win_tmp/tmp
cp src/or/tor.exe win_tmp/bin/
cp src/tools/tor-resolve.exe win_tmp/bin/
cp contrib/win32build/tor.ico win_tmp/bin/
cp src/config/geoip win_tmp/bin/
strip win_tmp/bin/*.exe
# There is no man2html in mingw.
# Maybe we should add this into make dist instead.
# One has to do this manually and cp it do the tor-source/doc dir
#man2html doc/tor.1.in > win_tmp/tmp/tor-reference.html
#man2html doc/tor-resolve.1 > win_tmp/tmp/tor-resolve.html
clean_newlines() {
perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg;' $1 >$2
}
clean_localstatedir() {
perl -pe 's/^\n$/\r\n/mg; s/([^\r])\n$/\1\r\n/mg; s{\@LOCALSTATEDIR\@/(lib|log)/tor/}{C:\\Documents and Settings\\Application Data\\Tor\\}' $1 >$2
}
for fn in address-spec.txt bridges-spec.txt control-spec.txt dir-spec.txt path-spec.txt rend-spec.txt socks-extensions.txt tor-spec.txt version-spec.txt; do
clean_newlines doc/spec/$fn win_tmp/doc/spec/$fn
done
for fn in HACKING tor-gencert.html tor.html torify.html tor-resolve.html; do
clean_newlines doc/$fn win_tmp/doc/$fn
done
for fn in README ChangeLog LICENSE; do
clean_newlines $fn win_tmp/$fn
done
clean_localstatedir src/config/torrc.sample.in win_tmp/src/config/torrc.sample
cp contrib/win32build/tor-mingw.nsi.in win_tmp/contrib/
cd win_tmp
makensis.exe contrib/tor-mingw.nsi.in
......@@ -28,7 +28,7 @@ Jenkins
Valgrind
--------
valgrind --leak-check=yes --error-limit=no --show-reachable=yes src/or/tor
valgrind --leak-check=yes --error-limit=no --show-reachable=yes src/app/tor
(Note that if you get a zillion openssl warnings, you will also need to
pass `--undef-value-errors=no` to valgrind, or rebuild your openssl
......@@ -232,10 +232,10 @@ Beforehand, install google-perftools.
Now you can run Tor with profiling enabled, and use the pprof utility to look at
performance! See the gperftools manual for more info, but basically:
2. Run `env CPUPROFILE=/tmp/profile src/or/tor -f <path/torrc>`. The profile file
2. Run `env CPUPROFILE=/tmp/profile src/app/tor -f <path/torrc>`. The profile file
is not written to until Tor finishes execuction.
3. Run `pprof src/or/tor /tm/profile` to start the REPL.
3. Run `pprof src/app/tor /tm/profile` to start the REPL.
Generating and analyzing a callgraph
------------------------------------
......
......@@ -12,9 +12,9 @@ Currently, there is only one module:
- Directory Authority subsystem (dirauth)
It is located in its own directory in `src/or/dirauth/`. To disable it, one
need to pass `--disable-module-dirauth` at configure time. All modules are
currently enabled by default.
It is located in its own directory in `src/feature/dirauth/`. To disable it,
one need to pass `--disable-module-dirauth` at configure time. All modules
are currently enabled by default.
## Build System ##
......@@ -32,10 +32,10 @@ The changes to the build system are pretty straightforward.
the C code to conditionally compile things for your module. And the
`BUILD_MODULE_<name>` is also defined for automake files (e.g: include.am).
3. In the `src/or/include.am` file, locate the `MODULE_DIRAUTH_SOURCES` value.
You need to create your own `_SOURCES` variable for your module and then
conditionally add the it to `LIBTOR_A_SOURCES` if you should build the
module.
3. In the `src/core/include.am` file, locate the `MODULE_DIRAUTH_SOURCES`
value. You need to create your own `_SOURCES` variable for your module
and then conditionally add the it to `LIBTOR_A_SOURCES` if you should
build the module.
It is then **very** important to add your SOURCES variable to
`src_or_libtor_testing_a_SOURCES` so the tests can build it.
......@@ -51,7 +51,7 @@ always build everything in order to tests everything.
## Coding ##
As mentioned above, a module must be isolated in its own directory (name of
the module) in `src/or/`.
the module) in `src/feature/`.
There are couples of "rules" you want to follow:
......@@ -87,10 +87,10 @@ There are couples of "rules" you want to follow:
making the code much more difficult to follow/understand.
* It is possible that you end up with code that needs to be used by the rest
of the code base but is still part of your module. As a good example, if you
look at `src/or/shared_random_client.c`: it contains code needed by the hidden
service subsystem but mainly related to the shared random subsystem very
specific to the dirauth module.
of the code base but is still part of your module. As a good example, if
you look at `src/feature/shared_random_client.c`: it contains code needed
by the hidden service subsystem but mainly related to the shared random
subsystem very specific to the dirauth module.
This is fine but try to keep it as lean as possible and never use the same
filename as the one in the module. For example, this is a bad idea and
......@@ -102,7 +102,7 @@ There are couples of "rules" you want to follow:
* When you include headers from the module, **always** use the full module
path in your statement. Example:
`#include "dirauth/dirvote.h"`
`#include "feature/dirauth/dirvote.h"`
The main reason is that we do **not** add the module include path by default
so it needs to be specified. But also, it helps our human brain understand
......
......@@ -69,7 +69,7 @@ configure option:
## Instrument Tor ##
This is pretty easy. Let's say you want to add a trace event in
`src/or/rendcache.c`, you only have to add this include statement:
`src/feature/rend/rendcache.c`, you only have to add this include statement:
#include "trace/events.h"
......
......@@ -7,7 +7,7 @@ my %torrcSampleOptions = ();
my %manPageOptions = ();
# Load the canonical list as actually accepted by Tor.
open(F, "@abs_top_builddir@/src/or/tor --list-torrc-options |") or die;
open(F, "@abs_top_builddir@/src/app/tor --list-torrc-options |") or die;
while (<F>) {
next if m!\[notice\] Tor v0\.!;
if (m!^([A-Za-z0-9_]+)!) {
......
......@@ -12,7 +12,8 @@
# To replace this list with the hard-coded fallback list (for testing), use
# a command similar to:
# cat src/or/fallback_dirs.inc | grep \" | grep -v weight | tr -d '\n' | \
# cat src/app/config/fallback_dirs.inc | grep \" | grep -v weight | \
# tr -d '\n' | \
# sed 's/"" / /g' | sed 's/""/"/g' | tr \" '\n' | grep -v '^$' \
# > scripts/maint/fallback.whitelist
#
......
......@@ -3,11 +3,11 @@
# Usage:
#
# Regenerate the list:
# scripts/maint/updateFallbackDirs.py > src/or/fallback_dirs.inc 2> fallback_dirs.log
# scripts/maint/updateFallbackDirs.py > src/app/config/fallback_dirs.inc 2> fallback_dirs.log
#
# Check the existing list:
# scripts/maint/updateFallbackDirs.py check_existing > fallback_dirs.inc.ok 2> fallback_dirs.log
# mv fallback_dirs.inc.ok src/or/fallback_dirs.inc
# mv fallback_dirs.inc.ok src/app/config/fallback_dirs.inc
#
# This script should be run from a stable, reliable network connection,
# with no other network activity (and not over tor).
......@@ -112,7 +112,7 @@ DOWNLOAD_MICRODESC_CONSENSUS = True
# expired consensus. This makes them fail the download check.
# We use a tolerance of 0, so that 0.2.x series relays also fail the download
# check if they serve an expired consensus.
CONSENSUS_EXPIRY_TOLERANCE = 0
CONSENSUS_EXPIRY_TOLERANCE = 0
# Output fallback name, flags, bandwidth, and ContactInfo in a C comment?
OUTPUT_COMMENTS = True if OUTPUT_CANDIDATES else False
......@@ -161,7 +161,7 @@ BLACKLIST_EXCLUDES_WHITELIST_ENTRIES = True
WHITELIST_FILE_NAME = 'scripts/maint/fallback.whitelist'
BLACKLIST_FILE_NAME = 'scripts/maint/fallback.blacklist'
FALLBACK_FILE_NAME = 'src/or/fallback_dirs.inc'
FALLBACK_FILE_NAME = 'src/app/config/fallback_dirs.inc'
# The number of bytes we'll read from a filter file before giving up
MAX_LIST_FILE_SIZE = 1024 * 1024
......
......@@ -7,7 +7,7 @@
dst=$1
for fn in src/or/*.c src/or/*/*.c src/common/*.c src/lib/*/*.c; do
for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do
BN=`basename $fn`
DN=`dirname $fn`
F=`echo $BN | sed -e 's/\.c$//;'`
......
......@@ -60,52 +60,52 @@
**/
#define CONFIG_PRIVATE
#include "or/or.h"
#include "or/bridges.h"
#include "or/addressmap.h"
#include "or/channel.h"
#include "or/circuitbuild.h"
#include "or/circuitlist.h"
#include "or/circuitmux.h"
#include "or/circuitmux_ewma.h"
#include "or/circuitstats.h"
#include "core/or/or.h"
#include "feature/client/bridges.h"
#include "feature/client/addressmap.h"
#include "core/or/channel.h"
#include "core/or/circuitbuild.h"
#include "core/or/circuitlist.h"
#include "core/or/circuitmux.h"
#include "core/or/circuitmux_ewma.h"
#include "core/or/circuitstats.h"
#include "lib/compress/compress.h"
#include "or/config.h"
#include "app/config/config.h"
#include "lib/encoding/confline.h"
#include "or/connection.h"
#include "or/connection_edge.h"
#include "or/connection_or.h"
#include "or/consdiffmgr.h"
#include "or/control.h"
#include "or/confparse.h"
#include "or/cpuworker.h"
#include "core/mainloop/connection.h"
#include "core/or/connection_edge.h"
#include "core/or/connection_or.h"
#include "feature/dircache/consdiffmgr.h"
#include "feature/control/control.h"
#include "app/config/confparse.h"
#include "core/mainloop/cpuworker.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "or/dirserv.h"
#include "or/dns.h"
#include "or/dos.h"
#include "or/entrynodes.h"
#include "or/git_revision.h"
#include "or/geoip.h"
#include "or/hibernate.h"
#include "or/main.h"
#include "or/networkstatus.h"
#include "or/nodelist.h"
#include "or/policies.h"
#include "or/relay.h"
#include "or/rendclient.h"
#include "or/rendservice.h"
#include "or/hs_config.h"
#include "or/rephist.h"
#include "or/router.h"
#include "feature/dircache/dirserv.h"
#include "feature/relay/dns.h"
#include "core/or/dos.h"
#include "feature/client/entrynodes.h"
#include "core/or/git_revision.h"
#include "feature/stats/geoip.h"
#include "feature/hibernate/hibernate.h"
#include "core/mainloop/main.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "core/or/policies.h"
#include "core/or/relay.h"
#include "feature/rend/rendclient.h"
#include "feature/rend/rendservice.h"
#include "feature/hs/hs_config.h"
#include "feature/stats/rephist.h"
#include "feature/relay/router.h"
#include "lib/sandbox/sandbox.h"
#include "or/routerlist.h"
#include "or/routerset.h"
#include "or/scheduler.h"
#include "or/statefile.h"
#include "or/transports.h"
#include "or/ext_orport.h"
#include "or/voting_schedule.h"
#include "feature/nodelist/routerlist.h"
#include "feature/nodelist/routerset.h"
#include "core/or/scheduler.h"
#include "app/config/statefile.h"
#include "feature/client/transports.h"
#include "feature/relay/ext_orport.h"
#include "feature/dircommon/voting_schedule.h"
#ifdef _WIN32
#include <shlobj.h>
#endif
......@@ -133,11 +133,11 @@
#include "lib/fs/conffile.h"
#include "lib/evloop/procmon.h"
#include "or/dirauth/dirvote.h"
#include "or/dirauth/mode.h"
#include "feature/dirauth/dirvote.h"
#include "feature/dirauth/mode.h"
#include "or/connection_st.h"
#include "or/port_cfg_st.h"
#include "core/or/connection_st.h"
#include "core/or/port_cfg_st.h"
#ifdef HAVE_SYSTEMD
# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
......
......@@ -12,7 +12,7 @@
#ifndef TOR_CONFIG_H
#define TOR_CONFIG_H
#include "or/or_options_st.h"
#include "app/config/or_options_st.h"
#include "lib/testsupport/testsupport.h"
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(DARWIN)
......
......@@ -21,9 +21,9 @@
* specified, and a linked list of key-value pairs.
*/
#include "or/or.h"
#include "or/confparse.h"
#include "or/routerset.h"
#include "core/or/or.h"
#include "app/config/confparse.h"
#include "feature/nodelist/routerset.h"
#include "lib/container/bitarray.h"
#include "lib/encoding/confline.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment