diff options
25 files changed, 28 insertions, 22 deletions
diff --git a/changes/ticket31626 b/changes/ticket31626 new file mode 100644 index 0000000000..443bc1eb87 --- /dev/null +++ b/changes/ticket31626 @@ -0,0 +1,4 @@ + o Code simplification and refactoring: + - Move our backend logic for working with configuration and state + files into a lower-level library, since in no longer depends on + any tor-specific functionality. Closes ticket 31626. diff --git a/src/app/config/config.c b/src/app/config/config.c index b4bccd9351..bdfa547fd7 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -61,7 +61,7 @@ #define CONFIG_PRIVATE #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "app/config/statefile.h" #include "app/main/main.h" #include "app/main/subsysmgr.h" diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c index bcc06809b3..552bd2c443 100644 --- a/src/app/config/statefile.c +++ b/src/app/config/statefile.c @@ -32,7 +32,7 @@ #include "core/or/or.h" #include "core/or/circuitstats.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "core/mainloop/mainloop.h" #include "core/mainloop/netstatus.h" #include "core/mainloop/connection.h" diff --git a/src/core/include.am b/src/core/include.am index 914c370ec1..9b4b251c81 100644 --- a/src/core/include.am +++ b/src/core/include.am @@ -9,7 +9,6 @@ endif # ADD_C_FILE: INSERT SOURCES HERE. LIBTOR_APP_A_SOURCES = \ src/app/config/config.c \ - src/app/config/confparse.c \ src/app/config/statefile.c \ src/app/main/main.c \ src/app/main/shutdown.c \ @@ -214,7 +213,6 @@ src_core_libtor_app_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) # ADD_C_FILE: INSERT HEADERS HERE. noinst_HEADERS += \ src/app/config/config.h \ - src/app/config/confparse.h \ src/app/config/or_options_st.h \ src/app/config/or_state_st.h \ src/app/config/statefile.h \ diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c index ff809c01cf..1daf468715 100644 --- a/src/core/or/circuitbuild.c +++ b/src/core/or/circuitbuild.c @@ -30,7 +30,7 @@ #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "core/crypto/hs_ntor.h" #include "core/crypto/onion_crypto.h" #include "core/crypto/onion_fast.h" diff --git a/src/core/or/circuitstats.c b/src/core/or/circuitstats.c index 03eea1d779..7a7f3ca600 100644 --- a/src/core/or/circuitstats.c +++ b/src/core/or/circuitstats.c @@ -29,7 +29,7 @@ #include "core/or/circuitbuild.h" #include "core/or/circuitstats.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "feature/control/control_events.h" #include "lib/crypt_ops/crypto_rand.h" #include "core/mainloop/mainloop.h" diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c index 5b6216f483..36b575ef20 100644 --- a/src/feature/client/entrynodes.c +++ b/src/feature/client/entrynodes.c @@ -114,7 +114,7 @@ #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "app/config/statefile.h" #include "core/mainloop/connection.h" #include "core/mainloop/mainloop.h" diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c index ad4a4ef0af..a1d7f825db 100644 --- a/src/feature/control/control_cmd.c +++ b/src/feature/control/control_cmd.c @@ -13,7 +13,7 @@ #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "app/main/main.h" #include "core/mainloop/connection.h" #include "core/or/circuitbuild.h" diff --git a/src/feature/dirauth/shared_random.c b/src/feature/dirauth/shared_random.c index 5ccf1a95e5..a45f0a29c3 100644 --- a/src/feature/dirauth/shared_random.c +++ b/src/feature/dirauth/shared_random.c @@ -90,7 +90,7 @@ #include "core/or/or.h" #include "feature/dirauth/shared_random.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_util.h" #include "feature/nodelist/networkstatus.h" diff --git a/src/feature/dirauth/shared_random_state.c b/src/feature/dirauth/shared_random_state.c index f2a626c738..76befb0f5f 100644 --- a/src/feature/dirauth/shared_random_state.c +++ b/src/feature/dirauth/shared_random_state.c @@ -12,7 +12,7 @@ #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "lib/crypt_ops/crypto_util.h" #include "feature/dirauth/dirvote.h" #include "feature/nodelist/networkstatus.h" diff --git a/src/feature/hs/hs_dos.c b/src/feature/hs/hs_dos.c index 0ae36017f8..19794e09d3 100644 --- a/src/feature/hs/hs_dos.c +++ b/src/feature/hs/hs_dos.c @@ -29,7 +29,7 @@ #include "lib/evloop/token_bucket.h" -#include "hs_dos.h" +#include "feature/hs/hs_dos.h" /* Default value of the allowed INTRODUCE2 cell rate per second. Above that * value per second, the introduction is denied. */ diff --git a/src/lib/confmgt/.may_include b/src/lib/confmgt/.may_include index d85dbf6904..2564133917 100644 --- a/src/lib/confmgt/.may_include +++ b/src/lib/confmgt/.may_include @@ -7,3 +7,5 @@ lib/encoding/*.h lib/log/*.h lib/malloc/*.h lib/string/*.h +lib/testsupport/*.h +ext/*.h diff --git a/src/app/config/confparse.c b/src/lib/confmgt/confparse.c index 9f7fdc5c35..08e562f654 100644 --- a/src/app/config/confparse.c +++ b/src/lib/confmgt/confparse.c @@ -23,7 +23,7 @@ #define CONFPARSE_PRIVATE #include "orconfig.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "lib/confmgt/structvar.h" #include "lib/confmgt/unitparse.h" diff --git a/src/app/config/confparse.h b/src/lib/confmgt/confparse.h index 054348d8d4..054348d8d4 100644 --- a/src/app/config/confparse.h +++ b/src/lib/confmgt/confparse.h diff --git a/src/lib/confmgt/include.am b/src/lib/confmgt/include.am index aa5b37fdb5..81cd868e5e 100644 --- a/src/lib/confmgt/include.am +++ b/src/lib/confmgt/include.am @@ -6,6 +6,7 @@ endif # ADD_C_FILE: INSERT SOURCES HERE. src_lib_libtor_confmgt_a_SOURCES = \ + src/lib/confmgt/confparse.c \ src/lib/confmgt/structvar.c \ src/lib/confmgt/type_defs.c \ src/lib/confmgt/typedvar.c \ @@ -18,6 +19,7 @@ src_lib_libtor_confmgt_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) # ADD_C_FILE: INSERT HEADERS HERE. noinst_HEADERS += \ + src/lib/confmgt/confparse.h \ src/lib/confmgt/structvar.h \ src/lib/confmgt/type_defs.h \ src/lib/confmgt/typedvar.h \ diff --git a/src/test/test_btrack.c b/src/test/test_btrack.c index 21e88a57b6..80da7829ae 100644 --- a/src/test/test_btrack.c +++ b/src/test/test_btrack.c @@ -4,7 +4,7 @@ #include "core/or/or.h" #include "test/test.h" -#include "test_helpers.h" +#include "test/test_helpers.h" #include "test/log_test_helpers.h" #define OCIRC_EVENT_PRIVATE diff --git a/src/test/test_config.c b/src/test/test_config.c index 9b715b2ecf..78f9ae9c3f 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -16,7 +16,7 @@ #include "core/or/circuitmux_ewma.h" #include "core/or/circuitbuild.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "core/mainloop/connection.h" #include "core/or/connection_edge.h" #include "test/test.h" diff --git a/src/test/test_confmgr.c b/src/test/test_confmgr.c index 5f73d9754b..d5c73b48e4 100644 --- a/src/test/test_confmgr.c +++ b/src/test/test_confmgr.c @@ -13,7 +13,7 @@ #include "core/or/or.h" #include "lib/encoding/confline.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "test/test.h" #include "test/log_test_helpers.h" diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c index bd2b5cdf1b..d929d1e361 100644 --- a/src/test/test_confparse.c +++ b/src/test/test_confparse.c @@ -14,7 +14,7 @@ #include "core/or/or.h" #include "lib/encoding/confline.h" #include "feature/nodelist/routerset.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "test/test.h" #include "test/log_test_helpers.h" diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 17d6db1e4d..6329ff7750 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -26,7 +26,7 @@ #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "core/mainloop/connection.h" #include "core/or/relay.h" #include "core/or/versions.h" diff --git a/src/test/test_entryconn.c b/src/test/test_entryconn.c index fc7c5d5800..8f2d507743 100644 --- a/src/test/test_entryconn.c +++ b/src/test/test_entryconn.c @@ -11,7 +11,7 @@ #include "feature/client/addressmap.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "core/mainloop/connection.h" #include "core/or/connection_edge.h" #include "feature/nodelist/nodelist.h" diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 2bd803e494..d59b1c7153 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -18,7 +18,7 @@ #include "core/or/circuitlist.h" #include "core/or/circuitbuild.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "lib/crypt_ops/crypto_rand.h" #include "feature/dircommon/directory.h" #include "feature/dirclient/dirclient.h" diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c index 31a6540efc..8eb3c2c928 100644 --- a/src/test/test_helpers.c +++ b/src/test/test_helpers.c @@ -16,7 +16,7 @@ #include "lib/buf/buffers.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "app/main/subsysmgr.h" #include "core/mainloop/connection.h" #include "lib/crypt_ops/crypto_rand.h" diff --git a/src/test/test_options.c b/src/test/test_options.c index a6bccdc524..0747a2e062 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -5,7 +5,7 @@ #define CONFIG_PRIVATE #include "core/or/or.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "app/config/config.h" #include "test/test.h" #include "lib/geoip/geoip.h" diff --git a/src/test/test_pt.c b/src/test/test_pt.c index 362c6664db..8f3ce03c42 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -11,7 +11,7 @@ #define PROCESS_PRIVATE #include "core/or/or.h" #include "app/config/config.h" -#include "app/config/confparse.h" +#include "lib/confmgt/confparse.h" #include "feature/control/control.h" #include "feature/control/control_events.h" #include "feature/client/transports.h" |