This is an automated email from the ASF dual-hosted git repository.
amc 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 321c1e1 RemapPluginInfo Refresh.
321c1e1 is described below
commit 321c1e1c7d236aed8f8aa14db2066c58feb4b2e8
Author: Alan M. Carroll <[email protected]>
AuthorDate: Mon Feb 25 10:57:10 2019 -0600
RemapPluginInfo Refresh.
---
proxy/ReverseProxy.cc | 3 +-
proxy/ReverseProxy.h | 1 -
proxy/http/HttpTransact.h | 4 +-
proxy/http/remap/RemapConfig.cc | 64 +++++++++++---------------
proxy/http/remap/RemapPluginInfo.cc | 92 ++++++++++---------------------------
proxy/http/remap/RemapPluginInfo.h | 90 +++++++++++++++++++++---------------
proxy/http/remap/RemapPlugins.cc | 8 ++--
proxy/http/remap/RemapPlugins.h | 2 +-
proxy/http/remap/UrlMapping.cc | 12 ++---
proxy/http/remap/UrlMapping.h | 6 +--
10 files changed, 121 insertions(+), 161 deletions(-)
diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc
index 8fe9da8..0164da9 100644
--- a/proxy/ReverseProxy.cc
+++ b/proxy/ReverseProxy.cc
@@ -43,8 +43,7 @@
// Global Ptrs
static Ptr<ProxyMutex> reconfig_mutex;
-UrlRewrite *rewrite_table = nullptr;
-remap_plugin_info *remap_pi_list = nullptr; // We never reload the remap
plugins, just append to 'em.
+UrlRewrite *rewrite_table = nullptr;
// Tokens for the Callback function
#define FILE_CHANGED 0
diff --git a/proxy/ReverseProxy.h b/proxy/ReverseProxy.h
index dd205cf..49f2e21 100644
--- a/proxy/ReverseProxy.h
+++ b/proxy/ReverseProxy.h
@@ -46,7 +46,6 @@ class url_mapping;
struct host_hdr_info;
extern UrlRewrite *rewrite_table;
-extern remap_plugin_info *remap_pi_list;
// API Functions
int init_reverse_proxy();
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 5315cdb..73d5e12 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -768,8 +768,8 @@ public:
// INK API/Remap API plugin interface
void *remap_plugin_instance = nullptr;
void *user_args[TS_HTTP_MAX_USER_ARG];
- remap_plugin_info::_tsremap_os_response *fp_tsremap_os_response = nullptr;
- HTTPStatus http_return_code =
HTTP_STATUS_NONE;
+ RemapPluginInfo::OS_Response_F *fp_tsremap_os_response = nullptr;
+ HTTPStatus http_return_code = HTTP_STATUS_NONE;
int api_txn_active_timeout_value = -1;
int api_txn_connect_timeout_value = -1;
diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index c0eab6e..872eb6d 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -714,7 +714,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
{
TSRemapInterface ri;
struct stat stat_buf;
- remap_plugin_info *pi;
+ RemapPluginInfo *pi;
char *c, *err, tmpbuf[2048], default_path[PATH_NAME_MAX];
const char *new_argv[1024];
char *parv[1024];
@@ -775,13 +775,9 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
Debug("remap_plugin", "using path %s for plugin", c);
- if (!remap_pi_list || (pi = remap_pi_list->find_by_path(c)) == nullptr) {
- pi = new remap_plugin_info(c);
- if (!remap_pi_list) {
- remap_pi_list = pi;
- } else {
- remap_pi_list->add_to_list(pi);
- }
+ if ((pi = RemapPluginInfo::find_by_path(c)) == nullptr) {
+ pi = new RemapPluginInfo(ts::file::path(c));
+ RemapPluginInfo::add_to_list(pi);
Debug("remap_plugin", "New remap plugin info created for \"%s\"", c);
{
@@ -789,7 +785,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
REC_ReadConfigInteger(elevate_access,
"proxy.config.plugin.load_elevated");
ElevateAccess access(elevate_access ? ElevateAccess::FILE_PRIVILEGE : 0);
- if ((pi->dlh = dlopen(c, RTLD_NOW)) == nullptr) {
+ if ((pi->dl_handle = dlopen(c, RTLD_NOW)) == nullptr) {
#if defined(freebsd) || defined(openbsd)
err = (char *)dlerror();
#else
@@ -798,30 +794,28 @@ remap_load_plugin(const char **argv, int argc,
url_mapping *mp, char *errbuf, in
snprintf(errbuf, errbufsize, "Can't load plugin \"%s\" - %s", c, err ?
err : "Unknown dlopen() error");
return -4;
}
- pi->fp_tsremap_init = reinterpret_cast<remap_plugin_info::_tsremap_init
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_INIT));
- pi->fp_tsremap_config_reload =
- reinterpret_cast<remap_plugin_info::_tsremap_config_reload
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_CONFIG_RELOAD));
- pi->fp_tsremap_done = reinterpret_cast<remap_plugin_info::_tsremap_done
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_DONE));
- pi->fp_tsremap_new_instance =
- reinterpret_cast<remap_plugin_info::_tsremap_new_instance
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_NEW_INSTANCE));
- pi->fp_tsremap_delete_instance =
- reinterpret_cast<remap_plugin_info::_tsremap_delete_instance
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_DELETE_INSTANCE));
- pi->fp_tsremap_do_remap =
reinterpret_cast<remap_plugin_info::_tsremap_do_remap *>(dlsym(pi->dlh,
TSREMAP_FUNCNAME_DO_REMAP));
- pi->fp_tsremap_os_response =
- reinterpret_cast<remap_plugin_info::_tsremap_os_response
*>(dlsym(pi->dlh, TSREMAP_FUNCNAME_OS_RESPONSE));
-
- if (!pi->fp_tsremap_init) {
+ pi->init_cb = reinterpret_cast<RemapPluginInfo::Init_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_INIT));
+ pi->config_reload_cb = reinterpret_cast<RemapPluginInfo::Reload_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_CONFIG_RELOAD));
+ pi->done_cb = reinterpret_cast<RemapPluginInfo::Done_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_DONE));
+ pi->new_instance_cb =
+ reinterpret_cast<RemapPluginInfo::New_Instance_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_NEW_INSTANCE));
+ pi->delete_instance_cb =
+ reinterpret_cast<RemapPluginInfo::Delete_Instance_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_DELETE_INSTANCE));
+ pi->do_remap_cb = reinterpret_cast<RemapPluginInfo::Do_Remap_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_DO_REMAP));
+ pi->os_response_cb = reinterpret_cast<RemapPluginInfo::OS_Response_F
*>(dlsym(pi->dl_handle, TSREMAP_FUNCNAME_OS_RESPONSE));
+
+ if (!pi->init_cb) {
snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap
plugin "%s")", TSREMAP_FUNCNAME_INIT, c);
retcode = -10;
- } else if (!pi->fp_tsremap_new_instance &&
pi->fp_tsremap_delete_instance) {
+ } else if (!pi->new_instance_cb && pi->delete_instance_cb) {
snprintf(errbuf, errbufsize,
R"(Can't find "%s" function in remap plugin "%s" which is
required if "%s" function exists)",
TSREMAP_FUNCNAME_NEW_INSTANCE, c,
TSREMAP_FUNCNAME_DELETE_INSTANCE);
retcode = -11;
- } else if (!pi->fp_tsremap_do_remap) {
+ } else if (!pi->do_remap_cb) {
snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap
plugin "%s")", TSREMAP_FUNCNAME_DO_REMAP, c);
retcode = -12;
- } else if (pi->fp_tsremap_new_instance &&
!pi->fp_tsremap_delete_instance) {
+ } else if (pi->new_instance_cb && !pi->delete_instance_cb) {
snprintf(errbuf, errbufsize,
R"(Can't find "%s" function in remap plugin "%s" which is
required if "%s" function exists)",
TSREMAP_FUNCNAME_DELETE_INSTANCE, c,
TSREMAP_FUNCNAME_NEW_INSTANCE);
@@ -831,16 +825,16 @@ remap_load_plugin(const char **argv, int argc,
url_mapping *mp, char *errbuf, in
if (errbuf && errbufsize > 0) {
Debug("remap_plugin", "%s", errbuf);
}
- dlclose(pi->dlh);
- pi->dlh = nullptr;
+ dlclose(pi->dl_handle);
+ pi->dl_handle = nullptr;
return retcode;
}
memset(&ri, 0, sizeof(ri));
ri.size = sizeof(ri);
ri.tsremap_version = TSREMAP_VERSION;
- if (pi->fp_tsremap_init(&ri, tmpbuf, sizeof(tmpbuf) - 1) != TS_SUCCESS) {
- snprintf(errbuf, errbufsize, "Failed to initialize plugin \"%s\": %s",
pi->path,
+ if (pi->init_cb(&ri, tmpbuf, sizeof(tmpbuf) - 1) != TS_SUCCESS) {
+ snprintf(errbuf, errbufsize, "Failed to initialize plugin \"%s\": %s",
pi->path.c_str(),
tmpbuf[0] ? tmpbuf : "Unknown plugin error");
return -5;
}
@@ -848,7 +842,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
Debug("remap_plugin", "Remap plugin \"%s\" - initialization completed", c);
}
- if (!pi->dlh) {
+ if (!pi->dl_handle) {
snprintf(errbuf, errbufsize, "Can't load plugin \"%s\"", c);
return -6;
}
@@ -889,7 +883,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
Debug("url_rewrite", "Argument %d: %s", k, argv[k]);
}
- Debug("url_rewrite", "Viewing parsed plugin parameters for %s: [%d]",
pi->path, *plugin_found_at);
+ Debug("url_rewrite", "Viewing parsed plugin parameters for %s: [%d]",
pi->path.c_str(), *plugin_found_at);
for (int k = 0; k < parc; k++) {
Debug("url_rewrite", "Argument %d: %s", k, parv[k]);
}
@@ -898,7 +892,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
void *ih = nullptr;
TSReturnCode res = TS_SUCCESS;
- if (pi->fp_tsremap_new_instance) {
+ if (pi->new_instance_cb) {
#if (!defined(kfreebsd) && defined(freebsd)) || defined(darwin)
optreset = 1;
#endif
@@ -910,7 +904,7 @@ remap_load_plugin(const char **argv, int argc, url_mapping
*mp, char *errbuf, in
opterr = 0;
optarg = nullptr;
- res = pi->fp_tsremap_new_instance(parc, parv, &ih, tmpbuf, sizeof(tmpbuf)
- 1);
+ res = pi->new_instance_cb(parc, parv, &ih, tmpbuf, sizeof(tmpbuf) - 1);
}
Debug("remap_plugin", "done creating new plugin instance");
@@ -1426,9 +1420,7 @@ remap_parse_config(const char *path, UrlRewrite *rewrite)
// If this happens to be a config reload, the list of loaded remap plugins
is non-empty, and we
// can signal all these plugins that a reload has begun.
- if (remap_pi_list) {
- remap_pi_list->indicate_reload();
- }
+ RemapPluginInfo::indicate_reload();
bti.rewrite = rewrite;
return remap_parse_config_bti(path, &bti);
}
diff --git a/proxy/http/remap/RemapPluginInfo.cc
b/proxy/http/remap/RemapPluginInfo.cc
index ad0b06c..db6dfe5 100644
--- a/proxy/http/remap/RemapPluginInfo.cc
+++ b/proxy/http/remap/RemapPluginInfo.cc
@@ -1,6 +1,6 @@
/** @file
- A brief file description
+ Information about remap plugin libraries.
@section license License
@@ -25,102 +25,56 @@
#include "tscore/ink_string.h"
#include "tscore/ink_memory.h"
-remap_plugin_info::remap_plugin_info(char *_path)
- : next(nullptr),
- path(nullptr),
- path_size(0),
- dlh(nullptr),
- fp_tsremap_init(nullptr),
- fp_tsremap_config_reload(nullptr),
- fp_tsremap_done(nullptr),
- fp_tsremap_new_instance(nullptr),
- fp_tsremap_delete_instance(nullptr),
- fp_tsremap_do_remap(nullptr),
- fp_tsremap_os_response(nullptr)
-{
- // coverity did not see ats_free
- // coverity[ctor_dtor_leak]
- if (_path && likely((path = ats_strdup(_path)) != nullptr)) {
- path_size = strlen(path);
- }
-}
+RemapPluginInfo::List RemapPluginInfo::g_list;
-remap_plugin_info::~remap_plugin_info()
+RemapPluginInfo::RemapPluginInfo(ts::file::path &&library_path) :
path(std::move(library_path)) {}
+
+RemapPluginInfo::~RemapPluginInfo()
{
- ats_free(path);
- if (dlh) {
- dlclose(dlh);
+ if (dl_handle) {
+ dlclose(dl_handle);
}
}
//
// Find a plugin by path from our linked list
//
-remap_plugin_info *
-remap_plugin_info::find_by_path(char *_path)
+RemapPluginInfo *
+RemapPluginInfo::find_by_path(std::string_view library_path)
{
- int _path_size = 0;
- remap_plugin_info *pi = nullptr;
-
- if (likely(_path && (_path_size = strlen(_path)) > 0)) {
- for (pi = this; pi; pi = pi->next) {
- if (pi->path && pi->path_size == _path_size && !strcmp(pi->path, _path))
{
- break;
- }
- }
- }
-
- return pi;
+ auto spot = std::find_if(g_list.begin(), g_list.end(),
+ [&](self_type const &info) -> bool { return 0 ==
library_path.compare(info.path.view()); });
+ return spot == g_list.end() ? nullptr : static_cast<self_type *>(spot);
}
//
// Add a plugin to the linked list
//
void
-remap_plugin_info::add_to_list(remap_plugin_info *pi)
+RemapPluginInfo::add_to_list(RemapPluginInfo *pi)
{
- remap_plugin_info *p = this;
-
- if (likely(pi)) {
- while (p->next) {
- p = p->next;
- }
-
- p->next = pi;
- pi->next = nullptr;
- }
+ g_list.append(pi);
}
//
-// Remove and delete all plugins from a list, including ourselves.
+// Remove and delete all plugins from a list.
//
void
-remap_plugin_info::delete_my_list()
+RemapPluginInfo::delete_list()
{
- remap_plugin_info *p = this->next;
-
- while (p) {
- remap_plugin_info *tmp = p;
-
- p = p->next;
- delete tmp;
- }
-
- delete this;
+ g_list.apply([](self_type *info) -> void { delete info; });
+ g_list.clear();
}
//
// Tell all plugins (that so wish) that remap.config is being reloaded
//
void
-remap_plugin_info::indicate_reload()
+RemapPluginInfo::indicate_reload()
{
- remap_plugin_info *p = this;
-
- while (p) {
- if (p->fp_tsremap_config_reload) {
- p->fp_tsremap_config_reload();
+ g_list.apply([](self_type *info) -> void {
+ if (info->config_reload_cb) {
+ info->config_reload_cb();
}
- p = p->next;
- }
+ });
}
diff --git a/proxy/http/remap/RemapPluginInfo.h
b/proxy/http/remap/RemapPluginInfo.h
index a83a485..a9ac0b7 100644
--- a/proxy/http/remap/RemapPluginInfo.h
+++ b/proxy/http/remap/RemapPluginInfo.h
@@ -1,6 +1,6 @@
/** @file
- A brief file description
+ Information about remap plugins.
@section license License
@@ -23,51 +23,67 @@
#pragma once
#include "tscore/ink_platform.h"
-
+#include "tscpp/util/IntrusiveDList.h"
+#include "tscore/ts_file.h"
#include "ts/apidefs.h"
#include "ts/remap.h"
-#define TSREMAP_FUNCNAME_INIT "TSRemapInit"
-#define TSREMAP_FUNCNAME_CONFIG_RELOAD "TSRemapConfigReload"
-#define TSREMAP_FUNCNAME_DONE "TSRemapDone"
-#define TSREMAP_FUNCNAME_NEW_INSTANCE "TSRemapNewInstance"
-#define TSREMAP_FUNCNAME_DELETE_INSTANCE "TSRemapDeleteInstance"
-#define TSREMAP_FUNCNAME_DO_REMAP "TSRemapDoRemap"
-#define TSREMAP_FUNCNAME_OS_RESPONSE "TSRemapOSResponse"
+static constexpr const char *const TSREMAP_FUNCNAME_INIT =
"TSRemapInit";
+static constexpr const char *const TSREMAP_FUNCNAME_CONFIG_RELOAD =
"TSRemapConfigReload";
+static constexpr const char *const TSREMAP_FUNCNAME_DONE =
"TSRemapDone";
+static constexpr const char *const TSREMAP_FUNCNAME_NEW_INSTANCE =
"TSRemapNewInstance";
+static constexpr const char *const TSREMAP_FUNCNAME_DELETE_INSTANCE =
"TSRemapDeleteInstance";
+static constexpr const char *const TSREMAP_FUNCNAME_DO_REMAP =
"TSRemapDoRemap";
+static constexpr const char *const TSREMAP_FUNCNAME_OS_RESPONSE =
"TSRemapOSResponse";
-/**
- *
- **/
-class remap_plugin_info
+/** Information for a remap plugin.
+ * This stores the name of the library file and the callback entry points.
+ */
+class RemapPluginInfo
{
public:
- typedef TSReturnCode _tsremap_init(TSRemapInterface *api_info, char *errbuf,
int errbuf_size);
- typedef void _tsremap_config_reload();
- typedef void _tsremap_done(void);
- typedef TSReturnCode _tsremap_new_instance(int argc, char *argv[], void
**ih, char *errbuf, int errbuf_size);
- typedef void _tsremap_delete_instance(void *);
- typedef TSRemapStatus _tsremap_do_remap(void *ih, TSHttpTxn rh,
TSRemapRequestInfo *rri);
- typedef void _tsremap_os_response(void *ih, TSHttpTxn rh, int
os_response_type);
+ using self_type = RemapPluginInfo; ///< Self reference type.
+
+ /// Initialization function, called on library load.
+ using Init_F = TSReturnCode(TSRemapInterface *api_info, char *errbuf, int
errbuf_size);
+ /// Reload function, called to inform the plugin of a configuration reload.
+ using Reload_F = void();
+ /// Called when remapping for a transaction has finished.
+ using Done_F = void();
+ /// Create an rule instance.
+ using New_Instance_F = TSReturnCode(int argc, char *argv[], void **ih, char
*errbuf, int errbuf_size);
+ /// Delete a rule instance.
+ using Delete_Instance_F = void(void *ih);
+ /// Perform remap.
+ using Do_Remap_F = TSRemapStatus(void *ih, TSHttpTxn rh, TSRemapRequestInfo
*rri);
+ /// I have no idea what this is for.
+ using OS_Response_F = void(void *ih, TSHttpTxn rh, int os_response_type);
+
+ self_type *_next = nullptr;
+ self_type *_prev = nullptr;
+ using Linkage = ts::IntrusiveLinkage<self_type>;
+ using List = ts::IntrusiveDList<Linkage>;
+
+ ts::file::path path;
+ void *dl_handle = nullptr; /* "handle" for the dynamic
library */
+ Init_F *init_cb = nullptr;
+ Reload_F *config_reload_cb = nullptr;
+ Done_F *done_cb = nullptr;
+ New_Instance_F *new_instance_cb = nullptr;
+ Delete_Instance_F *delete_instance_cb = nullptr;
+ Do_Remap_F *do_remap_cb = nullptr;
+ OS_Response_F *os_response_cb = nullptr;
- remap_plugin_info *next;
- char *path;
- int path_size;
- void *dlh; /* "handle" for the dynamic library */
- _tsremap_init *fp_tsremap_init;
- _tsremap_config_reload *fp_tsremap_config_reload;
- _tsremap_done *fp_tsremap_done;
- _tsremap_new_instance *fp_tsremap_new_instance;
- _tsremap_delete_instance *fp_tsremap_delete_instance;
- _tsremap_do_remap *fp_tsremap_do_remap;
- _tsremap_os_response *fp_tsremap_os_response;
+ RemapPluginInfo(ts::file::path &&library_path);
+ ~RemapPluginInfo();
- remap_plugin_info(char *_path);
- ~remap_plugin_info();
+ static self_type *find_by_path(std::string_view library_path);
+ static void add_to_list(self_type *pi);
+ static void delete_list();
+ static void indicate_reload();
- remap_plugin_info *find_by_path(char *_path);
- void add_to_list(remap_plugin_info *pi);
- void delete_my_list();
- void indicate_reload();
+ /// Singleton list of remap plugin info instances.
+ static List g_list;
};
/**
diff --git a/proxy/http/remap/RemapPlugins.cc b/proxy/http/remap/RemapPlugins.cc
index 7a3293b..6a66445 100644
--- a/proxy/http/remap/RemapPlugins.cc
+++ b/proxy/http/remap/RemapPlugins.cc
@@ -26,7 +26,7 @@
ClassAllocator<RemapPlugins> pluginAllocator("RemapPluginsAlloc");
TSRemapStatus
-RemapPlugins::run_plugin(remap_plugin_info *plugin)
+RemapPlugins::run_plugin(RemapPluginInfo *plugin)
{
ink_assert(_s);
@@ -51,11 +51,11 @@ RemapPlugins::run_plugin(remap_plugin_info *plugin)
// Prepare State for the future
if (_cur == 0) {
- _s->fp_tsremap_os_response = plugin->fp_tsremap_os_response;
+ _s->fp_tsremap_os_response = plugin->os_response_cb;
_s->remap_plugin_instance = ih;
}
- plugin_retcode = plugin->fp_tsremap_do_remap(ih,
reinterpret_cast<TSHttpTxn>(_s->state_machine), &rri);
+ plugin_retcode = plugin->do_remap_cb(ih,
reinterpret_cast<TSHttpTxn>(_s->state_machine), &rri);
// TODO: Deal with negative return codes here
if (plugin_retcode < 0) {
plugin_retcode = TSREMAP_NO_REMAP;
@@ -82,7 +82,7 @@ bool
RemapPlugins::run_single_remap()
{
url_mapping *map = _s->url_map.getMapping();
- remap_plugin_info *plugin = map->get_plugin(_cur); // get the nth plugin
in our list of plugins
+ RemapPluginInfo *plugin = map->get_plugin(_cur); // get the nth plugin
in our list of plugins
TSRemapStatus plugin_retcode = TSREMAP_NO_REMAP;
bool zret = true; // default - last iteration.
Debug("url_rewrite", "running single remap rule id %d for the %d%s time",
map->map_id, _cur,
diff --git a/proxy/http/remap/RemapPlugins.h b/proxy/http/remap/RemapPlugins.h
index eafff41..421b55c 100644
--- a/proxy/http/remap/RemapPlugins.h
+++ b/proxy/http/remap/RemapPlugins.h
@@ -68,7 +68,7 @@ struct RemapPlugins : public Continuation {
int run_remap(int event, Event *e);
bool run_single_remap();
- TSRemapStatus run_plugin(remap_plugin_info *plugin);
+ TSRemapStatus run_plugin(RemapPluginInfo *plugin);
Action action;
diff --git a/proxy/http/remap/UrlMapping.cc b/proxy/http/remap/UrlMapping.cc
index 5ff1d54..5979490 100644
--- a/proxy/http/remap/UrlMapping.cc
+++ b/proxy/http/remap/UrlMapping.cc
@@ -30,7 +30,7 @@
*
**/
bool
-url_mapping::add_plugin(remap_plugin_info *i, void *ih)
+url_mapping::add_plugin(RemapPluginInfo *i, void *ih)
{
_plugin_list.push_back(i);
_instance_data.push_back(ih);
@@ -41,7 +41,7 @@ url_mapping::add_plugin(remap_plugin_info *i, void *ih)
/**
*
**/
-remap_plugin_info *
+RemapPluginInfo *
url_mapping::get_plugin(std::size_t index) const
{
Debug("url_rewrite", "get_plugin says we have %zu plugins and asking for
plugin %zu", plugin_count(), index);
@@ -66,11 +66,11 @@ url_mapping::get_instance(std::size_t index) const
void
url_mapping::delete_instance(unsigned int index)
{
- void *ih = get_instance(index);
- remap_plugin_info *p = get_plugin(index);
+ void *ih = get_instance(index);
+ RemapPluginInfo *p = get_plugin(index);
- if (ih && p && p->fp_tsremap_delete_instance) {
- p->fp_tsremap_delete_instance(ih);
+ if (ih && p && p->delete_instance_cb) {
+ p->delete_instance_cb(ih);
}
}
diff --git a/proxy/http/remap/UrlMapping.h b/proxy/http/remap/UrlMapping.h
index 269d014..63f7ca0 100644
--- a/proxy/http/remap/UrlMapping.h
+++ b/proxy/http/remap/UrlMapping.h
@@ -79,8 +79,8 @@ class url_mapping
public:
~url_mapping();
- bool add_plugin(remap_plugin_info *i, void *ih);
- remap_plugin_info *get_plugin(std::size_t) const;
+ bool add_plugin(RemapPluginInfo *i, void *ih);
+ RemapPluginInfo *get_plugin(std::size_t) const;
void *get_instance(std::size_t) const;
std::size_t
@@ -122,7 +122,7 @@ public:
};
private:
- std::vector<remap_plugin_info *> _plugin_list;
+ std::vector<RemapPluginInfo *> _plugin_list;
std::vector<void *> _instance_data;
int _rank = 0;
};