diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1c7ac053a..1ad10614fa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,7 +404,6 @@ configure_file(include/ts/apidefs.h.in include/ts/apidefs.h) enable_testing() -add_subdirectory(src/api) add_subdirectory(src/tscpp/util) add_subdirectory(src/tscpp/api) add_subdirectory(src/tscore) @@ -413,6 +412,7 @@ add_subdirectory(iocore) add_subdirectory(proxy) add_subdirectory(mgmt/config) add_subdirectory(mgmt/rpc) +add_subdirectory(src/api) add_subdirectory(src/traffic_crashlog) add_subdirectory(src/traffic_server) add_subdirectory(src/traffic_ctl) diff --git a/cmake/add_atsplugin.cmake b/cmake/add_atsplugin.cmake index 899d3516943..27f5d8c1de9 100644 --- a/cmake/add_atsplugin.cmake +++ b/cmake/add_atsplugin.cmake @@ -19,7 +19,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "") function(add_atsplugin name) add_library(${name} MODULE ${ARGN}) - target_link_libraries(${name} PRIVATE traffic_server) + target_link_libraries(${name} PRIVATE ts::tsapi) set_target_properties(${name} PROPERTIES PREFIX "") set_target_properties(${name} PROPERTIES SUFFIX ".so") install(TARGETS ${name} DESTINATION libexec/trafficserver) diff --git a/configure.ac b/configure.ac index 9b84930f59a..826151aec77 100644 --- a/configure.ac +++ b/configure.ac @@ -771,6 +771,7 @@ esac TS_ADDTO(AM_CPPFLAGS, [-D$host_os_def]) AM_CONDITIONAL([OS_LINUX], [test "x$host_os_def" = "xlinux"]) +AM_CONDITIONAL([OS_NON_MACOS], [test "x$host_os_def" != "xdarwin"]) dnl AM_PROG_AR is not always available, but it doesn't seem to be needed in older versions. ifdef([AM_PROG_AR], diff --git a/doc/developer-guide/introduction/header-file-structure.en.rst b/doc/developer-guide/introduction/header-file-structure.en.rst index ae7490c2862..2dd22b795cd 100644 --- a/doc/developer-guide/introduction/header-file-structure.en.rst +++ b/doc/developer-guide/introduction/header-file-structure.en.rst @@ -18,8 +18,7 @@ Header Files ************ -There are four header directories, each containing header files for different purposes. Three of these -are available to plugins. +The header files are located in the ``include/`` directory. There are several sub-directories, each containing header files for different purposes. Three of these are available to plugins. "ts" The C Plugin API. These call functions directly embedded in ``traffic_server`` and therefore have @@ -43,6 +42,24 @@ are available to plugins. data structures either directly or operationally. This is linked in to the ``traffic_server`` binary therefore has no explicit linkage when used in the core. +"api" + Plugin API internal header files. These are header files for the internal ``tsapicore`` library (see below). Theses can only be used inside |TS| itself. + +New Plugin API layout +===================== + +Previously, all plugin interfaces were built into the main |TS| binary. In an effort to enhance modularity and enable compile-time checks, these interfaces have been moved to ``src/api``. They are now isolated into a separate shared library ``tsapi.so``. + +In addition, a new static library ``tsapicore.a`` has been created, which contains code used by both the core and the plugins (via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent. + +Note that ``tsapi.so`` depends on ``tsapicore.a`` and other static libraries in +the core. ``tsapi.so`` is not statically linked against these dependencies +during its creation, but relies on them being linked into |TS|. To verify these +dependencies, a compile-time sanity check links ``tsapi.so`` with the main +Traffic Server binary (|TS|), ensuring all symbols required by ``tsapi.so`` will +be available in |TS|. The actual binding of these dependent symbols occurs +dynamically at runtime when |TS| is launched. + Historical ========== diff --git a/src/traffic_server/FetchSM.h b/include/api/FetchSM.h similarity index 100% rename from src/traffic_server/FetchSM.h rename to include/api/FetchSM.h diff --git a/proxy/InkAPIInternal.h b/include/api/InkAPIInternal.h similarity index 100% rename from proxy/InkAPIInternal.h rename to include/api/InkAPIInternal.h diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am index c0babc8da23..450a212a56a 100644 --- a/iocore/aio/Makefile.am +++ b/iocore/aio/Makefile.am @@ -58,7 +58,7 @@ test_AIO_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc index 8742b5804a4..498162b2410 100644 --- a/iocore/aio/test_AIO.cc +++ b/iocore/aio/test_AIO.cc @@ -22,7 +22,7 @@ */ #include "P_AIO.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/ink_hw.h" #include "tscore/I_Layout.h" #include "tscore/TSSystemState.h" diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index d21e4772275..9233da2b0f0 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -33,7 +33,7 @@ #include "HttpTransactCache.h" #include "HttpSM.h" #include "HttpCacheSM.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/hugepages.h" diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am index 63daee25d48..2313b66f5ee 100644 --- a/iocore/cache/Makefile.am +++ b/iocore/cache/Makefile.am @@ -99,7 +99,7 @@ test_LDADD = \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/iocore/aio/libinkaio.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/lib/fastlz/libfastlz.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ diff --git a/iocore/cache/test/stub.cc b/iocore/cache/test/stub.cc index 1ea495ec964..87985aa0339 100644 --- a/iocore/cache/test/stub.cc +++ b/iocore/cache/test/stub.cc @@ -38,7 +38,7 @@ initialize_thread_for_http_sessions(EThread *, int) ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" void APIHooks::append(INKContInternal *cont) { @@ -105,8 +105,6 @@ SslAPIHooks *ssl_hooks = nullptr; LifecycleAPIHooks *lifecycle_hooks = nullptr; ConfigUpdateCbTable *global_config_cbs = nullptr; -HttpBodyFactory *body_factory = nullptr; - void HostStatus::setHostStatus(const std::string_view name, const TSHostStatus status, const unsigned int down_time, const unsigned int reason) @@ -215,7 +213,7 @@ INKVConnInternal::INKVConnInternal() : INKContInternal() {} INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {} -#include "../src/traffic_server/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am index 082aac58fb6..513a8b9e4fd 100644 --- a/iocore/eventsystem/Makefile.am +++ b/iocore/eventsystem/Makefile.am @@ -97,7 +97,7 @@ test_LD_ADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am index 88aaec7e6ba..3f15a0f219b 100644 --- a/iocore/hostdb/Makefile.am +++ b/iocore/hostdb/Makefile.am @@ -67,7 +67,7 @@ test_LD_ADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt index 2897d6b7e50..03ce7d1fb4e 100644 --- a/iocore/net/CMakeLists.txt +++ b/iocore/net/CMakeLists.txt @@ -114,7 +114,7 @@ target_include_directories(inknet PUBLIC ${CMAKE_SOURCE_DIR}/proxy/shared ${CMAKE_SOURCE_DIR}/proxy/http ${CMAKE_SOURCE_DIR}/proxy/http/remap - ${CMAKE_SOURCE_DIR}/src/traffic_server + ${CMAKE_SOURCE_DIR}/src/api ) target_link_libraries(inknet diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index 2cb1c640a99..e9ec2270d96 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -29,7 +29,6 @@ AM_CPPFLAGS += \ -I$(abs_top_srcdir)/proxy/shared \ -I$(abs_top_srcdir)/proxy/http \ -I$(abs_top_srcdir)/proxy/http/remap \ - -I$(abs_top_srcdir)/src/traffic_server \ $(TS_INCLUDES) \ @OPENSSL_INCLUDES@ \ @YAMLCPP_INCLUDES@ \ @@ -88,7 +87,7 @@ test_UDPNet_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/ParentSelectionStrategy.o \ @HWLOC_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBPCRE@ @LIBCAP@ if ENABLE_QUIC @@ -129,7 +128,7 @@ test_libinknet_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/proxy/ParentSelectionStrategy.o \ @HWLOC_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBCAP@ diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc index 375716b6c2f..d117d42b168 100644 --- a/iocore/net/OCSPStapling.cc +++ b/iocore/net/OCSPStapling.cc @@ -34,7 +34,7 @@ #include "P_SSLConfig.h" #include "P_SSLUtils.h" #include "SSLStats.h" -#include "FetchSM.h" +#include "api/FetchSM.h" // Macros for ASN1 and the code in TS_OCSP_* functions were borrowed from OpenSSL 3.1.0 (a92271e03a8d0dee507b6f1e7f49512568b2c7ad), // and were modified to make them compilable with BoringSSL and C++ compiler. diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 3cf67468380..e909d7f0020 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -30,7 +30,7 @@ #include "P_QUICNetVConnection.h" #include "P_QUICPacketHandler.h" #include "P_Net.h" -#include "InkAPIInternal.h" // Added to include the quic_hook definitions +#include "api/InkAPIInternal.h" // Added to include the quic_hook definitions #include "P_SSLNextProtocolSet.h" #include "QUICMultiCertConfigLoader.h" diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc index 1353a193662..620c6d68207 100644 --- a/iocore/net/SSLConfig.cc +++ b/iocore/net/SSLConfig.cc @@ -37,7 +37,7 @@ #include "tscore/ink_config.h" #include -#include "InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions #include "tscore/ink_platform.h" #include "tscore/I_Layout.h" diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index b43bd91a829..3f732481ca1 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -26,7 +26,7 @@ #include "tscore/I_Layout.h" #include "tscore/TSSystemState.h" -#include "InkAPIInternal.h" // Added to include the ssl_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook definitions #include "HttpTunnel.h" #include "ProxyProtocol.h" #include "HttpConfig.h" diff --git a/iocore/net/SSLSecret.cc b/iocore/net/SSLSecret.cc index f90db39a91c..e0bb8e502cb 100644 --- a/iocore/net/SSLSecret.cc +++ b/iocore/net/SSLSecret.cc @@ -21,7 +21,7 @@ #include "swoc/swoc_file.h" -#include "InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions #include "P_SSLConfig.h" #include diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index d902c88368c..5c056e29775 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -35,7 +35,7 @@ #include "records/I_RecHttp.h" #include "P_Net.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "P_OCSPStapling.h" #include "P_SSLConfig.h" diff --git a/iocore/net/TLSSessionResumptionSupport.cc b/iocore/net/TLSSessionResumptionSupport.cc index b4900f25252..79e45611d72 100644 --- a/iocore/net/TLSSessionResumptionSupport.cc +++ b/iocore/net/TLSSessionResumptionSupport.cc @@ -33,7 +33,7 @@ #ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB #include #endif -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/ink_config.h" // Remove this when drop OpenSSL 1.0.2 support diff --git a/iocore/net/libinknet_stub.cc b/iocore/net/libinknet_stub.cc index d08ae170151..d836d7dbf91 100644 --- a/iocore/net/libinknet_stub.cc +++ b/iocore/net/libinknet_stub.cc @@ -71,7 +71,7 @@ ParentConfigParams::nextParent(HttpRequestData *, ParentResult *, unsigned int, ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" int APIHook::invoke(int, void *) const { @@ -156,7 +156,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/traffic_server/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/mgmt/config/FileManager.cc b/mgmt/config/FileManager.cc index b79f689b90c..21c6cb9f8c7 100644 --- a/mgmt/config/FileManager.cc +++ b/mgmt/config/FileManager.cc @@ -25,7 +25,7 @@ #include #include -#include "InkAPIInternal.h" // TODO: this brings a lot of dependencies, double check this. +#include "api/InkAPIInternal.h" // TODO: this brings a lot of dependencies, double check this. #include "tscore/ink_platform.h" #include "tscore/ink_file.h" diff --git a/mgmt/rpc/Makefile.am b/mgmt/rpc/Makefile.am index 2286fff6ec4..d8afc528fed 100644 --- a/mgmt/rpc/Makefile.am +++ b/mgmt/rpc/Makefile.am @@ -106,7 +106,7 @@ test_jsonrpcserver_LDADD = \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ @YAMLCPP_LIBS@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/mgmt/rpc/handlers/plugins/Plugins.cc b/mgmt/rpc/handlers/plugins/Plugins.cc index 92500faf1d3..7d83570f8a9 100644 --- a/mgmt/rpc/handlers/plugins/Plugins.cc +++ b/mgmt/rpc/handlers/plugins/Plugins.cc @@ -21,7 +21,7 @@ #include "Plugins.h" #include "rpc/handlers/common/ErrorUtils.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" namespace { diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt index 8ea6f9f8cef..376785dfaae 100644 --- a/proxy/CMakeLists.txt +++ b/proxy/CMakeLists.txt @@ -21,6 +21,7 @@ add_library(proxy STATIC CacheControl.cc ControlBase.cc ControlMatcher.cc + HostStatus.cc IPAllow.cc ParentConsistentHash.cc ParentRoundRobin.cc @@ -55,6 +56,7 @@ set(PROXY_INCLUDE_DIRS ${PROXY_INCLUDE_DIRS} PARENT_SCOPE) target_include_directories(proxy PUBLIC ${IOCORE_INCLUDE_DIRS} ${PROXY_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/mgmt ${CMAKE_SOURCE_DIR}/lib/yamlcpp/include ) diff --git a/src/traffic_server/HostStatus.cc b/proxy/HostStatus.cc similarity index 100% rename from src/traffic_server/HostStatus.cc rename to proxy/HostStatus.cc diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 4e3a16a2690..42132ceebe4 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -31,6 +31,7 @@ AM_CPPFLAGS += \ $(iocore_include_dirs) \ -I$(abs_top_srcdir)/include \ -I$(abs_top_srcdir)/lib \ + -I$(abs_top_srcdir)/mgmt \ -I$(abs_srcdir)/http \ -I$(abs_srcdir)/http2 \ -I$(abs_srcdir)/http3 \ @@ -52,6 +53,8 @@ libproxy_a_SOURCES = \ ControlBase.h \ ControlMatcher.cc \ ControlMatcher.h \ + HostStatus.cc \ + HostStatus.h \ IPAllow.cc \ IPAllow.h \ ParentConsistentHash.cc \ diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index e0a0bc3dc9e..99a7688cf7b 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -27,7 +27,7 @@ #include "tscore/ParseRules.h" #include "records/I_RecCore.h" #include "tscore/I_Layout.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "Plugin.h" #include "tscore/ink_cap.h" #include "tscore/Filenames.h" diff --git a/proxy/ProxySession.h b/proxy/ProxySession.h index f2115069d57..6bb997a0186 100644 --- a/proxy/ProxySession.h +++ b/proxy/ProxySession.h @@ -28,7 +28,7 @@ #include "tscore/TSSystemState.h" #include #include -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "http/HttpSessionAccept.h" #include "IPAllow.h" #include "private/SSLProxySession.h" diff --git a/proxy/Transform.h b/proxy/Transform.h index c07defce170..cf115e6e269 100644 --- a/proxy/Transform.h +++ b/proxy/Transform.h @@ -25,7 +25,7 @@ #include "I_EventSystem.h" #include "HTTP.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #define TRANSFORM_READ_READY (TRANSFORM_EVENTS_START + 0) diff --git a/proxy/hdrs/Makefile.am b/proxy/hdrs/Makefile.am index 2aa0b66e3d9..a1343e98262 100644 --- a/proxy/hdrs/Makefile.am +++ b/proxy/hdrs/Makefile.am @@ -92,7 +92,7 @@ test_proxy_hdrs_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @YAMLCPP_LIBS@ @HWLOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ test_hdr_heap_CPPFLAGS = $(AM_CPPFLAGS) \ @@ -108,7 +108,7 @@ test_hdr_heap_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h index c36db307250..531b7ab802f 100644 --- a/proxy/http/Http1ClientSession.h +++ b/proxy/http/Http1ClientSession.h @@ -31,7 +31,7 @@ #pragma once -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "HTTP.h" #include "HttpConfig.h" #include "IPAllow.h" diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 6f4264e0095..de14655bf99 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -86,7 +86,7 @@ extern int cache_config_read_while_writer; -extern HttpBodyFactory *body_factory; +HttpBodyFactory *body_factory = nullptr; // We have a debugging list that can use to find stuck // state machines diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index 883a0ad300c..09f19f25598 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -43,7 +43,7 @@ #include "HttpVCTable.h" #include "UrlRewrite.h" #include "HttpTunnel.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "../ProxyTransaction.h" #include "HdrUtils.h" #include "tscore/History.h" diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am index 7c96ed34371..2894e2327ca 100644 --- a/proxy/http/Makefile.am +++ b/proxy/http/Makefile.am @@ -110,7 +110,7 @@ test_proxy_http_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @LIBCAP@ \ @@ -159,7 +159,7 @@ test_HttpTransact_LDADD = \ $(top_builddir)/iocore/net/libinknet.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ -lz -llzma -lcrypto -lresolv -lssl \ @LIBPCRE@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBCAP@ diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am index e61c0aeb4d5..e6e7f1a0393 100644 --- a/proxy/http/remap/Makefile.am +++ b/proxy/http/remap/Makefile.am @@ -68,7 +68,7 @@ libhttp_remap_a_SOURCES = \ COMMON_PLUGINDSO_LDADDS = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @@ -138,7 +138,7 @@ test_NextHopStrategyFactory_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/proxy/logging/liblogging.a \ @@ -173,7 +173,7 @@ test_NextHopRoundRobin_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/logging/liblogging.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ @@ -208,7 +208,7 @@ test_NextHopConsistentHash_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/logging/liblogging.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ diff --git a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc index 2f080f29093..ad332574146 100644 --- a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc +++ b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc @@ -166,7 +166,7 @@ HttpRequestData::get_client_ip() return &src_ip.sa; } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" void ConfigUpdateCbTable::invoke(char const *p) { diff --git a/proxy/http2/Makefile.am b/proxy/http2/Makefile.am index 6b9b837280f..9db5940e6d6 100644 --- a/proxy/http2/Makefile.am +++ b/proxy/http2/Makefile.am @@ -73,7 +73,7 @@ test_libhttp2_LDADD = \ HPACK.o \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @@ -129,7 +129,7 @@ test_HPACK_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @YAMLCPP_LIBS@ @LIBCAP@ test_HPACK_SOURCES = \ diff --git a/proxy/http3/CMakeLists.txt b/proxy/http3/CMakeLists.txt index 6d2caf71e66..d0e9120f427 100644 --- a/proxy/http3/CMakeLists.txt +++ b/proxy/http3/CMakeLists.txt @@ -59,7 +59,7 @@ target_link_libraries(test_http3 ts::quic ts::inkevent ts::records - ts::tsapi + ts::tsapicore ts::hdrs ts::tscore ) @@ -77,7 +77,7 @@ target_link_libraries(test_qpack ts::quic ts::inkevent ts::records - ts::tsapi + ts::tsapicore ts::hdrs ts::tscore ) diff --git a/proxy/http3/Makefile.am b/proxy/http3/Makefile.am index 07720502d8a..3a2dab78f00 100644 --- a/proxy/http3/Makefile.am +++ b/proxy/http3/Makefile.am @@ -73,7 +73,7 @@ test_LDADD = \ $(top_builddir)/iocore/net/TLSKeyLogger.o \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 57873748a2b..2180bd272d5 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -15,10 +15,23 @@ # ####################### -add_library(tsapi SHARED Metrics.cc) +add_library(tsapi SHARED + InkAPI.cc + InkContInternal.cc + InkIOCoreAPI.cc +) add_library(ts::tsapi ALIAS tsapi) target_link_libraries(tsapi PRIVATE ts::tscore) +add_library(tsapicore STATIC Metrics.cc FetchSM.cc) +add_library(ts::tsapicore ALIAS tsapicore) +target_link_libraries(tsapicore PRIVATE ts::tscore) + +include_directories( + ${IOCORE_INCLUDE_DIRS} + ${PROXY_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/mgmt +) install(TARGETS tsapi) @@ -30,7 +43,7 @@ add_executable(test_Metrics test_Metrics.cc ) -target_link_libraries(test_Metrics PRIVATE tsapi tscore catch2::catch2) +target_link_libraries(test_Metrics PRIVATE tsapicore tscore catch2::catch2) target_include_directories(test_Metrics PRIVATE ${CMAKE_SOURCE_DIR}/include) add_test(NAME test_Metrics COMMAND $) diff --git a/src/traffic_server/FetchSM.cc b/src/api/FetchSM.cc similarity index 99% rename from src/traffic_server/FetchSM.cc rename to src/api/FetchSM.cc index 0fae526bdf5..281e93c182d 100644 --- a/src/traffic_server/FetchSM.cc +++ b/src/api/FetchSM.cc @@ -22,7 +22,7 @@ */ #include "tscore/ink_config.h" -#include "FetchSM.h" +#include "api/FetchSM.h" #include #include "HTTP.h" #include "PluginVC.h" diff --git a/src/traffic_server/InkAPI.cc b/src/api/InkAPI.cc similarity index 99% rename from src/traffic_server/InkAPI.cc rename to src/api/InkAPI.cc index 987c7af6a9c..a8782ebe6b6 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -36,7 +36,7 @@ #include "tscore/Diags.h" #include "api/Metrics.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "Log.h" #include "URL.h" #include "MIME.h" @@ -65,7 +65,7 @@ #include "PluginVC.h" #include "HttpSessionAccept.h" #include "PluginVC.h" -#include "FetchSM.h" +#include "api/FetchSM.h" #include "HttpDebugNames.h" #include "I_AIO.h" #include "I_Tasks.h" @@ -78,6 +78,7 @@ #include "I_Machine.h" #include "HttpProxyServerMain.h" #include "shared/overridable_txn_vars.h" +#include "config/FileManager.h" #include "rpc/jsonrpc/JsonRPC.h" #include @@ -7740,7 +7741,11 @@ tsapi::c::TSMatcherLineValue(TSMatcherLine ml, int element) return (((matcher_line *)ml)->line)[1][element]; } -extern void load_config_file_callback(const char *parent, const char *remap_file); +void +load_config_file_callback(const char *parent_file, const char *remap_file) +{ + FileManager::instance().configFileChild(parent_file, remap_file); +} /* Config file name setting */ TSReturnCode diff --git a/src/traffic_server/InkAPITest.cc b/src/api/InkAPITest.cc similarity index 100% rename from src/traffic_server/InkAPITest.cc rename to src/api/InkAPITest.cc diff --git a/src/traffic_server/InkContInternal.cc b/src/api/InkContInternal.cc similarity index 100% rename from src/traffic_server/InkContInternal.cc rename to src/api/InkContInternal.cc diff --git a/src/traffic_server/InkIOCoreAPI.cc b/src/api/InkIOCoreAPI.cc similarity index 100% rename from src/traffic_server/InkIOCoreAPI.cc rename to src/api/InkIOCoreAPI.cc diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 4c1326b6adf..5bedece5e68 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -22,21 +22,46 @@ check_PROGRAMS = test_Metrics TESTS = $(check_PROGRAMS) +noinst_LIBRARIES = libtsapicore.a + lib_LTLIBRARIES = libtsapi.la AM_CPPFLAGS += \ + $(iocore_include_dirs) \ -I$(abs_top_srcdir)/include \ + -I$(abs_top_srcdir)/proxy \ + -I$(abs_top_srcdir)/proxy/hdrs \ + -I$(abs_top_srcdir)/proxy/http \ + -I$(abs_top_srcdir)/proxy/http2 \ + -I$(abs_top_srcdir)/proxy/http/remap \ + -I$(abs_top_srcdir)/proxy/logging \ + -I$(abs_top_srcdir)/mgmt/rpc \ + -I$(abs_top_srcdir)/mgmt/ \ @SWOC_INCLUDES@ \ + @YAMLCPP_INCLUDES@ \ $(TS_INCLUDES) +# libtsapi.la libtsapi_la_LDFLAGS = @AM_LDFLAGS@ -version-info @TS_LIBTOOL_VERSION@ @SWOC_LDFLAGS@ libtsapi_la_LIBADD = \ @SWOC_LIBS@ - libtsapi_la_SOURCES = \ - Metrics.cc + InkAPI.cc \ + InkContInternal.cc \ + InkIOCoreAPI.cc + +if BUILD_TESTS +libtsapi_la_SOURCES += \ + InkAPITest.cc +endif + +# libtsapicore.a + +libtsapicore_a_SOURCES = \ + Metrics.cc \ + FetchSM.cc test_Metrics_SOURCES = test_Metrics.cc @@ -45,7 +70,7 @@ test_Metrics_CPPFLAGS = $(AM_CPPFLAGS)\ test_Metrics_LDADD = \ $(top_builddir)/src/tscore/libtscore.a \ - libtsapi.la + libtsapicore.a clang-tidy-local: $(DIST_SOURCES) diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt index 745296e35bc..e6332632c79 100644 --- a/src/records/CMakeLists.txt +++ b/src/records/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(records ts::tscore yaml-cpp::yaml-cpp PRIVATE - ts::tsapi + ts::tsapicore ) add_executable(test_records unit_tests/unit_test_main.cc unit_tests/test_RecHttp.cc) diff --git a/src/records/Makefile.am b/src/records/Makefile.am index 62325ea907d..e9363c0412c 100644 --- a/src/records/Makefile.am +++ b/src/records/Makefile.am @@ -72,7 +72,7 @@ test_librecords_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @LIBCAP@ @YAMLCPP_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ test_librecords_on_eventsystem_CPPFLAGS = $(AM_CPPFLAGS)\ @@ -87,7 +87,7 @@ test_librecords_on_eventsystem_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @HWLOC_LIBS@ @LIBCAP@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ clang-tidy-local: $(sort $(DIST_SOURCES)) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ad351fd85fa..3c05384faed 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -47,7 +47,7 @@ link_libraries( aio records tscore - tsapi + tsapicore tscpputil proxy inknet diff --git a/src/traffic_crashlog/CMakeLists.txt b/src/traffic_crashlog/CMakeLists.txt index 13df48df1b0..962751251db 100644 --- a/src/traffic_crashlog/CMakeLists.txt +++ b/src/traffic_crashlog/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries(traffic_crashlog ts::inkevent ts::records ts::tscore - ts::tsapi + ts::tsapicore ) install(TARGETS traffic_crashlog) diff --git a/src/traffic_crashlog/Makefile.inc b/src/traffic_crashlog/Makefile.inc index a2bc75e3d40..983004beba8 100644 --- a/src/traffic_crashlog/Makefile.inc +++ b/src/traffic_crashlog/Makefile.inc @@ -40,5 +40,5 @@ traffic_crashlog_traffic_crashlog_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/src/traffic_layout/CMakeLists.txt b/src/traffic_layout/CMakeLists.txt index 7a02a6a5075..59bb9bb3881 100644 --- a/src/traffic_layout/CMakeLists.txt +++ b/src/traffic_layout/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries(traffic_layout OpenSSL::Crypto yaml-cpp::yaml-cpp ts::tscore - ts::tsapi + ts::tsapicore PCRE::PCRE ${OPENSSL_LIBRARY} ) diff --git a/src/traffic_layout/Makefile.inc b/src/traffic_layout/Makefile.inc index d4f2637a900..c63b3127424 100644 --- a/src/traffic_layout/Makefile.inc +++ b/src/traffic_layout/Makefile.inc @@ -45,5 +45,5 @@ traffic_layout_traffic_layout_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @LIBLZMA@ @LIBPCRE@ @LIBCAP@ diff --git a/src/traffic_logcat/CMakeLists.txt b/src/traffic_logcat/CMakeLists.txt index 7a0c3978fc5..e702c553e33 100644 --- a/src/traffic_logcat/CMakeLists.txt +++ b/src/traffic_logcat/CMakeLists.txt @@ -16,5 +16,5 @@ ####################### add_executable(traffic_logcat logcat.cc) -target_link_libraries(traffic_logcat PRIVATE ts::tscore ts::proxy ts::logging ts::hdrs ts::tsapi ts::diagsconfig libswoc) +target_link_libraries(traffic_logcat PRIVATE ts::tscore ts::proxy ts::logging ts::hdrs ts::tsapicore ts::diagsconfig libswoc) install(TARGETS traffic_logcat) diff --git a/src/traffic_logcat/Makefile.inc b/src/traffic_logcat/Makefile.inc index 4acc7c1fa35..962ecc7f808 100644 --- a/src/traffic_logcat/Makefile.inc +++ b/src/traffic_logcat/Makefile.inc @@ -46,7 +46,7 @@ traffic_logcat_traffic_logcat_LDADD = \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @YAMLCPP_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ \ @LIBPROFILER@ -lm diff --git a/src/traffic_logstats/CMakeLists.txt b/src/traffic_logstats/CMakeLists.txt index be589c1761b..f4ec1df2126 100644 --- a/src/traffic_logstats/CMakeLists.txt +++ b/src/traffic_logstats/CMakeLists.txt @@ -16,7 +16,7 @@ ####################### add_executable(traffic_logstats logstats.cc) -target_link_libraries(traffic_logstats PRIVATE ts::logging ts::hdrs ts::tscore ts::tsapi ts::records ts::diagsconfig ts::inkevent libswoc) +target_link_libraries(traffic_logstats PRIVATE ts::logging ts::hdrs ts::tscore ts::tsapicore ts::records ts::diagsconfig ts::inkevent libswoc) add_test( NAME test_logstats_json diff --git a/src/traffic_logstats/Makefile.inc b/src/traffic_logstats/Makefile.inc index 0f9014a437f..ee50cbbdb7f 100644 --- a/src/traffic_logstats/Makefile.inc +++ b/src/traffic_logstats/Makefile.inc @@ -50,7 +50,7 @@ traffic_logstats_traffic_logstats_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @OPENSSL_LIBS@ \ @SWOC_LIBS@ \ diff --git a/src/traffic_quic/traffic_quic.cc b/src/traffic_quic/traffic_quic.cc index 7db2863e520..837ff0a72fc 100644 --- a/src/traffic_quic/traffic_quic.cc +++ b/src/traffic_quic/traffic_quic.cc @@ -173,7 +173,7 @@ ParentConfigParams::nextParent(HttpRequestData *, ParentResult *, unsigned int, ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" APIHook * APIHook::next() const @@ -347,7 +347,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/traffic_server/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt index c053d72b971..b261ace2355 100644 --- a/src/traffic_server/CMakeLists.txt +++ b/src/traffic_server/CMakeLists.txt @@ -15,23 +15,9 @@ # ####################### -add_library(inkcont STATIC InkContInternal.cc) -add_library(ts::inkcont ALIAS inkcont) - -target_link_libraries(inkcont - PRIVATE - ts::http_remap - ts::inkevent - ts::tscore -) - add_executable(traffic_server Crash.cc EventName.cc - FetchSM.cc - HostStatus.cc - InkAPI.cc - InkIOCoreAPI.cc SocksProxy.cc traffic_server.cc RpcAdminPubHandlers.cc @@ -46,7 +32,7 @@ target_link_libraries(traffic_server PRIVATE ts::tscore ts::tsapi - ts::inkcont + ts::tsapicore ts::http ts::http_remap ts::http2 @@ -68,6 +54,12 @@ target_link_libraries(traffic_server ts::jsonrpc_server ts::rpcpublichandlers ) +if(NOT APPLE) + # Skipping apple because macOS doesn't seem to provide an equivalent option + # for disallowing undefined symbols in shared libraries the executable + # depends on. + target_link_options(traffic_server PRIVATE -Wl,--no-undefined,--no-allow-shlib-undefined) +endif() if(TS_USE_QUIC) target_link_libraries(traffic_server diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc index 80bda75596e..fd4bfb396de 100644 --- a/src/traffic_server/Makefile.inc +++ b/src/traffic_server/Makefile.inc @@ -43,28 +43,23 @@ traffic_server_traffic_server_LDFLAGS = \ @SWOC_LDFLAGS@ \ @YAMLCPP_LDFLAGS@ +if OS_NON_MACOS + # Skipping apple because macOS doesn't seem to provide an equivalent option + # for disallowing undefined symbols in shared libraries the executable + # depends on. + traffic_server_traffic_server_LDFLAGS += -Wl,--no-undefined,--no-allow-shlib-undefined +endif + traffic_server_traffic_server_SOURCES = \ traffic_server/Crash.cc \ traffic_server/EventName.cc \ traffic_server/EventName.h \ - traffic_server/FetchSM.cc \ - traffic_server/FetchSM.h \ - traffic_server/HostStatus.cc \ - traffic_server/InkAPI.cc \ - traffic_server/InkContInternal.cc \ - traffic_server/InkIOCoreAPI.cc \ traffic_server/SocksProxy.cc \ traffic_server/RpcAdminPubHandlers.cc \ traffic_server/RpcAdminPubHandlers.h \ shared/overridable_txn_vars.cc \ traffic_server/traffic_server.cc - -if BUILD_TESTS -traffic_server_traffic_server_SOURCES += \ - traffic_server/InkAPITest.cc -endif - traffic_server_traffic_server_LDADD = \ $(top_builddir)/proxy/http/libhttp.a \ $(top_builddir)/proxy/http/remap/libhttp_remap.a \ @@ -80,6 +75,7 @@ traffic_server_traffic_server_LDADD = \ $(top_builddir)/lib/fastlz/libfastlz.a \ $(top_builddir)/iocore/aio/libinkaio.a \ $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/libproxy.a \ $(top_builddir)/iocore/net/libinknet.a \ $(top_builddir)/src/records/librecords_p.a \ diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index def44b262f2..d80af430d62 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -98,7 +98,7 @@ extern "C" int plock(int); #include "RemapPluginInfo.h" #include "RemapProcessor.h" #include "I_Tasks.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "HTTP2.h" #include "tscore/ink_config.h" #include "P_SSLClientUtils.h" @@ -135,8 +135,7 @@ static char diags_log_filename[PATH_NAME_MAX] = DEFAULT_DIAGS_LOG_FILENAME; static const long MAX_LOGIN = ink_login_name_max(); static void init_ssl_ctx_callback(void *ctx, bool server); -// This isn't static as its also called from InkAPI.cc -void load_config_file_callback(const char *parent_file, const char *remap_file); +extern void load_config_file_callback(const char *parent_file, const char *remap_file); static void load_ssl_file_callback(const char *ssl_file); static void task_threads_started_callback(); @@ -169,7 +168,7 @@ static char error_tags[1024] = ""; static char action_tags[1024] = ""; static int show_statistics = 0; static DiagsConfig *diagsConfig = nullptr; -HttpBodyFactory *body_factory = nullptr; +extern HttpBodyFactory *body_factory; static int accept_mss = 0; static int poll_timeout = -1; // No value set. @@ -2317,12 +2316,6 @@ load_ssl_file_callback(const char *ssl_file) FileManager::instance().configFileChild(ts::filename::SSL_MULTICERT, ssl_file); } -void -load_config_file_callback(const char *parent_file, const char *remap_file) -{ - FileManager::instance().configFileChild(parent_file, remap_file); -} - static void task_threads_started_callback() { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b6e20b090b7..2959346f501 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,7 +22,7 @@ function(ADD_AUTEST_PLUGIN _NAME _SOURCES) PREFIX "" SUFFIX ".so" ) - target_link_libraries(${_NAME} PRIVATE traffic_server) + target_link_libraries(${_NAME} PRIVATE ts::tsapi) endfunction() add_subdirectory(tools/plugins) diff --git a/tools/benchmark/Makefile.am b/tools/benchmark/Makefile.am index 772fe19208f..c56ba1a8c93 100644 --- a/tools/benchmark/Makefile.am +++ b/tools/benchmark/Makefile.am @@ -49,7 +49,7 @@ benchmark_LD_ADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @HWLOC_LIBS@ \ @LIBPCRE@ \