From 97fedd173de8a95c02984ac50a43744c9ee640d7 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Tue, 26 May 2015 16:04:57 -0500 Subject: [PATCH 01/23] TS-3560: Make slow log overridable. --- README.md | 1 + doc/reference/api/TSHttpOverridableConfig.en.rst | 1 + plugins/conf_remap/conf_remap.cc | 2 +- plugins/experimental/ts_lua/ts_lua_http_config.c | 4 +++- proxy/InkAPI.cc | 8 ++++++++ proxy/http/HttpConfig.cc | 4 ++-- proxy/http/HttpConfig.h | 8 ++++---- proxy/http/HttpSM.cc | 5 +++-- 8 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000000..b936fa26741 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# overridable_slow_log_threshold diff --git a/doc/reference/api/TSHttpOverridableConfig.en.rst b/doc/reference/api/TSHttpOverridableConfig.en.rst index 5cc5e238a64..f63fdfaf69b 100644 --- a/doc/reference/api/TSHttpOverridableConfig.en.rst +++ b/doc/reference/api/TSHttpOverridableConfig.en.rst @@ -135,6 +135,7 @@ The following configurations (from ``records.config``) are overridable. | :ts:cv:`proxy.config.http.accept_encoding_filter_enabled` | :ts:cv:`proxy.config.http.cache.range.write` | :ts:cv:`proxy.config.http.global_user_agent_header` +| :ts:cv:`proxy.config.http.slow.log.threshold` Examples ======== diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc index 32b07995017..72a3fbf2f8a 100644 --- a/plugins/conf_remap/conf_remap.cc +++ b/plugins/conf_remap/conf_remap.cc @@ -270,7 +270,6 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE } RemapConfigs *conf = new (RemapConfigs); - for (int i = 2; i < argc; ++i) { if (strchr(argv[i], '=') != NULL) { // Parse as an inline key=value pair ... @@ -313,6 +312,7 @@ TSRemapDeleteInstance(void *ih) TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo * /* rri ATS_UNUSED */) { + if (NULL != ih) { RemapConfigs *conf = static_cast(ih); TSHttpTxn txnp = static_cast(rh); diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c index f8406258d63..a2126a54f53 100644 --- a/plugins/experimental/ts_lua/ts_lua_http_config.c +++ b/plugins/experimental/ts_lua/ts_lua_http_config.c @@ -81,7 +81,8 @@ typedef enum { TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY = TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY, TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT = TS_CONFIG_NET_SOCK_PACKET_MARK_OUT, TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, - TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY + TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY, + TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD= TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, //!@# } TSLuaOverridableConfigKey; typedef enum { @@ -140,6 +141,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = { TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_RESPONSE_SERVER_STR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY), + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD), //!@# }; ts_lua_var_item ts_lua_http_timeout_vars[] = { diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 8bca4bfc81b..b98d2751ec1 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7949,6 +7949,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr typ = OVERRIDABLE_TYPE_STRING; ret = &overridableHttpConfig->global_user_agent_header; break; + case TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD: //!@# + typ = OVERRIDABLE_TYPE_INT; + ret = &overridableHttpConfig->slow_log_threshold; + break; // This helps avoiding compiler warnings, yet detect unhandled enum members. case TS_CONFIG_NULL: @@ -8233,6 +8237,10 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length)) cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT; break; + case 'd': // !@# + if (!strncmp(name, "proxy.config.http.slow.log.threshold", length)) + cnf = TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD; + break; } break; diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 54955e505d0..805f2d0a310 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1122,7 +1122,7 @@ HttpConfig::startup() HttpEstablishStaticConfigByte(c.errors_log_error_pages, "proxy.config.http.errors.log_error_pages"); - HttpEstablishStaticConfigLongLong(c.slow_log_threshold, "proxy.config.http.slow.log.threshold"); + HttpEstablishStaticConfigLongLong(c.oride.slow_log_threshold, "proxy.config.http.slow.log.threshold"); HttpEstablishStaticConfigByte(c.record_cop_page, "proxy.config.http.record_heartbeat"); @@ -1382,7 +1382,7 @@ HttpConfig::reconfigure() params->reverse_proxy_enabled = INT_TO_BOOL(m_master.reverse_proxy_enabled); params->url_remap_required = INT_TO_BOOL(m_master.url_remap_required); params->errors_log_error_pages = INT_TO_BOOL(m_master.errors_log_error_pages); - params->slow_log_threshold = m_master.slow_log_threshold; + params->oride.slow_log_threshold = m_master.oride.slow_log_threshold; params->record_cop_page = INT_TO_BOOL(m_master.record_cop_page); params->oride.send_http11_requests = m_master.oride.send_http11_requests; params->oride.doc_in_cache_skip_dns = INT_TO_BOOL(m_master.oride.doc_in_cache_skip_dns); diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 4534c6c2445..75a927d5f87 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -383,7 +383,7 @@ struct OverridableHttpConfigParams { post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), - default_buffer_size_index(8), default_buffer_water_mark(32768), + default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // !@# // Strings / floats must come last proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), @@ -554,8 +554,8 @@ struct OverridableHttpConfigParams { MgmtInt flow_low_water_mark; ///< Flow control low water mark. MgmtInt default_buffer_size_index; - MgmtInt default_buffer_water_mark; - + MgmtInt default_buffer_water_mark; + MgmtInt slow_log_threshold;// !@# // IMPORTANT: Here comes all strings / floats configs. /////////////////////////////////////////////////////////////////// @@ -708,7 +708,7 @@ struct HttpConfigParams : public ConfigInfo { // Error Reporting // ///////////////////// MgmtByte errors_log_error_pages; - MgmtInt slow_log_threshold; + //MgmtInt slow_log_threshold; !@# MgmtByte enable_http_info; diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 04537472341..26eb4c85602 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6649,8 +6649,9 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.http_config_param->slow_log_threshold != 0 && - ink_hrtime_from_msec(t_state.http_config_param->slow_log_threshold) < total_time) { + //if (t_state.http_config_param->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.http_config_param->slow_log_threshold) < total_time) !@# + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) // !@# + { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From 924c7211125694e05de0e931506c9f0aaf75e813 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 27 May 2015 16:04:40 -0500 Subject: [PATCH 02/23] removed comment, whitespace and edited lua enum --- plugins/experimental/ts_lua/ts_lua_http_config.c | 4 ++-- proxy/InkAPI.cc | 4 ++-- proxy/http/HttpConfig.h | 8 +++----- proxy/http/HttpSM.cc | 3 +-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c index a2126a54f53..34e2c68ad40 100644 --- a/plugins/experimental/ts_lua/ts_lua_http_config.c +++ b/plugins/experimental/ts_lua/ts_lua_http_config.c @@ -81,8 +81,8 @@ typedef enum { TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY = TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY, TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT = TS_CONFIG_NET_SOCK_PACKET_MARK_OUT, TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, + TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD= TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY, - TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD= TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, //!@# } TSLuaOverridableConfigKey; typedef enum { @@ -141,7 +141,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = { TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_RESPONSE_SERVER_STR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY), - TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD), //!@# + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD), }; ts_lua_var_item ts_lua_http_timeout_vars[] = { diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index b98d2751ec1..41176aebb1b 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7949,7 +7949,7 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr typ = OVERRIDABLE_TYPE_STRING; ret = &overridableHttpConfig->global_user_agent_header; break; - case TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD: //!@# + case TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD: typ = OVERRIDABLE_TYPE_INT; ret = &overridableHttpConfig->slow_log_threshold; break; @@ -8237,7 +8237,7 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length)) cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT; break; - case 'd': // !@# + case 'd': if (!strncmp(name, "proxy.config.http.slow.log.threshold", length)) cnf = TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD; break; diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 75a927d5f87..fc3cec83011 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -383,7 +383,7 @@ struct OverridableHttpConfigParams { post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), - default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // !@# + default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // Strings / floats must come last proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), @@ -554,8 +554,8 @@ struct OverridableHttpConfigParams { MgmtInt flow_low_water_mark; ///< Flow control low water mark. MgmtInt default_buffer_size_index; - MgmtInt default_buffer_water_mark; - MgmtInt slow_log_threshold;// !@# + MgmtInt default_buffer_water_mark; + MgmtInt slow_log_threshold; // IMPORTANT: Here comes all strings / floats configs. /////////////////////////////////////////////////////////////////// @@ -708,8 +708,6 @@ struct HttpConfigParams : public ConfigInfo { // Error Reporting // ///////////////////// MgmtByte errors_log_error_pages; - //MgmtInt slow_log_threshold; !@# - MgmtByte enable_http_info; // Cluster time delta is not a config variable, diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 26eb4c85602..74cc319d897 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6649,8 +6649,7 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - //if (t_state.http_config_param->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.http_config_param->slow_log_threshold) < total_time) !@# - if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) // !@# + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; From 004ea199c5505cf92f90173dba02746e439528a8 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Tue, 26 May 2015 16:04:57 -0500 Subject: [PATCH 03/23] removed comment, whitespace and edited lua enum --- README.md | 1 + doc/reference/api/TSHttpOverridableConfig.en.rst | 1 + plugins/conf_remap/conf_remap.cc | 2 +- plugins/experimental/ts_lua/ts_lua_http_config.c | 4 +++- proxy/InkAPI.cc | 8 ++++++++ proxy/http/HttpConfig.cc | 4 ++-- proxy/http/HttpConfig.h | 6 ++---- proxy/http/HttpSM.cc | 4 ++-- 8 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000000..b936fa26741 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# overridable_slow_log_threshold diff --git a/doc/reference/api/TSHttpOverridableConfig.en.rst b/doc/reference/api/TSHttpOverridableConfig.en.rst index 5cc5e238a64..f63fdfaf69b 100644 --- a/doc/reference/api/TSHttpOverridableConfig.en.rst +++ b/doc/reference/api/TSHttpOverridableConfig.en.rst @@ -135,6 +135,7 @@ The following configurations (from ``records.config``) are overridable. | :ts:cv:`proxy.config.http.accept_encoding_filter_enabled` | :ts:cv:`proxy.config.http.cache.range.write` | :ts:cv:`proxy.config.http.global_user_agent_header` +| :ts:cv:`proxy.config.http.slow.log.threshold` Examples ======== diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc index 32b07995017..72a3fbf2f8a 100644 --- a/plugins/conf_remap/conf_remap.cc +++ b/plugins/conf_remap/conf_remap.cc @@ -270,7 +270,6 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE } RemapConfigs *conf = new (RemapConfigs); - for (int i = 2; i < argc; ++i) { if (strchr(argv[i], '=') != NULL) { // Parse as an inline key=value pair ... @@ -313,6 +312,7 @@ TSRemapDeleteInstance(void *ih) TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo * /* rri ATS_UNUSED */) { + if (NULL != ih) { RemapConfigs *conf = static_cast(ih); TSHttpTxn txnp = static_cast(rh); diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c index f8406258d63..34e2c68ad40 100644 --- a/plugins/experimental/ts_lua/ts_lua_http_config.c +++ b/plugins/experimental/ts_lua/ts_lua_http_config.c @@ -81,7 +81,8 @@ typedef enum { TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY = TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY, TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT = TS_CONFIG_NET_SOCK_PACKET_MARK_OUT, TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, - TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY + TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD= TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, + TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY, } TSLuaOverridableConfigKey; typedef enum { @@ -140,6 +141,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = { TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_RESPONSE_SERVER_STR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_MARK_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_SOCK_PACKET_TOS_OUT), TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY), + TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_SLOW_LOG_THRESHOLD), }; ts_lua_var_item ts_lua_http_timeout_vars[] = { diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 8bca4bfc81b..41176aebb1b 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7949,6 +7949,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr typ = OVERRIDABLE_TYPE_STRING; ret = &overridableHttpConfig->global_user_agent_header; break; + case TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD: + typ = OVERRIDABLE_TYPE_INT; + ret = &overridableHttpConfig->slow_log_threshold; + break; // This helps avoiding compiler warnings, yet detect unhandled enum members. case TS_CONFIG_NULL: @@ -8233,6 +8237,10 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, if (!strncmp(name, "proxy.config.net.sock_packet_tos_out", length)) cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT; break; + case 'd': + if (!strncmp(name, "proxy.config.http.slow.log.threshold", length)) + cnf = TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD; + break; } break; diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index 54955e505d0..805f2d0a310 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1122,7 +1122,7 @@ HttpConfig::startup() HttpEstablishStaticConfigByte(c.errors_log_error_pages, "proxy.config.http.errors.log_error_pages"); - HttpEstablishStaticConfigLongLong(c.slow_log_threshold, "proxy.config.http.slow.log.threshold"); + HttpEstablishStaticConfigLongLong(c.oride.slow_log_threshold, "proxy.config.http.slow.log.threshold"); HttpEstablishStaticConfigByte(c.record_cop_page, "proxy.config.http.record_heartbeat"); @@ -1382,7 +1382,7 @@ HttpConfig::reconfigure() params->reverse_proxy_enabled = INT_TO_BOOL(m_master.reverse_proxy_enabled); params->url_remap_required = INT_TO_BOOL(m_master.url_remap_required); params->errors_log_error_pages = INT_TO_BOOL(m_master.errors_log_error_pages); - params->slow_log_threshold = m_master.slow_log_threshold; + params->oride.slow_log_threshold = m_master.oride.slow_log_threshold; params->record_cop_page = INT_TO_BOOL(m_master.record_cop_page); params->oride.send_http11_requests = m_master.oride.send_http11_requests; params->oride.doc_in_cache_skip_dns = INT_TO_BOOL(m_master.oride.doc_in_cache_skip_dns); diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 4534c6c2445..fc3cec83011 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -383,7 +383,7 @@ struct OverridableHttpConfigParams { post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), - default_buffer_size_index(8), default_buffer_water_mark(32768), + default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // Strings / floats must come last proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), @@ -555,7 +555,7 @@ struct OverridableHttpConfigParams { MgmtInt default_buffer_size_index; MgmtInt default_buffer_water_mark; - + MgmtInt slow_log_threshold; // IMPORTANT: Here comes all strings / floats configs. /////////////////////////////////////////////////////////////////// @@ -708,8 +708,6 @@ struct HttpConfigParams : public ConfigInfo { // Error Reporting // ///////////////////// MgmtByte errors_log_error_pages; - MgmtInt slow_log_threshold; - MgmtByte enable_http_info; // Cluster time delta is not a config variable, diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 04537472341..74cc319d897 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6649,8 +6649,8 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.http_config_param->slow_log_threshold != 0 && - ink_hrtime_from_msec(t_state.http_config_param->slow_log_threshold) < total_time) { + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) + { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From 9daf2464e9be86522b47ec08dffae03ae9960daf Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Fri, 29 May 2015 10:18:01 -0500 Subject: [PATCH 04/23] added enum field in apidefs.h.in --- lib/ts/apidefs.h.in | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in index 3d956881f35..bd847f2fe1f 100644 --- a/lib/ts/apidefs.h.in +++ b/lib/ts/apidefs.h.in @@ -678,6 +678,7 @@ typedef enum { TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED, TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER, TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE, + TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, TS_CONFIG_LAST_ENTRY } TSOverridableConfigKey; From 23dfc3206816e2ca586525893483623df490286c Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Mon, 1 Jun 2015 10:54:12 -0500 Subject: [PATCH 05/23] slow log added to the inktestAPI.cc --- doc/reference/api/TSHttpOverridableConfig.en.rst | 2 +- proxy/InkAPITest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/reference/api/TSHttpOverridableConfig.en.rst b/doc/reference/api/TSHttpOverridableConfig.en.rst index f63fdfaf69b..0eeb5e65c79 100644 --- a/doc/reference/api/TSHttpOverridableConfig.en.rst +++ b/doc/reference/api/TSHttpOverridableConfig.en.rst @@ -41,7 +41,7 @@ Description =========== Some of the values that are set in :file:`records.config` can be changed for a specific transaction. It is important to -note that these functions change the configuration values stored for the transation, which is not quite the same as +note that these functions change the configuration values stored for the transaction, which is not quite the same as changing the actual operating values of the transaction. The critical effect is the value must be changed before it is used by the transaction - after that, changes will not have any effect. diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 200759ed7fe..e59b6bc77d9 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -7206,7 +7206,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = { "proxy.config.ssl.hsts_max_age", "proxy.config.ssl.hsts_include_subdomains", "proxy.config.http.cache.open_read_retry_time", "proxy.config.http.cache.max_open_read_retries", "proxy.config.http.cache.range.write", "proxy.config.http.post.check.content_length.enabled", "proxy.config.http.global_user_agent_header", - "proxy.config.http.auth_server_session_private"}; + "proxy.config.http.auth_server_session_private", "proxy.config.http.slow.log.threshold"}; REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus) { From 2cf58a6f5fbfed58d8846859da86b1e067047f6b Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 3 Jun 2015 17:51:28 -0500 Subject: [PATCH 06/23] 3647 --- lib/atscppapi/src/Transaction.cc | 39 ++++++++++++++++++- .../src/include/atscppapi/Transaction.h | 16 +++++++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index b2a70f22058..a916572245e 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -25,13 +25,12 @@ #include #include #include -#include +//#include #include #include "atscppapi/shared_ptr.h" #include "logging_internal.h" #include "utils_internal.h" #include "atscppapi/noncopyable.h" - using std::map; using std::string; using namespace atscppapi; @@ -97,6 +96,42 @@ Transaction::~Transaction() } delete state_; } +//TSHttpTxnConfigIntSet(TSHttpTxn txnp, TSOverridableConfigKey conf, TSMgmtInt value) !@# +bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value); + return (res==TS_SUCCESS); +} +bool Transaction::configIntGet(TSOverridableConfigKey conf, int *value) +{ + TSReturnCode res=TSHttpTxnConfigIntGet(state_->txn_, conf, (TSMgmtInt*)value); + return (res==TS_SUCCESS); +} + +bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value); + return (res==TS_SUCCESS); +} +bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) +{ + TSReturnCode res=TSHttpTxnConfigFloatGet(state_->txn_, conf, value); + return (res==TS_SUCCESS); +} + +bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value,length); + return (res==TS_SUCCESS); +} +bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) //!@# +{ + TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, value,length); + return (res==TS_SUCCESS); +} void Transaction::resume() diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index 771aa41e65e..fb38a702ab0 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -30,7 +30,8 @@ #include "atscppapi/shared_ptr.h" #include "atscppapi/ClientRequest.h" #include "atscppapi/Response.h" - +//#include //!@# +#include <../ts/apidefs.h> //!@# namespace atscppapi { // forward declarations @@ -320,7 +321,18 @@ class Transaction : noncopyable * Redirect the transaction a different @a url. */ void redirectTo(std::string const &url); - + //TSHttpTxnConfigIntGet + // TSHttpTxnConfigFloatSet + //TSHttpTxnConfigFloatGet + //TSHttpTxnConfigStringSet + //TSHttpTxnConfigStringGet + bool configIntSet(TSOverridableConfigKey conf, int value); //!@# + bool configIntGet(TSOverridableConfigKey conf, int* value); //!@# + bool configFloatSet(TSOverridableConfigKey conf, float value); + bool configFloatGet(TSOverridableConfigKey conf, float* value); + bool configStringSet(TSOverridableConfigKey conf, char* value,int length); + bool configStringGet(TSOverridableConfigKey conf,const char** value, int* length); + //bool TSHttpTxnConfigFind private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin() From df2fa64aaa62e9255acc27515993d13800ac8e6c Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 3 Jun 2015 17:52:28 -0500 Subject: [PATCH 07/23] plugininit --- lib/atscppapi/src/include/atscppapi/PluginInit.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h index a1249b843ec..29378074ed9 100644 --- a/lib/atscppapi/src/include/atscppapi/PluginInit.h +++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h @@ -25,7 +25,8 @@ #define ATSCPPAPI_PLUGININIT_H_ #include - +//#include //!@# +#include<../ts/apidefs.h> //!@# extern "C" { /** @@ -37,10 +38,10 @@ extern "C" { */ void TSPluginInit(int argc, const char *argv[]); -enum TsReturnCode { - TS_ERROR = -1, - TS_SUCCESS = 0, -}; +//enum TsReturnCode { +// TS_ERROR = -1, +// TS_SUCCESS = 0, +//}; //!@# /** * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam @@ -52,7 +53,7 @@ enum TsReturnCode { * @param errbuf Not used * @param errbuf_size Not used */ -TsReturnCode TSRemapNewInstance(int argc, char *argv[], void **instance_handle, char *errbuf, int errbuf_size); +TSReturnCode TSRemapNewInstance(int argc, char *argv[], void **instance_handle, char *errbuf, int errbuf_size); } From 3ce2376dcb650b990ff8b40f4ed84845090f5f13 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Thu, 4 Jun 2015 15:49:50 -0500 Subject: [PATCH 08/23] 3647: CPP API for overridqable config functions --- .../examples/remap_plugin/RemapPlugin.cc | 4 ++-- lib/atscppapi/src/Transaction.cc | 16 ++++++++++------ lib/atscppapi/src/include/atscppapi/PluginInit.h | 6 +++--- .../src/include/atscppapi/Transaction.h | 16 ++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc index cd83117d3db..7771b1a0424 100644 --- a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc +++ b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc @@ -40,7 +40,7 @@ class MyRemapPlugin : public RemapPlugin Url &request_url = transaction.getClientRequest().getUrl(); TS_DEBUG(LOG_TAG, "from URL is [%s], to URL is [%s], request URL is [%s]", map_from_url.getUrlString().c_str(), map_to_url.getUrlString().c_str(), request_url.getUrlString().c_str()); - const string &query = request_url.getQuery(); + const string &query = request_url.getQuery(); string query_param_raw; map query_params; std::istringstream iss(query); @@ -84,7 +84,7 @@ class MyRemapPlugin : public RemapPlugin } }; -TsReturnCode +TSReturnCode //!@# TSRemapNewInstance(int argc ATSCPPAPI_UNUSED, char *argv[] ATSCPPAPI_UNUSED, void **instance_handle, char *errbuf ATSCPPAPI_UNUSED, int errbuf_size ATSCPPAPI_UNUSED) { diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index a916572245e..5de5ecff0f9 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -96,8 +96,8 @@ Transaction::~Transaction() } delete state_; } -//TSHttpTxnConfigIntSet(TSHttpTxn txnp, TSOverridableConfigKey conf, TSMgmtInt value) !@# -bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) //!@# + +bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value); @@ -109,7 +109,7 @@ bool Transaction::configIntGet(TSOverridableConfigKey conf, int *value) return (res==TS_SUCCESS); } -bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) //!@# +bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value); @@ -121,18 +121,22 @@ bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) return (res==TS_SUCCESS); } -bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) //!@# +bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value,length); return (res==TS_SUCCESS); } -bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) //!@# +bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) { TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, value,length); return (res==TS_SUCCESS); } - +bool Transaction::configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type) +{ + TSReturnCode res=TSHttpTxnConfigFind(name,length,conf,type); + return (res==TS_SUCCESS); +} void Transaction::resume() { diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h index 29378074ed9..6c49c28ec5a 100644 --- a/lib/atscppapi/src/include/atscppapi/PluginInit.h +++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h @@ -25,8 +25,8 @@ #define ATSCPPAPI_PLUGININIT_H_ #include -//#include //!@# -#include<../ts/apidefs.h> //!@# +#include<../ts/apidefs.h> +#include <../../../../proxy/api/ts/ts.h> extern "C" { /** @@ -41,7 +41,7 @@ void TSPluginInit(int argc, const char *argv[]); //enum TsReturnCode { // TS_ERROR = -1, // TS_SUCCESS = 0, -//}; //!@# +//}; /** * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index fb38a702ab0..f1f0dc4268b 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -30,8 +30,7 @@ #include "atscppapi/shared_ptr.h" #include "atscppapi/ClientRequest.h" #include "atscppapi/Response.h" -//#include //!@# -#include <../ts/apidefs.h> //!@# +#include <../ts/apidefs.h> namespace atscppapi { // forward declarations @@ -321,18 +320,15 @@ class Transaction : noncopyable * Redirect the transaction a different @a url. */ void redirectTo(std::string const &url); - //TSHttpTxnConfigIntGet - // TSHttpTxnConfigFloatSet - //TSHttpTxnConfigFloatGet - //TSHttpTxnConfigStringSet - //TSHttpTxnConfigStringGet - bool configIntSet(TSOverridableConfigKey conf, int value); //!@# - bool configIntGet(TSOverridableConfigKey conf, int* value); //!@# + + bool configIntSet(TSOverridableConfigKey conf, int value); + bool configIntGet(TSOverridableConfigKey conf, int* value); bool configFloatSet(TSOverridableConfigKey conf, float value); bool configFloatGet(TSOverridableConfigKey conf, float* value); bool configStringSet(TSOverridableConfigKey conf, char* value,int length); bool configStringGet(TSOverridableConfigKey conf,const char** value, int* length); - //bool TSHttpTxnConfigFind + bool configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type); + private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin() From 90db5ed224ae08652c912b4f04c729488c6f8016 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Thu, 4 Jun 2015 16:19:55 -0500 Subject: [PATCH 09/23] adding pluginregister in globalhookplugin and helloworldplugin --- .../examples/globalhook/GlobalHookPlugin.cc | 16 +++++++++++----- .../examples/helloworld/HelloWorldPlugin.cc | 11 +++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index 1602a05e4e8..3ed92aebda6 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -19,24 +19,30 @@ #include #include #include - +#include<../ts/Diags.h> using namespace atscppapi; class GlobalHookPlugin : public GlobalPlugin { public: GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); } - + virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) - { - std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; - transaction.resume(); + { + std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; + transaction.resume(); } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + TSPluginRegistrationInfo info; + std::cout << "Hello from " << argv[0] << std::endl; + info.plugin_name=const_cast("GH plugin1"); + info.vendor_name=const_cast("GH plugin2"); + info.support_email=const_cast("GH plugin3"); + TSPluginRegister(TS_SDK_VERSION_3_0, &info); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index e7a43997744..5251c54a1eb 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -20,16 +20,23 @@ #include #include #include - +#include <../../../../proxy/api/ts/ts.h> class HelloWorldPlugin : public atscppapi::GlobalPlugin { public: - HelloWorldPlugin() { std::cout << "Hello World!" << std::endl; } + HelloWorldPlugin() { + std::cout << "Hello World!" << std::endl; + } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + TSPluginRegistrationInfo info; std::cout << "Hello from " << argv[0] << std::endl; + info.plugin_name=const_cast("Hello WOrld1"); + info.vendor_name=const_cast("Hello WOrld2"); + info.support_email=const_cast("Hello WOrld3"); + TSPluginRegister(TS_SDK_VERSION_3_0, &info); new HelloWorldPlugin(); } From 9b31f7300613731f9a25333d8e4af7f7d2e0382d Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Tue, 26 May 2015 16:04:57 -0500 Subject: [PATCH 10/23] TS-3560: Make slow log overridable. --- README.md | 1 + plugins/conf_remap/conf_remap.cc | 1 + proxy/http/HttpConfig.h | 6 +++--- proxy/http/HttpSM.cc | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000000..b936fa26741 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# overridable_slow_log_threshold diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc index a6281aa22ee..72a3fbf2f8a 100644 --- a/plugins/conf_remap/conf_remap.cc +++ b/plugins/conf_remap/conf_remap.cc @@ -312,6 +312,7 @@ TSRemapDeleteInstance(void *ih) TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo * /* rri ATS_UNUSED */) { + if (NULL != ih) { RemapConfigs *conf = static_cast(ih); TSHttpTxn txnp = static_cast(rh); diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index fc3cec83011..c9d35e17a39 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -382,8 +382,8 @@ struct OverridableHttpConfigParams { connect_attempts_max_retries_dead_server(3), connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), - background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), - default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), + background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), + default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // Strings / floats must come last proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), @@ -554,7 +554,7 @@ struct OverridableHttpConfigParams { MgmtInt flow_low_water_mark; ///< Flow control low water mark. MgmtInt default_buffer_size_index; - MgmtInt default_buffer_water_mark; + MgmtInt default_buffer_water_mark; MgmtInt slow_log_threshold; // IMPORTANT: Here comes all strings / floats configs. diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index a0ed48cf123..f6e644c6945 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6648,7 +6648,7 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From 57f59a6502bb19acad2bc95f481586948672aee5 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 27 May 2015 16:04:40 -0500 Subject: [PATCH 11/23] removed comment, whitespace and edited lua enum --- proxy/http/HttpConfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index c9d35e17a39..45ac748e114 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -383,7 +383,7 @@ struct OverridableHttpConfigParams { post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), - default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), + default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // Strings / floats must come last proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), @@ -554,7 +554,7 @@ struct OverridableHttpConfigParams { MgmtInt flow_low_water_mark; ///< Flow control low water mark. MgmtInt default_buffer_size_index; - MgmtInt default_buffer_water_mark; + MgmtInt default_buffer_water_mark; MgmtInt slow_log_threshold; // IMPORTANT: Here comes all strings / floats configs. From bbbaf50694c57708df867734df84d6712cf2869c Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 3 Jun 2015 17:51:28 -0500 Subject: [PATCH 12/23] 3647 --- lib/atscppapi/src/Transaction.cc | 39 ++++++++++++++++++- .../src/include/atscppapi/Transaction.h | 16 +++++++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index b2a70f22058..a916572245e 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -25,13 +25,12 @@ #include #include #include -#include +//#include #include #include "atscppapi/shared_ptr.h" #include "logging_internal.h" #include "utils_internal.h" #include "atscppapi/noncopyable.h" - using std::map; using std::string; using namespace atscppapi; @@ -97,6 +96,42 @@ Transaction::~Transaction() } delete state_; } +//TSHttpTxnConfigIntSet(TSHttpTxn txnp, TSOverridableConfigKey conf, TSMgmtInt value) !@# +bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value); + return (res==TS_SUCCESS); +} +bool Transaction::configIntGet(TSOverridableConfigKey conf, int *value) +{ + TSReturnCode res=TSHttpTxnConfigIntGet(state_->txn_, conf, (TSMgmtInt*)value); + return (res==TS_SUCCESS); +} + +bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value); + return (res==TS_SUCCESS); +} +bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) +{ + TSReturnCode res=TSHttpTxnConfigFloatGet(state_->txn_, conf, value); + return (res==TS_SUCCESS); +} + +bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) //!@# +{ + //txn,conf,value + TSReturnCode res=TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value,length); + return (res==TS_SUCCESS); +} +bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) //!@# +{ + TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, value,length); + return (res==TS_SUCCESS); +} void Transaction::resume() diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index 771aa41e65e..fb38a702ab0 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -30,7 +30,8 @@ #include "atscppapi/shared_ptr.h" #include "atscppapi/ClientRequest.h" #include "atscppapi/Response.h" - +//#include //!@# +#include <../ts/apidefs.h> //!@# namespace atscppapi { // forward declarations @@ -320,7 +321,18 @@ class Transaction : noncopyable * Redirect the transaction a different @a url. */ void redirectTo(std::string const &url); - + //TSHttpTxnConfigIntGet + // TSHttpTxnConfigFloatSet + //TSHttpTxnConfigFloatGet + //TSHttpTxnConfigStringSet + //TSHttpTxnConfigStringGet + bool configIntSet(TSOverridableConfigKey conf, int value); //!@# + bool configIntGet(TSOverridableConfigKey conf, int* value); //!@# + bool configFloatSet(TSOverridableConfigKey conf, float value); + bool configFloatGet(TSOverridableConfigKey conf, float* value); + bool configStringSet(TSOverridableConfigKey conf, char* value,int length); + bool configStringGet(TSOverridableConfigKey conf,const char** value, int* length); + //bool TSHttpTxnConfigFind private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin() From 61b88bbcd46dbcc25f05b8936a9b16e550269bb8 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Wed, 3 Jun 2015 17:52:28 -0500 Subject: [PATCH 13/23] plugininit --- lib/atscppapi/src/include/atscppapi/PluginInit.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h index a1249b843ec..29378074ed9 100644 --- a/lib/atscppapi/src/include/atscppapi/PluginInit.h +++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h @@ -25,7 +25,8 @@ #define ATSCPPAPI_PLUGININIT_H_ #include - +//#include //!@# +#include<../ts/apidefs.h> //!@# extern "C" { /** @@ -37,10 +38,10 @@ extern "C" { */ void TSPluginInit(int argc, const char *argv[]); -enum TsReturnCode { - TS_ERROR = -1, - TS_SUCCESS = 0, -}; +//enum TsReturnCode { +// TS_ERROR = -1, +// TS_SUCCESS = 0, +//}; //!@# /** * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam @@ -52,7 +53,7 @@ enum TsReturnCode { * @param errbuf Not used * @param errbuf_size Not used */ -TsReturnCode TSRemapNewInstance(int argc, char *argv[], void **instance_handle, char *errbuf, int errbuf_size); +TSReturnCode TSRemapNewInstance(int argc, char *argv[], void **instance_handle, char *errbuf, int errbuf_size); } From 4529c4f57bcf15d8c6f57fd61ef7854a9e36f679 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Thu, 4 Jun 2015 15:49:50 -0500 Subject: [PATCH 14/23] 3647: CPP API for overridqable config functions --- .../examples/remap_plugin/RemapPlugin.cc | 4 ++-- lib/atscppapi/src/Transaction.cc | 16 ++++++++++------ lib/atscppapi/src/include/atscppapi/PluginInit.h | 6 +++--- .../src/include/atscppapi/Transaction.h | 16 ++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc index cd83117d3db..7771b1a0424 100644 --- a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc +++ b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc @@ -40,7 +40,7 @@ class MyRemapPlugin : public RemapPlugin Url &request_url = transaction.getClientRequest().getUrl(); TS_DEBUG(LOG_TAG, "from URL is [%s], to URL is [%s], request URL is [%s]", map_from_url.getUrlString().c_str(), map_to_url.getUrlString().c_str(), request_url.getUrlString().c_str()); - const string &query = request_url.getQuery(); + const string &query = request_url.getQuery(); string query_param_raw; map query_params; std::istringstream iss(query); @@ -84,7 +84,7 @@ class MyRemapPlugin : public RemapPlugin } }; -TsReturnCode +TSReturnCode //!@# TSRemapNewInstance(int argc ATSCPPAPI_UNUSED, char *argv[] ATSCPPAPI_UNUSED, void **instance_handle, char *errbuf ATSCPPAPI_UNUSED, int errbuf_size ATSCPPAPI_UNUSED) { diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index a916572245e..5de5ecff0f9 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -96,8 +96,8 @@ Transaction::~Transaction() } delete state_; } -//TSHttpTxnConfigIntSet(TSHttpTxn txnp, TSOverridableConfigKey conf, TSMgmtInt value) !@# -bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) //!@# + +bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value); @@ -109,7 +109,7 @@ bool Transaction::configIntGet(TSOverridableConfigKey conf, int *value) return (res==TS_SUCCESS); } -bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) //!@# +bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value); @@ -121,18 +121,22 @@ bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) return (res==TS_SUCCESS); } -bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) //!@# +bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) { //txn,conf,value TSReturnCode res=TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value,length); return (res==TS_SUCCESS); } -bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) //!@# +bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) { TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, value,length); return (res==TS_SUCCESS); } - +bool Transaction::configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type) +{ + TSReturnCode res=TSHttpTxnConfigFind(name,length,conf,type); + return (res==TS_SUCCESS); +} void Transaction::resume() { diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h index 29378074ed9..6c49c28ec5a 100644 --- a/lib/atscppapi/src/include/atscppapi/PluginInit.h +++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h @@ -25,8 +25,8 @@ #define ATSCPPAPI_PLUGININIT_H_ #include -//#include //!@# -#include<../ts/apidefs.h> //!@# +#include<../ts/apidefs.h> +#include <../../../../proxy/api/ts/ts.h> extern "C" { /** @@ -41,7 +41,7 @@ void TSPluginInit(int argc, const char *argv[]); //enum TsReturnCode { // TS_ERROR = -1, // TS_SUCCESS = 0, -//}; //!@# +//}; /** * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index fb38a702ab0..f1f0dc4268b 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -30,8 +30,7 @@ #include "atscppapi/shared_ptr.h" #include "atscppapi/ClientRequest.h" #include "atscppapi/Response.h" -//#include //!@# -#include <../ts/apidefs.h> //!@# +#include <../ts/apidefs.h> namespace atscppapi { // forward declarations @@ -321,18 +320,15 @@ class Transaction : noncopyable * Redirect the transaction a different @a url. */ void redirectTo(std::string const &url); - //TSHttpTxnConfigIntGet - // TSHttpTxnConfigFloatSet - //TSHttpTxnConfigFloatGet - //TSHttpTxnConfigStringSet - //TSHttpTxnConfigStringGet - bool configIntSet(TSOverridableConfigKey conf, int value); //!@# - bool configIntGet(TSOverridableConfigKey conf, int* value); //!@# + + bool configIntSet(TSOverridableConfigKey conf, int value); + bool configIntGet(TSOverridableConfigKey conf, int* value); bool configFloatSet(TSOverridableConfigKey conf, float value); bool configFloatGet(TSOverridableConfigKey conf, float* value); bool configStringSet(TSOverridableConfigKey conf, char* value,int length); bool configStringGet(TSOverridableConfigKey conf,const char** value, int* length); - //bool TSHttpTxnConfigFind + bool configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type); + private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin() From a3a6d60f7d383ac43f556adea0f39417f383755c Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Thu, 4 Jun 2015 16:19:55 -0500 Subject: [PATCH 15/23] adding pluginregister in globalhookplugin and helloworldplugin --- .../examples/globalhook/GlobalHookPlugin.cc | 16 +++++++++++----- .../examples/helloworld/HelloWorldPlugin.cc | 11 +++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index 1602a05e4e8..3ed92aebda6 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -19,24 +19,30 @@ #include #include #include - +#include<../ts/Diags.h> using namespace atscppapi; class GlobalHookPlugin : public GlobalPlugin { public: GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); } - + virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) - { - std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; - transaction.resume(); + { + std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; + transaction.resume(); } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + TSPluginRegistrationInfo info; + std::cout << "Hello from " << argv[0] << std::endl; + info.plugin_name=const_cast("GH plugin1"); + info.vendor_name=const_cast("GH plugin2"); + info.support_email=const_cast("GH plugin3"); + TSPluginRegister(TS_SDK_VERSION_3_0, &info); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index e7a43997744..5251c54a1eb 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -20,16 +20,23 @@ #include #include #include - +#include <../../../../proxy/api/ts/ts.h> class HelloWorldPlugin : public atscppapi::GlobalPlugin { public: - HelloWorldPlugin() { std::cout << "Hello World!" << std::endl; } + HelloWorldPlugin() { + std::cout << "Hello World!" << std::endl; + } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + TSPluginRegistrationInfo info; std::cout << "Hello from " << argv[0] << std::endl; + info.plugin_name=const_cast("Hello WOrld1"); + info.vendor_name=const_cast("Hello WOrld2"); + info.support_email=const_cast("Hello WOrld3"); + TSPluginRegister(TS_SDK_VERSION_3_0, &info); new HelloWorldPlugin(); } From 1a9ef5594429676635252192188f973ce3eb8309 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Fri, 5 Jun 2015 17:14:46 -0500 Subject: [PATCH 16/23] TS-3647: include TSRegisterPlugin in plugin.h --- .../examples/globalhook/GlobalHookPlugin.cc | 54 ++++++++++++++----- .../examples/helloworld/HelloWorldPlugin.cc | 12 ++--- .../examples/remap_plugin/RemapPlugin.cc | 4 +- lib/atscppapi/src/Plugin.cc | 11 +++- lib/atscppapi/src/Transaction.cc | 39 ++++++-------- lib/atscppapi/src/include/atscppapi/Plugin.h | 5 ++ .../src/include/atscppapi/PluginInit.h | 10 +--- .../src/include/atscppapi/Transaction.h | 14 ++--- plugins/conf_remap/conf_remap.cc | 2 +- proxy/http/HttpConfig.h | 2 +- proxy/http/HttpSM.cc | 2 +- 11 files changed, 90 insertions(+), 65 deletions(-) diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index 3ed92aebda6..8fc961b8652 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -19,30 +19,60 @@ #include #include #include -#include<../ts/Diags.h> +#include <../ts/Diags.h> using namespace atscppapi; - +using namespace std; class GlobalHookPlugin : public GlobalPlugin { public: GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); } - + virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) - { - std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; - transaction.resume(); + { + ////////////////////////////////////////////// + int value; + float fvalue; + char* str; + std::string svalue; + int slength; + std::string keyval("proxy.config.http.slow.log.threshold"); + + TSOverridableConfigKey okey; + TSRecordDataType type; +// initialise string + transaction.configStringGet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,&svalue,&slength); + Note("value for http response str %s , %d\n",svalue.c_str(),slength); +// setting values + transaction.configIntSet(TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,4000); + if (false==transaction.configFloatSet(TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR, 0.15)) + Note("Could not set the lm factor\n"); + + str= new char[svalue.length()+1]; + strcpy(str,svalue.c_str()); + str[0]='X'; + svalue.assign(str); + transaction.configStringSet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,svalue,slength); +//getting values + transaction.configIntGet(TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,&value); + Note("value for heuristic min lifetime %d\n",value); + transaction.configFloatGet(TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR, &fvalue); + Note("value for heuristic lm factor %f\n",fvalue); + transaction.configStringGet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,&svalue,&slength); + Note("value for http response str %s , %d\n",svalue.c_str(),slength); + + if(true==transaction.configFind(keyval.c_str(),-1,&okey,&type)) + Note("found %d\n",okey); +/////////////////////////////////////////////////////////////////////// + std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; + transaction.resume(); } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSPluginRegistrationInfo info; - std::cout << "Hello from " << argv[0] << std::endl; - info.plugin_name=const_cast("GH plugin1"); - info.vendor_name=const_cast("GH plugin2"); - info.support_email=const_cast("GH plugin3"); - TSPluginRegister(TS_SDK_VERSION_3_0, &info); + atscppapi::TSRegisterPlugin( std::string("ghp"), std::string("ghp"), std::string("ghp")); + std::cout << "Hello from " << argv[0] << std::endl; new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index 5251c54a1eb..7440fe565dd 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -20,23 +20,17 @@ #include #include #include -#include <../../../../proxy/api/ts/ts.h> class HelloWorldPlugin : public atscppapi::GlobalPlugin { public: - HelloWorldPlugin() { - std::cout << "Hello World!" << std::endl; - } + HelloWorldPlugin() { std::cout << "Hello World!" << std::endl; } }; void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSPluginRegistrationInfo info; + std::cout << "Hello from " << argv[0] << std::endl; - info.plugin_name=const_cast("Hello WOrld1"); - info.vendor_name=const_cast("Hello WOrld2"); - info.support_email=const_cast("Hello WOrld3"); - TSPluginRegister(TS_SDK_VERSION_3_0, &info); + atscppapi::TSRegisterPlugin( std::string("hello1"), std::string("hello2"), std::string("hello3")); new HelloWorldPlugin(); } diff --git a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc index 7771b1a0424..b04c4feb0b2 100644 --- a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc +++ b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc @@ -40,7 +40,7 @@ class MyRemapPlugin : public RemapPlugin Url &request_url = transaction.getClientRequest().getUrl(); TS_DEBUG(LOG_TAG, "from URL is [%s], to URL is [%s], request URL is [%s]", map_from_url.getUrlString().c_str(), map_to_url.getUrlString().c_str(), request_url.getUrlString().c_str()); - const string &query = request_url.getQuery(); + const string &query = request_url.getQuery(); string query_param_raw; map query_params; std::istringstream iss(query); @@ -84,7 +84,7 @@ class MyRemapPlugin : public RemapPlugin } }; -TSReturnCode //!@# +TSReturnCode TSRemapNewInstance(int argc ATSCPPAPI_UNUSED, char *argv[] ATSCPPAPI_UNUSED, void **instance_handle, char *errbuf ATSCPPAPI_UNUSED, int errbuf_size ATSCPPAPI_UNUSED) { diff --git a/lib/atscppapi/src/Plugin.cc b/lib/atscppapi/src/Plugin.cc index 9e319e51655..384e62d96aa 100644 --- a/lib/atscppapi/src/Plugin.cc +++ b/lib/atscppapi/src/Plugin.cc @@ -20,9 +20,18 @@ * @file Plugin.cc */ #include "atscppapi/Plugin.h" - +#include const std::string atscppapi::HOOK_TYPE_STRINGS[] = { std::string("HOOK_READ_REQUEST_HEADERS_PRE_REMAP"), std::string("HOOK_READ_REQUEST_HEADERS_POST_REMAP"), std::string("HOOK_SEND_REQUEST_HEADERS"), std::string("HOOK_READ_RESPONSE_HEADERS"), std::string("HOOK_SEND_RESPONSE_HEADERS"), std::string("HOOK_OS_DNS"), std::string("HOOK_READ_REQUEST_HEADERS"), std::string("HOOK_READ_CACHE_HEADERS"), std::string("HOOK_CACHE_LOOKUP_COMPLETE"), std::string("HOOK_SELECT_ALT")}; + +void atscppapi::TSRegisterPlugin(std::string name, std::string vendor, std::string email) +{ + TSPluginRegistrationInfo info; + info.plugin_name=const_cast(name.c_str()); + info.vendor_name=const_cast(vendor.c_str()); + info.support_email=const_cast(email.c_str()); + TSPluginRegister(TS_SDK_VERSION_3_0, &info); +} diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index 5de5ecff0f9..8c8d2f171b1 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -25,7 +25,6 @@ #include #include #include -//#include #include #include "atscppapi/shared_ptr.h" #include "logging_internal.h" @@ -97,46 +96,42 @@ Transaction::~Transaction() delete state_; } -bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) +bool Transaction::configIntSet(TSOverridableConfigKey conf, int value) { - //txn,conf,value - TSReturnCode res=TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigIntSet(state_->txn_,conf,(TSMgmtInt)value)); } bool Transaction::configIntGet(TSOverridableConfigKey conf, int *value) { - TSReturnCode res=TSHttpTxnConfigIntGet(state_->txn_, conf, (TSMgmtInt*)value); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigIntGet(state_->txn_, conf, (TSMgmtInt*)value)); } -bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) +bool Transaction::configFloatSet(TSOverridableConfigKey conf, float value) { - //txn,conf,value - TSReturnCode res=TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigFloatSet(state_->txn_,conf,(TSMgmtFloat)value)); } + bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) { - TSReturnCode res=TSHttpTxnConfigFloatGet(state_->txn_, conf, value); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigFloatGet(state_->txn_, conf, value)); } -bool Transaction::configStringSet(TSOverridableConfigKey conf, char* value,int length) +bool Transaction::configStringSet(TSOverridableConfigKey conf, std::string value,int length) { - //txn,conf,value - TSReturnCode res=TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value,length); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value.c_str(),length)); } -bool Transaction::configStringGet(TSOverridableConfigKey conf,const char** value, int* length) + +bool Transaction::configStringGet(TSOverridableConfigKey conf,std::string* value, int* length) { - TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, value,length); - return (res==TS_SUCCESS); + const char* svalue; + svalue=value->c_str(); + return (TS_SUCCESS==TSHttpTxnConfigStringGet(state_->txn_, conf, &svalue,length)); } + bool Transaction::configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type) { - TSReturnCode res=TSHttpTxnConfigFind(name,length,conf,type); - return (res==TS_SUCCESS); + return (TS_SUCCESS==TSHttpTxnConfigFind(name,length,conf,type)); } + void Transaction::resume() { diff --git a/lib/atscppapi/src/include/atscppapi/Plugin.h b/lib/atscppapi/src/include/atscppapi/Plugin.h index 1800ea52014..1b3b7a7bd20 100644 --- a/lib/atscppapi/src/include/atscppapi/Plugin.h +++ b/lib/atscppapi/src/include/atscppapi/Plugin.h @@ -30,6 +30,7 @@ #include #include + namespace atscppapi { /** @@ -166,6 +167,10 @@ class Plugin : noncopyable /**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS] for example. */ extern const std::string HOOK_TYPE_STRINGS[]; +extern "C" +{ + extern void TSRegisterPlugin(std::string name, std::string vendor, std::string email); +} } /* atscppapi */ diff --git a/lib/atscppapi/src/include/atscppapi/PluginInit.h b/lib/atscppapi/src/include/atscppapi/PluginInit.h index 6c49c28ec5a..f5a4a8a27d1 100644 --- a/lib/atscppapi/src/include/atscppapi/PluginInit.h +++ b/lib/atscppapi/src/include/atscppapi/PluginInit.h @@ -23,10 +23,8 @@ #pragma once #ifndef ATSCPPAPI_PLUGININIT_H_ #define ATSCPPAPI_PLUGININIT_H_ - +#include <../ts/apidefs.h> #include -#include<../ts/apidefs.h> -#include <../../../../proxy/api/ts/ts.h> extern "C" { /** @@ -37,12 +35,6 @@ extern "C" { * @param argv Array of pointers pointing to arguments */ void TSPluginInit(int argc, const char *argv[]); - -//enum TsReturnCode { -// TS_ERROR = -1, -// TS_SUCCESS = 0, -//}; - /** * Invoked for remap plugins - listed in remap.config. The arguments provided as @pparam * in the remap.config line are provided in this invocation. diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index f1f0dc4268b..fb1aaba6535 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -30,7 +30,7 @@ #include "atscppapi/shared_ptr.h" #include "atscppapi/ClientRequest.h" #include "atscppapi/Response.h" -#include <../ts/apidefs.h> +#include <../ts/apidefs.h> namespace atscppapi { // forward declarations @@ -320,15 +320,15 @@ class Transaction : noncopyable * Redirect the transaction a different @a url. */ void redirectTo(std::string const &url); - - bool configIntSet(TSOverridableConfigKey conf, int value); - bool configIntGet(TSOverridableConfigKey conf, int* value); + + bool configIntSet(TSOverridableConfigKey conf, int value); + bool configIntGet(TSOverridableConfigKey conf, int* value); bool configFloatSet(TSOverridableConfigKey conf, float value); bool configFloatGet(TSOverridableConfigKey conf, float* value); - bool configStringSet(TSOverridableConfigKey conf, char* value,int length); - bool configStringGet(TSOverridableConfigKey conf,const char** value, int* length); + bool configStringSet(TSOverridableConfigKey conf, std::string value,int length); + bool configStringGet(TSOverridableConfigKey conf,std::string* value, int* length); bool configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type); - + private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can call addPlugin() diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc index 72a3fbf2f8a..93a9b00e52c 100644 --- a/plugins/conf_remap/conf_remap.cc +++ b/plugins/conf_remap/conf_remap.cc @@ -312,7 +312,7 @@ TSRemapDeleteInstance(void *ih) TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo * /* rri ATS_UNUSED */) { - + if (NULL != ih) { RemapConfigs *conf = static_cast(ih); TSHttpTxn txnp = static_cast(rh); diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 45ac748e114..fc3cec83011 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -382,7 +382,7 @@ struct OverridableHttpConfigParams { connect_attempts_max_retries_dead_server(3), connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800), down_server_timeout(300), client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1), cache_open_read_retry_time(10), - background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), + background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0), flow_low_water_mark(0), default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0), // Strings / floats must come last diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index f6e644c6945..983281d84b6 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6648,7 +6648,7 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From 4e563f99b361f15a00a245c292553106a4b5a6ae Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Mon, 8 Jun 2015 14:47:34 -0500 Subject: [PATCH 17/23] TSregisterplugin included in all the pluginit implementations of CPP-API-Example plugins; --- .../async_http_fetch/AsyncHttpFetch.cc | 1 + .../AsyncHttpFetchStreaming.cc | 1 + .../examples/async_timer/AsyncTimer.cc | 1 + lib/atscppapi/examples/boom/boom.cc | 1 + .../examples/clientredirect/ClientRedirect.cc | 1 + .../examples/clientrequest/ClientRequest.cc | 1 + .../examples/customresponse/CustomResponse.cc | 1 + .../examples/globalhook/GlobalHookPlugin.cc | 38 +------------------ .../GzipTransformationPlugin.cc | 1 + .../examples/helloworld/HelloWorldPlugin.cc | 2 +- lib/atscppapi/examples/intercept/intercept.cc | 1 + .../InternalTransactionHandling.cc | 1 + .../examples/logger_example/LoggerExample.cc | 1 + .../MultipleTransactionHookPlugins.cc | 1 + .../NullTransformationPlugin.cc | 1 + .../examples/post_buffer/PostBuffer.cc | 1 + .../examples/serverresponse/ServerResponse.cc | 1 + .../examples/stat_example/StatExample.cc | 1 + .../timeout_example/TimeoutExamplePlugin.cc | 1 + .../transactionhook/TransactionHookPlugin.cc | 1 + lib/atscppapi/src/Transaction.cc | 18 ++++++--- lib/atscppapi/src/include/atscppapi/Plugin.h | 2 +- .../src/include/atscppapi/Transaction.h | 6 +-- 23 files changed, 37 insertions(+), 47 deletions(-) diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc index 6e7974c451f..bd3e1680882 100644 --- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc +++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc @@ -214,6 +214,7 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); + atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncHttpFetch"), std::string("apache"), std::string("info@example.com")); GlobalPlugin *instance = new GlobalHookPlugin(); (void)instance; diff --git a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc index 33902c3a9b4..f8b32e43cef 100644 --- a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc +++ b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc @@ -75,6 +75,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncHttpFetchStreaming"), std::string("apache"), std::string("info@example.com")); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/async_timer/AsyncTimer.cc b/lib/atscppapi/examples/async_timer/AsyncTimer.cc index 6faa0813439..41de88cd39d 100644 --- a/lib/atscppapi/examples/async_timer/AsyncTimer.cc +++ b/lib/atscppapi/examples/async_timer/AsyncTimer.cc @@ -60,6 +60,7 @@ class TimerEventReceiver : public AsyncReceiver void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncTimer"), std::string("apache"), std::string("info@example.com")); int period_in_ms = 1000; TimerEventReceiver *timer1 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms); TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max instances 0", timer1, period_in_ms); diff --git a/lib/atscppapi/examples/boom/boom.cc b/lib/atscppapi/examples/boom/boom.cc index 4d8b9d45e14..d73855ff699 100644 --- a/lib/atscppapi/examples/boom/boom.cc +++ b/lib/atscppapi/examples/boom/boom.cc @@ -415,6 +415,7 @@ BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction) void TSPluginInit(int argc, const char *argv[]) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_Boom"), std::string("apache"), std::string("info@example.com")); boom_counter.init(BOOM_COUNTER); BoomResponseRegistry *pregistry = new BoomResponseRegistry(); diff --git a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc index b4fcbd11abf..84490a30e6f 100644 --- a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc +++ b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc @@ -78,5 +78,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_ClientDirect"), std::string("apache"), std::string("info@example.com")); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/clientrequest/ClientRequest.cc b/lib/atscppapi/examples/clientrequest/ClientRequest.cc index 323870f0b4d..29000487cab 100644 --- a/lib/atscppapi/examples/clientrequest/ClientRequest.cc +++ b/lib/atscppapi/examples/clientrequest/ClientRequest.cc @@ -135,5 +135,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_ClientRequest"), std::string("apache"), std::string("info@example.com")); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/customresponse/CustomResponse.cc b/lib/atscppapi/examples/customresponse/CustomResponse.cc index b6d3057aab9..28cb8041aeb 100644 --- a/lib/atscppapi/examples/customresponse/CustomResponse.cc +++ b/lib/atscppapi/examples/customresponse/CustomResponse.cc @@ -85,5 +85,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_CustomResponse"), std::string("apache"), std::string("info@example.com")); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index 8fc961b8652..d1f65f34df9 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -19,7 +19,7 @@ #include #include #include -#include <../ts/Diags.h> + using namespace atscppapi; using namespace std; class GlobalHookPlugin : public GlobalPlugin @@ -30,40 +30,6 @@ class GlobalHookPlugin : public GlobalPlugin virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) { - ////////////////////////////////////////////// - int value; - float fvalue; - char* str; - std::string svalue; - int slength; - std::string keyval("proxy.config.http.slow.log.threshold"); - - TSOverridableConfigKey okey; - TSRecordDataType type; -// initialise string - transaction.configStringGet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,&svalue,&slength); - Note("value for http response str %s , %d\n",svalue.c_str(),slength); -// setting values - transaction.configIntSet(TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,4000); - if (false==transaction.configFloatSet(TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR, 0.15)) - Note("Could not set the lm factor\n"); - - str= new char[svalue.length()+1]; - strcpy(str,svalue.c_str()); - str[0]='X'; - svalue.assign(str); - transaction.configStringSet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,svalue,slength); -//getting values - transaction.configIntGet(TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,&value); - Note("value for heuristic min lifetime %d\n",value); - transaction.configFloatGet(TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR, &fvalue); - Note("value for heuristic lm factor %f\n",fvalue); - transaction.configStringGet(TS_CONFIG_HTTP_RESPONSE_SERVER_STR,&svalue,&slength); - Note("value for http response str %s , %d\n",svalue.c_str(),slength); - - if(true==transaction.configFind(keyval.c_str(),-1,&okey,&type)) - Note("found %d\n",okey); -/////////////////////////////////////////////////////////////////////// std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; transaction.resume(); } @@ -72,7 +38,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("ghp"), std::string("ghp"), std::string("ghp")); + atscppapi::TSRegisterPlugin( std::string("CPP_Example_GlobalHookPplugin"), std::string("apache"), std::string("info@example.com")); std::cout << "Hello from " << argv[0] << std::endl; new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc index 9f3a8d49b8c..b633c74f599 100644 --- a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc +++ b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc @@ -192,6 +192,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_GzipTransformation"), std::string("apache"), std::string("info@example.com")); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index 7440fe565dd..73b53625f63 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -31,6 +31,6 @@ TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { std::cout << "Hello from " << argv[0] << std::endl; - atscppapi::TSRegisterPlugin( std::string("hello1"), std::string("hello2"), std::string("hello3")); + atscppapi::TSRegisterPlugin( std::string("CPP_Example_HelloWorld"), std::string("apache"), std::string("info@example.com")); new HelloWorldPlugin(); } diff --git a/lib/atscppapi/examples/intercept/intercept.cc b/lib/atscppapi/examples/intercept/intercept.cc index 9cb0005195e..bcc00989013 100644 --- a/lib/atscppapi/examples/intercept/intercept.cc +++ b/lib/atscppapi/examples/intercept/intercept.cc @@ -55,6 +55,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_Intercept"), std::string("apache"), std::string("info@example.com")); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc index ee1ba0761cd..92d218bafe5 100644 --- a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc +++ b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc @@ -71,6 +71,7 @@ class NoInternalTransactionsGlobalPlugin : public GlobalPlugin, public AsyncRece void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_InternalTransactionHandling"), std::string("apache"), std::string("info@example.com")); TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); new AllTransactionsGlobalPlugin(); new NoInternalTransactionsGlobalPlugin(); diff --git a/lib/atscppapi/examples/logger_example/LoggerExample.cc b/lib/atscppapi/examples/logger_example/LoggerExample.cc index 02f4732ab34..21c38b21e94 100644 --- a/lib/atscppapi/examples/logger_example/LoggerExample.cc +++ b/lib/atscppapi/examples/logger_example/LoggerExample.cc @@ -102,6 +102,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_Logger"), std::string("apache"), std::string("info@example.com")); // Create a new logger // This will create a log file with the name logger_example.log (since we left off // the extension it will automatically add .log) diff --git a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc index d1c2e4097e0..337b9fe6cf7 100644 --- a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc +++ b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc @@ -105,5 +105,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_MultipleTransactionHook"), std::string("apache"), std::string("info@example.com")); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc index fa6e710e6ce..0a83cf384d6 100644 --- a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc +++ b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc @@ -99,6 +99,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_NullTransformation"), std::string("apache"), std::string("info@example.com")); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/post_buffer/PostBuffer.cc b/lib/atscppapi/examples/post_buffer/PostBuffer.cc index 85131de76b9..3c05d8f33e2 100644 --- a/lib/atscppapi/examples/post_buffer/PostBuffer.cc +++ b/lib/atscppapi/examples/post_buffer/PostBuffer.cc @@ -80,5 +80,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_PostBuffer"), std::string("apache"), std::string("info@example.com")); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/serverresponse/ServerResponse.cc b/lib/atscppapi/examples/serverresponse/ServerResponse.cc index b15121010ed..981a5637b7f 100644 --- a/lib/atscppapi/examples/serverresponse/ServerResponse.cc +++ b/lib/atscppapi/examples/serverresponse/ServerResponse.cc @@ -114,5 +114,6 @@ class ServerResponsePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_ServerResponse"), std::string("apache"), std::string("info@example.com")); new ServerResponsePlugin(); } diff --git a/lib/atscppapi/examples/stat_example/StatExample.cc b/lib/atscppapi/examples/stat_example/StatExample.cc index 12b10cbfdef..5b3a8f795ab 100644 --- a/lib/atscppapi/examples/stat_example/StatExample.cc +++ b/lib/atscppapi/examples/stat_example/StatExample.cc @@ -67,6 +67,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_Stat"), std::string("apache"), std::string("info@example.com")); TS_DEBUG(TAG, "Loaded stat_example plugin"); // Since this stat is not persistent it will be initialized to 0. diff --git a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc index 63c4b78bfad..a783f91397b 100644 --- a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc +++ b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc @@ -57,6 +57,7 @@ class TimeoutExamplePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_Timeout"), std::string("apache"), std::string("info@example.com")); TS_DEBUG(TAG, "TSPluginInit"); new TimeoutExamplePlugin(); } diff --git a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc index 22adadfd52f..0d85fa13256 100644 --- a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc +++ b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc @@ -65,5 +65,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { + atscppapi::TSRegisterPlugin( std::string("CPP_Example_TransactionHook"), std::string("apache"), std::string("info@example.com")); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc index 8c8d2f171b1..443b044a262 100644 --- a/lib/atscppapi/src/Transaction.cc +++ b/lib/atscppapi/src/Transaction.cc @@ -115,21 +115,27 @@ bool Transaction::configFloatGet(TSOverridableConfigKey conf, float *value) return (TS_SUCCESS==TSHttpTxnConfigFloatGet(state_->txn_, conf, value)); } -bool Transaction::configStringSet(TSOverridableConfigKey conf, std::string value,int length) +bool Transaction::configStringSet(TSOverridableConfigKey conf, std::string const& value,int length) { return (TS_SUCCESS==TSHttpTxnConfigStringSet(state_->txn_,conf,(TSMgmtString)value.c_str(),length)); } -bool Transaction::configStringGet(TSOverridableConfigKey conf,std::string* value, int* length) +bool Transaction::configStringGet(TSOverridableConfigKey conf,std::string& value, int* length) { const char* svalue; - svalue=value->c_str(); - return (TS_SUCCESS==TSHttpTxnConfigStringGet(state_->txn_, conf, &svalue,length)); + TSReturnCode res=TSHttpTxnConfigStringGet(state_->txn_, conf, &svalue,length); + if(res==TS_SUCCESS) + { + value.assign(svalue); + return true; + } + else + return false; } -bool Transaction::configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type) +bool Transaction::configFind(std::string const& name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type) { - return (TS_SUCCESS==TSHttpTxnConfigFind(name,length,conf,type)); + return (TS_SUCCESS==TSHttpTxnConfigFind(name.c_str(),length,conf,type)); } void diff --git a/lib/atscppapi/src/include/atscppapi/Plugin.h b/lib/atscppapi/src/include/atscppapi/Plugin.h index 1b3b7a7bd20..6171965881d 100644 --- a/lib/atscppapi/src/include/atscppapi/Plugin.h +++ b/lib/atscppapi/src/include/atscppapi/Plugin.h @@ -169,7 +169,7 @@ class Plugin : noncopyable extern const std::string HOOK_TYPE_STRINGS[]; extern "C" { - extern void TSRegisterPlugin(std::string name, std::string vendor, std::string email); + void TSRegisterPlugin(std::string name, std::string vendor, std::string email); } } /* atscppapi */ diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h b/lib/atscppapi/src/include/atscppapi/Transaction.h index fb1aaba6535..b0e4afab10b 100644 --- a/lib/atscppapi/src/include/atscppapi/Transaction.h +++ b/lib/atscppapi/src/include/atscppapi/Transaction.h @@ -325,9 +325,9 @@ class Transaction : noncopyable bool configIntGet(TSOverridableConfigKey conf, int* value); bool configFloatSet(TSOverridableConfigKey conf, float value); bool configFloatGet(TSOverridableConfigKey conf, float* value); - bool configStringSet(TSOverridableConfigKey conf, std::string value,int length); - bool configStringGet(TSOverridableConfigKey conf,std::string* value, int* length); - bool configFind(const char *name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type); + bool configStringSet(TSOverridableConfigKey conf, std::string const& value,int length); + bool configStringGet(TSOverridableConfigKey conf,std::string& value, int* length); + bool configFind(std::string const& name, int length, TSOverridableConfigKey *conf, TSRecordDataType *type); private: TransactionState *state_; //!< The internal TransactionState object tied to the current Transaction From 4cf752444404667e98034d071fa236f09173a131 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Mon, 8 Jun 2015 15:25:43 -0500 Subject: [PATCH 18/23] minor formatting problem fixed --- lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc | 10 +++++----- plugins/conf_remap/conf_remap.cc | 1 - proxy/http/HttpSM.cc | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index c4e4edea84d..d21dabd1bfb 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -24,12 +24,12 @@ class GlobalHookPlugin : public GlobalPlugin { public: GlobalHookPlugin() { registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP); } - + virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) - { - std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; - transaction.resume(); + { + std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl; + transaction.resume(); } }; @@ -37,6 +37,6 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { atscppapi::TSRegisterPlugin( std::string("CPP_Example_GlobalHookPplugin"), std::string("apache"), std::string("info@example.com")); - std::cout << "Hello from " << argv[0] << std::endl; + std::cout << "Hello from " << argv[0] << std::endl; new GlobalHookPlugin(); } diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc index 93a9b00e52c..a6281aa22ee 100644 --- a/plugins/conf_remap/conf_remap.cc +++ b/plugins/conf_remap/conf_remap.cc @@ -312,7 +312,6 @@ TSRemapDeleteInstance(void *ih) TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo * /* rri ATS_UNUSED */) { - if (NULL != ih) { RemapConfigs *conf = static_cast(ih); TSHttpTxn txnp = static_cast(rh); diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 983281d84b6..f6e644c6945 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6648,7 +6648,7 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From 2d7b704d3bc09c103697709e7d3266635cd75899 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Mon, 8 Jun 2015 15:27:30 -0500 Subject: [PATCH 19/23] minor formatting problem fixed --- proxy/http/HttpSM.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index f6e644c6945..a0ed48cf123 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -6648,7 +6648,7 @@ HttpSM::update_stats() // print slow requests if the threshold is set (> 0) and if we are over the time threshold - if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { + if (t_state.txn_conf->slow_log_threshold != 0 && ink_hrtime_from_msec(t_state.txn_conf->slow_log_threshold) < total_time) { URL *url = t_state.hdr_info.client_request.url_get(); char url_string[256] = ""; int offset = 0; From e2c877583cecd1f10076b119d8d894048e18c767 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Mon, 8 Jun 2015 15:32:29 -0500 Subject: [PATCH 20/23] minor formatting problem fixed --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b936fa26741..e69de29bb2d 100644 --- a/README.md +++ b/README.md @@ -1 +0,0 @@ -# overridable_slow_log_threshold From 1c7774ad7cec0abc4a3eb4b2e3715289d68a4e93 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Fri, 19 Jun 2015 15:25:12 -0500 Subject: [PATCH 21/23] TS 3467- format fixning --- lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc | 2 +- .../async_http_fetch_streaming/AsyncHttpFetchStreaming.cc | 2 +- lib/atscppapi/examples/async_timer/AsyncTimer.cc | 2 +- lib/atscppapi/examples/boom/boom.cc | 2 +- lib/atscppapi/examples/clientredirect/ClientRedirect.cc | 2 +- lib/atscppapi/examples/clientrequest/ClientRequest.cc | 2 +- lib/atscppapi/examples/customresponse/CustomResponse.cc | 2 +- lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc | 2 +- .../examples/gzip_transformation/GzipTransformationPlugin.cc | 2 +- lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc | 2 +- lib/atscppapi/examples/intercept/intercept.cc | 2 +- .../InternalTransactionHandling.cc | 2 +- lib/atscppapi/examples/logger_example/LoggerExample.cc | 2 +- .../MultipleTransactionHookPlugins.cc | 2 +- .../null_transformation_plugin/NullTransformationPlugin.cc | 2 +- lib/atscppapi/examples/post_buffer/PostBuffer.cc | 2 +- lib/atscppapi/examples/serverresponse/ServerResponse.cc | 2 +- lib/atscppapi/examples/stat_example/StatExample.cc | 2 +- lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc | 2 +- lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc index bd3e1680882..6881dc66da3 100644 --- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc +++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc @@ -214,7 +214,7 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); - atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncHttpFetch"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_AsyncHttpFetch", "apache", "users@trafficserver.apache.org"); GlobalPlugin *instance = new GlobalHookPlugin(); (void)instance; diff --git a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc index f8b32e43cef..34ef1edd36a 100644 --- a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc +++ b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc @@ -75,7 +75,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncHttpFetchStreaming"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "users@trafficserver.apache.org"); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/async_timer/AsyncTimer.cc b/lib/atscppapi/examples/async_timer/AsyncTimer.cc index 41de88cd39d..ae52c67d15e 100644 --- a/lib/atscppapi/examples/async_timer/AsyncTimer.cc +++ b/lib/atscppapi/examples/async_timer/AsyncTimer.cc @@ -60,7 +60,7 @@ class TimerEventReceiver : public AsyncReceiver void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_AsyncTimer"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_AsyncTimer", "apache", "users@trafficserver.apache.org"); int period_in_ms = 1000; TimerEventReceiver *timer1 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms); TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max instances 0", timer1, period_in_ms); diff --git a/lib/atscppapi/examples/boom/boom.cc b/lib/atscppapi/examples/boom/boom.cc index d73855ff699..7e2733ef27e 100644 --- a/lib/atscppapi/examples/boom/boom.cc +++ b/lib/atscppapi/examples/boom/boom.cc @@ -415,7 +415,7 @@ BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction) void TSPluginInit(int argc, const char *argv[]) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_Boom"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_Boom", "apache", "users@trafficserver.apache.org"); boom_counter.init(BOOM_COUNTER); BoomResponseRegistry *pregistry = new BoomResponseRegistry(); diff --git a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc index 84490a30e6f..e29b35aa528 100644 --- a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc +++ b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc @@ -78,6 +78,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_ClientDirect"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_ClientDirect", "apache", "users@trafficserver.apache.org"); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/clientrequest/ClientRequest.cc b/lib/atscppapi/examples/clientrequest/ClientRequest.cc index 29000487cab..1d779d381a3 100644 --- a/lib/atscppapi/examples/clientrequest/ClientRequest.cc +++ b/lib/atscppapi/examples/clientrequest/ClientRequest.cc @@ -135,6 +135,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_ClientRequest"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_ClientRequest", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/customresponse/CustomResponse.cc b/lib/atscppapi/examples/customresponse/CustomResponse.cc index 28cb8041aeb..64455566e0e 100644 --- a/lib/atscppapi/examples/customresponse/CustomResponse.cc +++ b/lib/atscppapi/examples/customresponse/CustomResponse.cc @@ -85,6 +85,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_CustomResponse"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_CustomResponse", "apache", "users@trafficserver.apache.org"); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index d21dabd1bfb..94f39a6ff01 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -36,7 +36,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_GlobalHookPplugin"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_GlobalHookPplugin", "apache", "users@trafficserver.apache.org"); std::cout << "Hello from " << argv[0] << std::endl; new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc index b633c74f599..2c27e14b1b7 100644 --- a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc +++ b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc @@ -192,7 +192,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_GzipTransformation"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_GzipTransformation", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index cbb98fc3297..1426ef47888 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -33,6 +33,6 @@ TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { std::cout << "Hello from " << argv[0] << std::endl; - atscppapi::TSRegisterPlugin( std::string("CPP_Example_HelloWorld"), std::string("apache"), std::string("info@example.com")); + atscppapi::TSRegisterPlugin("CPP_Example_HelloWorld", "apache", "users@trafficserver.apache.org"); new HelloWorldPlugin(); } diff --git a/lib/atscppapi/examples/intercept/intercept.cc b/lib/atscppapi/examples/intercept/intercept.cc index bcc00989013..cf175dbb6b8 100644 --- a/lib/atscppapi/examples/intercept/intercept.cc +++ b/lib/atscppapi/examples/intercept/intercept.cc @@ -55,7 +55,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_Intercept"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_Intercept", "apache", "users@trafficserver.apache.org"); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc index 92d218bafe5..b875676d27c 100644 --- a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc +++ b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc @@ -71,7 +71,7 @@ class NoInternalTransactionsGlobalPlugin : public GlobalPlugin, public AsyncRece void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_InternalTransactionHandling"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_InternalTransactionHandling", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); new AllTransactionsGlobalPlugin(); new NoInternalTransactionsGlobalPlugin(); diff --git a/lib/atscppapi/examples/logger_example/LoggerExample.cc b/lib/atscppapi/examples/logger_example/LoggerExample.cc index 21c38b21e94..7bf3b384e39 100644 --- a/lib/atscppapi/examples/logger_example/LoggerExample.cc +++ b/lib/atscppapi/examples/logger_example/LoggerExample.cc @@ -102,7 +102,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_Logger"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_Logger", "apache", "users@trafficserver.apache.org"); // Create a new logger // This will create a log file with the name logger_example.log (since we left off // the extension it will automatically add .log) diff --git a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc index 337b9fe6cf7..3540eb85feb 100644 --- a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc +++ b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc @@ -105,6 +105,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_MultipleTransactionHook"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_MultipleTransactionHook", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc index 0a83cf384d6..e22baec0389 100644 --- a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc +++ b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc @@ -99,7 +99,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_NullTransformation"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_NullTransformation", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/post_buffer/PostBuffer.cc b/lib/atscppapi/examples/post_buffer/PostBuffer.cc index 3c05d8f33e2..e8d0c6ea234 100644 --- a/lib/atscppapi/examples/post_buffer/PostBuffer.cc +++ b/lib/atscppapi/examples/post_buffer/PostBuffer.cc @@ -80,6 +80,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_PostBuffer"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_PostBuffer", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/serverresponse/ServerResponse.cc b/lib/atscppapi/examples/serverresponse/ServerResponse.cc index 981a5637b7f..a0f8e1f3ed7 100644 --- a/lib/atscppapi/examples/serverresponse/ServerResponse.cc +++ b/lib/atscppapi/examples/serverresponse/ServerResponse.cc @@ -114,6 +114,6 @@ class ServerResponsePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_ServerResponse"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_ServerResponse", "apache", "users@trafficserver.apache.org"); new ServerResponsePlugin(); } diff --git a/lib/atscppapi/examples/stat_example/StatExample.cc b/lib/atscppapi/examples/stat_example/StatExample.cc index 5b3a8f795ab..b303e4a46c6 100644 --- a/lib/atscppapi/examples/stat_example/StatExample.cc +++ b/lib/atscppapi/examples/stat_example/StatExample.cc @@ -67,7 +67,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_Stat"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_Stat", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "Loaded stat_example plugin"); // Since this stat is not persistent it will be initialized to 0. diff --git a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc index a783f91397b..20f84ef83b3 100644 --- a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc +++ b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc @@ -57,7 +57,7 @@ class TimeoutExamplePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_Timeout"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin( "CPP_Example_Timeout", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new TimeoutExamplePlugin(); } diff --git a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc index 0d85fa13256..15596b2fe2f 100644 --- a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc +++ b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc @@ -65,6 +65,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - atscppapi::TSRegisterPlugin( std::string("CPP_Example_TransactionHook"), std::string("apache"), std::string("info@example.com")); + TSRegisterPlugin("CPP_Example_TransactionHook", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } From d084b752ef29736277070891eb3001bcbf8f16f2 Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Fri, 19 Jun 2015 15:34:31 -0500 Subject: [PATCH 22/23] TS-3647 : fixing whitespace --- lib/atscppapi/examples/remap_plugin/RemapPlugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc index db75b7316df..b04c4feb0b2 100644 --- a/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc +++ b/lib/atscppapi/examples/remap_plugin/RemapPlugin.cc @@ -40,7 +40,7 @@ class MyRemapPlugin : public RemapPlugin Url &request_url = transaction.getClientRequest().getUrl(); TS_DEBUG(LOG_TAG, "from URL is [%s], to URL is [%s], request URL is [%s]", map_from_url.getUrlString().c_str(), map_to_url.getUrlString().c_str(), request_url.getUrlString().c_str()); - const string &query = request_url.getQuery(); + const string &query = request_url.getQuery(); string query_param_raw; map query_params; std::istringstream iss(query); From 3cf4f8c27b2d2398276704078b2d04961154e16b Mon Sep 17 00:00:00 2001 From: Syeda Persia Aziz Date: Fri, 19 Jun 2015 16:44:45 -0500 Subject: [PATCH 23/23] TS-3647: renamed TSRegisterPlugin to RegsiterGlobalPlugin --- lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc | 2 +- .../async_http_fetch_streaming/AsyncHttpFetchStreaming.cc | 2 +- lib/atscppapi/examples/async_timer/AsyncTimer.cc | 2 +- lib/atscppapi/examples/boom/boom.cc | 2 +- lib/atscppapi/examples/clientredirect/ClientRedirect.cc | 2 +- lib/atscppapi/examples/clientrequest/ClientRequest.cc | 2 +- lib/atscppapi/examples/customresponse/CustomResponse.cc | 2 +- lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc | 2 +- .../examples/gzip_transformation/GzipTransformationPlugin.cc | 2 +- lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc | 2 +- lib/atscppapi/examples/intercept/intercept.cc | 2 +- .../InternalTransactionHandling.cc | 2 +- lib/atscppapi/examples/logger_example/LoggerExample.cc | 2 +- .../MultipleTransactionHookPlugins.cc | 2 +- .../null_transformation_plugin/NullTransformationPlugin.cc | 2 +- lib/atscppapi/examples/post_buffer/PostBuffer.cc | 2 +- lib/atscppapi/examples/serverresponse/ServerResponse.cc | 2 +- lib/atscppapi/examples/stat_example/StatExample.cc | 2 +- .../examples/timeout_example/TimeoutExamplePlugin.cc | 2 +- .../examples/transactionhook/TransactionHookPlugin.cc | 2 +- lib/atscppapi/src/Plugin.cc | 2 +- lib/atscppapi/src/include/atscppapi/Plugin.h | 5 +---- 22 files changed, 22 insertions(+), 25 deletions(-) diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc index 6881dc66da3..79607fbdfed 100644 --- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc +++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc @@ -214,7 +214,7 @@ void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); - TSRegisterPlugin("CPP_Example_AsyncHttpFetch", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_AsyncHttpFetch", "apache", "users@trafficserver.apache.org"); GlobalPlugin *instance = new GlobalHookPlugin(); (void)instance; diff --git a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc index 34ef1edd36a..fe27552b3a8 100644 --- a/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc +++ b/lib/atscppapi/examples/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc @@ -75,7 +75,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { - TSRegisterPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "users@trafficserver.apache.org"); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/async_timer/AsyncTimer.cc b/lib/atscppapi/examples/async_timer/AsyncTimer.cc index ae52c67d15e..3eb2211eb8f 100644 --- a/lib/atscppapi/examples/async_timer/AsyncTimer.cc +++ b/lib/atscppapi/examples/async_timer/AsyncTimer.cc @@ -60,7 +60,7 @@ class TimerEventReceiver : public AsyncReceiver void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_AsyncTimer", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_AsyncTimer", "apache", "users@trafficserver.apache.org"); int period_in_ms = 1000; TimerEventReceiver *timer1 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms); TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max instances 0", timer1, period_in_ms); diff --git a/lib/atscppapi/examples/boom/boom.cc b/lib/atscppapi/examples/boom/boom.cc index 7e2733ef27e..41d4077b41c 100644 --- a/lib/atscppapi/examples/boom/boom.cc +++ b/lib/atscppapi/examples/boom/boom.cc @@ -415,7 +415,7 @@ BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction) void TSPluginInit(int argc, const char *argv[]) { - TSRegisterPlugin("CPP_Example_Boom", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_Boom", "apache", "users@trafficserver.apache.org"); boom_counter.init(BOOM_COUNTER); BoomResponseRegistry *pregistry = new BoomResponseRegistry(); diff --git a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc index e29b35aa528..34138cbb2d8 100644 --- a/lib/atscppapi/examples/clientredirect/ClientRedirect.cc +++ b/lib/atscppapi/examples/clientredirect/ClientRedirect.cc @@ -78,6 +78,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_ClientDirect", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_ClientDirect", "apache", "users@trafficserver.apache.org"); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/clientrequest/ClientRequest.cc b/lib/atscppapi/examples/clientrequest/ClientRequest.cc index 1d779d381a3..daa7e691905 100644 --- a/lib/atscppapi/examples/clientrequest/ClientRequest.cc +++ b/lib/atscppapi/examples/clientrequest/ClientRequest.cc @@ -135,6 +135,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_ClientRequest", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_ClientRequest", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/customresponse/CustomResponse.cc b/lib/atscppapi/examples/customresponse/CustomResponse.cc index 64455566e0e..ce6f5b15767 100644 --- a/lib/atscppapi/examples/customresponse/CustomResponse.cc +++ b/lib/atscppapi/examples/customresponse/CustomResponse.cc @@ -85,6 +85,6 @@ class ClientRedirectGlobalPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_CustomResponse", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_CustomResponse", "apache", "users@trafficserver.apache.org"); new ClientRedirectGlobalPlugin(); } diff --git a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc index 94f39a6ff01..ce84e1ef174 100644 --- a/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc +++ b/lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc @@ -36,7 +36,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_GlobalHookPplugin", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_GlobalHookPplugin", "apache", "users@trafficserver.apache.org"); std::cout << "Hello from " << argv[0] << std::endl; new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc index 2c27e14b1b7..d01715824de 100644 --- a/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc +++ b/lib/atscppapi/examples/gzip_transformation/GzipTransformationPlugin.cc @@ -192,7 +192,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_GzipTransformation", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_GzipTransformation", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc index 1426ef47888..7100487d8e4 100644 --- a/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc +++ b/lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc @@ -33,6 +33,6 @@ TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { std::cout << "Hello from " << argv[0] << std::endl; - atscppapi::TSRegisterPlugin("CPP_Example_HelloWorld", "apache", "users@trafficserver.apache.org"); + atscppapi::RegisterGlobalPlugin("CPP_Example_HelloWorld", "apache", "users@trafficserver.apache.org"); new HelloWorldPlugin(); } diff --git a/lib/atscppapi/examples/intercept/intercept.cc b/lib/atscppapi/examples/intercept/intercept.cc index cf175dbb6b8..9cf0758d799 100644 --- a/lib/atscppapi/examples/intercept/intercept.cc +++ b/lib/atscppapi/examples/intercept/intercept.cc @@ -55,7 +55,7 @@ class InterceptInstaller : public GlobalPlugin void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) { - TSRegisterPlugin("CPP_Example_Intercept", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_Intercept", "apache", "users@trafficserver.apache.org"); new InterceptInstaller(); } diff --git a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc index b875676d27c..4ed9923a7e0 100644 --- a/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc +++ b/lib/atscppapi/examples/internal_transaction_handling/InternalTransactionHandling.cc @@ -71,7 +71,7 @@ class NoInternalTransactionsGlobalPlugin : public GlobalPlugin, public AsyncRece void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_InternalTransactionHandling", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_InternalTransactionHandling", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin"); new AllTransactionsGlobalPlugin(); new NoInternalTransactionsGlobalPlugin(); diff --git a/lib/atscppapi/examples/logger_example/LoggerExample.cc b/lib/atscppapi/examples/logger_example/LoggerExample.cc index 7bf3b384e39..7ec4ae3ce09 100644 --- a/lib/atscppapi/examples/logger_example/LoggerExample.cc +++ b/lib/atscppapi/examples/logger_example/LoggerExample.cc @@ -102,7 +102,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_Logger", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_Logger", "apache", "users@trafficserver.apache.org"); // Create a new logger // This will create a log file with the name logger_example.log (since we left off // the extension it will automatically add .log) diff --git a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc index 3540eb85feb..a8bce04d3ea 100644 --- a/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc +++ b/lib/atscppapi/examples/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc @@ -105,6 +105,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_MultipleTransactionHook", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_MultipleTransactionHook", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc index e22baec0389..17b93a850c4 100644 --- a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc +++ b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc @@ -99,7 +99,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_NullTransformation", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_NullTransformation", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/post_buffer/PostBuffer.cc b/lib/atscppapi/examples/post_buffer/PostBuffer.cc index e8d0c6ea234..d8aaa504134 100644 --- a/lib/atscppapi/examples/post_buffer/PostBuffer.cc +++ b/lib/atscppapi/examples/post_buffer/PostBuffer.cc @@ -80,6 +80,6 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_PostBuffer", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_PostBuffer", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/examples/serverresponse/ServerResponse.cc b/lib/atscppapi/examples/serverresponse/ServerResponse.cc index a0f8e1f3ed7..26b387b3e75 100644 --- a/lib/atscppapi/examples/serverresponse/ServerResponse.cc +++ b/lib/atscppapi/examples/serverresponse/ServerResponse.cc @@ -114,6 +114,6 @@ class ServerResponsePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_ServerResponse", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_ServerResponse", "apache", "users@trafficserver.apache.org"); new ServerResponsePlugin(); } diff --git a/lib/atscppapi/examples/stat_example/StatExample.cc b/lib/atscppapi/examples/stat_example/StatExample.cc index b303e4a46c6..e2883ee8cd1 100644 --- a/lib/atscppapi/examples/stat_example/StatExample.cc +++ b/lib/atscppapi/examples/stat_example/StatExample.cc @@ -67,7 +67,7 @@ class GlobalHookPlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_Stat", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_Stat", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "Loaded stat_example plugin"); // Since this stat is not persistent it will be initialized to 0. diff --git a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc index 20f84ef83b3..98309a4d210 100644 --- a/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc +++ b/lib/atscppapi/examples/timeout_example/TimeoutExamplePlugin.cc @@ -57,7 +57,7 @@ class TimeoutExamplePlugin : public GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin( "CPP_Example_Timeout", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin( "CPP_Example_Timeout", "apache", "users@trafficserver.apache.org"); TS_DEBUG(TAG, "TSPluginInit"); new TimeoutExamplePlugin(); } diff --git a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc index 15596b2fe2f..c46057168ac 100644 --- a/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc +++ b/lib/atscppapi/examples/transactionhook/TransactionHookPlugin.cc @@ -65,6 +65,6 @@ class GlobalHookPlugin : public atscppapi::GlobalPlugin void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) { - TSRegisterPlugin("CPP_Example_TransactionHook", "apache", "users@trafficserver.apache.org"); + RegisterGlobalPlugin("CPP_Example_TransactionHook", "apache", "users@trafficserver.apache.org"); new GlobalHookPlugin(); } diff --git a/lib/atscppapi/src/Plugin.cc b/lib/atscppapi/src/Plugin.cc index 384e62d96aa..fb99a6ecffa 100644 --- a/lib/atscppapi/src/Plugin.cc +++ b/lib/atscppapi/src/Plugin.cc @@ -27,7 +27,7 @@ const std::string atscppapi::HOOK_TYPE_STRINGS[] = { std::string("HOOK_OS_DNS"), std::string("HOOK_READ_REQUEST_HEADERS"), std::string("HOOK_READ_CACHE_HEADERS"), std::string("HOOK_CACHE_LOOKUP_COMPLETE"), std::string("HOOK_SELECT_ALT")}; -void atscppapi::TSRegisterPlugin(std::string name, std::string vendor, std::string email) +void atscppapi::RegisterGlobalPlugin(std::string name, std::string vendor, std::string email) { TSPluginRegistrationInfo info; info.plugin_name=const_cast(name.c_str()); diff --git a/lib/atscppapi/src/include/atscppapi/Plugin.h b/lib/atscppapi/src/include/atscppapi/Plugin.h index 6171965881d..eb72625dc1f 100644 --- a/lib/atscppapi/src/include/atscppapi/Plugin.h +++ b/lib/atscppapi/src/include/atscppapi/Plugin.h @@ -167,10 +167,7 @@ class Plugin : noncopyable /**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS] for example. */ extern const std::string HOOK_TYPE_STRINGS[]; -extern "C" -{ - void TSRegisterPlugin(std::string name, std::string vendor, std::string email); -} +void RegisterGlobalPlugin(std::string name, std::string vendor, std::string email); } /* atscppapi */