trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [3/3] git commit: TS-1953: remove check_ts_version() from examples
Date Thu, 01 Aug 2013 22:29:47 GMT
TS-1953: remove check_ts_version() from examples

remove the boilerplate check_ts_version() function call from all
examples. This function is nice in a specific example, but it does not
make sense to have it in every single example plugin.

Since the code is compiled, in most cases that's too late to catch
issues with API versions, so it doesn't make sense to begin with.
In order to enable Plugin Developers to do such checks, and #ifdef
around API issues, we'd have to expose the TS_VERSION_* contants.

n.b.: We might want add one example which shows off how to use the
TSTrafficServerGetVersion() API, but we have that in the man page now
anyway.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5b8b9685
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5b8b9685
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5b8b9685

Branch: refs/heads/master
Commit: 5b8b96850137ed29905fd1c244b4c6da3a3b02e2
Parents: 7e26b68
Author: Igor Galić <i.galic@brainsware.org>
Authored: Fri Aug 2 00:05:02 2013 +0200
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Fri Aug 2 00:29:31 2013 +0200

----------------------------------------------------------------------
 example/add-header/add-header.c               | 30 ----------------
 example/append-transform/append-transform.c   | 31 ----------------
 example/basic-auth/basic-auth.c               | 31 ----------------
 example/blacklist-0/blacklist-0.c             | 32 -----------------
 example/blacklist-1/blacklist-1.c             | 31 ----------------
 example/bnull-transform/bnull-transform.c     | 31 ----------------
 example/file-1/file-1.c                       | 30 ----------------
 example/hello/hello.c                         | 30 ----------------
 example/null-transform/null-transform.c       | 31 ----------------
 example/output-header/output-header.c         | 31 ----------------
 example/protocol/Protocol.c                   | 31 ----------------
 example/redirect-1/redirect-1.c               | 31 ----------------
 example/replace-header/replace-header.c       | 31 ----------------
 example/response-header-1/response-header-1.c | 31 ----------------
 example/server-transform/server-transform.c   | 31 ----------------
 example/session-1/session-1.c                 | 31 ----------------
 example/thread-1/thread-1.c                   | 30 ----------------
 example/thread-pool/psi.c                     | 41 ----------------------
 18 files changed, 565 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/add-header/add-header.c
----------------------------------------------------------------------
diff --git a/example/add-header/add-header.c b/example/add-header/add-header.c
index a329162..7bd1e15 100644
--- a/example/add-header/add-header.c
+++ b/example/add-header/add-header.c
@@ -120,31 +120,6 @@ add_header_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -162,11 +137,6 @@ TSPluginInit(int argc, const char *argv[])
     goto error;
   }
 
-  if (!check_ts_version()) {
-    TSError("[PluginInit] Plugin requires Traffic Server 3.0 or later\n");
-    goto error;
-  }
-
   if (argc < 2) {
     TSError("[PluginInit] Usage: %s \"name1: value1\" \"name2: value2\" ...>\n", argv[0]);
     goto error;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/append-transform/append-transform.c
----------------------------------------------------------------------
diff --git a/example/append-transform/append-transform.c b/example/append-transform/append-transform.c
index 00f0c22..31d78e6 100644
--- a/example/append-transform/append-transform.c
+++ b/example/append-transform/append-transform.c
@@ -347,32 +347,6 @@ load(const char *filename)
   return 1;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -387,11 +361,6 @@ TSPluginInit(int argc, const char *argv[])
     goto Lerror;
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    goto Lerror;
-  }
-
   if (argc != 2) {
     TSError("usage: %s <filename>\n", argv[0]);
     goto Lerror;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/basic-auth/basic-auth.c
----------------------------------------------------------------------
diff --git a/example/basic-auth/basic-auth.c b/example/basic-auth/basic-auth.c
index 7f6f4af..5b3cda0 100644
--- a/example/basic-auth/basic-auth.c
+++ b/example/basic-auth/basic-auth.c
@@ -209,32 +209,6 @@ auth_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -249,11 +223,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   /* Build translation table */
   for (i = 0, cc = 0; i < 256; i++) {
     base64_codes[i] = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/blacklist-0/blacklist-0.c
----------------------------------------------------------------------
diff --git a/example/blacklist-0/blacklist-0.c b/example/blacklist-0/blacklist-0.c
index a493277..9038b8f 100644
--- a/example/blacklist-0/blacklist-0.c
+++ b/example/blacklist-0/blacklist-0.c
@@ -146,32 +146,6 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -187,12 +161,6 @@ TSPluginInit(int argc, const char *argv[])
 
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
-
   nsites = argc - 1;
   if (nsites > 0) {
     sites = (char **) TSmalloc(sizeof(char *) * nsites);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/blacklist-1/blacklist-1.c
----------------------------------------------------------------------
diff --git a/example/blacklist-1/blacklist-1.c b/example/blacklist-1/blacklist-1.c
index f1a55a2..3b137d6 100644
--- a/example/blacklist-1/blacklist-1.c
+++ b/example/blacklist-1/blacklist-1.c
@@ -306,32 +306,6 @@ handle_txn_start(TSCont contp ATS_UNUSED, TSHttpTxn txnp)
 }
 
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -347,11 +321,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   /* create an TSTextLogObject to log blacklisted requests to */
   error = TSTextLogObjectCreate("blacklist", TS_LOG_MODE_ADD_TIMESTAMP, &log);
   if (!log || error == TS_ERROR) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/bnull-transform/bnull-transform.c
----------------------------------------------------------------------
diff --git a/example/bnull-transform/bnull-transform.c b/example/bnull-transform/bnull-transform.c
index 26cceca..03acb26 100644
--- a/example/bnull-transform/bnull-transform.c
+++ b/example/bnull-transform/bnull-transform.c
@@ -306,32 +306,6 @@ transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -347,11 +321,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     goto Lerror;
   }
 
-  if (!check_ts_version()) {
-    TSError("[bnull-transform] Plugin requires Traffic Server 3.0" " or later\n");
-    goto Lerror;
-  }
-
   /* This is call we could use if we need to protect global data */
   /* TSReleaseAssert ((mutex = TSMutexCreate()) != TS_NULL_MUTEX); */
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/file-1/file-1.c
----------------------------------------------------------------------
diff --git a/example/file-1/file-1.c b/example/file-1/file-1.c
index f7c9791..23d67d7 100644
--- a/example/file-1/file-1.c
+++ b/example/file-1/file-1.c
@@ -36,31 +36,6 @@
 #include <stdio.h>
 #include <ts/ts.h>
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -77,11 +52,6 @@ TSPluginInit(int argc, const char *argv[])
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   for (i = 1; i < argc; i++) {
     filep = TSfopen(argv[i], "r");
     if (!filep) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/hello/hello.c
----------------------------------------------------------------------
diff --git a/example/hello/hello.c b/example/hello/hello.c
index 5516274..e8906d3 100644
--- a/example/hello/hello.c
+++ b/example/hello/hello.c
@@ -26,31 +26,6 @@
 #include "ts/ts.h"
 #include "ink_defs.h"
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -64,10 +39,5 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed. \n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   TSDebug("debug-hello", "Hello World!\n");
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/null-transform/null-transform.c
----------------------------------------------------------------------
diff --git a/example/null-transform/null-transform.c b/example/null-transform/null-transform.c
index 154613f..2c23dea 100644
--- a/example/null-transform/null-transform.c
+++ b/example/null-transform/null-transform.c
@@ -306,32 +306,6 @@ transform_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -346,11 +320,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     goto Lerror;
   }
 
-  if (!check_ts_version()) {
-    TSError("[null-transform] Plugin requires Traffic Server 3.0 " "or later\n");
-    goto Lerror;
-  }
-
   TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(transform_plugin, NULL));
   return;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/output-header/output-header.c
----------------------------------------------------------------------
diff --git a/example/output-header/output-header.c b/example/output-header/output-header.c
index 8307c4e..34a7b81 100644
--- a/example/output-header/output-header.c
+++ b/example/output-header/output-header.c
@@ -148,31 +148,6 @@ hdr_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -187,12 +162,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     goto error;
   }
 
-  if (!check_ts_version()) {
-    TSError("[PluginInit] Plugin requires Traffic Server 3.0 or later\n");
-    goto error;
-  }
-
-
   TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, TSContCreate(hdr_plugin, NULL));
 
 error:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/protocol/Protocol.c
----------------------------------------------------------------------
diff --git a/example/protocol/Protocol.c b/example/protocol/Protocol.c
index 5bb786f..5d71430 100644
--- a/example/protocol/Protocol.c
+++ b/example/protocol/Protocol.c
@@ -100,32 +100,6 @@ protocol_init(int accept_port, int server_port ATS_UNUSED)
   pending_action = TSNetAccept(contp, accept_port, -1, 1);
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -140,11 +114,6 @@ TSPluginInit(int argc, const char *argv[])
     goto error;
   }
 
-  if (!check_ts_version()) {
-    TSError("[PluginInit] Plugin requires Traffic Server 3.0 or later\n");
-    goto error;
-  }
-
 
   /* default value */
   accept_port = 4666;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/redirect-1/redirect-1.c
----------------------------------------------------------------------
diff --git a/example/redirect-1/redirect-1.c b/example/redirect-1/redirect-1.c
index 6498b70..613235a 100644
--- a/example/redirect-1/redirect-1.c
+++ b/example/redirect-1/redirect-1.c
@@ -342,32 +342,6 @@ update_redirected_method_stats(TSMBuffer bufp, TSMLoc hdr_loc)
   }
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -383,11 +357,6 @@ TSPluginInit(int argc, const char *argv[])
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   if (argc == 3) {
     block_ip = TSstrdup(argv[1]);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/replace-header/replace-header.c
----------------------------------------------------------------------
diff --git a/example/replace-header/replace-header.c b/example/replace-header/replace-header.c
index 0b7c7df..d4bc31b 100644
--- a/example/replace-header/replace-header.c
+++ b/example/replace-header/replace-header.c
@@ -93,32 +93,6 @@ replace_header_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -132,10 +106,5 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed. \n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(replace_header_plugin, NULL));
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/response-header-1/response-header-1.c
----------------------------------------------------------------------
diff --git a/example/response-header-1/response-header-1.c b/example/response-header-1/response-header-1.c
index 73aff35..68c1d11 100644
--- a/example/response-header-1/response-header-1.c
+++ b/example/response-header-1/response-header-1.c
@@ -232,32 +232,6 @@ modify_response_header_plugin(TSCont contp ATS_UNUSED, TSEvent event,
void *edat
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -273,11 +247,6 @@ TSPluginInit(int argc, const char *argv[])
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   init_buffer_status = 0;
   if (argc > 1) {
     TSError("usage: %s \n", argv[0]);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/server-transform/server-transform.c
----------------------------------------------------------------------
diff --git a/example/server-transform/server-transform.c b/example/server-transform/server-transform.c
index 930d3b8..4a2df81 100644
--- a/example/server-transform/server-transform.c
+++ b/example/server-transform/server-transform.c
@@ -635,32 +635,6 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Since this is an TS-SDK 2.0 plugin, we need at
-       least Traffic Server 2.0 to run */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
 {
@@ -675,11 +649,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   /* connect to the echo port on localhost */
   server_ip = (127 << 24) | (0 << 16) | (0 << 8) | (1);
   server_ip = htonl(server_ip);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/session-1/session-1.c
----------------------------------------------------------------------
diff --git a/example/session-1/session-1.c b/example/session-1/session-1.c
index 7fbd6e0..8547649 100644
--- a/example/session-1/session-1.c
+++ b/example/session-1/session-1.c
@@ -87,32 +87,6 @@ ssn_handler(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
-
 void
 TSPluginInit(int argc, const char *argv[])
 {
@@ -128,11 +102,6 @@ TSPluginInit(int argc, const char *argv[])
     goto error;
   }
 
-  if (!check_ts_version()) {
-    TSError("[PluginInit] Plugin requires Traffic Server 3.0 or later\n");
-    goto error;
-  }
-
   transaction_count = INKStatCreate("transaction.count", INKSTAT_TYPE_INT64);
   session_count = INKStatCreate("session.count", INKSTAT_TYPE_INT64);
   av_transaction = INKStatCreate("avg.transactions", INKSTAT_TYPE_FLOAT);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/thread-1/thread-1.c
----------------------------------------------------------------------
diff --git a/example/thread-1/thread-1.c b/example/thread-1/thread-1.c
index d5ec2cb..5af7531 100644
--- a/example/thread-1/thread-1.c
+++ b/example/thread-1/thread-1.c
@@ -64,31 +64,6 @@ thread_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
   return 0;
 }
 
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-
-  }
-
-  return result;
-}
 
 void
 TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
@@ -103,10 +78,5 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, TSContCreate(thread_plugin, NULL));
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5b8b9685/example/thread-pool/psi.c
----------------------------------------------------------------------
diff --git a/example/thread-pool/psi.c b/example/thread-pool/psi.c
index 5a121db..fb84a4a 100644
--- a/example/thread-pool/psi.c
+++ b/example/thread-pool/psi.c
@@ -986,42 +986,6 @@ read_response_handler(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
 
 
 /*-------------------------------------------------------------------------
-  check_ts_version
-  Make sure TS version is at least 2.0
-
-  Input:
-  Output :
-  Return Value:
-    0  if error
-    1  if success
-  -------------------------------------------------------------------------*/
-int
-check_ts_version()
-{
-
-  const char *ts_version = TSTrafficServerVersionGet();
-  int result = 0;
-
-  if (ts_version) {
-    int major_ts_version = 0;
-    int minor_ts_version = 0;
-    int patch_ts_version = 0;
-
-    if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version)
!= 3) {
-      return 0;
-    }
-
-    /* Need at least TS 2.0 */
-    if (major_ts_version >= 2) {
-      result = 1;
-    }
-  }
-
-  return result;
-}
-
-
-/*-------------------------------------------------------------------------
   TSPluginInit
   Function called at plugin init time
 
@@ -1046,11 +1010,6 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("Plugin registration failed.\n");
   }
 
-  if (!check_ts_version()) {
-    TSError("Plugin requires Traffic Server 3.0 or later\n");
-    return;
-  }
-
   /* Initialize the psi directory = <plugin_path>/include */
   sprintf(psi_directory, "%s/%s", TSPluginDirGet(), PSI_PATH);
 


Mime
View raw message