Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/add_atsplugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
21 changes: 19 additions & 2 deletions doc/developer-guide/introduction/header-file-structure.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
==========

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion iocore/aio/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down
2 changes: 1 addition & 1 deletion iocore/aio/test_AIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/Cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "HttpTransactCache.h"
#include "HttpSM.h"
#include "HttpCacheSM.h"
#include "InkAPIInternal.h"
#include "api/InkAPIInternal.h"

#include "tscore/hugepages.h"

Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 2 additions & 4 deletions iocore/cache/test/stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion iocore/eventsystem/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down
2 changes: 1 addition & 1 deletion iocore/hostdb/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down
2 changes: 1 addition & 1 deletion iocore/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions iocore/net/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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@ \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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@
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/OCSPStapling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/QUICNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/SSLConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/SSLNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/SSLSecret.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/SSLUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/TLSSessionResumptionSupport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions iocore/net/libinknet_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion mgmt/config/FileManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rpc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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@
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rpc/handlers/plugins/Plugins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "Plugins.h"
#include "rpc/handlers/common/ErrorUtils.h"

#include "InkAPIInternal.h"
#include "api/InkAPIInternal.h"

namespace
{
Expand Down
2 changes: 2 additions & 0 deletions proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_library(proxy STATIC
CacheControl.cc
ControlBase.cc
ControlMatcher.cc
HostStatus.cc
IPAllow.cc
ParentConsistentHash.cc
ParentRoundRobin.cc
Expand Down Expand Up @@ -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
)

Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions proxy/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -52,6 +53,8 @@ libproxy_a_SOURCES = \
ControlBase.h \
ControlMatcher.cc \
ControlMatcher.h \
HostStatus.cc \
HostStatus.h \
IPAllow.cc \
IPAllow.h \
ParentConsistentHash.cc \
Expand Down
2 changes: 1 addition & 1 deletion proxy/Plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion proxy/ProxySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion proxy/Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions proxy/hdrs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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@

Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Http1ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#pragma once

#include "InkAPIInternal.h"
#include "api/InkAPIInternal.h"
#include "HTTP.h"
#include "HttpConfig.h"
#include "IPAllow.h"
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/HttpSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading