This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new f03109c6bc Move InkAPI.cc into src/api (#10315)
f03109c6bc is described below
commit f03109c6bc586e9572448a4d81ca06236dd66dda
Author: Zhengxi Li <[email protected]>
AuthorDate: Tue Sep 12 15:08:13 2023 -0400
Move InkAPI.cc into src/api (#10315)
This PR moves InkAPI.cc into src/api, so that it's built into the
libtsapi.so. A new libtsapicore.a is created to separate out the stuff also
used in the core(e.g. Metrics) from the high-level plugin APIs.
Also moved some files around:
* Moved Hoststatus.cc from src/traffic_server/ to proxy/ where the header
is.
* Moved FetchSM.h/cc from src/traffic_server/ to include/api and src/api
respectively.
* Moved InkContInternal.cc and InkIOCoreAPI.cc from src/traffic_server/ to
src/api.
* Moved InkAPIInternal.h from proxy/ to include/api.
---
CMakeLists.txt | 2 +-
cmake/add_atsplugin.cmake | 2 +-
configure.ac | 1 +
.../introduction/header-file-structure.en.rst | 21 +++++++++++++--
{src/traffic_server => include/api}/FetchSM.h | 0
{proxy => include/api}/InkAPIInternal.h | 0
iocore/aio/Makefile.am | 2 +-
iocore/aio/test_AIO.cc | 2 +-
iocore/cache/Cache.cc | 2 +-
iocore/cache/Makefile.am | 2 +-
iocore/cache/test/stub.cc | 6 ++---
iocore/eventsystem/Makefile.am | 2 +-
iocore/hostdb/Makefile.am | 2 +-
iocore/net/CMakeLists.txt | 2 +-
iocore/net/Makefile.am | 5 ++--
iocore/net/OCSPStapling.cc | 2 +-
iocore/net/QUICNetVConnection.cc | 2 +-
iocore/net/SSLConfig.cc | 2 +-
iocore/net/SSLNetVConnection.cc | 2 +-
iocore/net/SSLSecret.cc | 2 +-
iocore/net/SSLUtils.cc | 2 +-
iocore/net/TLSSessionResumptionSupport.cc | 2 +-
iocore/net/libinknet_stub.cc | 4 +--
mgmt/config/FileManager.cc | 2 +-
mgmt/rpc/Makefile.am | 2 +-
mgmt/rpc/handlers/plugins/Plugins.cc | 2 +-
proxy/CMakeLists.txt | 2 ++
{src/traffic_server => proxy}/HostStatus.cc | 0
proxy/Makefile.am | 3 +++
proxy/Plugin.cc | 2 +-
proxy/ProxySession.h | 2 +-
proxy/Transform.h | 2 +-
proxy/hdrs/Makefile.am | 4 +--
proxy/http/Http1ClientSession.h | 2 +-
proxy/http/HttpSM.cc | 2 +-
proxy/http/HttpSM.h | 2 +-
proxy/http/Makefile.am | 4 +--
proxy/http/remap/Makefile.am | 8 +++---
proxy/http/remap/unit-tests/nexthop_test_stubs.cc | 2 +-
proxy/http2/Makefile.am | 4 +--
proxy/http3/CMakeLists.txt | 4 +--
proxy/http3/Makefile.am | 2 +-
src/api/CMakeLists.txt | 17 ++++++++++--
src/{traffic_server => api}/FetchSM.cc | 2 +-
src/{traffic_server => api}/InkAPI.cc | 11 +++++---
src/{traffic_server => api}/InkAPITest.cc | 0
src/{traffic_server => api}/InkContInternal.cc | 0
src/{traffic_server => api}/InkIOCoreAPI.cc | 0
src/api/Makefile.am | 31 +++++++++++++++++++---
src/records/CMakeLists.txt | 2 +-
src/records/Makefile.am | 4 +--
src/tests/CMakeLists.txt | 2 +-
src/traffic_crashlog/CMakeLists.txt | 2 +-
src/traffic_crashlog/Makefile.inc | 2 +-
src/traffic_layout/CMakeLists.txt | 2 +-
src/traffic_layout/Makefile.inc | 2 +-
src/traffic_logcat/CMakeLists.txt | 2 +-
src/traffic_logcat/Makefile.inc | 2 +-
src/traffic_logstats/CMakeLists.txt | 2 +-
src/traffic_logstats/Makefile.inc | 2 +-
src/traffic_quic/traffic_quic.cc | 4 +--
src/traffic_server/CMakeLists.txt | 22 +++++----------
src/traffic_server/Makefile.inc | 20 ++++++--------
src/traffic_server/traffic_server.cc | 13 +++------
tests/CMakeLists.txt | 2 +-
tools/benchmark/Makefile.am | 2 +-
66 files changed, 156 insertions(+), 112 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a1c7ac053..1ad10614fa 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 899d351694..27f5d8c1de 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 9b84930f59..826151aec7 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 ae7490c286..2dd22b795c 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 c0babc8da2..450a212a56 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 8742b5804a..498162b241 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 d21e477227..9233da2b0f 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 63daee25d4..2313b66f5e 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 1ea495ec96..87985aa033 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<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
void
FetchSM::ext_launch()
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index 082aac58fb..513a8b9e4f 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 88aaec7e6b..3f15a0f219 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 2897d6b7e5..03ce7d1fb4 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 2cb1c640a9..e9ec2270d9 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 375716b6c2..d117d42b16 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 3cf6746838..e909d7f002 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 1353a19366..620c6d6820 100644
--- a/iocore/net/SSLConfig.cc
+++ b/iocore/net/SSLConfig.cc
@@ -37,7 +37,7 @@
#include "tscore/ink_config.h"
#include <openssl/pem.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 "tscore/ink_platform.h"
#include "tscore/I_Layout.h"
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index b43bd91a82..3f732481ca 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 f90db39a91..e0bb8e502c 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 <utility>
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index d902c88368..5c056e2977 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 b4900f2525..79e45611d7 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 <openssl/core_names.h>
#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 d08ae17015..d836d7dbf9 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<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
void
FetchSM::ext_launch()
diff --git a/mgmt/config/FileManager.cc b/mgmt/config/FileManager.cc
index b79f689b90..21c6cb9f8c 100644
--- a/mgmt/config/FileManager.cc
+++ b/mgmt/config/FileManager.cc
@@ -25,7 +25,7 @@
#include <vector>
#include <algorithm>
-#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 2286fff6ec..d8afc528fe 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 92500faf1d..7d83570f8a 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 8ea6f9f8ce..376785dfaa 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 4e3a16a269..42132ceebe 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 e0a0bc3dc9..99a7688cf7 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 f2115069d5..6bb997a018 100644
--- a/proxy/ProxySession.h
+++ b/proxy/ProxySession.h
@@ -28,7 +28,7 @@
#include "tscore/TSSystemState.h"
#include <string_view>
#include <memory>
-#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 c07defce17..cf115e6e26 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 2aa0b66e3d..a1343e9826 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 c36db30725..531b7ab802 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 6f4264e009..de14655bf9 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 883a0ad300..09f19f2559 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 7c96ed3437..2894e2327c 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 e61c0aeb4d..e6e7f1a039 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 2f080f2909..ad33257414 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 6b9b837280..9db5940e6d 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 6d2caf71e6..d0e9120f42 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 07720502d8..3a2dab78f0 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 57873748a2..2180bd272d 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 $<TARGET_FILE:test_Metrics>)
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 0fae526bdf..281e93c182 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 <cstdio>
#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 987c7af6a9..a8782ebe6b 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 <swoc/bwf_base.h>
@@ -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 4c1326b6ad..5bedece5e6 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 745296e35b..e6332632c7 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 62325ea907..e9363c0412 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 ad351fd85f..3c05384fae 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 13df48df1b..962751251d 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 a2bc75e3d4..983004beba 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 7a02a6a507..59bb9bb388 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 d4f2637a90..c63b312742 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 7a0c3978fc..e702c553e3 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 4acc7c1fa3..962ecc7f80 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 be589c1761..f4ec1df212 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 0f9014a437..ee50cbbdb7 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 7db2863e52..837ff0a72f 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<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
void
FetchSM::ext_launch()
diff --git a/src/traffic_server/CMakeLists.txt
b/src/traffic_server/CMakeLists.txt
index c053d72b97..b261ace235 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 80bda75596..fd4bfb396d 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 def44b262f..d80af430d6 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 b6e20b090b..2959346f50 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 772fe19208..c56ba1a8c9 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@ \