You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2017/03/28 13:59:09 UTC

[trafficserver] branch master updated: TS-4976: Regularize plugins - protocol_stack

This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  a770257   TS-4976: Regularize plugins - protocol_stack
a770257 is described below

commit a7702574790e2e0b21068a31ff7ff41398a01679
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Fri Mar 24 07:53:13 2017 -0500

    TS-4976: Regularize plugins - protocol_stack
---
 .../api/functions/TSClientProtocolStack.en.rst           |  7 +++----
 example/Makefile.am                                      |  4 ++--
 .../protocol_stack.cc}                                   | 16 ++++++++--------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/doc/developer-guide/api/functions/TSClientProtocolStack.en.rst b/doc/developer-guide/api/functions/TSClientProtocolStack.en.rst
index 80f6476..d84ca03 100644
--- a/doc/developer-guide/api/functions/TSClientProtocolStack.en.rst
+++ b/doc/developer-guide/api/functions/TSClientProtocolStack.en.rst
@@ -71,7 +71,7 @@ than 10 which therefore should suffice. These functions return :const:`TS_SUCCES
 
 The :func:`TSHttpTxnClientProtocolStackContains` and :func:`TSHttpSsnClientProtocolStackContains`
 functions are provided for the convenience when only the presence of a protocol is of interest, not
-its location or the presence of other protocols. These functions return NULL if the protocol
+its location or the presence of other protocols. These functions return :const:`NULL` if the protocol
 :arg:`tag` is not present, and a pointer to the normalized tag if it is present. The strings are
 matched with an anchor prefix search, as with debug tags. For instance if :arg:`tag` is "tls" then it
 will match "tls/1.2" or "tls/1.3". This makes checking for TLS or IP more convenient. If more precision
@@ -100,11 +100,10 @@ QUIC        quic
 Examples
 --------
 
-The example below is excerpted from `example/protocol-stack/protocol-stack.cc`
+The example below is excerpted from `example/protocol_stack/protocol_stack.cc`
 in the Traffic Server source distribution. It demonstrates how to
 use :func:`TSHttpTxnClientProtocolStackGet` and :func:`TSHttpTxnClientProtocolStackContains`
 
-.. literalinclude:: ../../../../example/protocol-stack/protocol-stack.cc
+.. literalinclude:: ../../../../example/protocol_stack/protocol_stack.cc
   :language: c
   :lines: 31-46
-
diff --git a/example/Makefile.am b/example/Makefile.am
index e376e98..ecf272f 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -37,7 +37,7 @@ example_Plugins = \
 	null_transform.la \
 	output_header.la \
 	passthru.la \
-	protocol-stack.la \
+	protocol_stack.la \
 	protocol.la \
 	psi.la \
 	query-remap.la \
@@ -103,7 +103,7 @@ null_transform_la_SOURCES = null_transform/null_transform.c
 output_header_la_SOURCES = output_header/output_header.c
 passthru_la_SOURCES = passthru/passthru.cc
 protocol_la_SOURCES = protocol/Protocol.c protocol/TxnSM.c
-protocol_stack_la_SOURCES = protocol-stack/protocol-stack.cc
+protocol_stack_la_SOURCES = protocol_stack/protocol_stack.cc
 psi_la_SOURCES = thread-pool/psi.c thread-pool/thread.c
 query_remap_la_SOURCES = query-remap/query-remap.c
 remap_header_add_la_SOURCES = remap_header_add/remap_header_add.cc
diff --git a/example/protocol-stack/protocol-stack.cc b/example/protocol_stack/protocol_stack.cc
similarity index 77%
rename from example/protocol-stack/protocol-stack.cc
rename to example/protocol_stack/protocol_stack.cc
index 411f6af..6bb603a 100644
--- a/example/protocol-stack/protocol-stack.cc
+++ b/example/protocol_stack/protocol_stack.cc
@@ -26,7 +26,7 @@
 #include "ts/ts.h"
 #include "ts/ink_defs.h"
 
-#define DEBUG_TAG "protocol-stack"
+#define PLUGIN_NAME "protocol_stack"
 
 static int
 proto_stack_cb(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
@@ -34,13 +34,13 @@ proto_stack_cb(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
   TSHttpTxn txnp = (TSHttpTxn)edata;
   const char *results[10];
   int count = 0;
-  TSDebug(DEBUG_TAG, "Protocols:");
+  TSDebug(PLUGIN_NAME, "Protocols:");
   TSHttpTxnClientProtocolStackGet(txnp, 10, results, &count);
   for (int i = 0; i < count; i++) {
-    TSDebug(DEBUG_TAG, "\t%d: %s", i, results[i]);
+    TSDebug(PLUGIN_NAME, "\t%d: %s", i, results[i]);
   }
   const char *ret_tag = TSHttpTxnClientProtocolStackContains(txnp, "h2");
-  TSDebug(DEBUG_TAG, "Stack %s HTTP/2", ret_tag != nullptr ? "contains" : "does not contain");
+  TSDebug(PLUGIN_NAME, "Stack %s HTTP/2", ret_tag != nullptr ? "contains" : "does not contain");
   TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
   return 0;
 }
@@ -50,12 +50,12 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
   TSPluginRegistrationInfo info;
 
-  info.plugin_name   = const_cast<char *>("protocol-stack");
-  info.vendor_name   = const_cast<char *>("MyCompany");
-  info.support_email = const_cast<char *>("ts-api-support@MyCompany.com");
+  info.plugin_name   = PLUGIN_NAME;
+  info.vendor_name   = "Apache Software Foundation";
+  info.support_email = "dev@trafficserver.apache.org";
 
   if (TSPluginRegister(&info) != TS_SUCCESS) {
-    TSError("[protocol-stack] Plugin registration failed.");
+    TSError("[%s] Plugin registration failed.", PLUGIN_NAME);
   }
 
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(proto_stack_cb, nullptr));

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].