summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-05 15:42:55 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-05 15:42:55 -0400
commit02ba0a2dbbe1032b56d0ba17468f2ee0d95e4f1b (patch)
treeeb0ec8b0dc6c1b803033e663558cc2a7542152ac
parent3d610363eff2fe70d3775a66a97f844956480141 (diff)
parentf7eff3008d33fb0c35986cbc14799b0127e8ab73 (diff)
downloadtor-02ba0a2dbbe1032b56d0ba17468f2ee0d95e4f1b.tar.gz
tor-02ba0a2dbbe1032b56d0ba17468f2ee0d95e4f1b.zip
Merge branch 'destroy_common'
-rw-r--r--.gitignore15
-rw-r--r--Makefile.am6
-rwxr-xr-xscripts/codegen/fuzzing_include_am.py23
-rw-r--r--src/common/Makefile.nmake28
-rw-r--r--src/common/include.am62
-rw-r--r--src/common/util.h52
-rw-r--r--src/include.am2
-rw-r--r--src/lib/container/handles.h (renamed from src/common/handles.h)0
-rw-r--r--src/lib/container/include.am1
-rw-r--r--src/lib/evloop/.may_include15
-rw-r--r--src/lib/evloop/compat_libevent.c (renamed from src/common/compat_libevent.c)2
-rw-r--r--src/lib/evloop/compat_libevent.h (renamed from src/common/compat_libevent.h)0
-rw-r--r--src/lib/evloop/include.am26
-rw-r--r--src/lib/evloop/procmon.c (renamed from src/common/procmon.c)2
-rw-r--r--src/lib/evloop/procmon.h (renamed from src/common/procmon.h)2
-rw-r--r--src/lib/evloop/timers.c (renamed from src/common/timers.c)4
-rw-r--r--src/lib/evloop/timers.h (renamed from src/common/timers.h)0
-rw-r--r--src/lib/evloop/token_bucket.c (renamed from src/common/token_bucket.c)2
-rw-r--r--src/lib/evloop/token_bucket.h (renamed from src/common/token_bucket.h)0
-rw-r--r--src/lib/evloop/workqueue.c (renamed from src/common/workqueue.c)4
-rw-r--r--src/lib/evloop/workqueue.h (renamed from src/common/workqueue.h)0
-rw-r--r--src/lib/malloc/include.am4
-rw-r--r--src/lib/net/include.am3
-rw-r--r--src/lib/net/socks5_status.h (renamed from src/common/socks5_status.h)0
-rw-r--r--src/or/address_set.c (renamed from src/common/address_set.c)2
-rw-r--r--src/or/address_set.h (renamed from src/common/address_set.h)0
-rw-r--r--src/or/channel.c2
-rw-r--r--src/or/channel.h2
-rw-r--r--src/or/channelpadding.c2
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/conscache.h2
-rw-r--r--src/or/consdiffmgr.c4
-rw-r--r--src/or/control.c6
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/dirauth/shared_random.c1
-rw-r--r--src/or/dns.c2
-rw-r--r--src/or/dnsserv.c2
-rw-r--r--src/or/entrynodes.h2
-rw-r--r--src/or/ext_orport.c1
-rw-r--r--src/or/hibernate.c2
-rw-r--r--src/or/hs_cell.c1
-rw-r--r--src/or/include.am2
-rw-r--r--src/or/keypin.c25
-rw-r--r--src/or/main.c4
-rw-r--r--src/or/nodelist.c2
-rw-r--r--src/or/ntmain.c2
-rw-r--r--src/or/onion_ntor.c11
-rw-r--r--src/or/or.h38
-rw-r--r--src/or/or_connection_st.h2
-rw-r--r--src/or/periodic.c4
-rw-r--r--src/or/reasons.h2
-rw-r--r--src/or/scheduler.c4
-rw-r--r--src/or/shared_random_client.c1
-rw-r--r--src/or/torcert.c1
-rw-r--r--src/or/transports.c1
-rw-r--r--src/test/fuzz/fuzz_hsdescv3.c1
-rw-r--r--src/test/include.am2
-rw-r--r--src/test/test-memwipe.c9
-rw-r--r--src/test/test-timers.c9
-rw-r--r--src/test/test_address_set.c2
-rw-r--r--src/test/test_bridges.c1
-rw-r--r--src/test/test_bt_cl.c1
-rw-r--r--src/test/test_bwmgt.c2
-rw-r--r--src/test/test_channelpadding.c4
-rw-r--r--src/test/test_checkdir.c1
-rw-r--r--src/test/test_compat_libevent.c2
-rw-r--r--src/test/test_config.c1
-rw-r--r--src/test/test_consdiffmgr.c2
-rw-r--r--src/test/test_crypto.c1
-rw-r--r--src/test/test_crypto_openssl.c5
-rw-r--r--src/test/test_entrynodes.c1
-rw-r--r--src/test/test_guardfraction.c1
-rw-r--r--src/test/test_handles.c7
-rw-r--r--src/test/test_hs_common.c1
-rw-r--r--src/test/test_hs_ntor_cl.c1
-rw-r--r--src/test/test_keypin.c1
-rw-r--r--src/test/test_ntor_cl.c1
-rw-r--r--src/test/test_oom.c2
-rw-r--r--src/test/test_procmon.c2
-rw-r--r--src/test/test_pt.c1
-rw-r--r--src/test/test_routerkeys.c1
-rw-r--r--src/test/test_scheduler.c2
-rw-r--r--src/test/test_socks.c2
-rw-r--r--src/test/test_util_slow.c8
-rw-r--r--src/test/test_workqueue.c4
-rw-r--r--src/test/testing_common.c2
-rw-r--r--src/tools/tor-resolve.c2
89 files changed, 195 insertions, 279 deletions
diff --git a/.gitignore b/.gitignore
index b1de1d79d8..7119744504 100644
--- a/.gitignore
+++ b/.gitignore
@@ -132,19 +132,6 @@ uptime-*.json
# /src/trace
/src/trace/libor-trace.a
-# /src/common/
-/src/common/Makefile
-/src/common/Makefile.in
-/src/common/libor.a
-/src/common/libor-testing.a
-/src/common/libor.lib
-/src/common/libor-ctime.a
-/src/common/libor-ctime-testing.a
-/src/common/libor-ctime.lib
-/src/common/libor-event.a
-/src/common/libor-event-testing.a
-/src/common/libor-event.lib
-
# /src/config/
/src/config/Makefile
/src/config/Makefile.in
@@ -173,6 +160,8 @@ uptime-*.json
/src/lib/libtor-ctime-testing.a
/src/lib/libtor-encoding.a
/src/lib/libtor-encoding-testing.a
+/src/lib/libtor-evloop.a
+/src/lib/libtor-evloop-testing.a
/src/lib/libtor-err.a
/src/lib/libtor-err-testing.a
/src/lib/libtor-fdio.a
diff --git a/Makefile.am b/Makefile.am
index fe2479a642..b2da55cdac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,6 @@ endif
# "Common" libraries used to link tor's utility code.
TOR_UTIL_LIBS = \
- src/common/libor.a \
src/lib/libtor-process.a \
src/lib/libtor-time.a \
src/lib/libtor-fs.a \
@@ -68,7 +67,6 @@ TOR_UTIL_LIBS = \
# Variants of the above for linking the testing variant of tor (for coverage
# and tests)
TOR_UTIL_TESTING_LIBS = \
- src/common/libor-testing.a \
src/lib/libtor-process-testing.a \
src/lib/libtor-time-testing.a \
src/lib/libtor-fs-testing.a \
@@ -112,9 +110,9 @@ TOR_CRYPTO_TESTING_LIBS = \
TOR_INTERNAL_LIBS = \
src/or/libtor-app.a \
src/lib/libtor-compress.a \
+ src/lib/libtor-evloop.a \
$(TOR_CRYPTO_LIBS) \
$(TOR_UTIL_LIBS) \
- src/common/libor-event.a \
src/trunnel/libor-trunnel.a \
src/lib/libtor-trace.a
@@ -123,9 +121,9 @@ TOR_INTERNAL_LIBS = \
TOR_INTERNAL_TESTING_LIBS = \
src/or/libtor-app-testing.a \
src/lib/libtor-compress-testing.a \
+ src/lib/libtor-evloop-testing.a \
$(TOR_CRYPTO_TESTING_LIBS) \
$(TOR_UTIL_TESTING_LIBS) \
- src/common/libor-event-testing.a \
src/trunnel/libor-trunnel-testing.a \
src/lib/libtor-trace.a
diff --git a/scripts/codegen/fuzzing_include_am.py b/scripts/codegen/fuzzing_include_am.py
index fda57d2ae8..42a61876e8 100755
--- a/scripts/codegen/fuzzing_include_am.py
+++ b/scripts/codegen/fuzzing_include_am.py
@@ -24,32 +24,17 @@ FUZZING_CFLAGS = \
FUZZING_LDFLAG = \
@TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
FUZZING_LIBS = \
- src/or/libtor-testing.a \
- src/common/libor-crypto-testing.a \
- $(LIBKECCAK_TINY) \
- $(LIBDONNA) \
- src/common/libor-testing.a \
- src/common/libor-ctime-testing.a \
- src/common/libor-event-testing.a \
- src/trunnel/libor-trunnel-testing.a \
+ $(TOR_INTERNAL_TESTING_LIBS) \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
- @TOR_LIBEVENT_LIBS@ \
- @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
- @CURVE25519_LIBS@ \
+ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
+ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \
@TOR_SYSTEMD_LIBS@ \
@TOR_LZMA_LIBS@ \
@TOR_ZSTD_LIBS@
oss-fuzz-prereqs: \
- src/or/libtor-testing.a \
- src/common/libor-crypto-testing.a \
- $(LIBKECCAK_TINY) \
- $(LIBDONNA) \
- src/common/libor-testing.a \
- src/common/libor-ctime-testing.a \
- src/common/libor-event-testing.a \
- src/trunnel/libor-trunnel-testing.a
+ $(TOR_INTERNAL_TESTING_LIBS)
noinst_HEADERS += \
src/test/fuzz/fuzzing.h
diff --git a/src/common/Makefile.nmake b/src/common/Makefile.nmake
deleted file mode 100644
index a1c819fffa..0000000000
--- a/src/common/Makefile.nmake
+++ /dev/null
@@ -1,28 +0,0 @@
-all: libor.lib libor-crypto.lib libor-event.lib
-
-CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \
- /I ..\ext
-
-LIBOR_OBJECTS = address.obj backtrace.obj compat.obj container.obj di_ops.obj \
- log.obj memarea.obj mempool.obj procmon.obj sandbox.obj util.obj \
- util_codedigest.obj
-
-LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj crypto_format.obj compress.obj compress_zlib.obj \
- tortls.obj crypto_curve25519.obj curve25519-donna.obj
-
-LIBOR_EVENT_OBJECTS = compat_libevent.obj
-
-curve25519-donna.obj: ..\ext\curve25519_donna\curve25519-donna.c
- $(CC) $(CFLAGS) /D inline=_inline /c ..\ext\curve25519_donna\curve25519-donna.c
-
-libor.lib: $(LIBOR_OBJECTS)
- lib $(LIBOR_OBJECTS) /out:libor.lib
-
-libor-crypto.lib: $(LIBOR_CRYPTO_OBJECTS)
- lib $(LIBOR_CRYPTO_OBJECTS) /out:libor-crypto.lib
-
-libor-event.lib: $(LIBOR_EVENT_OBJECTS)
- lib $(LIBOR_EVENT_OBJECTS) /out:libor-event.lib
-
-clean:
- del *.obj *.lib libor*.lib
diff --git a/src/common/include.am b/src/common/include.am
deleted file mode 100644
index 7427c69445..0000000000
--- a/src/common/include.am
+++ /dev/null
@@ -1,62 +0,0 @@
-
-noinst_LIBRARIES += \
- src/common/libor.a \
- src/common/libor-event.a
-
-if UNITTESTS_ENABLED
-noinst_LIBRARIES += \
- src/common/libor-testing.a \
- src/common/libor-event-testing.a
-endif
-
-EXTRA_DIST += src/common/Makefile.nmake
-
-if USE_OPENBSD_MALLOC
-libor_extra_source=src/ext/OpenBSD_malloc_Linux.c
-else
-libor_extra_source=
-endif
-
-LIBOR_A_SRC = \
- src/common/address_set.c \
- src/common/token_bucket.c \
- src/common/workqueue.c \
- $(libor_extra_source)
-
-src/common/src_common_libor_testing_a-log.$(OBJEXT) \
- src/common/log.$(OBJEXT): micro-revision.i
-
-LIBOR_EVENT_A_SRC = \
- src/common/compat_libevent.c \
- src/common/procmon.c \
- src/common/timers.c \
- src/ext/timeouts/timeout.c
-
-src_common_libor_a_SOURCES = $(LIBOR_A_SRC)
-src_common_libor_event_a_SOURCES = $(LIBOR_EVENT_A_SRC)
-
-if UNITTESTS_ENABLED
-src_common_libor_testing_a_SOURCES = $(LIBOR_A_SRC)
-src_common_libor_event_testing_a_SOURCES = $(LIBOR_EVENT_A_SRC)
-else
-src_common_libor_testing_a_SOURCES =
-src_common_libor_event_testing_a_SOURCES =
-endif
-
-src_common_libor_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
-src_common_libor_event_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
-src_common_libor_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
-src_common_libor_event_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
-
-COMMONHEADERS = \
- src/common/address_set.h \
- src/common/compat_libevent.h \
- src/common/handles.h \
- src/common/procmon.h \
- src/common/socks5_status.h \
- src/common/timers.h \
- src/common/token_bucket.h \
- src/common/util.h \
- src/common/workqueue.h
-
-noinst_HEADERS+= $(COMMONHEADERS)
diff --git a/src/common/util.h b/src/common/util.h
deleted file mode 100644
index 55eec2b8c9..0000000000
--- a/src/common/util.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2003-2004, Roger Dingledine
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2018, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file util.h
- * \brief Headers for util.c
- **/
-
-#ifndef TOR_UTIL_H
-#define TOR_UTIL_H
-
-#include "orconfig.h"
-#include "lib/arch/bytes.h"
-#include "lib/cc/compat_compiler.h"
-#include "lib/cc/torint.h"
-#include "lib/ctime/di_ops.h"
-#include "lib/encoding/cstring.h"
-#include "lib/encoding/time_fmt.h"
-#include "lib/err/torerr.h"
-#include "lib/fs/dir.h"
-#include "lib/fs/files.h"
-#include "lib/fs/mmap.h"
-#include "lib/fs/path.h"
-#include "lib/fs/userdb.h"
-#include "lib/intmath/addsub.h"
-#include "lib/intmath/bits.h"
-#include "lib/intmath/cmp.h"
-#include "lib/intmath/logic.h"
-#include "lib/intmath/muldiv.h"
-#include "lib/log/escape.h"
-#include "lib/log/ratelim.h"
-#include "lib/log/util_bug.h"
-#include "lib/malloc/util_malloc.h"
-#include "lib/net/ipv4.h"
-#include "lib/net/ipv6.h"
-#include "lib/net/resolve.h"
-#include "lib/net/socket.h"
-#include "lib/string/compat_ctype.h"
-#include "lib/string/compat_string.h"
-#include "lib/string/parse_int.h"
-#include "lib/string/printf.h"
-#include "lib/string/scanf.h"
-#include "lib/string/util_string.h"
-#include "lib/testsupport/testsupport.h"
-#include "lib/thread/threads.h"
-#include "lib/time/compat_time.h"
-#include "lib/wallclock/approx_time.h"
-#include "lib/wallclock/timeval.h"
-
-#endif /* !defined(TOR_UTIL_H) */
diff --git a/src/include.am b/src/include.am
index 1ed07425a6..950f9cc0fe 100644
--- a/src/include.am
+++ b/src/include.am
@@ -8,6 +8,7 @@ include src/lib/container/include.am
include src/lib/crypt_ops/include.am
include src/lib/defs/include.am
include src/lib/encoding/include.am
+include src/lib/evloop/include.am
include src/lib/fdio/include.am
include src/lib/fs/include.am
include src/lib/include.libdonna.am
@@ -31,7 +32,6 @@ include src/lib/time/include.am
include src/lib/tls/include.am
include src/lib/trace/include.am
include src/lib/wallclock/include.am
-include src/common/include.am
include src/trunnel/include.am
include src/or/include.am
include src/rust/include.am
diff --git a/src/common/handles.h b/src/lib/container/handles.h
index 21ec0dfeec..21ec0dfeec 100644
--- a/src/common/handles.h
+++ b/src/lib/container/handles.h
diff --git a/src/lib/container/include.am b/src/lib/container/include.am
index e91ad7d1ca..e6492098b5 100644
--- a/src/lib/container/include.am
+++ b/src/lib/container/include.am
@@ -21,6 +21,7 @@ noinst_HEADERS += \
src/lib/container/bitarray.h \
src/lib/container/bloomfilt.h \
src/lib/container/buffers.h \
+ src/lib/container/handles.h \
src/lib/container/map.h \
src/lib/container/order.h \
src/lib/container/smartlist.h
diff --git a/src/lib/evloop/.may_include b/src/lib/evloop/.may_include
new file mode 100644
index 0000000000..205f41b38f
--- /dev/null
+++ b/src/lib/evloop/.may_include
@@ -0,0 +1,15 @@
+orconfig.h
+
+lib/cc/*.h
+lib/crypt_ops/*.h
+lib/evloop/*.h
+lib/intmath/*.h
+lib/log/*.h
+lib/malloc/*.h
+lib/net/*.h
+lib/string/*.h
+lib/testsupport/*.h
+lib/thread/*.h
+lib/time/*.h
+
+src/ext/timeouts/timeout.c
diff --git a/src/common/compat_libevent.c b/src/lib/evloop/compat_libevent.c
index 9d21cf20bd..5e5faf163c 100644
--- a/src/common/compat_libevent.c
+++ b/src/lib/evloop/compat_libevent.c
@@ -8,7 +8,7 @@
#include "orconfig.h"
#define COMPAT_LIBEVENT_PRIVATE
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/log/torlog.h"
diff --git a/src/common/compat_libevent.h b/src/lib/evloop/compat_libevent.h
index 0a50cfa667..0a50cfa667 100644
--- a/src/common/compat_libevent.h
+++ b/src/lib/evloop/compat_libevent.h
diff --git a/src/lib/evloop/include.am b/src/lib/evloop/include.am
new file mode 100644
index 0000000000..6b0076272a
--- /dev/null
+++ b/src/lib/evloop/include.am
@@ -0,0 +1,26 @@
+
+noinst_LIBRARIES += src/lib/libtor-evloop.a
+
+if UNITTESTS_ENABLED
+noinst_LIBRARIES += src/lib/libtor-evloop-testing.a
+endif
+
+src_lib_libtor_evloop_a_SOURCES = \
+ src/lib/evloop/compat_libevent.c \
+ src/lib/evloop/procmon.c \
+ src/lib/evloop/timers.c \
+ src/lib/evloop/token_bucket.c \
+ src/lib/evloop/workqueue.c
+
+
+src_lib_libtor_evloop_testing_a_SOURCES = \
+ $(src_lib_libtor_evloop_a_SOURCES)
+src_lib_libtor_evloop_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
+src_lib_libtor_evloop_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
+
+noinst_HEADERS += \
+ src/lib/evloop/compat_libevent.h \
+ src/lib/evloop/procmon.h \
+ src/lib/evloop/timers.h \
+ src/lib/evloop/token_bucket.h \
+ src/lib/evloop/workqueue.h
diff --git a/src/common/procmon.c b/src/lib/evloop/procmon.c
index 6c2b3e71e5..a923fbad74 100644
--- a/src/common/procmon.c
+++ b/src/lib/evloop/procmon.c
@@ -6,7 +6,7 @@
* \brief Process-termination monitor functions
**/
-#include "common/procmon.h"
+#include "lib/evloop/procmon.h"
#include "lib/log/torlog.h"
#include "lib/log/util_bug.h"
diff --git a/src/common/procmon.h b/src/lib/evloop/procmon.h
index b8daeed0db..b596e5cc6d 100644
--- a/src/common/procmon.h
+++ b/src/lib/evloop/procmon.h
@@ -9,7 +9,7 @@
#ifndef TOR_PROCMON_H
#define TOR_PROCMON_H
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "lib/log/torlog.h"
diff --git a/src/common/timers.c b/src/lib/evloop/timers.c
index ff92a2e447..c07bd2e726 100644
--- a/src/common/timers.c
+++ b/src/lib/evloop/timers.c
@@ -31,8 +31,8 @@
#define TOR_TIMERS_PRIVATE
-#include "common/compat_libevent.h"
-#include "common/timers.h"
+#include "lib/evloop/compat_libevent.h"
+#include "lib/evloop/timers.h"
#include "lib/intmath/muldiv.h"
#include "lib/log/torlog.h"
#include "lib/log/util_bug.h"
diff --git a/src/common/timers.h b/src/lib/evloop/timers.h
index 2348c7b7c1..2348c7b7c1 100644
--- a/src/common/timers.h
+++ b/src/lib/evloop/timers.h
diff --git a/src/common/token_bucket.c b/src/lib/evloop/token_bucket.c
index f7b092f612..f7cd05c6c5 100644
--- a/src/common/token_bucket.c
+++ b/src/lib/evloop/token_bucket.c
@@ -18,7 +18,7 @@
#define TOKEN_BUCKET_PRIVATE
-#include "common/token_bucket.h"
+#include "lib/evloop/token_bucket.h"
#include "lib/log/util_bug.h"
#include "lib/intmath/cmp.h"
#include "lib/time/compat_time.h"
diff --git a/src/common/token_bucket.h b/src/lib/evloop/token_bucket.h
index 787317fa1f..787317fa1f 100644
--- a/src/common/token_bucket.h
+++ b/src/lib/evloop/token_bucket.h
diff --git a/src/common/workqueue.c b/src/lib/evloop/workqueue.c
index e5254396f9..4d36f352e3 100644
--- a/src/common/workqueue.c
+++ b/src/lib/evloop/workqueue.c
@@ -24,8 +24,8 @@
*/
#include "orconfig.h"
-#include "common/compat_libevent.h"
-#include "common/workqueue.h"
+#include "lib/evloop/compat_libevent.h"
+#include "lib/evloop/workqueue.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/intmath/weakrng.h"
diff --git a/src/common/workqueue.h b/src/lib/evloop/workqueue.h
index 4e5c424be6..4e5c424be6 100644
--- a/src/common/workqueue.h
+++ b/src/lib/evloop/workqueue.h
diff --git a/src/lib/malloc/include.am b/src/lib/malloc/include.am
index b4c5cae54d..50de9cb736 100644
--- a/src/lib/malloc/include.am
+++ b/src/lib/malloc/include.am
@@ -8,6 +8,10 @@ endif
src_lib_libtor_malloc_a_SOURCES = \
src/lib/malloc/util_malloc.c
+if USE_OPENBSD_MALLOC
+src_lib_libtor_malloc_a_SOURCES += src/ext/OpenBSD_malloc_Linux.c
+endif
+
src_lib_libtor_malloc_testing_a_SOURCES = \
$(src_lib_libtor_malloc_a_SOURCES)
src_lib_libtor_malloc_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
diff --git a/src/lib/net/include.am b/src/lib/net/include.am
index a375ac8ad5..6fda173614 100644
--- a/src/lib/net/include.am
+++ b/src/lib/net/include.am
@@ -29,4 +29,5 @@ noinst_HEADERS += \
src/lib/net/ipv6.h \
src/lib/net/nettypes.h \
src/lib/net/resolve.h \
- src/lib/net/socket.h
+ src/lib/net/socket.h \
+ src/lib/net/socks5_status.h
diff --git a/src/common/socks5_status.h b/src/lib/net/socks5_status.h
index 74b9c91023..74b9c91023 100644
--- a/src/common/socks5_status.h
+++ b/src/lib/net/socks5_status.h
diff --git a/src/common/address_set.c b/src/or/address_set.c
index 1bd1462387..927a5597c0 100644
--- a/src/common/address_set.c
+++ b/src/or/address_set.c
@@ -11,7 +11,7 @@
**/
#include "orconfig.h"
-#include "common/address_set.h"
+#include "or/address_set.h"
#include "lib/net/address.h"
#include "lib/container/bloomfilt.h"
#include "lib/crypt_ops/crypto_rand.h"
diff --git a/src/common/address_set.h b/src/or/address_set.h
index 2efa1cb03b..2efa1cb03b 100644
--- a/src/common/address_set.h
+++ b/src/or/address_set.h
diff --git a/src/or/channel.c b/src/or/channel.c
index 2dbacbde98..e6d717f111 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -79,7 +79,7 @@
#include "lib/time/compat_time.h"
#include "or/networkstatus.h"
#include "or/rendservice.h"
-#include "common/timers.h"
+#include "lib/evloop/timers.h"
#include "or/cell_queue_st.h"
diff --git a/src/or/channel.h b/src/or/channel.h
index 010a8aa5bc..7f25056769 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -11,7 +11,7 @@
#include "or/or.h"
#include "or/circuitmux.h"
-#include "common/handles.h"
+#include "lib/container/handles.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "tor_queue.h"
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 298fea79a9..504f6f8f83 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -22,7 +22,7 @@
#include "or/router.h"
#include "lib/time/compat_time.h"
#include "or/rendservice.h"
-#include "common/timers.h"
+#include "lib/evloop/timers.h"
#include "or/cell_st.h"
#include "or/or_connection_st.h"
diff --git a/src/or/config.c b/src/or/config.c
index 13002dd963..9b2706982a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -99,7 +99,6 @@
#include "or/rephist.h"
#include "or/router.h"
#include "lib/sandbox/sandbox.h"
-#include "common/util.h"
#include "or/routerlist.h"
#include "or/routerset.h"
#include "or/scheduler.h"
@@ -132,7 +131,7 @@
#include "lib/encoding/keyval.h"
#include "lib/fs/conffile.h"
-#include "common/procmon.h"
+#include "lib/evloop/procmon.h"
#include "or/dirauth/dirvote.h"
#include "or/dirauth/mode.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index 9680b08b56..6fd8fbf771 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -105,7 +105,7 @@
#include "lib/sandbox/sandbox.h"
#include "lib/net/buffers_net.h"
#include "lib/tls/tortls.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "lib/compress/compress.h"
#ifdef HAVE_PWD_H
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index f3f77dbc91..13d957a937 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -106,7 +106,7 @@
#include "or/or_circuit_st.h"
#include "or/origin_circuit_st.h"
#include "or/socks_request_st.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#ifdef HAVE_LINUX_TYPES_H
#include <linux/types.h>
diff --git a/src/or/conscache.h b/src/or/conscache.h
index c46b824235..c274a60393 100644
--- a/src/or/conscache.h
+++ b/src/or/conscache.h
@@ -4,7 +4,7 @@
#ifndef TOR_CONSCACHE_H
#define TOR_CONSCACHE_H
-#include "common/handles.h"
+#include "lib/container/handles.h"
typedef struct consensus_cache_entry_t consensus_cache_entry_t;
typedef struct consensus_cache_t consensus_cache_t;
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index c75b59c1f5..6d5183f934 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -21,8 +21,8 @@
#include "or/cpuworker.h"
#include "or/networkstatus.h"
#include "or/routerparse.h"
-#include "common/compat_libevent.h"
-#include "common/workqueue.h"
+#include "lib/evloop/compat_libevent.h"
+#include "lib/evloop/workqueue.h"
#include "lib/compress/compress.h"
#include "lib/encoding/confline.h"
diff --git a/src/or/control.c b/src/or/control.c
index ea12448126..aa43fccff0 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -46,7 +46,7 @@
#include "or/circuitstats.h"
#include "or/circuituse.h"
#include "or/command.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/config.h"
#include "or/confparse.h"
#include "or/connection.h"
@@ -113,8 +113,8 @@
#endif
#include "lib/crypt_ops/crypto_s2k.h"
-#include "common/procmon.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/procmon.h"
+#include "lib/evloop/compat_libevent.h"
/** Yield true iff <b>s</b> is the state of a control_connection_t that has
* finished authentication and is accepting commands. */
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index b37dfd1684..8b58e4c68c 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -30,7 +30,7 @@
#include "or/onion.h"
#include "or/rephist.h"
#include "or/router.h"
-#include "common/workqueue.h"
+#include "lib/evloop/workqueue.h"
#include "or/or_circuit_st.h"
#include "lib/intmath/weakrng.h"
diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c
index 8b53c1e743..d122690129 100644
--- a/src/or/dirauth/shared_random.c
+++ b/src/or/dirauth/shared_random.c
@@ -99,7 +99,6 @@
#include "or/routerlist.h"
#include "or/shared_random_client.h"
#include "or/dirauth/shared_random_state.h"
-#include "common/util.h"
#include "or/voting_schedule.h"
#include "or/dirauth/dirvote.h"
diff --git a/src/or/dns.c b/src/or/dns.c
index 45c4384eb1..4ac58552f4 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -64,7 +64,7 @@
#include "or/router.h"
#include "ht.h"
#include "lib/sandbox/sandbox.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/edge_connection_st.h"
#include "or/or_circuit_st.h"
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index d2ef4a496e..6e75254239 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -34,7 +34,7 @@
#include "or/entry_connection_st.h"
#include "or/listener_connection_st.h"
#include "or/socks_request_st.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include <event2/dns.h>
#include <event2/dns_compat.h>
diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
index 56b961e9a0..5f9b5bdcba 100644
--- a/src/or/entrynodes.h
+++ b/src/or/entrynodes.h
@@ -12,7 +12,7 @@
#ifndef TOR_ENTRYNODES_H
#define TOR_ENTRYNODES_H
-#include "common/handles.h"
+#include "lib/container/handles.h"
/* Forward declare for guard_selection_t; entrynodes.c has the real struct */
typedef struct guard_selection_s guard_selection_t;
diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
index 701dc45288..7342a66e06 100644
--- a/src/or/ext_orport.c
+++ b/src/or/ext_orport.c
@@ -27,7 +27,6 @@
#include "or/ext_orport.h"
#include "or/main.h"
#include "or/proto_ext_or.h"
-#include "common/util.h"
#include "or/or_connection_st.h"
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 1024c03546..55de64c13e 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -41,7 +41,7 @@ hibernating, phase 2:
#include "or/main.h"
#include "or/router.h"
#include "or/statefile.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/or_connection_st.h"
#include "or/or_state_st.h"
diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c
index b50c87dfa3..f8b76c5133 100644
--- a/src/or/hs_cell.c
+++ b/src/or/hs_cell.c
@@ -11,7 +11,6 @@
#include "lib/crypt_ops/crypto_util.h"
#include "or/rendservice.h"
#include "or/replaycache.h"
-#include "common/util.h"
#include "or/hs_cell.h"
#include "or/hs_ntor.h"
diff --git a/src/or/include.am b/src/or/include.am
index 9b5f7c1f60..ad7ee69bf5 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -19,6 +19,7 @@ EXTRA_DIST+= src/or/ntmain.c src/or/Makefile.nmake
LIBTOR_APP_A_SOURCES = \
src/or/addressmap.c \
+ src/or/address_set.c \
src/or/bridges.c \
src/or/channel.c \
src/or/channelpadding.c \
@@ -180,6 +181,7 @@ endif
ORHEADERS = \
src/or/addressmap.h \
+ src/or/address_set.h \
src/or/addr_policy_st.h \
src/or/authority_cert_st.h \
src/or/auth_dirs.inc \
diff --git a/src/or/keypin.c b/src/or/keypin.c
index 34cf64f5c4..a2f3654b82 100644
--- a/src/or/keypin.c
+++ b/src/or/keypin.c
@@ -11,17 +11,28 @@
#define KEYPIN_PRIVATE
#include "orconfig.h"
+
+#include "lib/cc/torint.h"
#include "lib/crypt_ops/crypto_digest.h"
#include "lib/crypt_ops/crypto_format.h"
+#include "lib/crypt_ops/crypto_format.h"
+#include "lib/ctime/di_ops.h"
#include "lib/ctime/di_ops.h"
+#include "lib/encoding/binascii.h"
+#include "lib/encoding/time_fmt.h"
+#include "lib/fdio/fdio.h"
+#include "lib/fs/files.h"
+#include "lib/fs/mmap.h"
+#include "lib/log/torlog.h"
+#include "lib/log/util_bug.h"
+#include "lib/string/compat_ctype.h"
+#include "lib/string/printf.h"
+#include "lib/wallclock/approx_time.h"
+
#include "ht.h"
#include "or/keypin.h"
+
#include "siphash.h"
-#include "lib/cc/torint.h"
-#include "lib/log/torlog.h"
-#include "lib/fdio/fdio.h"
-#include "common/util.h"
-#include "lib/encoding/binascii.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -34,6 +45,10 @@
#include <io.h>
#endif
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
/**
* @file keypin.c
* @brief Key-pinning for RSA and Ed25519 identity keys at directory
diff --git a/src/or/main.c b/src/or/main.c
index 408d9cf77c..7e3eb2b595 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -117,9 +117,9 @@
#include "lib/fs/lockfile.h"
#include "lib/net/buffers_net.h"
#include "lib/tls/tortls.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "lib/encoding/confline.h"
-#include "common/timers.h"
+#include "lib/evloop/timers.h"
#include <event2/event.h>
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index bc04ab9526..51fd0015df 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -42,7 +42,7 @@
#include "or/or.h"
#include "lib/net/address.h"
-#include "common/address_set.h"
+#include "or/address_set.h"
#include "or/bridges.h"
#include "or/config.h"
#include "or/control.h"
diff --git a/src/or/ntmain.c b/src/or/ntmain.c
index 99e77a285e..f6b57753d3 100644
--- a/src/or/ntmain.c
+++ b/src/or/ntmain.c
@@ -25,7 +25,7 @@
#include "or/ntmain.h"
#include "lib/log/win32err.h"
#include "lib/fs/winlib.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include <windows.h>
#define GENSRV_SERVICENAME "tor"
diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c
index 34b1112020..59c923cb97 100644
--- a/src/or/onion_ntor.c
+++ b/src/or/onion_ntor.c
@@ -21,14 +21,17 @@
#include "orconfig.h"
#define ONION_NTOR_PRIVATE
+
#include "lib/crypt_ops/crypto.h"
-#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_digest.h"
+#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_util.h"
-#include "or/onion_ntor.h"
-#include "lib/log/torlog.h"
#include "lib/ctime/di_ops.h"
-#include "common/util.h"
+#include "lib/log/torlog.h"
+#include "lib/log/util_bug.h"
+#include "or/onion_ntor.h"
+
+#include <string.h>
/** Free storage held in an ntor handshake state. */
void
diff --git a/src/or/or.h b/src/or/or.h
index b0340ed1a0..826e81e468 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -22,14 +22,48 @@
#include <time.h>
#endif
-#include "common/util.h"
-
+#include "lib/arch/bytes.h"
+#include "lib/cc/compat_compiler.h"
+#include "lib/cc/torint.h"
#include "lib/container/map.h"
#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto.h"
+#include "lib/ctime/di_ops.h"
#include "lib/defs/dh_sizes.h"
#include "lib/encoding/binascii.h"
+#include "lib/encoding/cstring.h"
+#include "lib/encoding/time_fmt.h"
+#include "lib/err/torerr.h"
+#include "lib/fs/dir.h"
+#include "lib/fs/files.h"
+#include "lib/fs/mmap.h"
+#include "lib/fs/path.h"
+#include "lib/fs/userdb.h"
+#include "lib/intmath/addsub.h"
+#include "lib/intmath/bits.h"
+#include "lib/intmath/cmp.h"
+#include "lib/intmath/logic.h"
+#include "lib/intmath/muldiv.h"
+#include "lib/log/escape.h"
+#include "lib/log/ratelim.h"
+#include "lib/log/util_bug.h"
+#include "lib/malloc/util_malloc.h"
#include "lib/net/address.h"
+#include "lib/net/ipv4.h"
+#include "lib/net/ipv6.h"
+#include "lib/net/resolve.h"
+#include "lib/net/socket.h"
+#include "lib/string/compat_ctype.h"
+#include "lib/string/compat_string.h"
+#include "lib/string/parse_int.h"
+#include "lib/string/printf.h"
+#include "lib/string/scanf.h"
+#include "lib/string/util_string.h"
+#include "lib/testsupport/testsupport.h"
+#include "lib/thread/threads.h"
+#include "lib/time/compat_time.h"
+#include "lib/wallclock/approx_time.h"
+#include "lib/wallclock/timeval.h"
#include "ht.h"
diff --git a/src/or/or_connection_st.h b/src/or/or_connection_st.h
index dbfe7528b0..8c2c1f89c6 100644
--- a/src/or/or_connection_st.h
+++ b/src/or/or_connection_st.h
@@ -8,7 +8,7 @@
#define OR_CONNECTION_ST_H
#include "or/connection_st.h"
-#include "common/token_bucket.h"
+#include "lib/evloop/token_bucket.h"
struct tor_tls_t;
diff --git a/src/or/periodic.c b/src/or/periodic.c
index 0cbf359b2e..041b2d287b 100644
--- a/src/or/periodic.c
+++ b/src/or/periodic.c
@@ -12,11 +12,11 @@
*/
#include "or/or.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/config.h"
#include "or/main.h"
#include "or/periodic.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
/** We disable any interval greater than this number of seconds, on the
* grounds that it is probably an absolute time mistakenly passed in as a
diff --git a/src/or/reasons.h b/src/or/reasons.h
index b815463b74..837b4a0f1a 100644
--- a/src/or/reasons.h
+++ b/src/or/reasons.h
@@ -12,7 +12,7 @@
#ifndef TOR_REASONS_H
#define TOR_REASONS_H
-#include "common/socks5_status.h"
+#include "lib/net/socks5_status.h"
enum bandwidth_weight_rule_t;
const char *stream_end_reason_to_control_string(int reason);
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index 7c423064c7..b8eaca3dca 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -4,7 +4,7 @@
#include "or/or.h"
#include "or/config.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#define SCHEDULER_PRIVATE_
#define SCHEDULER_KIST_PRIVATE
#include "or/scheduler.h"
@@ -12,7 +12,7 @@
#include "lib/container/buffers.h"
#define TOR_CHANNEL_INTERNAL_
#include "or/channeltls.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/or_connection_st.h"
diff --git a/src/or/shared_random_client.c b/src/or/shared_random_client.c
index 9a6c0f6644..42a5b42f60 100644
--- a/src/or/shared_random_client.c
+++ b/src/or/shared_random_client.c
@@ -14,7 +14,6 @@
#include "or/config.h"
#include "or/voting_schedule.h"
#include "or/networkstatus.h"
-#include "common/util.h"
#include "lib/encoding/binascii.h"
#include "or/networkstatus_st.h"
diff --git a/src/or/torcert.c b/src/or/torcert.c
index 269fa66cea..39c6605c65 100644
--- a/src/or/torcert.c
+++ b/src/or/torcert.c
@@ -31,7 +31,6 @@
#include "or/torcert.h"
#include "trunnel/ed25519_cert.h"
#include "lib/log/torlog.h"
-#include "common/util.h"
#include "trunnel/link_handshake.h"
#include "lib/tls/tortls.h"
diff --git a/src/or/transports.c b/src/or/transports.c
index ff51ff00eb..1d3cb7b951 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -96,7 +96,6 @@
#include "or/connection.h"
#include "or/circuitbuild.h"
#include "or/transports.h"
-#include "common/util.h"
#include "or/router.h"
#include "or/statefile.h"
#include "or/connection_or.h"
diff --git a/src/test/fuzz/fuzz_hsdescv3.c b/src/test/fuzz/fuzz_hsdescv3.c
index ada9fa6c2d..de574ac26d 100644
--- a/src/test/fuzz/fuzz_hsdescv3.c
+++ b/src/test/fuzz/fuzz_hsdescv3.c
@@ -9,7 +9,6 @@
#include "lib/crypt_ops/crypto_ed25519.h"
#include "or/hs_descriptor.h"
#include "or/routerparse.h"
-#include "common/util.h"
#include "test/fuzz/fuzzing.h"
diff --git a/src/test/include.am b/src/test/include.am
index 827b780ce3..a749ff1436 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -271,7 +271,7 @@ src_test_test_workqueue_LDADD = \
src_test_test_timers_CPPFLAGS = $(src_test_test_CPPFLAGS)
src_test_test_timers_CFLAGS = $(src_test_test_CFLAGS)
src_test_test_timers_LDADD = \
- src/common/libor-event-testing.a \
+ src/lib/libtor-evloop-testing.a \
$(TOR_CRYPTO_TESTING_LIBS) \
$(TOR_UTIL_TESTING_LIBS) \
$(rust_ldadd) \
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 552cbbc551..8a4610e904 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -2,14 +2,16 @@
/* See LICENSE for licensing information */
#include "orconfig.h"
+#include "lib/crypt_ops/crypto_util.h"
+
+#include "lib/intmath/cmp.h"
+#include "lib/malloc/util_malloc.h"
+
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
-#include "lib/crypt_ops/crypto_util.h"
-#include "common/util.h"
-
static unsigned fill_a_buffer_memset(void) __attribute__((noinline));
static unsigned fill_a_buffer_memwipe(void) __attribute__((noinline));
static unsigned fill_a_buffer_nothing(void) __attribute__((noinline));
@@ -214,4 +216,3 @@ main(int argc, char **argv)
return 0;
}
}
-
diff --git a/src/test/test-timers.c b/src/test/test-timers.c
index aed150bda6..f9276c25d6 100644
--- a/src/test/test-timers.c
+++ b/src/test/test-timers.c
@@ -7,10 +7,12 @@
#include <stdio.h>
#include <string.h>
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
+#include "lib/evloop/timers.h"
#include "lib/crypt_ops/crypto_rand.h"
-#include "common/timers.h"
-#include "common/util.h"
+#include "lib/log/util_bug.h"
+#include "lib/time/compat_time.h"
+#include "lib/wallclock/timeval.h"
#define N_TIMERS 1000
#define MAX_DURATION 30
@@ -138,4 +140,3 @@ main(int argc, char **argv)
timers_shutdown();
return ret;
}
-
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index 3699685848..ec4e6b7e87 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -3,7 +3,7 @@
#include "or/or.h"
#include "lib/crypt_ops/crypto_rand.h"
-#include "common/address_set.h"
+#include "or/address_set.h"
#include "or/microdesc.h"
#include "or/networkstatus.h"
#include "or/nodelist.h"
diff --git a/src/test/test_bridges.c b/src/test/test_bridges.c
index 98e85cd6d8..685027c0e0 100644
--- a/src/test/test_bridges.c
+++ b/src/test/test_bridges.c
@@ -16,7 +16,6 @@
#include "or/bridges.h"
#include "or/config.h"
#include "or/transports.h"
-#include "common/util.h"
/* Test suite stuff */
#include "test/test.h"
diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c
index 8a8221f190..3f7b0a203a 100644
--- a/src/test/test_bt_cl.c
+++ b/src/test/test_bt_cl.c
@@ -8,7 +8,6 @@
/* To prevent 'assert' from going away. */
#undef TOR_COVERAGE
#include "or/or.h"
-#include "common/util.h"
#include "lib/err/backtrace.h"
#include "lib/log/torlog.h"
diff --git a/src/test/test_bwmgt.c b/src/test/test_bwmgt.c
index 604987e070..4cfca6c776 100644
--- a/src/test/test_bwmgt.c
+++ b/src/test/test_bwmgt.c
@@ -11,7 +11,7 @@
#include "or/or.h"
#include "test/test.h"
-#include "common/token_bucket.h"
+#include "lib/evloop/token_bucket.h"
// an imaginary time, in timestamp units. Chosen so it will roll over.
static const uint32_t START_TS = UINT32_MAX-10;
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 7e0c33f63b..ff2ab8daab 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -13,14 +13,14 @@
#include "or/channel.h"
#include "or/channeltls.h"
#include "or/channelpadding.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/config.h"
#include "lib/time/compat_time.h"
#include "or/main.h"
#include "or/networkstatus.h"
#include "test/log_test_helpers.h"
#include "lib/tls/tortls.h"
-#include "common/timers.h"
+#include "lib/evloop/timers.h"
#include "lib/container/buffers.h"
#include "or/cell_st.h"
diff --git a/src/test/test_checkdir.c b/src/test/test_checkdir.c
index 09688cf0a9..a80c6ebd3a 100644
--- a/src/test/test_checkdir.c
+++ b/src/test/test_checkdir.c
@@ -12,7 +12,6 @@
#include "or/config.h"
#include "test/test.h"
-#include "common/util.h"
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
diff --git a/src/test/test_compat_libevent.c b/src/test/test_compat_libevent.c
index 8e59137856..1262a3140e 100644
--- a/src/test/test_compat_libevent.c
+++ b/src/test/test_compat_libevent.c
@@ -7,7 +7,7 @@
#include "test/test.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include <event2/event.h>
diff --git a/src/test/test_config.c b/src/test/test_config.c
index fb05645930..c7623d0c85 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -19,7 +19,6 @@
#include "or/connection.h"
#include "or/connection_edge.h"
#include "test/test.h"
-#include "common/util.h"
#include "or/connection_or.h"
#include "or/control.h"
#include "or/cpuworker.h"
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index a0dfe95d35..959075903f 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -12,7 +12,7 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "or/networkstatus.h"
#include "or/routerparse.h"
-#include "common/workqueue.h"
+#include "lib/evloop/workqueue.h"
#include "lib/compress/compress.h"
#include "lib/encoding/confline.h"
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 341dbc9a4f..2e38dfc279 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -9,7 +9,6 @@
#include "or/or.h"
#include "test/test.h"
#include "lib/crypt_ops/aes.h"
-#include "common/util.h"
#include "siphash.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_dh.h"
diff --git a/src/test/test_crypto_openssl.c b/src/test/test_crypto_openssl.c
index d443ba6fd0..1d31ad0279 100644
--- a/src/test/test_crypto_openssl.c
+++ b/src/test/test_crypto_openssl.c
@@ -7,14 +7,14 @@
#define CRYPTO_RAND_PRIVATE
+#include "lib/crypt_ops/compat_openssl.h"
#include "lib/crypt_ops/crypto_rand.h"
-#include "common/util.h"
#include "lib/encoding/binascii.h"
#include "test/test.h"
#include <openssl/evp.h>
#include <openssl/rand.h>
-#include "lib/crypt_ops/compat_openssl.h"
+#include <string.h>
/* Test for rectifying openssl RAND engine. */
static void
@@ -103,4 +103,3 @@ struct testcase_t crypto_openssl_tests[] = {
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 262e2fa680..9c35cdaaf2 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -28,7 +28,6 @@
#include "or/routerparse.h"
#include "or/routerset.h"
#include "or/statefile.h"
-#include "common/util.h"
#include "or/cpath_build_state_st.h"
#include "or/crypt_path_st.h"
diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c
index b7737cafa8..3c293e378b 100644
--- a/src/test/test_guardfraction.c
+++ b/src/test/test_guardfraction.c
@@ -10,7 +10,6 @@
#include "or/config.h"
#include "or/dirserv.h"
#include "or/entrynodes.h"
-#include "common/util.h"
#include "or/routerparse.h"
#include "or/networkstatus.h"
diff --git a/src/test/test_handles.c b/src/test/test_handles.c
index 153ac5787b..2910d7e18f 100644
--- a/src/test/test_handles.c
+++ b/src/test/test_handles.c
@@ -4,8 +4,10 @@
#include "orconfig.h"
#include "test/test.h"
-#include "common/util.h"
-#include "common/handles.h"
+#include "lib/container/handles.h"
+#include "lib/log/util_bug.h"
+
+#include <stdio.h>
typedef struct demo_t {
HANDLE_ENTRY(demo, demo_t);
@@ -94,4 +96,3 @@ struct testcase_t handle_tests[] = {
HANDLE_TEST(basic, 0),
END_OF_TESTCASES
};
-
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 28c6316bd0..4c39570e30 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -31,7 +31,6 @@
#include "or/statefile.h"
#include "or/circuitlist.h"
#include "or/dirauth/shared_random.h"
-#include "common/util.h"
#include "or/voting_schedule.h"
#include "or/microdesc_st.h"
diff --git a/src/test/test_hs_ntor_cl.c b/src/test/test_hs_ntor_cl.c
index 6bf11560b4..8643897db5 100644
--- a/src/test/test_hs_ntor_cl.c
+++ b/src/test/test_hs_ntor_cl.c
@@ -14,7 +14,6 @@
#define ONION_NTOR_PRIVATE
#include "or/or.h"
-#include "common/util.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_ed25519.h"
diff --git a/src/test/test_keypin.c b/src/test/test_keypin.c
index e7e7e62963..e7897a8473 100644
--- a/src/test/test_keypin.c
+++ b/src/test/test_keypin.c
@@ -5,7 +5,6 @@
#define KEYPIN_PRIVATE
#include "or/or.h"
#include "or/keypin.h"
-#include "common/util.h"
#include "test/test.h"
diff --git a/src/test/test_ntor_cl.c b/src/test/test_ntor_cl.c
index 75d5ccc126..5711a9116a 100644
--- a/src/test/test_ntor_cl.c
+++ b/src/test/test_ntor_cl.c
@@ -7,7 +7,6 @@
#define ONION_NTOR_PRIVATE
#include "or/or.h"
-#include "common/util.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "or/onion_ntor.h"
diff --git a/src/test/test_oom.c b/src/test/test_oom.c
index 2e5989c0d0..6c3ee1a27b 100644
--- a/src/test/test_oom.c
+++ b/src/test/test_oom.c
@@ -10,7 +10,7 @@
#include "or/or.h"
#include "lib/container/buffers.h"
#include "or/circuitlist.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/connection.h"
#include "or/config.h"
#include "lib/crypt_ops/crypto_rand.h"
diff --git a/src/test/test_procmon.c b/src/test/test_procmon.c
index ae30bd00b6..e2915d0fb4 100644
--- a/src/test/test_procmon.c
+++ b/src/test/test_procmon.c
@@ -6,7 +6,7 @@
#include "or/or.h"
#include "test/test.h"
-#include "common/procmon.h"
+#include "lib/evloop/procmon.h"
#include "test/log_test_helpers.h"
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index e685ab50de..189cb25846 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -15,7 +15,6 @@
#include "or/control.h"
#include "or/transports.h"
#include "or/circuitbuild.h"
-#include "common/util.h"
#include "or/statefile.h"
#include "test/test.h"
#include "lib/process/subprocess.h"
diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c
index 8c2be30a8f..2a761ad6e1 100644
--- a/src/test/test_routerkeys.c
+++ b/src/test/test_routerkeys.c
@@ -9,7 +9,6 @@
#include "or/config.h"
#include "or/router.h"
#include "or/routerkeys.h"
-#include "common/util.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/crypt_ops/crypto_format.h"
#include "or/torcert.h"
diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c
index 1087befa68..555a2a6bfd 100644
--- a/src/test/test_scheduler.c
+++ b/src/test/test_scheduler.c
@@ -10,7 +10,7 @@
#define CHANNEL_PRIVATE_
#include "or/or.h"
#include "or/config.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "or/channel.h"
#include "or/channeltls.h"
#include "or/connection.h"
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index 046ed35978..0a01bf6431 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -11,7 +11,7 @@
#include "test/test.h"
#include "test/log_test_helpers.h"
#include "or/socks_request_st.h"
-#include "common/socks5_status.h"
+#include "lib/net/socks5_status.h"
typedef struct socks_test_data_t {
socks_request_t *req;
diff --git a/src/test/test_util_slow.c b/src/test/test_util_slow.c
index aeb0d422c1..5021e89dff 100644
--- a/src/test/test_util_slow.c
+++ b/src/test/test_util_slow.c
@@ -6,13 +6,17 @@
#include "orconfig.h"
#define UTIL_PRIVATE
#define SUBPROCESS_PRIVATE
-#include "common/util.h"
-#include "lib/process/waitpid.h"
#include "lib/crypt_ops/crypto.h"
#include "lib/log/torlog.h"
#include "lib/process/subprocess.h"
+#include "lib/process/waitpid.h"
+#include "lib/string/printf.h"
+#include "lib/time/compat_time.h"
#include "test/test.h"
+#include <errno.h>
+#include <string.h>
+
#ifndef BUILDDIR
#define BUILDDIR "."
#endif
diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c
index dda724b78b..2cb42734c4 100644
--- a/src/test/test_workqueue.c
+++ b/src/test/test_workqueue.c
@@ -6,11 +6,11 @@
#include "or/or.h"
#include "lib/thread/threads.h"
#include "or/onion.h"
-#include "common/workqueue.h"
+#include "lib/evloop/workqueue.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/net/alertsock.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include "lib/intmath/weakrng.h"
#include <stdio.h>
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index ace564d0fe..b0514f85ec 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -22,7 +22,7 @@
#include "or/channelpadding.h"
#include "or/main.h"
#include "lib/compress/compress.h"
-#include "common/compat_libevent.h"
+#include "lib/evloop/compat_libevent.h"
#include <stdio.h>
#ifdef HAVE_FCNTL_H
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 303c7af3ee..1532d5f201 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -14,7 +14,7 @@
#include "lib/sandbox/sandbox.h"
#include "lib/string/util_string.h"
-#include "common/socks5_status.h"
+#include "lib/net/socks5_status.h"
#include <stdio.h>
#include <stdlib.h>