You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/04/20 21:20:18 UTC

[01/50] [abbrv] git commit: Fix some more compiler warnings for build errors

Repository: trafficserver
Updated Branches:
  refs/heads/lua_config 5f436dfe2 -> ea5fb9f6f
  refs/heads/master 634ba7575 -> 4f2dc70f0


Fix some more compiler warnings for build errors


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

Branch: refs/heads/lua_config
Commit: b7172b49f955f2c41f8427ce3196b98f586df5b4
Parents: f7c688d
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Mar 13 11:02:06 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Mar 13 11:06:32 2014 -0600

----------------------------------------------------------------------
 lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc | 6 +++---
 lib/atscppapi/examples/intercept/intercept.cc             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b7172b49/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
index 6b7533c..0535786 100644
--- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
+++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
@@ -52,7 +52,7 @@ public:
     registerHook(HOOK_SEND_REQUEST_HEADERS);
   }
 
-  void handleSendRequestHeaders(Transaction &transaction) {
+  void handleSendRequestHeaders(Transaction & /*transaction ATS_UNUSED */) {
     Async::execute<AsyncHttpFetch>(this, new AsyncHttpFetch("http://127.0.0.1/"), getMutex());
     ++num_fetches_pending_;
     AsyncHttpFetch *post_request = new AsyncHttpFetch("http://127.0.0.1/post", "data");
@@ -90,7 +90,7 @@ public:
     Async::execute<AsyncHttpFetch3>(this, new AsyncHttpFetch3("http://127.0.0.1/", HTTP_METHOD_POST), getMutex());
   }
 
-  void handleAsyncComplete(AsyncHttpFetch3 &async_http_fetch) {
+  void handleAsyncComplete(AsyncHttpFetch3 & /* async_http_fetch ATS_UNUSED */) {
     assert(!"AsyncHttpFetch3 shouldn't have completed!");
   }
 
@@ -112,7 +112,7 @@ private:
       const void *body;
       size_t body_size;
       async_http_fetch.getResponseBody(body, body_size);
-      TS_DEBUG(TAG, "Response body is [%.*s]", static_cast<int>(body_size), body);
+      TS_DEBUG(TAG, "Response body is [%.*s]", static_cast<int>(body_size), static_cast<const char*>(body));
     } else {
       TS_ERROR(TAG, "Fetch did not complete successfully; Result %d",
                static_cast<int>(async_http_fetch.getResult()));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b7172b49/lib/atscppapi/examples/intercept/intercept.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/intercept/intercept.cc b/lib/atscppapi/examples/intercept/intercept.cc
index 4c98782..54133dd 100644
--- a/lib/atscppapi/examples/intercept/intercept.cc
+++ b/lib/atscppapi/examples/intercept/intercept.cc
@@ -29,7 +29,7 @@ public:
   }
 };
 
-void TSPluginInit(int argc, const char *argv[]) {
+void TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ []) {
   new InterceptInstaller();
 }
 


[27/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: 283e66cbe02953bb6f1850e71dcf94764a7cc770
Parents: 395f14b
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:58:04 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:58:04 2014 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/283e66cb/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 5de3a18..ba51186 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2651] atscppapi: race conditions in destruction of async providers
+ 
   *) [TS-2646] regex_remap: Add a new option, @caseless.
 
   *) [TS-2647] atscppapi: Bug fixes in headers and atscppapi


[26/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: 395f14b4ceaebc2d60aef924c9f1933e6fb405fd
Parents: ce43725
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:57:42 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:57:42 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/include/utils_internal.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/395f14b4/lib/atscppapi/src/include/utils_internal.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/utils_internal.h b/lib/atscppapi/src/include/utils_internal.h
index edc02c2..7cef956 100644
--- a/lib/atscppapi/src/include/utils_internal.h
+++ b/lib/atscppapi/src/include/utils_internal.h
@@ -83,10 +83,13 @@ public:
   }
 
   static void dispatchInterceptEvent(InterceptPlugin *plugin, TSEvent event, void *edata) {
-    ScopedSharedMutexLock scopedSharedMutexLock(plugin->getMutex());
     plugin->handleEvent(static_cast<int>(event), edata);
   }
 
+  static void deleteAsyncHttpFetch(AsyncHttpFetch *fetch) {
+    delete fetch;
+  }
+
 }; /* internal */
 
 } /* utils */


[33/50] [abbrv] git commit: Update CHANGES with TS-2431

Posted by zw...@apache.org.
Update CHANGES with TS-2431


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

Branch: refs/heads/lua_config
Commit: 829be64b45def63677c7d2320b3cf5f2a0a5e915
Parents: 79dd503
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Mar 24 14:36:55 2014 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Mon Mar 24 14:36:55 2014 +0800

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/829be64b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 72526cd..c6d664f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
   
+  *) [TS-2431] Migrate Taobao SPDY plugin to ATS core.
+
   *) [TS-2651] atscppapi: race conditions in destruction of async providers
  
   *) [TS-2646] regex_remap: Add a new option, @caseless.


[06/50] [abbrv] git commit: Update CHANGES with TS-1062/TS-2610/TS-2612/TS-2630

Posted by zw...@apache.org.
Update CHANGES with TS-1062/TS-2610/TS-2612/TS-2630


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

Branch: refs/heads/lua_config
Commit: 575469618a2855b8b9bbeef020eefe7472494c0d
Parents: 175dbca
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Fri Mar 14 19:51:47 2014 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Fri Mar 14 19:51:47 2014 +0800

----------------------------------------------------------------------
 CHANGES | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/57546961/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0ff0580..7ee10c5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,14 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2630] Add lib/ts/apidefs.h to place common types.
+
+  *) [TS-2610] Add "client_protocol_stack"(%<cps>) field into LogFormat.
+
+  *) [TS-2612] Indroduce TSHttpConnectWithProtoStack() API.
+
+  *) [TS-1062] Extends and optimizes FetchSM.
+
   *) [TS-2631] Header_rewrite should support changing destination in non-remap
    case.
 


[21/50] [abbrv] git commit: Avoid compiler warnings with newer clang

Posted by zw...@apache.org.
Avoid compiler warnings with newer clang


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

Branch: refs/heads/lua_config
Commit: b749034af325f26daad91fcefd47f2d5916a4773
Parents: 0838331
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 19 13:33:07 2014 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Mar 19 13:33:07 2014 -0700

----------------------------------------------------------------------
 proxy/http/HttpSM.cc | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b749034a/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 02ea660..b314bc9 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -88,11 +88,8 @@ static uint32_t val[MAX_SCATTER_LEN];
 static uint16_t to[MAX_SCATTER_LEN];
 static int scat_count = 0;
 
-static const char bound[] = "RANGE_SEPARATOR";
-static char const cont_type[] = "Content-type: ";
-static char const cont_range[] = "Content-range: bytes ";
-static const int sub_header_size = sizeof(cont_type) - 1 + 2 + sizeof(cont_range) - 1 + 4;
-static const int boundary_size = 2 + sizeof(bound) - 1 + 2;
+static const int sub_header_size = sizeof("Content-type: ") - 1 + 2 + sizeof("Content-range: bytes ") - 1 + 4;
+static const int boundary_size = 2 + sizeof("RANGE_SEPARATOR") - 1 + 2;
 
 /**
  * Takes two milestones and returns the difference.


[08/50] [abbrv] git commit: TS-2637: add traffic_line records match option

Posted by zw...@apache.org.
TS-2637: add traffic_line records match option

Add the -m option to traffic_line. This matches the given regular
expression against all the records, allowing users to discover new
statistics and configuration options.


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

Branch: refs/heads/lua_config
Commit: 0389be399cf888679b75a569345f4ff8e03569e3
Parents: 5754696
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 12 15:32:04 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Mar 14 11:50:07 2014 -0700

----------------------------------------------------------------------
 CHANGES                                    |    2 +
 cmd/traffic_line/traffic_line.cc           |   43 +
 doc/reference/commands/traffic_line.en.rst | 1482 ++++++++++++-----------
 mgmt/api/CoreAPI.cc                        |    9 +
 mgmt/api/CoreAPI.h                         |    1 +
 mgmt/api/CoreAPIRemote.cc                  |  111 +-
 mgmt/api/INKMgmtAPI.cc                     |    9 +
 mgmt/api/NetworkUtilsDefs.h                |    1 +
 mgmt/api/NetworkUtilsLocal.cc              |   30 +-
 mgmt/api/NetworkUtilsLocal.h               |    2 +-
 mgmt/api/NetworkUtilsRemote.cc             |  128 +-
 mgmt/api/NetworkUtilsRemote.h              |    5 +-
 mgmt/api/TSControlMain.cc                  |  217 ++--
 mgmt/api/TSControlMain.h                   |    3 +-
 mgmt/api/include/mgmtapi.h                 |    6 +
 15 files changed, 1138 insertions(+), 911 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7ee10c5..1afbde4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2637] Add traffic_line records match option.
+
   *) [TS-2630] Add lib/ts/apidefs.h to place common types.
 
   *) [TS-2610] Add "client_protocol_stack"(%<cps>) field into LogFormat.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/cmd/traffic_line/traffic_line.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_line/traffic_line.cc b/cmd/traffic_line/traffic_line.cc
index 7169ce9..65df8db 100644
--- a/cmd/traffic_line/traffic_line.cc
+++ b/cmd/traffic_line/traffic_line.cc
@@ -32,6 +32,7 @@
 static const char *programName;
 
 static char ReadVar[1024];
+static char MatchVar[1024];
 static char SetVar[1024];
 static char VarValue[1024];
 static int ReRead;
@@ -205,6 +206,46 @@ handleArgInvocation()
       TSRecordEleDestroy(rec_ele);
       return err;
     }
+  } else if (*MatchVar != '\0') {        // Handle a value read
+    if (*SetVar != '\0' || *VarValue != '\0') {
+      fprintf(stderr, "%s: Invalid Argument Combination: Can not read and set values at the same time\n", programName);
+      return TS_ERR_FAIL;
+    } else {
+      TSError err;
+      TSList list = TSListCreate();
+
+      if ((err = TSRecordGetMatchMlt(MatchVar, list)) != TS_ERR_OKAY) {
+        fprintf(stderr, "%s: %s\n", programName, TSGetErrorMessage(err));
+      }
+
+      // If the RPC call failed, the list will be empty, so we won't print anything. Otherwise,
+      // print all the results, freeing them as we go.
+      for (TSRecordEle * rec_ele = (TSRecordEle *) TSListDequeue(list); rec_ele;
+          rec_ele = (TSRecordEle *) TSListDequeue(list)) {
+        switch (rec_ele->rec_type) {
+        case TS_REC_INT:
+          printf("%s %" PRId64 "\n", rec_ele->rec_name, rec_ele->int_val);
+          break;
+        case TS_REC_COUNTER:
+          printf("%s %" PRId64 "\n", rec_ele->rec_name, rec_ele->counter_val);
+          break;
+        case TS_REC_FLOAT:
+          printf("%s %f\n", rec_ele->rec_name, rec_ele->float_val);
+          break;
+        case TS_REC_STRING:
+          printf("%s %s\n", rec_ele->rec_name, rec_ele->string_val);
+          break;
+        default:
+          // just skip it ...
+          break;
+        }
+
+        TSRecordEleDestroy(rec_ele);
+      }
+
+      TSListDestroy(list);
+      return err;
+    }
   } else if (*SetVar != '\0') { // Setting a variable
     if (*VarValue == '\0') {
       fprintf(stderr, "%s: Set requires a -v argument\n", programName);
@@ -254,6 +295,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
   programName = argv[0];
 
   ReadVar[0] = '\0';
+  MatchVar[0] = '\0';
   SetVar[0] = '\0';
   VarValue[0] = '\0';
   ReRead = 0;
@@ -282,6 +324,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
   ArgumentDescription argument_descriptions[] = {
     {"query_deadhosts", 'q', "Query congested sites", "F", &QueryDeadhosts, NULL, NULL},
     {"read_var", 'r', "Read Variable", "S1024", &ReadVar, NULL, NULL},
+    {"match_var", 'm', "Match Variable", "S1024", &MatchVar, NULL, NULL},
     {"set_var", 's', "Set Variable (requires -v option)", "S1024", &SetVar, NULL, NULL},
     {"value", 'v', "Set Value (used with -s option)", "S1024", &VarValue, NULL, NULL},
     {"help", 'h', "Help", NULL, NULL, NULL, usage},

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/doc/reference/commands/traffic_line.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/commands/traffic_line.en.rst b/doc/reference/commands/traffic_line.en.rst
index 70cfdd5..b99be29 100644
--- a/doc/reference/commands/traffic_line.en.rst
+++ b/doc/reference/commands/traffic_line.en.rst
@@ -71,6 +71,11 @@ Options
     Restart the :program:`traffic_manager` process and the
     :program:`traffic_server` process on all the nodes in a cluster.
 
+.. option:: -m REGEX, --match_var REGEX
+
+    Display the current values of all performance statistics or configuration
+    variables whose names match the given regular expression.
+
 .. option:: -r VAR, --read_var VAR
 
     Display specific performance statistics or a current configuration
@@ -144,677 +149,766 @@ Performance Statistics
 
 The :option:`traffic_line -r` option accepts the following variable names::
 
-    proxy.node.num_processes
-    proxy.node.hostname_FQ
-    proxy.node.hostname
-    proxy.node.restarts.manager.start_time
-    proxy.node.restarts.proxy.start_time
-    proxy.node.restarts.proxy.stop_time
-    proxy.node.restarts.proxy.restart_count
-    proxy.node.version.manager.short
-    proxy.node.version.manager.long
-    proxy.node.version.manager.build_number
-    proxy.node.version.manager.build_time
-    proxy.node.version.manager.build_date
-    proxy.node.version.manager.build_machine
-    proxy.node.version.manager.build_person
-    proxy.node.bandwidth_hit_ratio
-    proxy.node.bandwidth_hit_ratio_int_pct
-    proxy.node.hostdb.hit_ratio
-    proxy.node.hostdb.hit_ratio_int_pct
-    proxy.node.proxy_running
-    proxy.node.cache.percent_free
-    proxy.node.cache_hit_ratio
-    proxy.node.cache_hit_ratio_int_pct
-    proxy.node.cache_hit_ratio_avg_10s_int_pct
-    proxy.node.bandwidth_hit_ratio_avg_10s_int_pct
-    proxy.node.bandwidth_hit_ratio_avg_10s
-    proxy.node.http.cache_hit_fresh_avg_10s
-    proxy.node.http.cache_hit_revalidated_avg_10s
-    proxy.node.http.cache_hit_ims_avg_10s
-    proxy.node.http.cache_hit_stale_served_avg_10s
-    proxy.node.http.cache_miss_cold_avg_10s
-    proxy.node.http.cache_miss_changed_avg_10s
-    proxy.node.http.cache_miss_not_cacheable_avg_10s
-    proxy.node.http.cache_miss_client_no_cache_avg_10s
-    proxy.node.http.cache_miss_ims_avg_10s
-    proxy.node.http.cache_read_error_avg_10s
-    proxy.node.cache_total_hits_avg_10s
-    proxy.node.cache_total_misses_avg_10s
-    proxy.node.cache_hit_ratio_avg_10s
-    proxy.node.hostdb.total_lookups_avg_10s
-    proxy.node.hostdb.total_hits_avg_10s
-    proxy.node.hostdb.hit_ratio_avg_10s
-    proxy.node.http.transaction_counts_avg_10s.hit_fresh
-    proxy.node.http.transaction_counts_avg_10s.hit_revalidated
-    proxy.node.http.transaction_counts_avg_10s.miss_cold
-    proxy.node.http.transaction_counts_avg_10s.miss_not_cacheable
-    proxy.node.http.transaction_counts_avg_10s.miss_changed
-    proxy.node.http.transaction_counts_avg_10s.miss_client_no_cache
-    proxy.node.http.transaction_counts_avg_10s.errors.connect_failed
-    proxy.node.http.transaction_counts_avg_10s.errors.aborts
-    proxy.node.http.transaction_counts_avg_10s.errors.possible_aborts
-    proxy.node.http.transaction_counts_avg_10s.errors.pre_accept_hangups
-    proxy.node.http.transaction_counts_avg_10s.errors.early_hangups
-    proxy.node.http.transaction_counts_avg_10s.errors.empty_hangups
-    proxy.node.http.transaction_counts_avg_10s.errors.other
-    proxy.node.http.transaction_counts_avg_10s.other.unclassified
-    proxy.node.http.transaction_frac_avg_10s.hit_fresh
-    proxy.node.http.transaction_frac_avg_10s.hit_revalidated
-    proxy.node.http.transaction_frac_avg_10s.miss_cold
-    proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable
-    proxy.node.http.transaction_frac_avg_10s.miss_changed
-    proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache
-    proxy.node.http.transaction_frac_avg_10s.errors.connect_failed
-    proxy.node.http.transaction_frac_avg_10s.errors.aborts
-    proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts
-    proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups
-    proxy.node.http.transaction_frac_avg_10s.errors.early_hangups
-    proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups
-    proxy.node.http.transaction_frac_avg_10s.errors.other
-    proxy.node.http.transaction_frac_avg_10s.other.unclassified
-    proxy.node.http.transaction_frac_avg_10s.hit_fresh_int_pct
-    proxy.node.http.transaction_frac_avg_10s.hit_revalidated_int_pct
-    proxy.node.http.transaction_frac_avg_10s.miss_cold_int_pct
-    proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable_int_pct
-    proxy.node.http.transaction_frac_avg_10s.miss_changed_int_pct
-    proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.connect_failed_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.aborts_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.early_hangups_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups_int_pct
-    proxy.node.http.transaction_frac_avg_10s.errors.other_int_pct
-    proxy.node.http.transaction_frac_avg_10s.other.unclassified_int_pct
-    proxy.node.http.transaction_msec_avg_10s.hit_fresh
-    proxy.node.http.transaction_msec_avg_10s.hit_revalidated
-    proxy.node.http.transaction_msec_avg_10s.miss_cold
-    proxy.node.http.transaction_msec_avg_10s.miss_not_cacheable
-    proxy.node.http.transaction_msec_avg_10s.miss_changed
-    proxy.node.http.transaction_msec_avg_10s.miss_client_no_cache
-    proxy.node.http.transaction_msec_avg_10s.errors.connect_failed
-    proxy.node.http.transaction_msec_avg_10s.errors.aborts
-    proxy.node.http.transaction_msec_avg_10s.errors.possible_aborts
-    proxy.node.http.transaction_msec_avg_10s.errors.pre_accept_hangups
-    proxy.node.http.transaction_msec_avg_10s.errors.early_hangups
-    proxy.node.http.transaction_msec_avg_10s.errors.empty_hangups
-    proxy.node.http.transaction_msec_avg_10s.errors.other
-    proxy.node.http.transaction_msec_avg_10s.other.unclassified
-    proxy.node.http.throughput
-    proxy.node.http.user_agent_xacts_per_second
-    proxy.node.http.user_agent_current_connections_count
-    proxy.node.http.user_agent_total_request_bytes
-    proxy.node.http.user_agent_total_response_bytes
-    proxy.node.http.user_agents_total_transactions_count
-    proxy.node.http.user_agents_total_documents_served
-    proxy.node.http.origin_server_current_connections_count
-    proxy.node.http.origin_server_total_request_bytes
-    proxy.node.http.origin_server_total_response_bytes
-    proxy.node.http.parent_proxy_total_request_bytes
-    proxy.node.http.parent_proxy_total_response_bytes
-    proxy.node.http.origin_server_total_transactions_count
-    proxy.node.http.cache_current_connections_count
-    proxy.node.http.current_parent_proxy_connections
-    proxy.node.cache.contents.num_docs
-    proxy.node.cache.bytes_total
-    proxy.node.cache.bytes_total_mb
-    proxy.node.cache.bytes_free
-    proxy.node.cache.bytes_free_mb
-    proxy.node.cache.percent_free_int_pct
-    proxy.node.cache_total_hits
-    proxy.node.cache_total_misses
-    proxy.node.current_cache_connections
-    proxy.node.dns.lookups_per_second
-    proxy.node.dns.lookup_avg_time_ms
-    proxy.node.dns.total_dns_lookups
-    proxy.node.hostdb.total_lookups
-    proxy.node.hostdb.total_hits
-    proxy.node.cluster.nodes
-    proxy.node.client_throughput_out
-    proxy.node.client_throughput_out_kbit
-    proxy.node.current_client_connections
-    proxy.node.current_server_connections
-    proxy.node.user_agent_total_bytes
-    proxy.node.origin_server_total_bytes
-    proxy.node.user_agent_total_bytes_avg_10s
-    proxy.node.origin_server_total_bytes_avg_10s
-    proxy.node.user_agent_xacts_per_second
-    proxy.node.user_agents_total_documents_served
-    proxy.cluster.user_agent_total_bytes_avg_10s
-    proxy.cluster.origin_server_total_bytes_avg_10s
-    proxy.cluster.bandwidth_hit_ratio
-    proxy.cluster.bandwidth_hit_ratio_int_pct
-    proxy.cluster.bandwidth_hit_ratio_avg_10s
-    proxy.cluster.http.throughput
-    proxy.cluster.http.user_agent_xacts_per_second
-    proxy.cluster.http.user_agent_current_connections_count
-    proxy.cluster.http.user_agent_total_request_bytes
-    proxy.cluster.http.user_agent_total_response_bytes
-    proxy.cluster.http.user_agents_total_transactions_count
-    proxy.cluster.http.user_agents_total_documents_served
-    proxy.cluster.http.origin_server_current_connections_count
-    proxy.cluster.http.origin_server_total_request_bytes
-    proxy.cluster.http.origin_server_total_response_bytes
-    proxy.cluster.http.origin_server_total_transactions_count
-    proxy.cluster.http.cache_current_connections_count
-    proxy.cluster.http.current_parent_proxy_connections
-    proxy.cluster.http.parent_proxy_total_request_bytes
-    proxy.cluster.http.parent_proxy_total_response_bytes
-    proxy.cluster.cache.contents.num_docs
-    proxy.cluster.cache.bytes_free
-    proxy.cluster.cache.bytes_free_mb
-    proxy.cluster.cache.percent_free
-    proxy.cluster.cache.percent_free_int_pct
-    proxy.cluster.cache_hit_ratio
-    proxy.cluster.cache_hit_ratio_int_pct
-    proxy.cluster.cache_total_hits
-    proxy.cluster.cache_total_misses
-    proxy.cluster.current_cache_connections
-    proxy.cluster.cache_total_hits_avg_10s
-    proxy.cluster.cache_total_misses_avg_10s
-    proxy.cluster.cache_hit_ratio_avg_10s
-    proxy.cluster.dns.lookups_per_second
-    proxy.cluster.dns.total_dns_lookups
-    proxy.cluster.hostdb.hit_ratio
-    proxy.cluster.hostdb.hit_ratio_int_pct
-    proxy.cluster.hostdb.total_lookups_avg_10s
-    proxy.cluster.hostdb.total_hits_avg_10s
-    proxy.cluster.hostdb.hit_ratio_avg_10s
-    proxy.cluster.user_agent_xacts_per_second
-    proxy.cluster.client_throughput_out
-    proxy.cluster.client_throughput_out_kbit
-    proxy.cluster.current_client_connections
-    proxy.cluster.current_server_connections
-    proxy.process.version.server.short
-    proxy.process.version.server.long
-    proxy.process.version.server.build_number
-    proxy.process.version.server.build_time
-    proxy.process.version.server.build_date
-    proxy.process.version.server.build_machine
-    proxy.process.version.server.build_person
-    proxy.process.net.net_handler_run
-    proxy.process.net.read_bytes
-    proxy.process.net.write_bytes
-    proxy.process.net.calls_to_readfromnet
-    proxy.process.net.calls_to_readfromnet_afterpoll
-    proxy.process.net.calls_to_read
-    proxy.process.net.calls_to_read_nodata
-    proxy.process.net.calls_to_writetonet
-    proxy.process.net.calls_to_writetonet_afterpoll
-    proxy.process.net.calls_to_write
-    proxy.process.net.calls_to_write_nodata
-    proxy.process.socks.connections_successful
-    proxy.process.socks.connections_unsuccessful
-    proxy.process.cache.read_per_sec
-    proxy.process.cache.write_per_sec
-    proxy.process.cache.KB_read_per_sec
-    proxy.process.cache.KB_write_per_sec
-    proxy.process.cache.ram_cache.total_bytes
-    proxy.process.hostdb.total_entries
-    proxy.process.hostdb.total_lookups
-    proxy.process.hostdb.ttl
-    proxy.process.hostdb.ttl_expires
-    proxy.process.hostdb.re_dns_on_reload
-    proxy.process.hostdb.bytes
-    proxy.process.dns.total_dns_lookups
-    proxy.process.dns.lookup_avg_time
-    proxy.process.dns.lookup_successes
-    proxy.process.dns.fail_avg_time
-    proxy.process.dns.lookup_failures
-    proxy.process.dns.retries
-    proxy.process.dns.max_retries_exceeded
-    proxy.process.log.bytes_buffered
-    proxy.process.log.bytes_written_to_disk
-    proxy.process.log.bytes_sent_to_network
-    proxy.process.log.bytes_received_from_network
-    proxy.process.log.event_log_error
-    proxy.process.log.event_log_access
-    proxy.process.log.event_log_access_fail
-    proxy.process.log.event_log_access_skip
-    proxy.process.cache.volume_0.ram_cache.total_bytes
-    proxy.process.http.completed_requests
-    proxy.process.http.total_incoming_connections
-    proxy.process.http.total_client_connections
-    proxy.process.http.total_client_connections_ipv4
-    proxy.process.http.total_client_connections_ipv6
-    proxy.process.http.total_server_connections
-    proxy.process.http.total_parent_proxy_connections
-    proxy.process.http.avg_transactions_per_client_connection
-    proxy.process.http.avg_transactions_per_server_connection
-    proxy.process.http.avg_transactions_per_parent_connection
-    proxy.process.http.client_connection_time
-    proxy.process.http.parent_proxy_connection_time
-    proxy.process.http.server_connection_time
-    proxy.process.http.cache_connection_time
-    proxy.process.http.transaction_counts.errors.pre_accept_hangups
-    proxy.process.http.transaction_totaltime.errors.pre_accept_hangups
-    proxy.process.http.transaction_counts.errors.empty_hangups
-    proxy.process.http.transaction_totaltime.errors.empty_hangups
-    proxy.process.http.transaction_counts.errors.early_hangups
-    proxy.process.http.transaction_totaltime.errors.early_hangups
-    proxy.process.http.incoming_requests
-    proxy.process.http.outgoing_requests
-    proxy.process.http.incoming_responses
-    proxy.process.http.invalid_client_requests
-    proxy.process.http.missing_host_hdr
-    proxy.process.http.get_requests
-    proxy.process.http.head_requests
-    proxy.process.http.trace_requests
-    proxy.process.http.options_requests
-    proxy.process.http.post_requests
-    proxy.process.http.put_requests
-    proxy.process.http.push_requests
-    proxy.process.http.delete_requests
-    proxy.process.http.purge_requests
-    proxy.process.http.connect_requests
-    proxy.process.http.extension_method_requests
-    proxy.process.http.client_no_cache_requests
-    proxy.process.http.broken_server_connections
-    proxy.process.http.cache_lookups
-    proxy.process.http.cache_writes
-    proxy.process.http.cache_updates
-    proxy.process.http.cache_deletes
-    proxy.process.http.tunnels
-    proxy.process.http.throttled_proxy_only
-    proxy.process.http.request_taxonomy.i0_n0_m0
-    proxy.process.http.request_taxonomy.i1_n0_m0
-    proxy.process.http.request_taxonomy.i0_n1_m0
-    proxy.process.http.request_taxonomy.i1_n1_m0
-    proxy.process.http.request_taxonomy.i0_n0_m1
-    proxy.process.http.request_taxonomy.i1_n0_m1
-    proxy.process.http.request_taxonomy.i0_n1_m1
-    proxy.process.http.request_taxonomy.i1_n1_m1
-    proxy.process.http.icp_suggested_lookups
-    proxy.process.http.client_transaction_time
-    proxy.process.http.client_write_time
-    proxy.process.http.server_read_time
-    proxy.process.http.icp_transaction_time
-    proxy.process.http.icp_raw_transaction_time
-    proxy.process.http.parent_proxy_transaction_time
-    proxy.process.http.parent_proxy_raw_transaction_time
-    proxy.process.http.server_transaction_time
-    proxy.process.http.server_raw_transaction_time
-    proxy.process.http.user_agent_request_header_total_size
-    proxy.process.http.user_agent_response_header_total_size
-    proxy.process.http.user_agent_request_document_total_size
-    proxy.process.http.user_agent_response_document_total_size
-    proxy.process.http.origin_server_request_header_total_size
-    proxy.process.http.origin_server_response_header_total_size
-    proxy.process.http.origin_server_request_document_total_size
-    proxy.process.http.origin_server_response_document_total_size
-    proxy.process.http.parent_proxy_request_total_bytes
-    proxy.process.http.parent_proxy_response_total_bytes
-    proxy.process.http.pushed_response_header_total_size
-    proxy.process.http.pushed_document_total_size
-    proxy.process.http.response_document_size_100
-    proxy.process.http.response_document_size_1K
-    proxy.process.http.response_document_size_3K
-    proxy.process.http.response_document_size_5K
-    proxy.process.http.response_document_size_10K
-    proxy.process.http.response_document_size_1M
-    proxy.process.http.response_document_size_inf
-    proxy.process.http.request_document_size_100
-    proxy.process.http.request_document_size_1K
-    proxy.process.http.request_document_size_3K
-    proxy.process.http.request_document_size_5K
-    proxy.process.http.request_document_size_10K
-    proxy.process.http.request_document_size_1M
-    proxy.process.http.request_document_size_inf
-    proxy.process.http.user_agent_speed_bytes_per_sec_100
-    proxy.process.http.user_agent_speed_bytes_per_sec_1K
-    proxy.process.http.user_agent_speed_bytes_per_sec_10K
-    proxy.process.http.user_agent_speed_bytes_per_sec_100K
-    proxy.process.http.user_agent_speed_bytes_per_sec_1M
-    proxy.process.http.user_agent_speed_bytes_per_sec_10M
-    proxy.process.http.user_agent_speed_bytes_per_sec_100M
-    proxy.process.http.origin_server_speed_bytes_per_sec_100
-    proxy.process.http.origin_server_speed_bytes_per_sec_1K
-    proxy.process.http.origin_server_speed_bytes_per_sec_10K
-    proxy.process.http.origin_server_speed_bytes_per_sec_100K
-    proxy.process.http.origin_server_speed_bytes_per_sec_1M
-    proxy.process.http.origin_server_speed_bytes_per_sec_10M
-    proxy.process.http.origin_server_speed_bytes_per_sec_100M
-    proxy.process.http.total_transactions_time
-    proxy.process.http.total_transactions_think_time
-    proxy.process.http.cache_hit_fresh
-    proxy.process.http.cache_hit_revalidated
-    proxy.process.http.cache_hit_ims
-    proxy.process.http.cache_hit_stale_served
-    proxy.process.http.cache_miss_cold
-    proxy.process.http.cache_miss_changed
-    proxy.process.http.cache_miss_client_no_cache
-    proxy.process.http.cache_miss_client_not_cacheable
-    proxy.process.http.cache_miss_ims
-    proxy.process.http.cache_read_error
-    proxy.process.http.tcp_hit_count_stat
-    proxy.process.http.tcp_hit_user_agent_bytes_stat
-    proxy.process.http.tcp_hit_origin_server_bytes_stat
-    proxy.process.http.tcp_miss_count_stat
-    proxy.process.http.tcp_miss_user_agent_bytes_stat
-    proxy.process.http.tcp_miss_origin_server_bytes_stat
-    proxy.process.http.tcp_expired_miss_count_stat
-    proxy.process.http.tcp_expired_miss_user_agent_bytes_stat
-    proxy.process.http.tcp_expired_miss_origin_server_bytes_stat
-    proxy.process.http.tcp_refresh_hit_count_stat
-    proxy.process.http.tcp_refresh_hit_user_agent_bytes_stat
-    proxy.process.http.tcp_refresh_hit_origin_server_bytes_stat
-    proxy.process.http.tcp_refresh_miss_count_stat
-    proxy.process.http.tcp_refresh_miss_user_agent_bytes_stat
-    proxy.process.http.tcp_refresh_miss_origin_server_bytes_stat
-    proxy.process.http.tcp_client_refresh_count_stat
-    proxy.process.http.tcp_client_refresh_user_agent_bytes_stat
-    proxy.process.http.tcp_client_refresh_origin_server_bytes_stat
-    proxy.process.http.tcp_ims_hit_count_stat
-    proxy.process.http.tcp_ims_hit_user_agent_bytes_stat
-    proxy.process.http.tcp_ims_hit_origin_server_bytes_stat
-    proxy.process.http.tcp_ims_miss_count_stat
-    proxy.process.http.tcp_ims_miss_user_agent_bytes_stat
-    proxy.process.http.tcp_ims_miss_origin_server_bytes_stat
-    proxy.process.http.err_client_abort_count_stat
-    proxy.process.http.err_client_abort_user_agent_bytes_stat
-    proxy.process.http.err_client_abort_origin_server_bytes_stat
-    proxy.process.http.err_connect_fail_count_stat
-    proxy.process.http.err_connect_fail_user_agent_bytes_stat
-    proxy.process.http.err_connect_fail_origin_server_bytes_stat
-    proxy.process.http.misc_count_stat
-    proxy.process.http.misc_user_agent_bytes_stat
-    proxy.process.http.background_fill_bytes_aborted_stat
-    proxy.process.http.background_fill_bytes_completed_stat
-    proxy.process.http.cache_write_errors
-    proxy.process.http.cache_read_errors
-    proxy.process.http.100_responses
-    proxy.process.http.101_responses
-    proxy.process.http.1xx_responses
-    proxy.process.http.200_responses
-    proxy.process.http.201_responses
-    proxy.process.http.202_responses
-    proxy.process.http.203_responses
-    proxy.process.http.204_responses
-    proxy.process.http.205_responses
-    proxy.process.http.206_responses
-    proxy.process.http.2xx_responses
-    proxy.process.http.300_responses
-    proxy.process.http.301_responses
-    proxy.process.http.302_responses
-    proxy.process.http.303_responses
-    proxy.process.http.304_responses
-    proxy.process.http.305_responses
-    proxy.process.http.307_responses
-    proxy.process.http.3xx_responses
-    proxy.process.http.400_responses
-    proxy.process.http.401_responses
-    proxy.process.http.402_responses
-    proxy.process.http.403_responses
-    proxy.process.http.404_responses
-    proxy.process.http.405_responses
-    proxy.process.http.406_responses
-    proxy.process.http.407_responses
-    proxy.process.http.408_responses
-    proxy.process.http.409_responses
-    proxy.process.http.410_responses
-    proxy.process.http.411_responses
-    proxy.process.http.412_responses
-    proxy.process.http.413_responses
-    proxy.process.http.414_responses
-    proxy.process.http.415_responses
-    proxy.process.http.416_responses
-    proxy.process.http.4xx_responses
-    proxy.process.http.500_responses
-    proxy.process.http.501_responses
-    proxy.process.http.502_responses
-    proxy.process.http.503_responses
-    proxy.process.http.504_responses
-    proxy.process.http.505_responses
-    proxy.process.http.5xx_responses
-    proxy.process.http.transaction_counts.hit_fresh
-    proxy.process.http.transaction_totaltime.hit_fresh
-    proxy.process.http.transaction_counts.hit_fresh.process
-    proxy.process.http.transaction_totaltime.hit_fresh.process
-    proxy.process.http.transaction_counts.hit_revalidated
-    proxy.process.http.transaction_totaltime.hit_revalidated
-    proxy.process.http.transaction_counts.miss_cold
-    proxy.process.http.transaction_totaltime.miss_cold
-    proxy.process.http.transaction_counts.miss_not_cacheable
-    proxy.process.http.transaction_totaltime.miss_not_cacheable
-    proxy.process.http.transaction_counts.miss_changed
-    proxy.process.http.transaction_totaltime.miss_changed
-    proxy.process.http.transaction_counts.miss_client_no_cache
-    proxy.process.http.transaction_totaltime.miss_client_no_cache
-    proxy.process.http.transaction_counts.errors.aborts
-    proxy.process.http.transaction_totaltime.errors.aborts
-    proxy.process.http.transaction_counts.errors.possible_aborts
-    proxy.process.http.transaction_totaltime.errors.possible_aborts
-    proxy.process.http.transaction_counts.errors.connect_failed
-    proxy.process.http.transaction_totaltime.errors.connect_failed
-    proxy.process.http.transaction_counts.errors.other
-    proxy.process.http.transaction_totaltime.errors.other
-    proxy.process.http.transaction_counts.other.unclassified
-    proxy.process.http.transaction_totaltime.other.unclassified
-    proxy.process.http.total_x_redirect_count
-    proxy.process.icp.config_mgmt_callouts
-    proxy.process.icp.reconfig_polls
-    proxy.process.icp.reconfig_events
-    proxy.process.icp.invalid_poll_data
-    proxy.process.icp.no_data_read
-    proxy.process.icp.short_read
-    proxy.process.icp.invalid_sender
-    proxy.process.icp.read_not_v2_icp
-    proxy.process.icp.icp_remote_query_requests
-    proxy.process.icp.icp_remote_responses
-    proxy.process.icp.cache_lookup_success
-    proxy.process.icp.cache_lookup_fail
-    proxy.process.icp.query_response_write
-    proxy.process.icp.query_response_partial_write
-    proxy.process.icp.no_icp_request_for_response
-    proxy.process.icp.icp_response_request_nolock
-    proxy.process.icp.icp_start_icpoff
-    proxy.process.icp.send_query_partial_write
-    proxy.process.icp.icp_queries_no_expected_replies
-    proxy.process.icp.icp_query_hits
-    proxy.process.icp.icp_query_misses
-    proxy.process.icp.invalid_icp_query_response
-    proxy.process.icp.icp_query_requests
-    proxy.process.icp.total_icp_response_time
-    proxy.process.icp.total_udp_send_queries
-    proxy.process.icp.total_icp_request_time
-    proxy.process.net.connections_currently_open
-    proxy.process.net.accepts_currently_open
-    proxy.process.socks.connections_currently_open
-    proxy.process.cache.bytes_used
-    proxy.process.cache.bytes_total
-    proxy.process.cache.ram_cache.bytes_used
-    proxy.process.cache.ram_cache.hits
-    proxy.process.cache.pread_count
-    proxy.process.cache.percent_full
-    proxy.process.cache.lookup.active
-    proxy.process.cache.lookup.success
-    proxy.process.cache.lookup.failure
-    proxy.process.cache.read.active
-    proxy.process.cache.read.success
-    proxy.process.cache.read.failure
-    proxy.process.cache.write.active
-    proxy.process.cache.write.success
-    proxy.process.cache.write.failure
-    proxy.process.cache.write.backlog.failure
-    proxy.process.cache.update.active
-    proxy.process.cache.update.success
-    proxy.process.cache.update.failure
-    proxy.process.cache.remove.active
-    proxy.process.cache.remove.success
-    proxy.process.cache.remove.failure
-    proxy.process.cache.evacuate.active
-    proxy.process.cache.evacuate.success
-    proxy.process.cache.evacuate.failure
-    proxy.process.cache.scan.active
-    proxy.process.cache.scan.success
-    proxy.process.cache.scan.failure
-    proxy.process.cache.direntries.total
-    proxy.process.cache.direntries.used
-    proxy.process.cache.directory_collision
-    proxy.process.cache.frags_per_doc.1
-    proxy.process.cache.frags_per_doc.2
-    proxy.process.cache.frags_per_doc.3+
-    proxy.process.cache.read_busy.success
-    proxy.process.cache.read_busy.failure
-    proxy.process.cache.write_bytes_stat
-    proxy.process.cache.vector_marshals
-    proxy.process.cache.hdr_marshals
-    proxy.process.cache.hdr_marshal_bytes
-    proxy.process.cache.gc_bytes_evacuated
-    proxy.process.cache.gc_frags_evacuated
-    proxy.process.hostdb.total_hits
-    proxy.process.dns.success_avg_time
-    proxy.process.dns.in_flight
-    proxy.process.congestion.congested_on_conn_failures
-    proxy.process.congestion.congested_on_max_connection
-    proxy.process.cluster.connections_open
-    proxy.process.cluster.connections_opened
-    proxy.process.cluster.connections_closed
-    proxy.process.cluster.slow_ctrl_msgs_sent
-    proxy.process.cluster.connections_locked
-    proxy.process.cluster.reads
-    proxy.process.cluster.read_bytes
-    proxy.process.cluster.writes
-    proxy.process.cluster.write_bytes
-    proxy.process.cluster.control_messages_sent
-    proxy.process.cluster.control_messages_received
-    proxy.process.cluster.op_delayed_for_lock
-    proxy.process.cluster.connections_bumped
-    proxy.process.cluster.net_backup
-    proxy.process.cluster.nodes
-    proxy.process.cluster.machines_allocated
-    proxy.process.cluster.machines_freed
-    proxy.process.cluster.configuration_changes
-    proxy.process.cluster.delayed_reads
-    proxy.process.cluster.byte_bank_used
-    proxy.process.cluster.alloc_data_news
-    proxy.process.cluster.write_bb_mallocs
-    proxy.process.cluster.partial_reads
-    proxy.process.cluster.partial_writes
-    proxy.process.cluster.cache_outstanding
-    proxy.process.cluster.remote_op_timeouts
-    proxy.process.cluster.remote_op_reply_timeouts
-    proxy.process.cluster.chan_inuse
-    proxy.process.cluster.open_delays
-    proxy.process.cluster.connections_avg_time
-    proxy.process.cluster.control_messages_avg_send_time
-    proxy.process.cluster.control_messages_avg_receive_time
-    proxy.process.cluster.open_delay_time
-    proxy.process.cluster.cache_callback_time
-    proxy.process.cluster.rmt_cache_callback_time
-    proxy.process.cluster.lkrmt_cache_callback_time
-    proxy.process.cluster.local_connection_time
-    proxy.process.cluster.remote_connection_time
-    proxy.process.cluster.rdmsg_assemble_time
-    proxy.process.cluster.cluster_ping_time
-    proxy.process.cluster.cache_callbacks
-    proxy.process.cluster.rmt_cache_callbacks
-    proxy.process.cluster.lkrmt_cache_callbacks
-    proxy.process.cluster.local_connections_closed
-    proxy.process.cluster.remote_connections_closed
-    proxy.process.cluster.setdata_no_clustervc
-    proxy.process.cluster.setdata_no_tunnel
-    proxy.process.cluster.setdata_no_cachevc
-    proxy.process.cluster.setdata_no_cluster
-    proxy.process.cluster.vc_write_stall
-    proxy.process.cluster.no_remote_space
-    proxy.process.cluster.level1_bank
-    proxy.process.cluster.multilevel_bank
-    proxy.process.cluster.vc_cache_insert_lock_misses
-    proxy.process.cluster.vc_cache_inserts
-    proxy.process.cluster.vc_cache_lookup_lock_misses
-    proxy.process.cluster.vc_cache_lookup_hits
-    proxy.process.cluster.vc_cache_lookup_misses
-    proxy.process.cluster.vc_cache_scans
-    proxy.process.cluster.vc_cache_scan_lock_misses
-    proxy.process.cluster.vc_cache_purges
-    proxy.process.cluster.write_lock_misses
-    proxy.process.log.log_files_open
-    proxy.process.log.log_files_space_used
-    proxy.process.http.background_fill_current_count
-    proxy.process.http.current_client_connections
-    proxy.process.http.current_active_client_connections
-    proxy.process.http.current_client_transactions
-    proxy.process.http.current_parent_proxy_transactions
-    proxy.process.http.current_icp_transactions
-    proxy.process.http.current_server_transactions
-    proxy.process.http.current_parent_proxy_raw_transactions
-    proxy.process.http.current_icp_raw_transactions
-    proxy.process.http.current_server_raw_transactions
-    proxy.process.http.current_parent_proxy_connections
-    proxy.process.http.current_server_connections
-    proxy.process.http.current_cache_connections
-    proxy.process.update.successes
-    proxy.process.update.no_actions
-    proxy.process.update.fails
-    proxy.process.update.unknown_status
-    proxy.process.update.state_machines
-    proxy.process.cache.volume_0.bytes_used
-    proxy.process.cache.volume_0.bytes_total
-    proxy.process.cache.volume_0.ram_cache.bytes_used
-    proxy.process.cache.volume_0.ram_cache.hits
-    proxy.process.cache.volume_0.pread_count
-    proxy.process.cache.volume_0.percent_full
-    proxy.process.cache.volume_0.lookup.active
-    proxy.process.cache.volume_0.lookup.success
-    proxy.process.cache.volume_0.lookup.failure
-    proxy.process.cache.volume_0.read.active
-    proxy.process.cache.volume_0.read.success
-    proxy.process.cache.volume_0.read.failure
-    proxy.process.cache.volume_0.write.active
-    proxy.process.cache.volume_0.write.success
-    proxy.process.cache.volume_0.write.failure
-    proxy.process.cache.volume_0.write.backlog.failure
-    proxy.process.cache.volume_0.update.active
-    proxy.process.cache.volume_0.update.success
-    proxy.process.cache.volume_0.update.failure
-    proxy.process.cache.volume_0.remove.active
-    proxy.process.cache.volume_0.remove.success
-    proxy.process.cache.volume_0.remove.failure
-    proxy.process.cache.volume_0.evacuate.active
-    proxy.process.cache.volume_0.evacuate.success
-    proxy.process.cache.volume_0.evacuate.failure
-    proxy.process.cache.volume_0.scan.active
-    proxy.process.cache.volume_0.scan.success
-    proxy.process.cache.volume_0.scan.failure
-    proxy.process.cache.volume_0.direntries.total
-    proxy.process.cache.volume_0.direntries.used
-    proxy.process.cache.volume_0.directory_collision
-    proxy.process.cache.volume_0.frags_per_doc.1
-    proxy.process.cache.volume_0.frags_per_doc.2
-    proxy.process.cache.volume_0.frags_per_doc.3+
-    proxy.process.cache.volume_0.read_busy.success
-    proxy.process.cache.volume_0.read_busy.failure
-    proxy.process.cache.volume_0.write_bytes_stat
-    proxy.process.cache.volume_0.vector_marshals
-    proxy.process.cache.volume_0.hdr_marshals
-    proxy.process.cache.volume_0.hdr_marshal_bytes
-    proxy.process.cache.volume_0.gc_bytes_evacuated
-    proxy.process.cache.volume_0.gc_frags_evacuated
-    proxy.process.ssl.user_agent_other_errors
-    proxy.process.ssl.user_agent_expired_cert
-    proxy.process.ssl.user_agent_revoked_cert
-    proxy.process.ssl.user_agent_unknown_cert
-    proxy.process.ssl.user_agent_cert_verify_failed
-    proxy.process.ssl.user_agent_bad_cert
-    proxy.process.ssl.user_agent_decryption_failed
-    proxy.process.ssl.user_agent_wrong_version
-    proxy.process.ssl.user_agent_unknown_ca
-    proxy.process.ssl.origin_server_other_errors
-    proxy.process.ssl.origin_server_expired_cert
-    proxy.process.ssl.origin_server_revoked_cert
-    proxy.process.ssl.origin_server_unknown_cert
-    proxy.process.ssl.origin_server_cert_verify_failed
-    proxy.process.ssl.origin_server_bad_cert
-    proxy.process.ssl.origin_server_decryption_failed
-    proxy.process.ssl.origin_server_wrong_version
-    proxy.process.ssl.origin_server_unknown_ca
-    proxy.process.ssl.user_agent_sessions
-    proxy.process.ssl.user_agent_session_hit
-    proxy.process.ssl.user_agent_session_miss
-    proxy.process.ssl.user_agent_session_timeout
-    proxy.process.ssl.cipher.user_agent.{cipherName}
+  proxy.cluster.bandwidth_hit_ratio
+  proxy.cluster.bandwidth_hit_ratio_avg_10s
+  proxy.cluster.bandwidth_hit_ratio_int_pct
+  proxy.cluster.cache.bytes_free
+  proxy.cluster.cache.bytes_free_mb
+  proxy.cluster.cache.contents.num_docs
+  proxy.cluster.cache.percent_free
+  proxy.cluster.cache.percent_free_int_pct
+  proxy.cluster.cache_hit_mem_ratio
+  proxy.cluster.cache_hit_mem_ratio_avg_10s
+  proxy.cluster.cache_hit_mem_ratio_int_pct
+  proxy.cluster.cache_hit_ratio
+  proxy.cluster.cache_hit_ratio_avg_10s
+  proxy.cluster.cache_hit_ratio_int_pct
+  proxy.cluster.cache_total_hits
+  proxy.cluster.cache_total_hits_avg_10s
+  proxy.cluster.cache_total_hits_mem
+  proxy.cluster.cache_total_hits_mem_avg_10s
+  proxy.cluster.cache_total_misses
+  proxy.cluster.cache_total_misses_avg_10s
+  proxy.cluster.client_throughput_out
+  proxy.cluster.client_throughput_out_kbit
+  proxy.cluster.current_cache_connections
+  proxy.cluster.current_client_connections
+  proxy.cluster.current_server_connections
+  proxy.cluster.dns.lookups_per_second
+  proxy.cluster.dns.total_dns_lookups
+  proxy.cluster.hostdb.hit_ratio
+  proxy.cluster.hostdb.hit_ratio_avg_10s
+  proxy.cluster.hostdb.hit_ratio_int_pct
+  proxy.cluster.hostdb.total_hits_avg_10s
+  proxy.cluster.hostdb.total_lookups_avg_10s
+  proxy.cluster.http.cache_current_connections_count
+  proxy.cluster.http.current_parent_proxy_connections
+  proxy.cluster.http.origin_server_current_connections_count
+  proxy.cluster.http.origin_server_total_request_bytes
+  proxy.cluster.http.origin_server_total_response_bytes
+  proxy.cluster.http.origin_server_total_transactions_count
+  proxy.cluster.http.parent_proxy_total_request_bytes
+  proxy.cluster.http.parent_proxy_total_response_bytes
+  proxy.cluster.http.throughput
+  proxy.cluster.http.user_agent_current_connections_count
+  proxy.cluster.http.user_agent_total_request_bytes
+  proxy.cluster.http.user_agent_total_response_bytes
+  proxy.cluster.http.user_agent_xacts_per_second
+  proxy.cluster.http.user_agents_total_documents_served
+  proxy.cluster.http.user_agents_total_transactions_count
+
+  proxy.cluster.log.bytes_flush_to_disk
+  proxy.cluster.log.bytes_lost_before_flush_to_disk
+  proxy.cluster.log.bytes_lost_before_preproc
+  proxy.cluster.log.bytes_lost_before_sent_to_network
+  proxy.cluster.log.bytes_lost_before_written_to_disk
+  proxy.cluster.log.bytes_received_from_network
+  proxy.cluster.log.bytes_received_from_network_avg_10s
+  proxy.cluster.log.bytes_sent_to_network
+  proxy.cluster.log.bytes_sent_to_network_avg_10s
+  proxy.cluster.log.bytes_written_to_disk
+  proxy.cluster.log.event_log_access_aggr
+  proxy.cluster.log.event_log_access_fail
+  proxy.cluster.log.event_log_access_full
+  proxy.cluster.log.event_log_access_ok
+  proxy.cluster.log.event_log_access_skip
+  proxy.cluster.log.event_log_error_aggr
+  proxy.cluster.log.event_log_error_fail
+  proxy.cluster.log.event_log_error_full
+  proxy.cluster.log.event_log_error_ok
+  proxy.cluster.log.event_log_error_skip
+  proxy.cluster.log.num_flush_to_disk
+  proxy.cluster.log.num_lost_before_flush_to_disk
+  proxy.cluster.log.num_lost_before_sent_to_network
+  proxy.cluster.log.num_received_from_network
+  proxy.cluster.log.num_sent_to_network
+
+  proxy.cluster.origin_server_total_bytes_avg_10s
+  proxy.cluster.user_agent_total_bytes_avg_10s
+  proxy.cluster.user_agent_xacts_per_second
+
+  proxy.node.bandwidth_hit_ratio
+  proxy.node.bandwidth_hit_ratio_avg_10s
+  proxy.node.bandwidth_hit_ratio_avg_10s_int_pct
+  proxy.node.bandwidth_hit_ratio_int_pct
+
+  proxy.node.cache.bytes_free
+  proxy.node.cache.bytes_free_mb
+  proxy.node.cache.bytes_total
+  proxy.node.cache.bytes_total_mb
+  proxy.node.cache.contents.num_docs
+  proxy.node.cache.percent_free
+  proxy.node.cache.percent_free_int_pct
+  proxy.node.cache_hit_mem_ratio
+  proxy.node.cache_hit_mem_ratio_avg_10s
+  proxy.node.cache_hit_mem_ratio_avg_10s_int_pct
+  proxy.node.cache_hit_mem_ratio_int_pct
+  proxy.node.cache_hit_ratio
+  proxy.node.cache_hit_ratio_avg_10s
+  proxy.node.cache_hit_ratio_avg_10s_int_pct
+  proxy.node.cache_hit_ratio_int_pct
+  proxy.node.cache_total_hits
+  proxy.node.cache_total_hits_avg_10s
+  proxy.node.cache_total_hits_mem
+  proxy.node.cache_total_hits_mem_avg_10s
+  proxy.node.cache_total_misses
+  proxy.node.cache_total_misses_avg_10s
+
+  proxy.node.client_throughput_out
+  proxy.node.client_throughput_out_kbit
+  proxy.node.cluster.nodes
+
+  proxy.node.current_cache_connections
+  proxy.node.current_client_connections
+  proxy.node.current_server_connections
+
+  proxy.node.dns.lookup_avg_time_ms
+  proxy.node.dns.lookups_per_second
+  proxy.node.dns.total_dns_lookups
+
+  proxy.node.hostdb.hit_ratio
+  proxy.node.hostdb.hit_ratio_avg_10s
+  proxy.node.hostdb.hit_ratio_int_pct
+  proxy.node.hostdb.total_hits
+  proxy.node.hostdb.total_hits_avg_10s
+  proxy.node.hostdb.total_lookups
+  proxy.node.hostdb.total_lookups_avg_10s
+
+  proxy.node.hostname
+  proxy.node.hostname_FQ
+
+  proxy.node.http.cache_current_connections_count
+  proxy.node.http.cache_hit_fresh_avg_10s
+  proxy.node.http.cache_hit_ims_avg_10s
+  proxy.node.http.cache_hit_mem_fresh_avg_10s
+  proxy.node.http.cache_hit_revalidated_avg_10s
+  proxy.node.http.cache_hit_stale_served_avg_10s
+  proxy.node.http.cache_miss_changed_avg_10s
+  proxy.node.http.cache_miss_client_no_cache_avg_10s
+  proxy.node.http.cache_miss_cold_avg_10s
+  proxy.node.http.cache_miss_ims_avg_10s
+  proxy.node.http.cache_miss_not_cacheable_avg_10s
+  proxy.node.http.cache_read_error_avg_10s
+  proxy.node.http.current_parent_proxy_connections
+  proxy.node.http.origin_server_current_connections_count
+  proxy.node.http.origin_server_total_request_bytes
+  proxy.node.http.origin_server_total_response_bytes
+  proxy.node.http.origin_server_total_transactions_count
+  proxy.node.http.parent_proxy_total_request_bytes
+  proxy.node.http.parent_proxy_total_response_bytes
+  proxy.node.http.throughput
+  proxy.node.http.transaction_counts_avg_10s.errors.aborts
+  proxy.node.http.transaction_counts_avg_10s.errors.connect_failed
+  proxy.node.http.transaction_counts_avg_10s.errors.early_hangups
+  proxy.node.http.transaction_counts_avg_10s.errors.empty_hangups
+  proxy.node.http.transaction_counts_avg_10s.errors.other
+  proxy.node.http.transaction_counts_avg_10s.errors.possible_aborts
+  proxy.node.http.transaction_counts_avg_10s.errors.pre_accept_hangups
+  proxy.node.http.transaction_counts_avg_10s.hit_fresh
+  proxy.node.http.transaction_counts_avg_10s.hit_revalidated
+  proxy.node.http.transaction_counts_avg_10s.miss_changed
+  proxy.node.http.transaction_counts_avg_10s.miss_client_no_cache
+  proxy.node.http.transaction_counts_avg_10s.miss_cold
+  proxy.node.http.transaction_counts_avg_10s.miss_not_cacheable
+  proxy.node.http.transaction_counts_avg_10s.other.unclassified
+  proxy.node.http.transaction_frac_avg_10s.errors.aborts
+  proxy.node.http.transaction_frac_avg_10s.errors.aborts_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.connect_failed
+  proxy.node.http.transaction_frac_avg_10s.errors.connect_failed_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.early_hangups
+  proxy.node.http.transaction_frac_avg_10s.errors.early_hangups_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups
+  proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.other
+  proxy.node.http.transaction_frac_avg_10s.errors.other_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts
+  proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts_int_pct
+  proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups
+  proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups_int_pct
+  proxy.node.http.transaction_frac_avg_10s.hit_fresh
+  proxy.node.http.transaction_frac_avg_10s.hit_fresh_int_pct
+  proxy.node.http.transaction_frac_avg_10s.hit_revalidated
+  proxy.node.http.transaction_frac_avg_10s.hit_revalidated_int_pct
+  proxy.node.http.transaction_frac_avg_10s.miss_changed
+  proxy.node.http.transaction_frac_avg_10s.miss_changed_int_pct
+  proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache
+  proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache_int_pct
+  proxy.node.http.transaction_frac_avg_10s.miss_cold
+  proxy.node.http.transaction_frac_avg_10s.miss_cold_int_pct
+  proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable
+  proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable_int_pct
+  proxy.node.http.transaction_frac_avg_10s.other.unclassified
+  proxy.node.http.transaction_frac_avg_10s.other.unclassified_int_pct
+  proxy.node.http.transaction_msec_avg_10s.errors.aborts
+  proxy.node.http.transaction_msec_avg_10s.errors.connect_failed
+  proxy.node.http.transaction_msec_avg_10s.errors.early_hangups
+  proxy.node.http.transaction_msec_avg_10s.errors.empty_hangups
+  proxy.node.http.transaction_msec_avg_10s.errors.other
+  proxy.node.http.transaction_msec_avg_10s.errors.possible_aborts
+  proxy.node.http.transaction_msec_avg_10s.errors.pre_accept_hangups
+  proxy.node.http.transaction_msec_avg_10s.hit_fresh
+  proxy.node.http.transaction_msec_avg_10s.hit_revalidated
+  proxy.node.http.transaction_msec_avg_10s.miss_changed
+  proxy.node.http.transaction_msec_avg_10s.miss_client_no_cache
+  proxy.node.http.transaction_msec_avg_10s.miss_cold
+  proxy.node.http.transaction_msec_avg_10s.miss_not_cacheable
+  proxy.node.http.transaction_msec_avg_10s.other.unclassified
+  proxy.node.http.user_agent_current_connections_count
+  proxy.node.http.user_agent_total_request_bytes
+  proxy.node.http.user_agent_total_response_bytes
+  proxy.node.http.user_agent_xacts_per_second
+  proxy.node.http.user_agents_total_documents_served
+  proxy.node.http.user_agents_total_transactions_count
+
+  proxy.node.log.bytes_flush_to_disk
+  proxy.node.log.bytes_lost_before_flush_to_disk
+  proxy.node.log.bytes_lost_before_preproc
+  proxy.node.log.bytes_lost_before_sent_to_network
+  proxy.node.log.bytes_lost_before_written_to_disk
+  proxy.node.log.bytes_received_from_network
+  proxy.node.log.bytes_received_from_network_avg_10s
+  proxy.node.log.bytes_sent_to_network
+  proxy.node.log.bytes_sent_to_network_avg_10s
+  proxy.node.log.bytes_written_to_disk
+  proxy.node.log.event_log_access_aggr
+  proxy.node.log.event_log_access_fail
+  proxy.node.log.event_log_access_full
+  proxy.node.log.event_log_access_ok
+  proxy.node.log.event_log_access_skip
+  proxy.node.log.event_log_error_aggr
+  proxy.node.log.event_log_error_fail
+  proxy.node.log.event_log_error_full
+  proxy.node.log.event_log_error_ok
+  proxy.node.log.event_log_error_skip
+  proxy.node.log.num_flush_to_disk
+  proxy.node.log.num_lost_before_flush_to_disk
+  proxy.node.log.num_lost_before_sent_to_network
+  proxy.node.log.num_received_from_network
+  proxy.node.log.num_sent_to_network
+
+  proxy.node.num_processes
+
+  proxy.node.origin_server_total_bytes
+  proxy.node.origin_server_total_bytes_avg_10s
+
+  proxy.node.proxy_running
+
+  proxy.node.restarts.manager.start_time
+  proxy.node.restarts.proxy.cache_ready_time
+  proxy.node.restarts.proxy.restart_count
+  proxy.node.restarts.proxy.start_time
+  proxy.node.restarts.proxy.stop_time
+
+  proxy.node.user_agent_total_bytes
+  proxy.node.user_agent_total_bytes_avg_10s
+  proxy.node.user_agent_xacts_per_second
+  proxy.node.user_agents_total_documents_served
+
+  proxy.node.version.manager.build_date
+  proxy.node.version.manager.build_machine
+  proxy.node.version.manager.build_number
+  proxy.node.version.manager.build_person
+  proxy.node.version.manager.build_time
+  proxy.node.version.manager.long
+  proxy.node.version.manager.short
+
+  proxy.process.cache.KB_read_per_sec
+  proxy.process.cache.KB_write_per_sec
+  proxy.process.cache.bytes_total
+  proxy.process.cache.bytes_used
+  proxy.process.cache.directory_collision
+  proxy.process.cache.direntries.total
+  proxy.process.cache.direntries.used
+  proxy.process.cache.evacuate.active
+  proxy.process.cache.evacuate.failure
+  proxy.process.cache.evacuate.success
+  proxy.process.cache.frags_per_doc.1
+  proxy.process.cache.frags_per_doc.2
+  proxy.process.cache.frags_per_doc.3+
+  proxy.process.cache.gc_bytes_evacuated
+  proxy.process.cache.gc_frags_evacuated
+  proxy.process.cache.hdr_marshal_bytes
+  proxy.process.cache.hdr_marshals
+  proxy.process.cache.lookup.active
+  proxy.process.cache.lookup.failure
+  proxy.process.cache.lookup.success
+  proxy.process.cache.percent_full
+  proxy.process.cache.pread_count
+  proxy.process.cache.ram_cache.bytes_used
+  proxy.process.cache.ram_cache.hits
+  proxy.process.cache.ram_cache.misses
+  proxy.process.cache.ram_cache.total_bytes
+  proxy.process.cache.read.active
+  proxy.process.cache.read.failure
+  proxy.process.cache.read.success
+  proxy.process.cache.read_busy.failure
+  proxy.process.cache.read_busy.success
+  proxy.process.cache.read_per_sec
+  proxy.process.cache.remove.active
+  proxy.process.cache.remove.failure
+  proxy.process.cache.remove.success
+  proxy.process.cache.scan.active
+  proxy.process.cache.scan.failure
+  proxy.process.cache.scan.success
+  proxy.process.cache.update.active
+  proxy.process.cache.update.failure
+  proxy.process.cache.update.success
+  proxy.process.cache.vector_marshals
+  proxy.process.cache.volume_{N}.bytes_total
+  proxy.process.cache.volume_{N}.bytes_used
+  proxy.process.cache.volume_{N}.directory_collision
+  proxy.process.cache.volume_{N}.direntries.total
+  proxy.process.cache.volume_{N}.direntries.used
+  proxy.process.cache.volume_{N}.evacuate.active
+  proxy.process.cache.volume_{N}.evacuate.failure
+  proxy.process.cache.volume_{N}.evacuate.success
+  proxy.process.cache.volume_{N}.frags_per_doc.1
+  proxy.process.cache.volume_{N}.frags_per_doc.2
+  proxy.process.cache.volume_{N}.frags_per_doc.3+
+  proxy.process.cache.volume_{N}.gc_bytes_evacuated
+  proxy.process.cache.volume_{N}.gc_frags_evacuated
+  proxy.process.cache.volume_{N}.hdr_marshal_bytes
+  proxy.process.cache.volume_{N}.hdr_marshals
+  proxy.process.cache.volume_{N}.lookup.active
+  proxy.process.cache.volume_{N}.lookup.failure
+  proxy.process.cache.volume_{N}.lookup.success
+  proxy.process.cache.volume_{N}.percent_full
+  proxy.process.cache.volume_{N}.pread_count
+  proxy.process.cache.volume_{N}.ram_cache.bytes_used
+  proxy.process.cache.volume_{N}.ram_cache.hits
+  proxy.process.cache.volume_{N}.ram_cache.misses
+  proxy.process.cache.volume_{N}.ram_cache.total_bytes
+  proxy.process.cache.volume_{N}.read.active
+  proxy.process.cache.volume_{N}.read.failure
+  proxy.process.cache.volume_{N}.read.success
+  proxy.process.cache.volume_{N}.read_busy.failure
+  proxy.process.cache.volume_{N}.read_busy.success
+  proxy.process.cache.volume_{N}.remove.active
+  proxy.process.cache.volume_{N}.remove.failure
+  proxy.process.cache.volume_{N}.remove.success
+  proxy.process.cache.volume_{N}.scan.active
+  proxy.process.cache.volume_{N}.scan.failure
+  proxy.process.cache.volume_{N}.scan.success
+  proxy.process.cache.volume_{N}.update.active
+  proxy.process.cache.volume_{N}.update.failure
+  proxy.process.cache.volume_{N}.update.success
+  proxy.process.cache.volume_{N}.vector_marshals
+  proxy.process.cache.volume_{N}.write.active
+  proxy.process.cache.volume_{N}.write.backlog.failure
+  proxy.process.cache.volume_{N}.write.failure
+  proxy.process.cache.volume_{N}.write.success
+  proxy.process.cache.volume_{N}.write_bytes_stat
+  proxy.process.cache.write.active
+  proxy.process.cache.write.backlog.failure
+  proxy.process.cache.write.failure
+  proxy.process.cache.write.success
+  proxy.process.cache.write_bytes_stat
+  proxy.process.cache.write_per_sec
+
+  proxy.process.cluster.alloc_data_news
+  proxy.process.cluster.byte_bank_used
+  proxy.process.cluster.cache_callback_time
+  proxy.process.cluster.cache_callbacks
+  proxy.process.cluster.cache_outstanding
+  proxy.process.cluster.chan_inuse
+  proxy.process.cluster.cluster_ping_time
+  proxy.process.cluster.configuration_changes
+  proxy.process.cluster.connections_avg_time
+  proxy.process.cluster.connections_bumped
+  proxy.process.cluster.connections_closed
+  proxy.process.cluster.connections_open
+  proxy.process.cluster.connections_opened
+  proxy.process.cluster.connections_read_locked
+  proxy.process.cluster.connections_write_locked
+  proxy.process.cluster.control_messages_avg_receive_time
+  proxy.process.cluster.control_messages_avg_send_time
+  proxy.process.cluster.control_messages_received
+  proxy.process.cluster.control_messages_sent
+  proxy.process.cluster.delayed_reads
+  proxy.process.cluster.level1_bank
+  proxy.process.cluster.lkrmt_cache_callback_time
+  proxy.process.cluster.lkrmt_cache_callbacks
+  proxy.process.cluster.local_connection_time
+  proxy.process.cluster.local_connections_closed
+  proxy.process.cluster.machines_allocated
+  proxy.process.cluster.machines_freed
+  proxy.process.cluster.multilevel_bank
+  proxy.process.cluster.net_backup
+  proxy.process.cluster.no_remote_space
+  proxy.process.cluster.nodes
+  proxy.process.cluster.op_delayed_for_lock
+  proxy.process.cluster.open_delay_time
+  proxy.process.cluster.open_delays
+  proxy.process.cluster.partial_reads
+  proxy.process.cluster.partial_writes
+  proxy.process.cluster.rdmsg_assemble_time
+  proxy.process.cluster.read_bytes
+  proxy.process.cluster.reads
+  proxy.process.cluster.remote_connection_time
+  proxy.process.cluster.remote_connections_closed
+  proxy.process.cluster.remote_op_reply_timeouts
+  proxy.process.cluster.remote_op_timeouts
+  proxy.process.cluster.rmt_cache_callback_time
+  proxy.process.cluster.rmt_cache_callbacks
+  proxy.process.cluster.setdata_no_cachevc
+  proxy.process.cluster.setdata_no_cluster
+  proxy.process.cluster.setdata_no_clustervc
+  proxy.process.cluster.setdata_no_tunnel
+  proxy.process.cluster.slow_ctrl_msgs_sent
+  proxy.process.cluster.vc_cache_insert_lock_misses
+  proxy.process.cluster.vc_cache_inserts
+  proxy.process.cluster.vc_cache_lookup_hits
+  proxy.process.cluster.vc_cache_lookup_lock_misses
+  proxy.process.cluster.vc_cache_lookup_misses
+  proxy.process.cluster.vc_cache_purges
+  proxy.process.cluster.vc_cache_scan_lock_misses
+  proxy.process.cluster.vc_cache_scans
+  proxy.process.cluster.vc_read_list_len
+  proxy.process.cluster.vc_write_list_len
+  proxy.process.cluster.vc_write_stall
+  proxy.process.cluster.write_bb_mallocs
+  proxy.process.cluster.write_bytes
+  proxy.process.cluster.write_lock_misses
+  proxy.process.cluster.writes
+
+  proxy.process.congestion.congested_on_conn_failures
+  proxy.process.congestion.congested_on_max_connection
+
+  proxy.process.dns.fail_avg_time
+  proxy.process.dns.in_flight
+  proxy.process.dns.lookup_avg_time
+  proxy.process.dns.lookup_failures
+  proxy.process.dns.lookup_successes
+  proxy.process.dns.max_retries_exceeded
+  proxy.process.dns.retries
+  proxy.process.dns.success_avg_time
+  proxy.process.dns.total_dns_lookups
+
+  proxy.process.hostdb.bytes
+  proxy.process.hostdb.re_dns_on_reload
+  proxy.process.hostdb.total_entries
+  proxy.process.hostdb.total_hits
+  proxy.process.hostdb.total_lookups
+  proxy.process.hostdb.ttl
+  proxy.process.hostdb.ttl_expires
+
+  proxy.process.http.100_responses
+  proxy.process.http.101_responses
+  proxy.process.http.1xx_responses
+  proxy.process.http.200_responses
+  proxy.process.http.201_responses
+  proxy.process.http.202_responses
+  proxy.process.http.203_responses
+  proxy.process.http.204_responses
+  proxy.process.http.205_responses
+  proxy.process.http.206_responses
+  proxy.process.http.2xx_responses
+  proxy.process.http.300_responses
+  proxy.process.http.301_responses
+  proxy.process.http.302_responses
+  proxy.process.http.303_responses
+  proxy.process.http.304_responses
+  proxy.process.http.305_responses
+  proxy.process.http.307_responses
+  proxy.process.http.3xx_responses
+  proxy.process.http.400_responses
+  proxy.process.http.401_responses
+  proxy.process.http.402_responses
+  proxy.process.http.403_responses
+  proxy.process.http.404_responses
+  proxy.process.http.405_responses
+  proxy.process.http.406_responses
+  proxy.process.http.407_responses
+  proxy.process.http.408_responses
+  proxy.process.http.409_responses
+  proxy.process.http.410_responses
+  proxy.process.http.411_responses
+  proxy.process.http.412_responses
+  proxy.process.http.413_responses
+  proxy.process.http.414_responses
+  proxy.process.http.415_responses
+  proxy.process.http.416_responses
+  proxy.process.http.4xx_responses
+  proxy.process.http.500_responses
+  proxy.process.http.501_responses
+  proxy.process.http.502_responses
+  proxy.process.http.503_responses
+  proxy.process.http.504_responses
+  proxy.process.http.505_responses
+  proxy.process.http.5xx_responses
+  proxy.process.http.avg_transactions_per_client_connection
+  proxy.process.http.avg_transactions_per_parent_connection
+  proxy.process.http.avg_transactions_per_server_connection
+  proxy.process.http.background_fill_bytes_aborted_stat
+  proxy.process.http.background_fill_bytes_completed_stat
+  proxy.process.http.background_fill_current_count
+  proxy.process.http.broken_server_connections
+  proxy.process.http.cache_connection_time
+  proxy.process.http.cache_deletes
+  proxy.process.http.cache_hit_fresh
+  proxy.process.http.cache_hit_ims
+  proxy.process.http.cache_hit_mem_fresh
+  proxy.process.http.cache_hit_revalidated
+  proxy.process.http.cache_hit_stale_served
+  proxy.process.http.cache_lookups
+  proxy.process.http.cache_miss_changed
+  proxy.process.http.cache_miss_client_no_cache
+  proxy.process.http.cache_miss_client_not_cacheable
+  proxy.process.http.cache_miss_cold
+  proxy.process.http.cache_miss_ims
+  proxy.process.http.cache_read_error
+  proxy.process.http.cache_read_errors
+  proxy.process.http.cache_updates
+  proxy.process.http.cache_write_errors
+  proxy.process.http.cache_writes
+  proxy.process.http.client_connection_time
+  proxy.process.http.client_no_cache_requests
+  proxy.process.http.client_transaction_time
+  proxy.process.http.client_write_time
+  proxy.process.http.completed_requests
+  proxy.process.http.connect_requests
+  proxy.process.http.current_active_client_connections
+  proxy.process.http.current_cache_connections
+  proxy.process.http.current_client_connections
+  proxy.process.http.current_client_transactions
+  proxy.process.http.current_icp_raw_transactions
+  proxy.process.http.current_icp_transactions
+  proxy.process.http.current_parent_proxy_connections
+  proxy.process.http.current_parent_proxy_raw_transactions
+  proxy.process.http.current_parent_proxy_transactions
+  proxy.process.http.current_server_connections
+  proxy.process.http.current_server_raw_transactions
+  proxy.process.http.current_server_transactions
+  proxy.process.http.delete_requests
+  proxy.process.http.err_client_abort_count_stat
+  proxy.process.http.err_client_abort_origin_server_bytes_stat
+  proxy.process.http.err_client_abort_user_agent_bytes_stat
+  proxy.process.http.err_connect_fail_count_stat
+  proxy.process.http.err_connect_fail_origin_server_bytes_stat
+  proxy.process.http.err_connect_fail_user_agent_bytes_stat
+  proxy.process.http.extension_method_requests
+  proxy.process.http.get_requests
+  proxy.process.http.head_requests
+  proxy.process.http.icp_raw_transaction_time
+  proxy.process.http.icp_suggested_lookups
+  proxy.process.http.icp_transaction_time
+  proxy.process.http.incoming_requests
+  proxy.process.http.incoming_responses
+  proxy.process.http.invalid_client_requests
+  proxy.process.http.misc_count_stat
+  proxy.process.http.misc_user_agent_bytes_stat
+  proxy.process.http.missing_host_hdr
+  proxy.process.http.options_requests
+  proxy.process.http.origin_server_request_document_total_size
+  proxy.process.http.origin_server_request_header_total_size
+  proxy.process.http.origin_server_response_document_total_size
+  proxy.process.http.origin_server_response_header_total_size
+  proxy.process.http.origin_server_speed_bytes_per_sec_100
+  proxy.process.http.origin_server_speed_bytes_per_sec_100K
+  proxy.process.http.origin_server_speed_bytes_per_sec_100M
+  proxy.process.http.origin_server_speed_bytes_per_sec_10K
+  proxy.process.http.origin_server_speed_bytes_per_sec_10M
+  proxy.process.http.origin_server_speed_bytes_per_sec_1K
+  proxy.process.http.origin_server_speed_bytes_per_sec_1M
+  proxy.process.http.outgoing_requests
+  proxy.process.http.parent_proxy_connection_time
+  proxy.process.http.parent_proxy_raw_transaction_time
+  proxy.process.http.parent_proxy_request_total_bytes
+  proxy.process.http.parent_proxy_response_total_bytes
+  proxy.process.http.parent_proxy_transaction_time
+  proxy.process.http.post_requests
+  proxy.process.http.purge_requests
+  proxy.process.http.push_requests
+  proxy.process.http.pushed_document_total_size
+  proxy.process.http.pushed_response_header_total_size
+  proxy.process.http.put_requests
+  proxy.process.http.request_document_size_100
+  proxy.process.http.request_document_size_10K
+  proxy.process.http.request_document_size_1K
+  proxy.process.http.request_document_size_1M
+  proxy.process.http.request_document_size_3K
+  proxy.process.http.request_document_size_5K
+  proxy.process.http.request_document_size_inf
+  proxy.process.http.request_taxonomy.i0_n0_m0
+  proxy.process.http.request_taxonomy.i0_n0_m1
+  proxy.process.http.request_taxonomy.i0_n1_m0
+  proxy.process.http.request_taxonomy.i0_n1_m1
+  proxy.process.http.request_taxonomy.i1_n0_m0
+  proxy.process.http.request_taxonomy.i1_n0_m1
+  proxy.process.http.request_taxonomy.i1_n1_m0
+  proxy.process.http.request_taxonomy.i1_n1_m1
+  proxy.process.http.response_document_size_100
+  proxy.process.http.response_document_size_10K
+  proxy.process.http.response_document_size_1K
+  proxy.process.http.response_document_size_1M
+  proxy.process.http.response_document_size_3K
+  proxy.process.http.response_document_size_5K
+  proxy.process.http.response_document_size_inf
+  proxy.process.http.server_connection_time
+  proxy.process.http.server_raw_transaction_time
+  proxy.process.http.server_read_time
+  proxy.process.http.server_transaction_time
+  proxy.process.http.tcp_client_refresh_count_stat
+  proxy.process.http.tcp_client_refresh_origin_server_bytes_stat
+  proxy.process.http.tcp_client_refresh_user_agent_bytes_stat
+  proxy.process.http.tcp_expired_miss_count_stat
+  proxy.process.http.tcp_expired_miss_origin_server_bytes_stat
+  proxy.process.http.tcp_expired_miss_user_agent_bytes_stat
+  proxy.process.http.tcp_hit_count_stat
+  proxy.process.http.tcp_hit_origin_server_bytes_stat
+  proxy.process.http.tcp_hit_user_agent_bytes_stat
+  proxy.process.http.tcp_ims_hit_count_stat
+  proxy.process.http.tcp_ims_hit_origin_server_bytes_stat
+  proxy.process.http.tcp_ims_hit_user_agent_bytes_stat
+  proxy.process.http.tcp_ims_miss_count_stat
+  proxy.process.http.tcp_ims_miss_origin_server_bytes_stat
+  proxy.process.http.tcp_ims_miss_user_agent_bytes_stat
+  proxy.process.http.tcp_miss_count_stat
+  proxy.process.http.tcp_miss_origin_server_bytes_stat
+  proxy.process.http.tcp_miss_user_agent_bytes_stat
+  proxy.process.http.tcp_refresh_hit_count_stat
+  proxy.process.http.tcp_refresh_hit_origin_server_bytes_stat
+  proxy.process.http.tcp_refresh_hit_user_agent_bytes_stat
+  proxy.process.http.tcp_refresh_miss_count_stat
+  proxy.process.http.tcp_refresh_miss_origin_server_bytes_stat
+  proxy.process.http.tcp_refresh_miss_user_agent_bytes_stat
+  proxy.process.http.throttled_proxy_only
+  proxy.process.http.total_client_connections
+  proxy.process.http.total_client_connections_ipv4
+  proxy.process.http.total_client_connections_ipv6
+  proxy.process.http.total_incoming_connections
+  proxy.process.http.total_parent_proxy_connections
+  proxy.process.http.total_server_connections
+  proxy.process.http.total_transactions_think_time
+  proxy.process.http.total_transactions_time
+  proxy.process.http.total_x_redirect_count
+  proxy.process.http.trace_requests
+  proxy.process.http.transaction_counts.errors.aborts
+  proxy.process.http.transaction_counts.errors.connect_failed
+  proxy.process.http.transaction_counts.errors.early_hangups
+  proxy.process.http.transaction_counts.errors.empty_hangups
+  proxy.process.http.transaction_counts.errors.other
+  proxy.process.http.transaction_counts.errors.possible_aborts
+  proxy.process.http.transaction_counts.errors.pre_accept_hangups
+  proxy.process.http.transaction_counts.hit_fresh
+  proxy.process.http.transaction_counts.hit_fresh.process
+  proxy.process.http.transaction_counts.hit_revalidated
+  proxy.process.http.transaction_counts.miss_changed
+  proxy.process.http.transaction_counts.miss_client_no_cache
+  proxy.process.http.transaction_counts.miss_cold
+  proxy.process.http.transaction_counts.miss_not_cacheable
+  proxy.process.http.transaction_counts.other.unclassified
+  proxy.process.http.transaction_totaltime.errors.aborts
+  proxy.process.http.transaction_totaltime.errors.connect_failed
+  proxy.process.http.transaction_totaltime.errors.early_hangups
+  proxy.process.http.transaction_totaltime.errors.empty_hangups
+  proxy.process.http.transaction_totaltime.errors.other
+  proxy.process.http.transaction_totaltime.errors.possible_aborts
+  proxy.process.http.transaction_totaltime.errors.pre_accept_hangups
+  proxy.process.http.transaction_totaltime.hit_fresh
+  proxy.process.http.transaction_totaltime.hit_fresh.process
+  proxy.process.http.transaction_totaltime.hit_revalidated
+  proxy.process.http.transaction_totaltime.miss_changed
+  proxy.process.http.transaction_totaltime.miss_client_no_cache
+  proxy.process.http.transaction_totaltime.miss_cold
+  proxy.process.http.transaction_totaltime.miss_not_cacheable
+  proxy.process.http.transaction_totaltime.other.unclassified
+  proxy.process.http.tunnels
+  proxy.process.http.user_agent_request_document_total_size
+  proxy.process.http.user_agent_request_header_total_size
+  proxy.process.http.user_agent_response_document_total_size
+  proxy.process.http.user_agent_response_header_total_size
+  proxy.process.http.user_agent_speed_bytes_per_sec_100
+  proxy.process.http.user_agent_speed_bytes_per_sec_100K
+  proxy.process.http.user_agent_speed_bytes_per_sec_100M
+  proxy.process.http.user_agent_speed_bytes_per_sec_10K
+  proxy.process.http.user_agent_speed_bytes_per_sec_10M
+  proxy.process.http.user_agent_speed_bytes_per_sec_1K
+  proxy.process.http.user_agent_speed_bytes_per_sec_1M
+  proxy.process.http.websocket.current_active_client_connections
+
+  proxy.process.log.bytes_flush_to_disk
+  proxy.process.log.bytes_lost_before_flush_to_disk
+  proxy.process.log.bytes_lost_before_preproc
+  proxy.process.log.bytes_lost_before_sent_to_network
+  proxy.process.log.bytes_lost_before_written_to_disk
+  proxy.process.log.bytes_received_from_network
+  proxy.process.log.bytes_sent_to_network
+  proxy.process.log.bytes_written_to_disk
+  proxy.process.log.event_log_access_aggr
+  proxy.process.log.event_log_access_fail
+  proxy.process.log.event_log_access_full
+  proxy.process.log.event_log_access_ok
+  proxy.process.log.event_log_access_skip
+  proxy.process.log.event_log_error_aggr
+  proxy.process.log.event_log_error_fail
+  proxy.process.log.event_log_error_full
+  proxy.process.log.event_log_error_ok
+  proxy.process.log.event_log_error_skip
+  proxy.process.log.log_files_open
+  proxy.process.log.log_files_space_used
+  proxy.process.log.num_flush_to_disk
+  proxy.process.log.num_lost_before_flush_to_disk
+  proxy.process.log.num_lost_before_sent_to_network
+  proxy.process.log.num_received_from_network
+  proxy.process.log.num_sent_to_network
+
+  proxy.process.net.accepts_currently_open
+  proxy.process.net.calls_to_read
+  proxy.process.net.calls_to_read_nodata
+  proxy.process.net.calls_to_readfromnet
+  proxy.process.net.calls_to_readfromnet_afterpoll
+  proxy.process.net.calls_to_write
+  proxy.process.net.calls_to_write_nodata
+  proxy.process.net.calls_to_writetonet
+  proxy.process.net.calls_to_writetonet_afterpoll
+  proxy.process.net.connections_currently_open
+  proxy.process.net.inactivity_cop_lock_acquire_failure
+  proxy.process.net.net_handler_run
+  proxy.process.net.read_bytes
+  proxy.process.net.write_bytes
+
+  proxy.process.socks.connections_currently_open
+  proxy.process.socks.connections_successful
+  proxy.process.socks.connections_unsuccessful
+
+  proxy.process.ssl.cipher.user_agent.{CIPHER}
+  proxy.process.ssl.origin_server_bad_cert
+  proxy.process.ssl.origin_server_cert_verify_failed
+  proxy.process.ssl.origin_server_decryption_failed
+  proxy.process.ssl.origin_server_expired_cert
+  proxy.process.ssl.origin_server_other_errors
+  proxy.process.ssl.origin_server_revoked_cert
+  proxy.process.ssl.origin_server_unknown_ca
+  proxy.process.ssl.origin_server_unknown_cert
+  proxy.process.ssl.origin_server_wrong_version
+  proxy.process.ssl.user_agent_bad_cert
+  proxy.process.ssl.user_agent_cert_verify_failed
+  proxy.process.ssl.user_agent_decryption_failed
+  proxy.process.ssl.user_agent_expired_cert
+  proxy.process.ssl.user_agent_other_errors
+  proxy.process.ssl.user_agent_revoked_cert
+  proxy.process.ssl.user_agent_session_hit
+  proxy.process.ssl.user_agent_session_miss
+  proxy.process.ssl.user_agent_session_timeout
+  proxy.process.ssl.user_agent_sessions
+  proxy.process.ssl.user_agent_unknown_ca
+  proxy.process.ssl.user_agent_unknown_cert
+  proxy.process.ssl.user_agent_wrong_version
+
+  proxy.process.update.fails
+  proxy.process.update.no_actions
+  proxy.process.update.state_machines
+  proxy.process.update.successes
+  proxy.process.update.unknown_status
+
+  proxy.process.version.server.build_date
+  proxy.process.version.server.build_machine
+  proxy.process.version.server.build_number
+  proxy.process.version.server.build_person
+  proxy.process.version.server.build_time
+  proxy.process.version.server.long
+  proxy.process.version.server.short
 
 Statistics Descriptions
 =======================
@@ -904,33 +998,19 @@ proxy.process.ssl.user_agent_session_timeout
   Total number of session timeouts.  The ssl client provided a session, but
   it could not be used because it was past the session timeout.
 
-proxy.process.ssl.cipher.user_agent.{cipherName}
-  Total number of ssl client connections that used cipherName.  The list of
-  cipher stats is dynamic and depends upon the installed ciphers and the
-  cipher configuration of ats (proxy.config.ssl.server.cipher_suite).
-  Some common cipher stats are::
-
-    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-RC4-SHA
-    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES128-SHA256
-    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES128-GCM-SHA256
-    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES128-SHA
-    proxy.process.ssl.cipher.user_agent.RC4-SHA
-    proxy.process.ssl.cipher.user_agent.RC4-MD5
-    proxy.process.ssl.cipher.user_agent.AES128-GCM-SHA256
-    proxy.process.ssl.cipher.user_agent.AES128-SHA
-
-There are two ways to get the list of cipher stats:
-
-1.  Run ATS with debug logging and show ssl diags::
+proxy.process.ssl.cipher.user_agent.{CIPHERNAME}
+  Total number of ssl client connections that used cipherName.  The
+  list of cipher statistics is dynamic and depends upon the installed
+  ciphers and the :ts:cv:`proxy.config.ssl.server.cipher_suite`
+  configuration. The set of cipher statistics can be discovered
+  with :option:`traffic_line -m`. For example::
 
-      CONFIG proxy.config.diags.debug.enabled INT 1
-      CONFIG proxy.config.diags.debug.tags STRING ssl.*
-      View output of traffic.out looking for lines like:
-         (ssl) Registering ssl cipher stat 'proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES256-GCM-SHA384'
-
-2.  Run this (asks openssl to tell us) to get a list of all possible ciphers on the system (not all may be available as stats)::
-
-         openssl ciphers | sed 's/\([^:]\+\)/proxy.process.ssl.cipher.user_agent.\1/g; s/:/\n/g'
+    $ traffic_line -m proxy.process.ssl.cipher.user_agent.
+    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES256-GCM-SHA384 0
+    proxy.process.ssl.cipher.user_agent.ECDHE-ECDSA-AES256-GCM-SHA384 0
+    proxy.process.ssl.cipher.user_agent.ECDHE-RSA-AES256-SHA384 0
+    proxy.process.ssl.cipher.user_agent.ECDHE-ECDSA-AES256-SHA384 0
+    ...
 
 Examples
 ========
@@ -941,12 +1021,8 @@ Configure Traffic Server to log in Squid format::
     $ traffic_line -s proxy.config.log.squid_log_is_ascii -v 1
     $ traffic_line -x
 
-Files
-=====
-
-:file:`records.config`, :file:`ssl_multicert.config`
-
 See also
 ========
 
-:manpage:`records.config(5)`
+:manpage:`records.config(5)`,
+:manpage:`storage.config(5)`

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index b99d616..592d782 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -383,6 +383,15 @@ MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
   return TS_ERR_OKAY;
 }
 
+// This is not implemented in the Core side of the API because we don't want
+// to buffer up all the matching records in memory. We stream the records
+// directory onto the management socket in handle_record_match(). This stub
+// is just here for link time dependencies.
+TSError
+MgmtRecordGetMatching(const char * /* regex */, TSList /* rec_vals */)
+{
+  return TS_ERR_FAIL;
+}
 
 /*-------------------------------------------------------------------------
  * reads the RecordsConfig info to determine which type of action is needed

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/CoreAPI.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h
index 87dd84e..21d9da6 100644
--- a/mgmt/api/CoreAPI.h
+++ b/mgmt/api/CoreAPI.h
@@ -69,6 +69,7 @@ TSError MgmtRecordSetInt(const char *rec_name, MgmtInt int_val, TSActionNeedT *
 TSError MgmtRecordSetCounter(const char *rec_name, MgmtIntCounter counter_val, TSActionNeedT *action_need);
 TSError MgmtRecordSetFloat(const char *rec_name, MgmtFloat float_val, TSActionNeedT * action_need);
 TSError MgmtRecordSetString(const char *rec_name, const char*string_val, TSActionNeedT * action_need);
+TSError MgmtRecordGetMatching(const char * regex, TSList rec_vals);
 
 
 /***************************************************************************

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index 8ccdac0..0dc360a 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -476,54 +476,113 @@ StorageDeviceCmdOffline(char const* dev)
   ret = send_request_name(main_socket_fd, STORAGE_DEVICE_CMD_OFFLINE, dev);
   return TS_ERR_OKAY != ret ? ret : parse_reply(main_socket_fd);
 }
+
 /***************************************************************************
  * Record Operations
  ***************************************************************************/
+static TSError
+mgmt_record_get_reply(TSRecordEle * rec_ele)
+{
+  TSError ret;
+  void *val;
+  char *name;
+
+  rec_ele->rec_name = NULL;
+  rec_ele->rec_type = TS_REC_UNDEFINED;
+
+  // parse the reply to get record value and type
+  ret = parse_record_get_reply(main_socket_fd, &(rec_ele->rec_type), &val, &name);
+  if (ret != TS_ERR_OKAY) {
+    return ret;
+  }
+
+  // convert the record value to appropriate type
+  if (val) {
+    switch (rec_ele->rec_type) {
+    case TS_REC_INT:
+      rec_ele->int_val = *(TSInt *) val;
+      break;
+    case TS_REC_COUNTER:
+      rec_ele->counter_val = *(TSCounter *) val;
+      break;
+    case TS_REC_FLOAT:
+      rec_ele->float_val = *(TSFloat *) val;
+      break;
+    case TS_REC_STRING:
+      rec_ele->string_val = ats_strdup((char *) val);
+      break;
+    default:
+      ; // nothing ... shut up compiler!
+    }
+  }
+
+  if (name) {
+    rec_ele->rec_name = name;
+  }
+
+  ats_free(val);
+  return TS_ERR_OKAY;
+}
+
 // note that the record value is being sent as chunk of memory, regardless of
 // record type; it's not being converted to a string!!
 TSError
 MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
 {
   TSError ret;
-  void *val;
 
-  if (!rec_name || !rec_ele)
+  if (!rec_name || !rec_ele) {
     return TS_ERR_PARAMS;
-
-  rec_ele->rec_name = ats_strdup(rec_name);
+  }
 
   // create and send request
   ret = send_record_get_request(main_socket_fd, rec_ele->rec_name);
-  if (ret != TS_ERR_OKAY)
+  if (ret != TS_ERR_OKAY) {
     return ret;
+  }
 
-  // parse the reply to get record value and type
-  ret = parse_record_get_reply(main_socket_fd, &(rec_ele->rec_type), &val);
-  if (ret != TS_ERR_OKAY)
+  return mgmt_record_get_reply(rec_ele);
+}
+
+TSError
+MgmtRecordGetMatching(const char * regex, TSList rec_vals)
+{
+  TSError       ret;
+  TSRecordEle * rec_ele;
+
+  ret = send_record_match_request(main_socket_fd, regex);
+  if (ret != TS_ERR_OKAY) {
     return ret;
+  }
 
-  // convert the record value to appropriate type
-  switch (rec_ele->rec_type) {
-  case TS_REC_INT:
-    rec_ele->int_val = *(TSInt *) val;
-    break;
-  case TS_REC_COUNTER:
-    rec_ele->counter_val = *(TSCounter *) val;
-    break;
-  case TS_REC_FLOAT:
-    rec_ele->float_val = *(TSFloat *) val;
-    break;
-  case TS_REC_STRING:
-    rec_ele->string_val = ats_strdup((char *) val);
-    break;
-  default:                     // ERROR - invalid record type
-    return TS_ERR_FAIL;
+  for (;;) {
+    rec_ele = TSRecordEleCreate();
+
+    // parse the reply to get record value and type
+    ret = mgmt_record_get_reply(rec_ele);
+    if (ret != TS_ERR_OKAY) {
+      goto fail;
+    }
+
+    // A NULL record ends the list.
+    if (rec_ele->rec_type == TS_REC_UNDEFINED) {
+      break;
+    }
+
+    enqueue((LLQ *) rec_vals, rec_ele);
   }
 
-  ats_free(val);
   return TS_ERR_OKAY;
-}
 
+fail:
+
+  TSRecordEleDestroy(rec_ele);
+  for (rec_ele = (TSRecordEle *) dequeue((LLQ *) rec_vals); rec_ele; rec_ele = (TSRecordEle *) dequeue((LLQ *) rec_vals)) {
+      TSRecordEleDestroy(rec_ele);
+  }
+
+  return ret;
+}
 
 TSError
 MgmtRecordSet(const char *rec_name, const char *val, TSActionNeedT * action_need)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/INKMgmtAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
index 709debc..a466fbd 100644
--- a/mgmt/api/INKMgmtAPI.cc
+++ b/mgmt/api/INKMgmtAPI.cc
@@ -1581,6 +1581,15 @@ TSRecordGetMlt(TSStringList rec_names, TSList rec_vals)
   return TS_ERR_OKAY;
 }
 
+tsapi TSError
+TSRecordGetMatchMlt(const char * regex, TSList rec_vals)
+{
+  if (!regex || !rec_vals) {
+    return TS_ERR_PARAMS;
+  }
+
+  return MgmtRecordGetMatching(regex, rec_vals);
+}
 
 tsapi TSError
 TSRecordSet(const char *rec_name, const char *val, TSActionNeedT * action_need)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/NetworkUtilsDefs.h
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsDefs.h b/mgmt/api/NetworkUtilsDefs.h
index 6f0127b..bd94fdc 100644
--- a/mgmt/api/NetworkUtilsDefs.h
+++ b/mgmt/api/NetworkUtilsDefs.h
@@ -80,6 +80,7 @@ typedef enum
   STATS_RESET_NODE,
   STATS_RESET_CLUSTER,
   STORAGE_DEVICE_CMD_OFFLINE,
+  RECORD_MATCH_GET,
   UNDEFINED_OP /* This must be last */
 } OpType;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/NetworkUtilsLocal.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsLocal.cc b/mgmt/api/NetworkUtilsLocal.cc
index 03b4666..3f05d18 100644
--- a/mgmt/api/NetworkUtilsLocal.cc
+++ b/mgmt/api/NetworkUtilsLocal.cc
@@ -513,22 +513,20 @@ send_reply_list(struct SocketInfo sock_info, TSError retval, char *list)
  * output: TS_ERR_*
  * notes: this function does not need to go through the internal structure
  *        so no cleaning up is done.
- *        format = <TSError> <rec_val_len> <rec_type> <rec_val>
+ *        format = <TSError> <rec_val_len> <name_size> <rec_type> <rec_val> <rec_name>
  **********************************************************************/
 TSError
-send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, int val_size, TSRecordT rec_type)
+send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, int val_size,
+    TSRecordT rec_type, const char *rec_name)
 {
   TSError ret;
   int msg_pos = 0, total_len;
   char *msg;
   int16_t record_t, ret_val;
-  int32_t v_size;                 // to be safe, typecast
+  int32_t v_size = (int32_t) val_size; // to be safe, typecast
+  int32_t n_size = rec_name ? (int32_t)strlen(rec_name) : 0;
 
-  if (!val) {
-    return TS_ERR_PARAMS;
-  }
-
-  total_len = SIZE_ERR_T + SIZE_LEN + SIZE_REC_T + val_size;
+  total_len = SIZE_ERR_T + SIZE_LEN + SIZE_LEN + SIZE_REC_T + v_size + n_size;
   msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the return value
@@ -537,17 +535,29 @@ send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, in
   msg_pos += SIZE_ERR_T;
 
   // write the size of the record value
-  v_size = (int32_t) val_size;
   memcpy(msg + msg_pos, (void *) &v_size, SIZE_LEN);
   msg_pos += SIZE_LEN;
 
+  // write the size of the record name
+  memcpy(msg + msg_pos, (void *) &n_size, SIZE_LEN);
+  msg_pos += SIZE_LEN;
+
   // write the record type
   record_t = (int16_t) rec_type;
   memcpy(msg + msg_pos, (void *) &record_t, SIZE_REC_T);
   msg_pos += SIZE_REC_T;
 
   // write the record value
-  memcpy(msg + msg_pos, val, val_size);
+  if (v_size) {
+    memcpy(msg + msg_pos, val, v_size);
+    msg_pos += v_size;
+  }
+
+  // write the record name
+  if (n_size) {
+    memcpy(msg + msg_pos, rec_name, n_size);
+    msg_pos += n_size;
+  }
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/NetworkUtilsLocal.h
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsLocal.h b/mgmt/api/NetworkUtilsLocal.h
index 8773bda..805beef 100644
--- a/mgmt/api/NetworkUtilsLocal.h
+++ b/mgmt/api/NetworkUtilsLocal.h
@@ -69,7 +69,7 @@ TSError send_reply(struct SocketInfo sock_info, TSError retval);
 TSError send_reply_list(struct SocketInfo sock_info, TSError retval, char *list);
 
 TSError send_record_get_reply(struct SocketInfo sock_info, TSError retval, void *val, int val_size,
-                               TSRecordT rec_type);
+                               TSRecordT rec_type, const char *rec_name);
 TSError send_record_set_reply(struct SocketInfo sock_info, TSError retval, TSActionNeedT action_need);
 TSError send_file_read_reply(struct SocketInfo sock_info, TSError retval, int ver, int size, char *text);
 TSError send_proxy_state_get_reply(struct SocketInfo sock_info, TSProxyStateT state);


[39/50] [abbrv] git commit: Merge branch 'remaporder' of https://github.com/jacksontj/trafficserver

Posted by zw...@apache.org.
Merge branch 'remaporder' of https://github.com/jacksontj/trafficserver


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

Branch: refs/heads/lua_config
Commit: 8dd20f5b622003594c6cd46c0883a1f02a2b9e51
Parents: 80156ae 622157c
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 10:53:55 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 10:53:55 2014 -0700

----------------------------------------------------------------------
 doc/reference/configuration/remap.config.en.rst | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[37/50] [abbrv] git commit: TS-2661: Remove unused HttpSM::decide_cached_url method.

Posted by zw...@apache.org.
TS-2661: Remove unused HttpSM::decide_cached_url method.


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

Branch: refs/heads/lua_config
Commit: 059b9c8453073f7f8d9eaa529f9d803fd093c056
Parents: 7d3f9c8
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Tue Mar 25 11:14:25 2014 -0500
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Tue Mar 25 11:14:25 2014 -0500

----------------------------------------------------------------------
 CHANGES              |  2 ++
 proxy/http/HttpSM.cc | 52 -----------------------------------------------
 proxy/http/HttpSM.h  |  1 -
 3 files changed, 2 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/059b9c84/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index da8b67e..0f20b07 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2661] Remove unused HttpSM::decided_cached_url.
+
   *) [TS-2658] Additional debug logging for SSL certificates.
 
   *) [TS-2431] Migrate Taobao SPDY plugin to ATS core.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/059b9c84/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index b314bc9..2cb19eb 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -432,58 +432,6 @@ HttpSM::init()
 
 }
 
-bool
-HttpSM::decide_cached_url(URL * s_url)
-{
-  INK_MD5 md5s, md5l, md5o;
-  bool result = false;
-
-  s_url->MD5_get(&md5s);
-  if (second_cache_sm == NULL) {
-    if (cache_sm.cache_write_vc == NULL && t_state.cache_info.write_lock_state == HttpTransact::CACHE_WL_INIT)
-      return true;
-
-    cache_sm.get_lookup_url()->MD5_get(&md5l);
-    result = (md5s == md5l) ? true : false;
-  } else {
-    // we only get here after we already issued the cache writes
-    // do we need another cache_info for second_cache_sm???????
-    cache_sm.get_lookup_url()->MD5_get(&md5l);
-    second_cache_sm->get_lookup_url()->MD5_get(&md5o);
-
-    if (md5s == md5o) {
-      cache_sm.end_both();
-      t_state.cache_info.object_read = t_state.cache_info.second_object_read;
-      t_state.cache_info.second_object_read = NULL;
-      cache_sm.set_lookup_url(second_cache_sm->get_lookup_url());
-      second_cache_sm->set_lookup_url(NULL);
-      cache_sm.cache_read_vc = second_cache_sm->cache_read_vc;
-      second_cache_sm->cache_read_vc = NULL;
-      cache_sm.read_locked = second_cache_sm->read_locked;
-      cache_sm.cache_write_vc = second_cache_sm->cache_write_vc;
-      second_cache_sm->cache_write_vc = NULL;
-      cache_sm.write_locked = second_cache_sm->write_locked;
-    } else if (md5s == md5l) {
-      second_cache_sm->end_both();
-    } else {
-      cache_sm.end_both();
-      second_cache_sm->end_both();
-    }
-
-    second_cache_sm->mutex.clear();
-    delete second_cache_sm;
-    second_cache_sm = NULL;
-
-    result = cache_sm.cache_write_vc ? true : false;
-    if (result == false) {
-      t_state.cache_info.action = HttpTransact::CACHE_DO_NO_ACTION;
-    } else
-      DebugSM("http_cache_write", "[%" PRId64 "] cache write decide to use URL %s", sm_id, s_url->string_get(&t_state.arena));
-  }
-
-  return result;
-}
-
 void
 HttpSM::set_ua_half_close_flag()
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/059b9c84/proxy/http/HttpSM.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index 53069ff..0a0a23e 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -263,7 +263,6 @@ public:
   void add_history_entry(const char *fileline, int event, int reentrant);
   void add_cache_sm();
   bool is_private();
-  bool decide_cached_url(URL * s_url);
 
   TSClientProtoStack proto_stack;
   int64_t sm_id;


[05/50] [abbrv] git commit: TS-2630: Add lib/ts/apidefs.h to place common types

Posted by zw...@apache.org.
TS-2630: Add lib/ts/apidefs.h to place common types

The apidefs.h file is used to place common types that can be shared
between internal code and TS APIs.

It's hard to judge what types in api/ts/ts.h should be migrated to
lib/ts/apidefs.h, so this patch is just a beginning ...

Why I named it 'apidefs.h' instead of 'defs.h' and put it into 'lib/ts'?
 1) Firstly, there is a 'ink_defs.h' file in 'lib/ts', then 'defs.h' seems
    too similar with it. So named it 'apidefs.h' would be more clearly.

 2) Since 'apidefs.h' will be shared not only by 'iocore' modules, puting it
    into 'lib/ts' would be more suitable than 'iocore/api' or any other else.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>


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

Branch: refs/heads/lua_config
Commit: 175dbca3718db208a24d1544fa468ca87cdfe0d2
Parents: b7172b4
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Fri Mar 14 16:29:17 2014 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Fri Mar 14 19:26:28 2014 +0800

----------------------------------------------------------------------
 .gitignore                                      |    1 -
 configure.ac                                    |    2 +-
 iocore/aio/Makefile.am                          |    2 -
 iocore/cache/Makefile.am                        |    2 -
 iocore/cluster/Makefile.am                      |    2 -
 iocore/dns/Makefile.am                          |    2 -
 iocore/eventsystem/Makefile.am                  |    2 -
 iocore/hostdb/Makefile.am                       |    2 -
 iocore/net/I_NetVConnection.h                   |    2 +-
 iocore/net/Makefile.am                          |    2 -
 iocore/net/SSLNextProtocolSet.cc                |    2 +-
 lib/atscppapi/examples/data_caching/Makefile.am |    2 +-
 lib/atscppapi/src/Makefile.am                   |    1 -
 lib/ts/Makefile.am                              |    3 +
 lib/ts/apidefs.h.in                             | 1170 ++++++
 lib/wccp/Makefile.am                            |    3 +-
 mgmt/Makefile.am                                |    2 -
 proxy/Makefile.am                               |    1 -
 proxy/api/ts/ts.h                               | 2278 ++++++++++++
 proxy/api/ts/ts.h.in                            | 3398 ------------------
 proxy/congest/Makefile.am                       |    2 -
 proxy/http/Makefile.am                          |    2 -
 proxy/http/remap/Makefile.am                    |    2 -
 proxy/logging/Makefile.am                       |    2 -
 proxy/shared/Makefile.am                        |    1 -
 25 files changed, 3456 insertions(+), 3432 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index e9e0b21..7ba5f45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,7 +104,6 @@ rc/trafficserver.conf
 rc/trafficserver.service
 
 proxy/api/include/ts
-proxy/api/ts/ts.h
 example/app-template/tsapp
 example/app-template/records.config
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 7460f7c..75ec359 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1913,6 +1913,7 @@ AC_CONFIG_FILES([
   lib/Makefile
   lib/records/Makefile
   lib/ts/Makefile
+  lib/ts/apidefs.h
   lib/ts/ink_config.h
   lib/tsconfig/Makefile
   lib/atscppapi/Makefile
@@ -1979,7 +1980,6 @@ AC_CONFIG_FILES([
   plugins/stats_over_http/Makefile
   proxy/Makefile
   proxy/api/ts/Makefile
-  proxy/api/ts/ts.h
   proxy/config/Makefile
   proxy/config/body_factory/Makefile
   proxy/config/body_factory/default/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/aio/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am
index 20c619d..df648f8 100644
--- a/iocore/aio/Makefile.am
+++ b/iocore/aio/Makefile.am
@@ -38,9 +38,7 @@ test_AIO_SOURCES = \
 
 test_AIO_CXXFLAGS = \
   $(iocore_include_dirs) \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/api \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/hdrs \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/cache/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index 2419ca0..82e9de5 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -21,9 +21,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/http \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/cluster/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/cluster/Makefile.am b/iocore/cluster/Makefile.am
index 7c5204a..ccc0afc 100644
--- a/iocore/cluster/Makefile.am
+++ b/iocore/cluster/Makefile.am
@@ -23,9 +23,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/proxy/hdrs \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/preparse \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/dns/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/dns/Makefile.am b/iocore/dns/Makefile.am
index 91de208..5a002fd 100644
--- a/iocore/dns/Makefile.am
+++ b/iocore/dns/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/proxy \
-  -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/mgmt \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/eventsystem/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index a1caa3c..2cceaaa 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -73,9 +73,7 @@ check_PROGRAMS = test_Buffer test_Event
 
 test_CXXFLAGS = \
   $(iocore_include_dirs) \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/api \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/hdrs \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/hostdb/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am
index b84220c..1ad06f7 100644
--- a/iocore/hostdb/Makefile.am
+++ b/iocore/hostdb/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/proxy \
-  -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/mgmt \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/net/I_NetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index b3df6c6..ef94825 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -31,7 +31,7 @@
 #include "List.h"
 #include "I_IOBuffer.h"
 #include "I_Socks.h"
-#include "ts.h"
+#include "apidefs.h"
 
 #define CONNECT_SUCCESS   1
 #define CONNECT_FAILURE   0

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/net/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 66eb680..4575e9e 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/proxy \
-  -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/shared \
   -I$(top_srcdir)/mgmt \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/iocore/net/SSLNextProtocolSet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index e2bc86c..148a6d1 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -22,7 +22,7 @@
  */
 
 #include "ink_config.h"
-#include "ts.h"
+#include "apidefs.h"
 #include "libts.h"
 #include "P_SSLNextProtocolSet.h"
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/lib/atscppapi/examples/data_caching/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/data_caching/Makefile.am b/lib/atscppapi/examples/data_caching/Makefile.am
index e2e83e8..a0a8cd7 100644
--- a/lib/atscppapi/examples/data_caching/Makefile.am
+++ b/lib/atscppapi/examples/data_caching/Makefile.am
@@ -14,7 +14,7 @@
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
-AM_CPPFLAGS =   -I$(top_builddir)/proxy/api \
+AM_CPPFLAGS = \
   -I$(top_srcdir)/proxy/api \
   -I$(top_builddir)/lib/ts \
   -I$(top_srcdir)/lib/ts \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/lib/atscppapi/src/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Makefile.am b/lib/atscppapi/src/Makefile.am
index 346bdee..b2c721b 100644
--- a/lib/atscppapi/src/Makefile.am
+++ b/lib/atscppapi/src/Makefile.am
@@ -18,7 +18,6 @@
 TS_PLUGIN_CPPFLAGS = \
   -D__STDC_LIMIT_MACROS=1 \
   -D__STDC_FORMAT_MACROS=1 \
-  -I$(top_builddir)/proxy/api \
   -I$(top_srcdir)/proxy/api \
   -I$(top_builddir)/lib/ts \
   -I$(top_srcdir)/lib/ts

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/lib/ts/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/ts/Makefile.am b/lib/ts/Makefile.am
index b5b5fb5..0faf502 100644
--- a/lib/ts/Makefile.am
+++ b/lib/ts/Makefile.am
@@ -15,6 +15,9 @@
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
+includedir=$(prefix)/include/ts
+
+include_HEADERS = apidefs.h
 
 noinst_PROGRAMS = mkdfa CompileParseRules
 check_PROGRAMS = test_atomic test_freelist test_arena test_List test_Map test_Vec

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/lib/ts/apidefs.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
new file mode 100644
index 0000000..86a650f
--- /dev/null
+++ b/lib/ts/apidefs.h.in
@@ -0,0 +1,1170 @@
+/** @file
+
+  This header file defines common types that can be shared
+  between internal code and TS APIs.
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  @section developers Developers
+
+  Developers, when adding a new element to an enum, append it. DO NOT
+  insert it.  Otherwise, binary compatibility of plugins will be broken!
+
+ */
+
+#ifndef __TS_TYPES_H__
+#define __TS_TYPES_H__
+
+/*
+ * ATS Plugin just needs to include <ts/ts.h>,
+ * should not include this file directly!
+ *
+ */
+
+/* GENERATED FILE WARNING!  DO NOT EDIT apidefs.h
+ *
+ * You must modify apidefs.h.in instead.
+ *
+ */
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#ifndef tsapi
+#define tsapi
+#endif
+
+#if !defined(TS_PRINTFLIKE)
+#if defined(__GNUC__) || defined(__clang__)
+#define TS_PRINTFLIKE(fmt, arg) __attribute__((format(printf, fmt, arg)))
+#else
+#define TS_PRINTFLIKE(fmt, arg)
+#endif
+#endif
+
+#if !defined(TS_NORETURN)
+#if defined(__GNUC__) || defined(__clang__)
+#define TS_NORETURN __attribute__((noreturn))
+#else
+#define TS_NORETURN
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+  /* Version info
+   */
+#define TS_VERSION_STRING             "@TS_VERSION_STRING@"
+#define TS_VERSION_NUMBER              @TS_VERSION_NUMBER@
+#define TS_VERSION_MAJOR               @TS_VERSION_MAJOR@
+#define TS_VERSION_MINOR               @TS_VERSION_MINOR@
+#define TS_VERSION_MICRO               @TS_VERSION_MICRO@
+
+#define TS_HTTP_VERSION(a,b)  ((((a) & 0xFFFF) << 16) | ((b) & 0xFFFF))
+#define TS_HTTP_MINOR(v)      ((v) & 0xFFFF)
+#define TS_HTTP_MAJOR(v)      (((v) >> 16) & 0xFFFF)
+#define __TS_RES_PATH(x)   #x
+#define _TS_RES_PATH(x)    __TS_RES_PATH (x)
+#define TS_RES_PATH(x)     x __FILE__ ":" _TS_RES_PATH (__LINE__)
+#define TS_RES_MEM_PATH    TS_RES_PATH ("memory/")
+#define TS_MAX_USER_NAME_LEN 256
+
+#ifndef TS_DEPRECATED
+#define TS_DEPRECATED __attribute__ ((deprecated))
+#endif
+
+  /**
+      TSClientProtoStack represents what protocols are used by
+      the client. It may be composed by several TSProtoType.
+
+      The value of TSProtoType indicates bit-offset that can
+      be mapped to TSClientProtoStack by bit shifting.
+
+      For example, TLS+SPDY can be mapped to protocol stack:
+        proto_stack = (1u << TS_PROTO_TLS) | (1u << TS_PROTO_SPDY)
+
+      For the sake of brevity, TS_PROTO_TCP is usually omitted in
+      protocol stack.
+   */
+  typedef enum {
+    /* Transport protocols (0~11) */
+    TS_PROTO_UDP = 0,
+    TS_PROTO_TCP = 1,
+    TS_PROTO_TLS = 2,   /* TLS/SSL */
+
+    /* Application protocols (12~31) */
+    TS_PROTO_HTTP = 12,
+    TS_PROTO_SPDY = 13,
+    TS_PROTO_RTMP = 14,
+    TS_PROTO_WBSK = 15, /* WebSocket */
+  } TSProtoType;
+
+  typedef uint32_t TSClientProtoStack;
+
+  /**
+      The following struct is used by TSPluginRegister(). It stores
+      registration information about the plugin.
+
+   */
+  typedef struct
+  {
+    char* plugin_name;
+    char* vendor_name;
+    char* support_email;
+  } TSPluginRegistrationInfo;
+
+  /**
+      This set of enums are possible values returned by
+      TSHttpHdrParseReq() and TSHttpHdrParseResp().
+
+   */
+  typedef enum
+  {
+    TS_PARSE_ERROR = -1,
+    TS_PARSE_DONE = 0,
+    TS_PARSE_OK = 1,
+    TS_PARSE_CONT = 2
+  } TSParseResult;
+
+  /**
+      This set of enums represents the possible HTTP types that
+      can be assigned to an HTTP header. When a header is created
+      with TSHttpHdrCreate(), it is automatically assigned a type of
+      TS_HTTP_TYPE_UNKNOWN. You can modify the HTTP type ONCE after it
+      the header is created, using TSHttpHdrTypeSet(). After setting the
+      HTTP type once, you cannot set it again. Use TSHttpHdrTypeGet()
+      to obtain the TSHttpType of an HTTP header.
+
+   */
+  typedef enum
+  {
+    TS_HTTP_TYPE_UNKNOWN,
+    TS_HTTP_TYPE_REQUEST,
+    TS_HTTP_TYPE_RESPONSE
+  } TSHttpType;
+
+  /**
+      This set of enums represents possible return values from
+      TSHttpHdrStatusGet(), which retrieves the status code from an
+      HTTP response header (TSHttpHdrStatusGet() retrieves status codes
+      only from headers of type TS_HTTP_TYPE_RESPONSE). You can also set
+      the TSHttpStatus of a response header using TSHttpHdrStatusSet().
+
+   */
+  typedef enum
+  {
+    TS_HTTP_STATUS_NONE = 0,
+
+    TS_HTTP_STATUS_CONTINUE = 100,
+    TS_HTTP_STATUS_SWITCHING_PROTOCOL = 101,
+
+    TS_HTTP_STATUS_OK = 200,
+    TS_HTTP_STATUS_CREATED = 201,
+    TS_HTTP_STATUS_ACCEPTED = 202,
+    TS_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
+    TS_HTTP_STATUS_NO_CONTENT = 204,
+    TS_HTTP_STATUS_RESET_CONTENT = 205,
+    TS_HTTP_STATUS_PARTIAL_CONTENT = 206,
+    TS_HTTP_STATUS_MULTI_STATUS = 207,
+    TS_HTTP_STATUS_ALREADY_REPORTED = 208,
+    TS_HTTP_STATUS_IM_USED = 211,
+
+    TS_HTTP_STATUS_MULTIPLE_CHOICES = 300,
+    TS_HTTP_STATUS_MOVED_PERMANENTLY = 301,
+    TS_HTTP_STATUS_MOVED_TEMPORARILY = 302,
+    TS_HTTP_STATUS_SEE_OTHER = 303,
+    TS_HTTP_STATUS_NOT_MODIFIED = 304,
+    TS_HTTP_STATUS_USE_PROXY = 305,
+    TS_HTTP_STATUS_TEMPORARY_REDIRECT = 307,
+    TS_HTTP_STATUS_PERMANENT_REDIRECT = 308,
+
+    TS_HTTP_STATUS_BAD_REQUEST = 400,
+    TS_HTTP_STATUS_UNAUTHORIZED = 401,
+    TS_HTTP_STATUS_PAYMENT_REQUIRED = 402,
+    TS_HTTP_STATUS_FORBIDDEN = 403,
+    TS_HTTP_STATUS_NOT_FOUND = 404,
+    TS_HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
+    TS_HTTP_STATUS_NOT_ACCEPTABLE = 406,
+    TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
+    TS_HTTP_STATUS_REQUEST_TIMEOUT = 408,
+    TS_HTTP_STATUS_CONFLICT = 409,
+    TS_HTTP_STATUS_GONE = 410,
+    TS_HTTP_STATUS_LENGTH_REQUIRED = 411,
+    TS_HTTP_STATUS_PRECONDITION_FAILED = 412,
+    TS_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413,
+    TS_HTTP_STATUS_REQUEST_URI_TOO_LONG = 414,
+    TS_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,
+    TS_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
+    TS_HTTP_STATUS_EXPECTATION_FAILED = 417,
+    TS_HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
+    TS_HTTP_STATUS_LOCKED = 423,
+    TS_HTTP_STATUS_FAILED_DEPENDENCY = 424,
+    TS_HTTP_STATUS_UPGRADE_REQUIRED = 426,
+    TS_HTTP_STATUS_PRECONDITION_REQUIRED = 428,
+    TS_HTTP_STATUS_TOO_MANY_REQUESTS = 429,
+    TS_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
+
+    TS_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
+    TS_HTTP_STATUS_NOT_IMPLEMENTED = 501,
+    TS_HTTP_STATUS_BAD_GATEWAY = 502,
+    TS_HTTP_STATUS_SERVICE_UNAVAILABLE = 503,
+    TS_HTTP_STATUS_GATEWAY_TIMEOUT = 504,
+    TS_HTTP_STATUS_HTTPVER_NOT_SUPPORTED = 505,
+    TS_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506,
+    TS_HTTP_STATUS_INSUFFICIENT_STORAGE = 507,
+    TS_HTTP_STATUS_LOOP_DETECTED = 508,
+    TS_HTTP_STATUS_NOT_EXTENDED = 510,
+    TS_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
+
+  } TSHttpStatus;
+
+  /**
+      This set of enums represents the possible hooks where you can
+      set up continuation callbacks. The functions used to register a
+      continuation for a particular hook are:
+
+      TSHttpHookAdd: adds a global hook. You can globally add
+      any hook except for
+       - TS_HTTP_REQUEST_TRANSFORM_HOOK
+       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
+       - TS_HTTP_RESPONSE_CLIENT_HOOK
+
+      The following hooks can ONLY be added globally:
+       - TS_HTTP_SELECT_ALT_HOOK
+       - TS_HTTP_SSN_START_HOOK
+       - TS_HTTP_SSN_CLOSE_HOOK
+
+      TSHttpSsnHookAdd: adds a transaction hook to each transaction
+      within a session. You can only use transaction hooks with this call:
+       - TS_HTTP_READ_REQUEST_HDR_HOOK
+       - TS_HTTP_OS_DNS_HOOK
+       - TS_HTTP_SEND_REQUEST_HDR_HOOK
+       - TS_HTTP_READ_CACHE_HDR_HOOK
+       - TS_HTTP_READ_RESPONSE_HDR_HOOK
+       - TS_HTTP_SEND_RESPONSE_HDR_HOOK
+       - TS_HTTP_REQUEST_TRANSFORM_HOOK
+       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
+       - TS_HTTP_RESPONSE_CLIENT_HOOK
+       - TS_HTTP_TXN_START_HOOK
+       - TS_HTTP_TXN_CLOSE_HOOK
+
+      TSHttpTxnHookAdd: adds a callback at a specific point within
+      an HTTP transaction. The following hooks can be used with this
+      function:
+       - TS_HTTP_READ_REQUEST_HDR_HOOK
+       - TS_HTTP_OS_DNS_HOOK
+       - TS_HTTP_SEND_REQUEST_HDR_HOOK
+       - TS_HTTP_READ_CACHE_HDR_HOOK
+       - TS_HTTP_READ_RESPONSE_HDR_HOOK
+       - TS_HTTP_SEND_RESPONSE_HDR_HOOK
+       - TS_HTTP_REQUEST_TRANSFORM_HOOK
+       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
+       - TS_HTTP_TXN_CLOSE_HOOK
+
+      The two transform hooks can ONLY be added as transaction hooks.
+
+      TS_HTTP_LAST_HOOK _must_ be the last element. Only right place
+      to insert a new element is just before TS_HTTP_LAST_HOOK.
+
+   */
+  typedef enum
+  {
+    TS_HTTP_READ_REQUEST_HDR_HOOK,
+    TS_HTTP_OS_DNS_HOOK,
+    TS_HTTP_SEND_REQUEST_HDR_HOOK,
+    TS_HTTP_READ_CACHE_HDR_HOOK,
+    TS_HTTP_READ_RESPONSE_HDR_HOOK,
+    TS_HTTP_SEND_RESPONSE_HDR_HOOK,
+    TS_HTTP_REQUEST_TRANSFORM_HOOK,
+    TS_HTTP_RESPONSE_TRANSFORM_HOOK,
+    TS_HTTP_SELECT_ALT_HOOK,
+    TS_HTTP_TXN_START_HOOK,
+    TS_HTTP_TXN_CLOSE_HOOK,
+    TS_HTTP_SSN_START_HOOK,
+    TS_HTTP_SSN_CLOSE_HOOK,
+    TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK,
+    TS_HTTP_PRE_REMAP_HOOK,
+    TS_HTTP_POST_REMAP_HOOK,
+    TS_HTTP_RESPONSE_CLIENT_HOOK,
+    TS_HTTP_LAST_HOOK
+  } TSHttpHookID;
+  #define TS_HTTP_READ_REQUEST_PRE_REMAP_HOOK TS_HTTP_PRE_REMAP_HOOK  /* backwards compat */
+
+  /** Plugin lifecycle hooks.
+
+      These are called during lifecycle events of a plugin. They
+      should be set in the plugin initialization function. The
+      continuation is invoked with an event ID specified for each hook
+      and @c NULL for the event data.
+
+      TS_LIFECYCLE_PORTS_INITIALIZED_HOOK
+
+        called once, after the HTTP proxy port data structures have
+        been initialized. In particular, SSL related calls that depend
+        on accept endpoints may be invoked. After this hook is
+        finished, the proxy port sockets are opened and connections
+        are accepted.
+
+        Event: TS_EVENT_LIFECYCLE_PORTS_INITIALIZED
+
+      TS_LIFECYCLE_PORTS_READY_HOOK
+
+        called once, after the sockets have been opened and the accept
+        threads have been started. That is, the ports are ready to
+        accept connections. This is *not* guaranteed to be called
+        before the first connection is accepted.
+
+        Event: TS_EVENT_LIFECYCLE_PORTS_READY_HOOK
+
+      TS_LIFECYCLE_CACHE_READY_HOOK
+
+        called once, after the cache has finished its
+        initialization. It is either online or has failed when this
+        hook is called.
+
+        Event: TS_EVENT_LIFECYCLE_CACHE_READY
+
+      TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK
+
+        called every time after a server SSL_CTX has finished the initialization.
+        It exposes the initialized SSL_CTX pointer.
+
+        Event: TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED
+
+      TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK
+
+        called once, after the client SSL_CTX has finished the initialization.
+        It exposes the initialized SSL_CTX pointer.
+
+        Event: TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED
+
+      Ordering guarantees:
+
+      - TS_LIFECYCLE_PORTS_INITIALIZED_HOOK before TS_LIFECYCLE_PORTS_READY_HOOK.
+
+      NOTE! ONLY the orderings EXPLICITLY mentioned above are guaranteed.
+      
+   */
+  typedef enum
+  {
+    TS_LIFECYCLE_PORTS_INITIALIZED_HOOK,
+    TS_LIFECYCLE_PORTS_READY_HOOK,
+    TS_LIFECYCLE_CACHE_READY_HOOK,
+    TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK,
+    TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK,
+    TS_LIFECYCLE_LAST_HOOK
+  } TSLifecycleHookID;
+
+  /**
+      TSEvents are sent to continuations when they are called back.
+      The TSEvent provides the continuation's handler function with
+      information about the callback. Based on the event it receives,
+      the handler function can decide what to do.
+
+   */
+  typedef enum
+  {
+    TS_EVENT_NONE = 0,
+    TS_EVENT_IMMEDIATE = 1,
+    TS_EVENT_TIMEOUT = 2,
+    TS_EVENT_ERROR = 3,
+    TS_EVENT_CONTINUE = 4,
+
+    TS_EVENT_VCONN_READ_READY = 100,
+    TS_EVENT_VCONN_WRITE_READY = 101,
+    TS_EVENT_VCONN_READ_COMPLETE = 102,
+    TS_EVENT_VCONN_WRITE_COMPLETE = 103,
+    TS_EVENT_VCONN_EOS = 104,
+    TS_EVENT_VCONN_INACTIVITY_TIMEOUT = 105,
+
+    TS_EVENT_NET_CONNECT = 200,
+    TS_EVENT_NET_CONNECT_FAILED = 201,
+    TS_EVENT_NET_ACCEPT = 202,
+    TS_EVENT_NET_ACCEPT_FAILED = 204,
+
+    /* EVENTS 206 - 212 for internal use */
+    TS_EVENT_INTERNAL_206 = 206,
+    TS_EVENT_INTERNAL_207 = 207,
+    TS_EVENT_INTERNAL_208 = 208,
+    TS_EVENT_INTERNAL_209 = 209,
+    TS_EVENT_INTERNAL_210 = 210,
+    TS_EVENT_INTERNAL_211 = 211,
+    TS_EVENT_INTERNAL_212 = 212,
+
+    TS_EVENT_HOST_LOOKUP = 500,
+    TS_EVENT_CACHE_OPEN_READ = 1102,
+    TS_EVENT_CACHE_OPEN_READ_FAILED = 1103,
+    TS_EVENT_CACHE_OPEN_WRITE = 1108,
+    TS_EVENT_CACHE_OPEN_WRITE_FAILED = 1109,
+    TS_EVENT_CACHE_REMOVE = 1112,
+    TS_EVENT_CACHE_REMOVE_FAILED = 1113,
+    TS_EVENT_CACHE_SCAN = 1120,
+    TS_EVENT_CACHE_SCAN_FAILED = 1121,
+    TS_EVENT_CACHE_SCAN_OBJECT = 1122,
+    TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED = 1123,
+    TS_EVENT_CACHE_SCAN_OPERATION_FAILED = 1124,
+    TS_EVENT_CACHE_SCAN_DONE = 1125,
+
+    TS_EVENT_CACHE_LOOKUP = 1126,
+    TS_EVENT_CACHE_READ = 1127,
+    TS_EVENT_CACHE_DELETE = 1128,
+    TS_EVENT_CACHE_WRITE = 1129,
+    TS_EVENT_CACHE_WRITE_HEADER = 1130,
+    TS_EVENT_CACHE_CLOSE = 1131,
+    TS_EVENT_CACHE_LOOKUP_READY = 1132,
+    TS_EVENT_CACHE_LOOKUP_COMPLETE = 1133,
+    TS_EVENT_CACHE_READ_READY = 1134,
+    TS_EVENT_CACHE_READ_COMPLETE = 1135,
+
+    /* EVENT 1200 for internal use */
+    TS_EVENT_INTERNAL_1200 = 1200,
+
+    /* EVENT 3900 is corresponding to event AIO_EVENT_DONE defined in I_AIO.h */
+    TS_AIO_EVENT_DONE = 3900,
+
+    TS_EVENT_HTTP_CONTINUE = 60000,
+    TS_EVENT_HTTP_ERROR = 60001,
+    TS_EVENT_HTTP_READ_REQUEST_HDR = 60002,
+    TS_EVENT_HTTP_OS_DNS = 60003,
+    TS_EVENT_HTTP_SEND_REQUEST_HDR = 60004,
+    TS_EVENT_HTTP_READ_CACHE_HDR = 60005,
+    TS_EVENT_HTTP_READ_RESPONSE_HDR = 60006,
+    TS_EVENT_HTTP_SEND_RESPONSE_HDR = 60007,
+    TS_EVENT_HTTP_REQUEST_TRANSFORM = 60008,
+    TS_EVENT_HTTP_RESPONSE_TRANSFORM = 60009,
+    TS_EVENT_HTTP_SELECT_ALT = 60010,
+    TS_EVENT_HTTP_TXN_START = 60011,
+    TS_EVENT_HTTP_TXN_CLOSE = 60012,
+    TS_EVENT_HTTP_SSN_START = 60013,
+    TS_EVENT_HTTP_SSN_CLOSE = 60014,
+    TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE = 60015,
+    TS_EVENT_HTTP_PRE_REMAP = 60016,
+    TS_EVENT_HTTP_POST_REMAP = 60017,
+    TS_EVENT_LIFECYCLE_PORTS_INITIALIZED = 60018,
+    TS_EVENT_LIFECYCLE_PORTS_READY = 60019,
+    TS_EVENT_LIFECYCLE_CACHE_READY = 60020,
+    TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED = 60021,
+    TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED = 60022,
+    TS_EVENT_MGMT_UPDATE = 60100,
+
+    /* EVENTS 60200 - 60202 for internal use */
+    TS_EVENT_INTERNAL_60200 = 60200,
+    TS_EVENT_INTERNAL_60201 = 60201,
+    TS_EVENT_INTERNAL_60202 = 60202
+  } TSEvent;
+  #define TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP TS_EVENT_HTTP_PRE_REMAP /* backwards compat */
+
+  typedef enum
+  { TS_SRVSTATE_STATE_UNDEFINED = 0,
+    TS_SRVSTATE_ACTIVE_TIMEOUT,
+    TS_SRVSTATE_BAD_INCOMING_RESPONSE,
+    TS_SRVSTATE_CONNECTION_ALIVE,
+    TS_SRVSTATE_CONNECTION_CLOSED,
+    TS_SRVSTATE_CONNECTION_ERROR,
+    TS_SRVSTATE_INACTIVE_TIMEOUT,
+    TS_SRVSTATE_OPEN_RAW_ERROR,
+    TS_SRVSTATE_PARSE_ERROR,
+    TS_SRVSTATE_TRANSACTION_COMPLETE,
+    TS_SRVSTATE_CONGEST_CONTROL_CONGESTED_ON_F,
+    TS_SRVSTATE_CONGEST_CONTROL_CONGESTED_ON_M
+  } TSServerState;
+
+  typedef enum
+  {
+    TS_LOOKUP_UNDEFINED_LOOKUP,
+    TS_LOOKUP_ICP_SUGGESTED_HOST,
+    TS_LOOKUP_PARENT_PROXY,
+    TS_LOOKUP_ORIGIN_SERVER,
+    TS_LOOKUP_INCOMING_ROUTER,
+    TS_LOOKUP_HOST_NONE
+  } TSLookingUpType;
+
+  typedef enum
+  {
+    TS_CACHE_LOOKUP_MISS,
+    TS_CACHE_LOOKUP_HIT_STALE,
+    TS_CACHE_LOOKUP_HIT_FRESH,
+    TS_CACHE_LOOKUP_SKIPPED
+  } TSCacheLookupResult;
+
+  typedef enum
+  {
+    TS_CACHE_DATA_TYPE_NONE,
+    TS_CACHE_DATA_TYPE_HTTP,
+    TS_CACHE_DATA_TYPE_OTHER
+  } TSCacheDataType;
+
+  typedef enum
+  {
+    TS_CACHE_ERROR_NO_DOC = -20400,
+    TS_CACHE_ERROR_DOC_BUSY = -20401,
+    TS_CACHE_ERROR_NOT_READY = -20407
+  } TSCacheError;
+
+  typedef enum
+  {
+    TS_CACHE_SCAN_RESULT_DONE = 0,
+    TS_CACHE_SCAN_RESULT_CONTINUE = 1,
+    TS_CACHE_SCAN_RESULT_DELETE = 10,
+    TS_CACHE_SCAN_RESULT_DELETE_ALL_ALTERNATES,
+    TS_CACHE_SCAN_RESULT_UPDATE,
+    TS_CACHE_SCAN_RESULT_RETRY
+  } TSCacheScanResult;
+
+  typedef enum
+  {
+    TS_VC_CLOSE_ABORT = -1,
+    TS_VC_CLOSE_NORMAL = 1
+  } TSVConnCloseFlags;
+
+  typedef enum
+  {
+    TS_IOBUFFER_SIZE_INDEX_128 = 0,
+    TS_IOBUFFER_SIZE_INDEX_256 = 1,
+    TS_IOBUFFER_SIZE_INDEX_512 = 2,
+    TS_IOBUFFER_SIZE_INDEX_1K = 3,
+    TS_IOBUFFER_SIZE_INDEX_2K = 4,
+    TS_IOBUFFER_SIZE_INDEX_4K = 5,
+    TS_IOBUFFER_SIZE_INDEX_8K = 6,
+    TS_IOBUFFER_SIZE_INDEX_16K = 7,
+    TS_IOBUFFER_SIZE_INDEX_32K = 8
+  } TSIOBufferSizeIndex;
+
+  /**
+      Starting 2.0, SDK now follows same versioning as Traffic Server.
+   */
+  typedef enum
+  {
+    TS_SDK_VERSION_2_0 = 0,
+    TS_SDK_VERSION_3_0
+  } TSSDKVersion;
+
+  typedef enum
+  {
+    TS_ERROR = -1,
+    TS_SUCCESS = 0
+  } TSReturnCode;
+
+  typedef enum
+  {
+    NO_CALLBACK = 0,
+    AFTER_HEADER ,
+    AFTER_BODY
+  } TSFetchWakeUpOptions;
+
+#ifndef _HTTP_PROXY_API_ENUMS_H_
+#define _HTTP_PROXY_API_ENUMS_H_
+  /// Server session sharing values - match
+  /// Must be identical to definition in HttpProxyAPIEnums.h
+  typedef enum
+  {
+    TS_SERVER_SESSION_SHARING_MATCH_NONE,
+    TS_SERVER_SESSION_SHARING_MATCH_BOTH,
+    TS_SERVER_SESSION_SHARING_MATCH_IP,
+    TS_SERVER_SESSION_SHARING_MATCH_HOST
+  } TSServerSessionSharingMatchType;
+
+  /// Server session sharing values - pool
+  /// Must be identical to definition in HttpProxyAPIEnums.h
+  typedef enum
+  {
+    TS_SERVER_SESSION_SHARING_POOL_GLOBAL,
+    TS_SERVER_SESSION_SHARING_POOL_THREAD
+  } TSServerSessionSharingPoolType;
+#endif
+
+  /* librecords types */
+
+  /* The values of this enum must match enum RecT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDTYPE_NULL = 0,
+      TS_RECORDTYPE_CONFIG = 1,
+      TS_RECORDTYPE_PROCESS = 2,
+      TS_RECORDTYPE_NODE = 4,
+      TS_RECORDTYPE_CLUSTER = 8,
+      TS_RECORDTYPE_LOCAL = 16,
+      TS_RECORDTYPE_PLUGIN = 32,
+      TS_RECORDTYPE_ALL = 63
+    } TSRecordType;
+
+  /* The values of this enum must match enum RecDataT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDDATATYPE_NULL = 0,
+      TS_RECORDDATATYPE_INT,
+      TS_RECORDDATATYPE_FLOAT,
+      TS_RECORDDATATYPE_STRING,
+      TS_RECORDDATATYPE_COUNTER,
+      TS_RECORDDATATYPE_STAT_CONST,
+      TS_RECORDDATATYPE_STAT_FX,
+      TS_RECORDDATATYPE_MAX
+    } TSRecordDataType;
+
+  typedef union
+  {
+    int64_t rec_int;
+    float rec_float;
+    char* rec_string;
+    int64_t rec_counter;
+  } TSRecordData;
+
+  /* The values of this enum must match enum RecPersistT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDP_NULL,
+      TS_RECORDP_PERSISTENT,
+      TS_RECORDP_NON_PERSISTENT
+    } TSRecordPersistType;
+
+  /* The values of this enum must match enum RecUpdateT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDUPDATE_NULL,
+      TS_RECORDUPDATE_DYNAMIC,
+      TS_RECORDUPDATE_RESTART_TS,
+      TS_RECORDUPDATE_RESTART_TM,
+      TS_RECORDUPDATE_RESTART_TC
+    } TSRecordUpdateType;
+
+  /* The values of this enum must match enum RecCheckT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDCHECK_NULL,
+      TS_RECORDCHECK_STR,
+      TS_RECORDCHECK_INT,
+      TS_RECORDCHECK_IP
+    } TSRecordCheckType;
+
+  /* The values of this enum must match enum RecModeT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDMODE_NULL,
+      TS_RECORDMODE_CLIENT,
+      TS_RECORDMODE_SERVER,
+      TS_RECORDMODE_STAND_ALONE
+    } TSRecordModeType;
+
+  /* The values of this enum must match enum RecAccessT in I_RecDefs.h */
+  typedef enum
+    {
+      TS_RECORDACCESS_NULL,
+      TS_RECORDACCESS_NO_ACCESS,
+      TS_RECORDACCESS_READ_ONLY
+    } TSRecordAccessType;
+
+  typedef enum
+  {
+    TS_CONFIG_NULL = -1,
+    TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR,
+    TS_CONFIG_HTTP_CHUNKING_ENABLED,
+    TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED,
+    TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME,
+    TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE,
+    TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN,
+    TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT,
+    TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT,
+    TS_CONFIG_HTTP_SHARE_SERVER_SESSIONS, // DEPRECATED
+    TS_CONFIG_HTTP_SERVER_SESSION_SHARING_POOL,
+    TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH,
+    TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT,
+    TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT,
+    TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT,
+    TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT,
+    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM,
+    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER,
+    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT,
+    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE,
+    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP,
+    TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP,
+    TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
+    TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
+    TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND,
+    TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
+    TS_CONFIG_HTTP_CACHE_HTTP,
+    TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL,
+    TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,
+    TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE,
+    TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE,
+    TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE,
+    TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES,
+    TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION,
+    TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC,
+    TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS,
+    TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR,
+    TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR,
+    TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,
+    TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME,
+    TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME,
+    TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME,
+    TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE,
+    TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN,
+    TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT,
+    TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN,
+    TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT,
+    TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT,
+    TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS,
+    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES,
+    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER,
+    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
+    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
+    TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
+    TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
+    TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
+    TS_CONFIG_HTTP_CACHE_FUZZ_TIME,
+    TS_CONFIG_HTTP_CACHE_FUZZ_MIN_TIME,
+    TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
+    TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT,
+    TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
+    TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR,
+    TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY,
+    TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD,
+    TS_CONFIG_NET_SOCK_PACKET_MARK_OUT,
+    TS_CONFIG_NET_SOCK_PACKET_TOS_OUT,
+    TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE,
+    TS_CONFIG_HTTP_CHUNKING_SIZE,
+    TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
+    TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
+    TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
+    TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
+    TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
+    TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
+    TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
+    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
+    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
+    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
+    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
+    TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED,
+    TS_CONFIG_SSL_HSTS_MAX_AGE,
+    TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS,
+    TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME,
+    TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES,
+    TS_CONFIG_LAST_ENTRY
+  } TSOverridableConfigKey;
+
+  /* The TASK pool of threads is the primary method of off-loading continuations from the
+     net-threads. Configure this with proxy.config.task_threads in records.config. */
+  typedef enum
+    {
+      TS_THREAD_POOL_DEFAULT = -1,
+      TS_THREAD_POOL_NET,
+      TS_THREAD_POOL_TASK,
+      /* unlikely you should use these */
+      TS_THREAD_POOL_SSL,
+      TS_THREAD_POOL_DNS,
+      TS_THREAD_POOL_REMAP,
+      TS_THREAD_POOL_CLUSTER,
+      TS_THREAD_POOL_UDP
+    } TSThreadPool;
+
+  typedef int64_t TSHRTime;
+
+  /* The TSMilestonesType is an enum defining all the various milestones ("timers") that
+     we track for a request. */
+  typedef enum
+    {
+      TS_MILESTONE_NULL = -1,
+      TS_MILESTONE_UA_BEGIN,
+      TS_MILESTONE_UA_READ_HEADER_DONE,
+      TS_MILESTONE_UA_BEGIN_WRITE,
+      TS_MILESTONE_UA_CLOSE,
+      TS_MILESTONE_SERVER_FIRST_CONNECT,
+      TS_MILESTONE_SERVER_CONNECT,
+      TS_MILESTONE_SERVER_CONNECT_END,
+      TS_MILESTONE_SERVER_BEGIN_WRITE,
+      TS_MILESTONE_SERVER_FIRST_READ,
+      TS_MILESTONE_SERVER_READ_HEADER_DONE,
+      TS_MILESTONE_SERVER_CLOSE,
+      TS_MILESTONE_CACHE_OPEN_READ_BEGIN,
+      TS_MILESTONE_CACHE_OPEN_READ_END,
+      TS_MILESTONE_CACHE_OPEN_WRITE_BEGIN,
+      TS_MILESTONE_CACHE_OPEN_WRITE_END,
+      TS_MILESTONE_DNS_LOOKUP_BEGIN,
+      TS_MILESTONE_DNS_LOOKUP_END,
+      TS_MILESTONE_SM_START,
+      TS_MILESTONE_SM_FINISH,
+      TS_MILESTONE_LAST_ENTRY
+    } TSMilestonesType;
+
+
+  /* These typedefs are used with the corresponding TSMgmt*Get functions
+     for storing the values retrieved by those functions. For example,
+     TSMgmtCounterGet() retrieves an TSMgmtCounter. */
+  typedef int64_t TSMgmtInt;
+  typedef int64_t TSMgmtCounter;
+  typedef float TSMgmtFloat;
+  typedef char* TSMgmtString;
+
+  typedef struct tsapi_file* TSFile;
+
+  typedef struct tsapi_mloc* TSMLoc;
+  typedef struct tsapi_mbuffer* TSMBuffer;
+  typedef struct tsapi_httpssn* TSHttpSsn;
+  typedef struct tsapi_httptxn* TSHttpTxn;
+  typedef struct tsapi_httpaltinfo* TSHttpAltInfo;
+  typedef struct tsapi_mimeparser* TSMimeParser;
+  typedef struct tsapi_httpparser* TSHttpParser;
+  typedef struct tsapi_cachekey* TSCacheKey;
+  typedef struct tsapi_cachehttpinfo* TSCacheHttpInfo;
+  typedef struct tsapi_cachetxn* TSCacheTxn;
+
+  typedef struct tsapi_port* TSPortDescriptor;
+  typedef struct tsapi_vio* TSVIO;
+  typedef struct tsapi_thread* TSThread;
+  typedef struct tsapi_mutex* TSMutex;
+  typedef struct tsapi_config* TSConfig;
+  typedef struct tsapi_cont* TSCont;
+  typedef struct tsapi_cont* TSVConn; /* a VConn is really a specialized TSCont */
+  typedef struct tsapi_action* TSAction;
+  typedef struct tsapi_iobuffer* TSIOBuffer;
+  typedef struct tsapi_iobufferdata* TSIOBufferData;
+  typedef struct tsapi_bufferblock* TSIOBufferBlock;
+  typedef struct tsapi_bufferreader* TSIOBufferReader;
+  typedef struct tsapi_hostlookupresult* TSHostLookupResult;
+  typedef struct tsapi_aiocallback* TSAIOCallback;
+
+  typedef void *(*TSThreadFunc) (void* data);
+  typedef int (*TSEventFunc) (TSCont contp, TSEvent event, void* edata);
+  typedef void (*TSConfigDestroyFunc) (void* data);
+
+  typedef struct
+  {
+    int success_event_id;
+    int failure_event_id;
+    int timeout_event_id;
+  } TSFetchEvent;
+
+  typedef struct TSFetchUrlParams
+  {
+    const char* request;
+    int request_len;
+    struct sockaddr_storage ip;
+    int port;
+    TSCont contp;
+    TSFetchEvent events;
+    TSFetchWakeUpOptions options;
+    struct TSFetchUrlParams* next;
+  } TSFetchUrlParams_t;
+
+  /* --------------------------------------------------------------------------
+     Init */
+
+  /**
+      This function must be defined by all plugins. Traffic Server
+      calls this initialization routine when it loads the plugin (at
+      startup), and sets argc and argv appropriately based on the values
+      in plugin.config.
+
+      @param argc the number of initial values specified in plugin.config,
+        plus one. If only the name of your plugin shared object is
+        specified in plugin.config, argc=1.
+      @param argv the vector of arguments. The length of argv is argc.
+        argv[0] is the name of the plugin shared library. Subsequent
+        values of argv are initialization values specified in
+        plugin.config.
+
+   */
+  extern tsapi void TSPluginInit(int argc, const char* argv[]);
+
+  /* --------------------------------------------------------------------------
+     URL schemes */
+  extern tsapi const char* TS_URL_SCHEME_FILE;
+  extern tsapi const char* TS_URL_SCHEME_FTP;
+  extern tsapi const char* TS_URL_SCHEME_GOPHER;
+  extern tsapi const char* TS_URL_SCHEME_HTTP;
+  extern tsapi const char* TS_URL_SCHEME_HTTPS;
+  extern tsapi const char* TS_URL_SCHEME_MAILTO;
+  extern tsapi const char* TS_URL_SCHEME_NEWS;
+  extern tsapi const char* TS_URL_SCHEME_NNTP;
+  extern tsapi const char* TS_URL_SCHEME_PROSPERO;
+  extern tsapi const char* TS_URL_SCHEME_TELNET;
+  extern tsapi const char* TS_URL_SCHEME_TUNNEL;
+  extern tsapi const char* TS_URL_SCHEME_WAIS;
+  extern tsapi const char* TS_URL_SCHEME_PNM;
+  extern tsapi const char* TS_URL_SCHEME_RTSP;
+  extern tsapi const char* TS_URL_SCHEME_RTSPU;
+  extern tsapi const char* TS_URL_SCHEME_MMS;
+  extern tsapi const char* TS_URL_SCHEME_MMSU;
+  extern tsapi const char* TS_URL_SCHEME_MMST;
+
+  /* --------------------------------------------------------------------------
+     URL scheme string lengths */
+  extern tsapi int TS_URL_LEN_FILE;
+  extern tsapi int TS_URL_LEN_FTP;
+  extern tsapi int TS_URL_LEN_GOPHER;
+  extern tsapi int TS_URL_LEN_HTTP;
+  extern tsapi int TS_URL_LEN_HTTPS;
+  extern tsapi int TS_URL_LEN_MAILTO;
+  extern tsapi int TS_URL_LEN_NEWS;
+  extern tsapi int TS_URL_LEN_NNTP;
+  extern tsapi int TS_URL_LEN_PROSPERO;
+  extern tsapi int TS_URL_LEN_TELNET;
+  extern tsapi int TS_URL_LEN_WAIS;
+
+  /* --------------------------------------------------------------------------
+     MIME fields */
+  extern tsapi const char* TS_MIME_FIELD_ACCEPT;
+  extern tsapi const char* TS_MIME_FIELD_ACCEPT_CHARSET;
+  extern tsapi const char* TS_MIME_FIELD_ACCEPT_ENCODING;
+  extern tsapi const char* TS_MIME_FIELD_ACCEPT_LANGUAGE;
+  extern tsapi const char* TS_MIME_FIELD_ACCEPT_RANGES;
+  extern tsapi const char* TS_MIME_FIELD_AGE;
+  extern tsapi const char* TS_MIME_FIELD_ALLOW;
+  extern tsapi const char* TS_MIME_FIELD_APPROVED;
+  extern tsapi const char* TS_MIME_FIELD_AUTHORIZATION;
+  extern tsapi const char* TS_MIME_FIELD_BYTES;
+  extern tsapi const char* TS_MIME_FIELD_CACHE_CONTROL;
+  extern tsapi const char* TS_MIME_FIELD_CLIENT_IP;
+  extern tsapi const char* TS_MIME_FIELD_CONNECTION;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_BASE;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_ENCODING;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_LANGUAGE;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_LENGTH;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_LOCATION;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_MD5;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_RANGE;
+  extern tsapi const char* TS_MIME_FIELD_CONTENT_TYPE;
+  extern tsapi const char* TS_MIME_FIELD_CONTROL;
+  extern tsapi const char* TS_MIME_FIELD_COOKIE;
+  extern tsapi const char* TS_MIME_FIELD_DATE;
+  extern tsapi const char* TS_MIME_FIELD_DISTRIBUTION;
+  extern tsapi const char* TS_MIME_FIELD_ETAG;
+  extern tsapi const char* TS_MIME_FIELD_EXPECT;
+  extern tsapi const char* TS_MIME_FIELD_EXPIRES;
+  extern tsapi const char* TS_MIME_FIELD_FOLLOWUP_TO;
+  extern tsapi const char* TS_MIME_FIELD_FROM;
+  extern tsapi const char* TS_MIME_FIELD_HOST;
+  extern tsapi const char* TS_MIME_FIELD_IF_MATCH;
+  extern tsapi const char* TS_MIME_FIELD_IF_MODIFIED_SINCE;
+  extern tsapi const char* TS_MIME_FIELD_IF_NONE_MATCH;
+  extern tsapi const char* TS_MIME_FIELD_IF_RANGE;
+  extern tsapi const char* TS_MIME_FIELD_IF_UNMODIFIED_SINCE;
+  extern tsapi const char* TS_MIME_FIELD_KEEP_ALIVE;
+  extern tsapi const char* TS_MIME_FIELD_KEYWORDS;
+  extern tsapi const char* TS_MIME_FIELD_LAST_MODIFIED;
+  extern tsapi const char* TS_MIME_FIELD_LINES;
+  extern tsapi const char* TS_MIME_FIELD_LOCATION;
+  extern tsapi const char* TS_MIME_FIELD_MAX_FORWARDS;
+  extern tsapi const char* TS_MIME_FIELD_MESSAGE_ID;
+  extern tsapi const char* TS_MIME_FIELD_NEWSGROUPS;
+  extern tsapi const char* TS_MIME_FIELD_ORGANIZATION;
+  extern tsapi const char* TS_MIME_FIELD_PATH;
+  extern tsapi const char* TS_MIME_FIELD_PRAGMA;
+  extern tsapi const char* TS_MIME_FIELD_PROXY_AUTHENTICATE;
+  extern tsapi const char* TS_MIME_FIELD_PROXY_AUTHORIZATION;
+  extern tsapi const char* TS_MIME_FIELD_PROXY_CONNECTION;
+  extern tsapi const char* TS_MIME_FIELD_PUBLIC;
+  extern tsapi const char* TS_MIME_FIELD_RANGE;
+  extern tsapi const char* TS_MIME_FIELD_REFERENCES;
+  extern tsapi const char* TS_MIME_FIELD_REFERER;
+  extern tsapi const char* TS_MIME_FIELD_REPLY_TO;
+  extern tsapi const char* TS_MIME_FIELD_RETRY_AFTER;
+  extern tsapi const char* TS_MIME_FIELD_SENDER;
+  extern tsapi const char* TS_MIME_FIELD_SERVER;
+  extern tsapi const char* TS_MIME_FIELD_SET_COOKIE;
+  extern tsapi const char* TS_MIME_FIELD_STRICT_TRANSPORT_SECURITY;
+  extern tsapi const char* TS_MIME_FIELD_SUBJECT;
+  extern tsapi const char* TS_MIME_FIELD_SUMMARY;
+  extern tsapi const char* TS_MIME_FIELD_TE;
+  extern tsapi const char* TS_MIME_FIELD_TRANSFER_ENCODING;
+  extern tsapi const char* TS_MIME_FIELD_UPGRADE;
+  extern tsapi const char* TS_MIME_FIELD_USER_AGENT;
+  extern tsapi const char* TS_MIME_FIELD_VARY;
+  extern tsapi const char* TS_MIME_FIELD_VIA;
+  extern tsapi const char* TS_MIME_FIELD_WARNING;
+  extern tsapi const char* TS_MIME_FIELD_WWW_AUTHENTICATE;
+  extern tsapi const char* TS_MIME_FIELD_XREF;
+  extern tsapi const char* TS_MIME_FIELD_X_FORWARDED_FOR;
+
+  /* --------------------------------------------------------------------------
+     MIME fields string lengths */
+  extern tsapi int TS_MIME_LEN_ACCEPT;
+  extern tsapi int TS_MIME_LEN_ACCEPT_CHARSET;
+  extern tsapi int TS_MIME_LEN_ACCEPT_ENCODING;
+  extern tsapi int TS_MIME_LEN_ACCEPT_LANGUAGE;
+  extern tsapi int TS_MIME_LEN_ACCEPT_RANGES;
+  extern tsapi int TS_MIME_LEN_AGE;
+  extern tsapi int TS_MIME_LEN_ALLOW;
+  extern tsapi int TS_MIME_LEN_APPROVED;
+  extern tsapi int TS_MIME_LEN_AUTHORIZATION;
+  extern tsapi int TS_MIME_LEN_BYTES;
+  extern tsapi int TS_MIME_LEN_CACHE_CONTROL;
+  extern tsapi int TS_MIME_LEN_CLIENT_IP;
+  extern tsapi int TS_MIME_LEN_CONNECTION;
+  extern tsapi int TS_MIME_LEN_CONTENT_BASE;
+  extern tsapi int TS_MIME_LEN_CONTENT_ENCODING;
+  extern tsapi int TS_MIME_LEN_CONTENT_LANGUAGE;
+  extern tsapi int TS_MIME_LEN_CONTENT_LENGTH;
+  extern tsapi int TS_MIME_LEN_CONTENT_LOCATION;
+  extern tsapi int TS_MIME_LEN_CONTENT_MD5;
+  extern tsapi int TS_MIME_LEN_CONTENT_RANGE;
+  extern tsapi int TS_MIME_LEN_CONTENT_TYPE;
+  extern tsapi int TS_MIME_LEN_CONTROL;
+  extern tsapi int TS_MIME_LEN_COOKIE;
+  extern tsapi int TS_MIME_LEN_DATE;
+  extern tsapi int TS_MIME_LEN_DISTRIBUTION;
+  extern tsapi int TS_MIME_LEN_ETAG;
+  extern tsapi int TS_MIME_LEN_EXPECT;
+  extern tsapi int TS_MIME_LEN_EXPIRES;
+  extern tsapi int TS_MIME_LEN_FOLLOWUP_TO;
+  extern tsapi int TS_MIME_LEN_FROM;
+  extern tsapi int TS_MIME_LEN_HOST;
+  extern tsapi int TS_MIME_LEN_IF_MATCH;
+  extern tsapi int TS_MIME_LEN_IF_MODIFIED_SINCE;
+  extern tsapi int TS_MIME_LEN_IF_NONE_MATCH;
+  extern tsapi int TS_MIME_LEN_IF_RANGE;
+  extern tsapi int TS_MIME_LEN_IF_UNMODIFIED_SINCE;
+  extern tsapi int TS_MIME_LEN_KEEP_ALIVE;
+  extern tsapi int TS_MIME_LEN_KEYWORDS;
+  extern tsapi int TS_MIME_LEN_LAST_MODIFIED;
+  extern tsapi int TS_MIME_LEN_LINES;
+  extern tsapi int TS_MIME_LEN_LOCATION;
+  extern tsapi int TS_MIME_LEN_MAX_FORWARDS;
+  extern tsapi int TS_MIME_LEN_MESSAGE_ID;
+  extern tsapi int TS_MIME_LEN_NEWSGROUPS;
+  extern tsapi int TS_MIME_LEN_ORGANIZATION;
+  extern tsapi int TS_MIME_LEN_PATH;
+  extern tsapi int TS_MIME_LEN_PRAGMA;
+  extern tsapi int TS_MIME_LEN_PROXY_AUTHENTICATE;
+  extern tsapi int TS_MIME_LEN_PROXY_AUTHORIZATION;
+  extern tsapi int TS_MIME_LEN_PROXY_CONNECTION;
+  extern tsapi int TS_MIME_LEN_PUBLIC;
+  extern tsapi int TS_MIME_LEN_RANGE;
+  extern tsapi int TS_MIME_LEN_REFERENCES;
+  extern tsapi int TS_MIME_LEN_REFERER;
+  extern tsapi int TS_MIME_LEN_REPLY_TO;
+  extern tsapi int TS_MIME_LEN_RETRY_AFTER;
+  extern tsapi int TS_MIME_LEN_SENDER;
+  extern tsapi int TS_MIME_LEN_SERVER;
+  extern tsapi int TS_MIME_LEN_SET_COOKIE;
+  extern tsapi int TS_MIME_LEN_STRICT_TRANSPORT_SECURITY;
+  extern tsapi int TS_MIME_LEN_SUBJECT;
+  extern tsapi int TS_MIME_LEN_SUMMARY;
+  extern tsapi int TS_MIME_LEN_TE;
+  extern tsapi int TS_MIME_LEN_TRANSFER_ENCODING;
+  extern tsapi int TS_MIME_LEN_UPGRADE;
+  extern tsapi int TS_MIME_LEN_USER_AGENT;
+  extern tsapi int TS_MIME_LEN_VARY;
+  extern tsapi int TS_MIME_LEN_VIA;
+  extern tsapi int TS_MIME_LEN_WARNING;
+  extern tsapi int TS_MIME_LEN_WWW_AUTHENTICATE;
+  extern tsapi int TS_MIME_LEN_XREF;
+  extern tsapi int TS_MIME_LEN_X_FORWARDED_FOR;
+
+  /* --------------------------------------------------------------------------
+     HTTP values */
+  extern tsapi const char* TS_HTTP_VALUE_BYTES;
+  extern tsapi const char* TS_HTTP_VALUE_CHUNKED;
+  extern tsapi const char* TS_HTTP_VALUE_CLOSE;
+  extern tsapi const char* TS_HTTP_VALUE_COMPRESS;
+  extern tsapi const char* TS_HTTP_VALUE_DEFLATE;
+  extern tsapi const char* TS_HTTP_VALUE_GZIP;
+  extern tsapi const char* TS_HTTP_VALUE_IDENTITY;
+  extern tsapi const char* TS_HTTP_VALUE_KEEP_ALIVE;
+  extern tsapi const char* TS_HTTP_VALUE_MAX_AGE;
+  extern tsapi const char* TS_HTTP_VALUE_MAX_STALE;
+  extern tsapi const char* TS_HTTP_VALUE_MIN_FRESH;
+  extern tsapi const char* TS_HTTP_VALUE_MUST_REVALIDATE;
+  extern tsapi const char* TS_HTTP_VALUE_NONE;
+  extern tsapi const char* TS_HTTP_VALUE_NO_CACHE;
+  extern tsapi const char* TS_HTTP_VALUE_NO_STORE;
+  extern tsapi const char* TS_HTTP_VALUE_NO_TRANSFORM;
+  extern tsapi const char* TS_HTTP_VALUE_ONLY_IF_CACHED;
+  extern tsapi const char* TS_HTTP_VALUE_PRIVATE;
+  extern tsapi const char* TS_HTTP_VALUE_PROXY_REVALIDATE;
+  extern tsapi const char* TS_HTTP_VALUE_PUBLIC;
+
+  /* --------------------------------------------------------------------------
+     HTTP values string lengths */
+  extern tsapi int TS_HTTP_LEN_BYTES;
+  extern tsapi int TS_HTTP_LEN_CHUNKED;
+  extern tsapi int TS_HTTP_LEN_CLOSE;
+  extern tsapi int TS_HTTP_LEN_COMPRESS;
+  extern tsapi int TS_HTTP_LEN_DEFLATE;
+  extern tsapi int TS_HTTP_LEN_GZIP;
+  extern tsapi int TS_HTTP_LEN_IDENTITY;
+  extern tsapi int TS_HTTP_LEN_KEEP_ALIVE;
+  extern tsapi int TS_HTTP_LEN_MAX_AGE;
+  extern tsapi int TS_HTTP_LEN_MAX_STALE;
+  extern tsapi int TS_HTTP_LEN_MIN_FRESH;
+  extern tsapi int TS_HTTP_LEN_MUST_REVALIDATE;
+  extern tsapi int TS_HTTP_LEN_NONE;
+  extern tsapi int TS_HTTP_LEN_NO_CACHE;
+  extern tsapi int TS_HTTP_LEN_NO_STORE;
+  extern tsapi int TS_HTTP_LEN_NO_TRANSFORM;
+  extern tsapi int TS_HTTP_LEN_ONLY_IF_CACHED;
+  extern tsapi int TS_HTTP_LEN_PRIVATE;
+  extern tsapi int TS_HTTP_LEN_PROXY_REVALIDATE;
+  extern tsapi int TS_HTTP_LEN_PUBLIC;
+
+  /* --------------------------------------------------------------------------
+     HTTP methods */
+  extern tsapi const char* TS_HTTP_METHOD_CONNECT;
+  extern tsapi const char* TS_HTTP_METHOD_DELETE;
+  extern tsapi const char* TS_HTTP_METHOD_GET;
+  extern tsapi const char* TS_HTTP_METHOD_HEAD;
+  extern tsapi const char* TS_HTTP_METHOD_ICP_QUERY;
+  extern tsapi const char* TS_HTTP_METHOD_OPTIONS;
+  extern tsapi const char* TS_HTTP_METHOD_POST;
+  extern tsapi const char* TS_HTTP_METHOD_PURGE;
+  extern tsapi const char* TS_HTTP_METHOD_PUT;
+  extern tsapi const char* TS_HTTP_METHOD_TRACE;
+  extern tsapi const char* TS_HTTP_METHOD_PUSH;
+
+  /* --------------------------------------------------------------------------
+     HTTP methods string lengths */
+  extern tsapi int TS_HTTP_LEN_CONNECT;
+  extern tsapi int TS_HTTP_LEN_DELETE;
+  extern tsapi int TS_HTTP_LEN_GET;
+  extern tsapi int TS_HTTP_LEN_HEAD;
+  extern tsapi int TS_HTTP_LEN_ICP_QUERY;
+  extern tsapi int TS_HTTP_LEN_OPTIONS;
+  extern tsapi int TS_HTTP_LEN_POST;
+  extern tsapi int TS_HTTP_LEN_PURGE;
+  extern tsapi int TS_HTTP_LEN_PUT;
+  extern tsapi int TS_HTTP_LEN_TRACE;
+  extern tsapi int TS_HTTP_LEN_PUSH;
+
+  /* --------------------------------------------------------------------------
+     TLS Next Protocol well-known protocol names. */
+  extern tsapi const char * TS_NPN_PROTOCOL_HTTP_1_0;
+  extern tsapi const char * TS_NPN_PROTOCOL_HTTP_1_1;
+  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_1;
+  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_2;
+  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_3;
+
+  /* --------------------------------------------------------------------------
+     MLoc Constants */
+  /**
+      Use TS_NULL_MLOC as the parent in calls that require a parent
+      when an TSMLoc does not have a parent TSMLoc. For example if
+      the TSMLoc is obtained by a call to TSHttpTxnClientReqGet(),
+
+   */
+  extern tsapi const TSMLoc TS_NULL_MLOC;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TS_TYPES_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/lib/wccp/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/wccp/Makefile.am b/lib/wccp/Makefile.am
index 0f53fcd..f782c8b 100644
--- a/lib/wccp/Makefile.am
+++ b/lib/wccp/Makefile.am
@@ -20,8 +20,7 @@
 AM_CPPFLAGS = \
   -I$(top_srcdir)/lib \
   -I$(top_srcdir)/lib/ts \
-  -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts
+  -I$(top_srcdir)/proxy/api/ts
 
 #WCCP_DEFS = @WCCP_DEFS@
 #DEFS += $(WCCP_DEFS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/mgmt/Makefile.am
----------------------------------------------------------------------
diff --git a/mgmt/Makefile.am b/mgmt/Makefile.am
index 55c105a..56c42f0 100644
--- a/mgmt/Makefile.am
+++ b/mgmt/Makefile.am
@@ -51,9 +51,7 @@ libmgmt_p_a_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/preparse \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/mgmt/web2 \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/lib/records \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 46b9247..ba8645b 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -46,7 +46,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/preparse \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/lib
 
 noinst_HEADERS = \


[25/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: ce437252627bfcc33b77fc8b56befff54f8315d3
Parents: 5ae5dda
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:57:27 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:57:27 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce437252/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
index a98e1a6..42118fa 100644
--- a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
+++ b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
@@ -87,12 +87,12 @@ public:
    */
   void getResponseBody(const void *&body, size_t &body_size) const;
 
-  virtual ~AsyncHttpFetch();
-
   /**
    * Starts a HTTP fetch of the Request contained.
    */  
   virtual void run(shared_ptr<AsyncDispatchControllerBase> dispatch_controller);
+protected:
+  virtual ~AsyncHttpFetch();
 
 private:
   AsyncHttpFetchState *state_;


[19/50] [abbrv] git commit: TS-2646 Make the overall code slightly less hideous

Posted by zw...@apache.org.
TS-2646 Make the overall code slightly less hideous


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

Branch: refs/heads/lua_config
Commit: df0938afc11fe2b792202b24208ffa04d876cee3
Parents: ba7d394
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 18 18:44:40 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Mar 18 18:44:40 2014 -0600

----------------------------------------------------------------------
 plugins/regex_remap/regex_remap.cc | 748 ++++++++++++++++----------------
 1 file changed, 377 insertions(+), 371 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/df0938af/plugins/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index 1f98442..416f90c 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -116,136 +116,20 @@ struct UrlComponents
 class RemapRegex
 {
  public:
-  RemapRegex(const std::string& reg, const std::string& sub, const std::string& opt) :
+  RemapRegex() :
     _num_subs(-1), _rex(NULL), _extra(NULL), _options(0), _order(-1),
     _simple(false), _lowercase_substitutions(false),
     _active_timeout(-1), _no_activity_timeout(-1), _connect_timeout(-1), _dns_timeout(-1),
     _first_override(NULL)
   {
     TSDebug(PLUGIN_NAME, "Calling constructor");
-
-    _status = static_cast<TSHttpStatus>(0);
-
-    if (!reg.empty()) {
-      if (reg == ".") {
-        TSDebug(PLUGIN_NAME, "Rule is simple, and fast!");
-        _simple = true;
-      }
-      _rex_string = TSstrdup(reg.c_str());
-    } else
-      _rex_string = NULL;
-
-    if (!sub.empty()) {
-      _subst = TSstrdup(sub.c_str());
-      _subst_len = sub.length();
-    } else {
-      _subst = NULL;
-      _subst_len = 0;
-    }
-
-    _hits = 0;
-
-    memset(_sub_pos, 0, sizeof(_sub_pos));
-    memset(_sub_ix, 0, sizeof(_sub_ix));
-    _next = NULL;
-
-    // Parse options
-    std::string::size_type start = opt.find_first_of("@");
-    std::string::size_type pos1, pos2;
-    Override* last_override = NULL;
-
-    while (start != std::string::npos) {
-      std::string opt_val;
-
-      ++start;
-      pos1 = opt.find_first_of("=", start);
-      pos2 = opt.find_first_of(" \t\n", pos1);
-      if (pos2 == std::string::npos) {
-        pos2 = opt.length();
-      }
-
-      if (pos1 != std::string::npos) {
-        // Get the value as well
-        ++pos1;
-        opt_val = opt.substr(pos1, pos2-pos1);
-      }
-
-      // These take an option 0|1 value, without value it implies 1
-      if (opt.compare(start, 8, "caseless") == 0) {
-        _options |= PCRE_CASELESS;
-      } else if (opt.compare(start, 23, "lowercase_substitutions") == 0) {
-        _lowercase_substitutions = true;
-      } else if (opt_val.size() <= 0) {
-        // All other options have a required value
-        TSError("Malformed options: %s", opt.c_str());
-        break;
-      }
-
-      if (opt.compare(start, 6, "status") == 0) {
-        _status = static_cast<TSHttpStatus>(strtol(opt_val.c_str(), NULL, 10));
-      } else if (opt.compare(start, 14, "active_timeout") == 0) {
-        _active_timeout = strtol(opt_val.c_str(), NULL, 10);
-      } else if (opt.compare(start, 19, "no_activity_timeout") == 0) {
-        _no_activity_timeout = strtol(opt_val.c_str(), NULL, 10);
-      } else if (opt.compare(start, 15, "connect_timeout") == 0) {
-        _connect_timeout = strtol(opt_val.c_str(), NULL, 10);
-      } else if (opt.compare(start, 11, "dns_timeout") == 0) {
-        _dns_timeout = strtol(opt_val.c_str(), NULL, 10);
-      } else {
-        TSOverridableConfigKey key;
-        TSRecordDataType type;
-        std::string opt_name = opt.substr(start, pos1-start-1);
-
-        if (TS_SUCCESS == TSHttpTxnConfigFind(opt_name.c_str(), opt_name.length(), &key, &type)) {
-          Override* cur = new Override;
-
-          switch (type) {
-          case TS_RECORDDATATYPE_INT:
-            cur->data.rec_int = strtoll(opt_val.c_str(), NULL, 10);
-            break;
-          case TS_RECORDDATATYPE_FLOAT:
-            cur->data.rec_float = strtof(opt_val.c_str(), NULL);
-            break;
-          case TS_RECORDDATATYPE_STRING:
-            cur->data.rec_string = TSstrdup(opt_val.c_str());
-            cur->data_len = opt_val.size();
-            break;
-          default:
-            delete cur;
-            cur = NULL;
-            TSError("%s: configuration variable '%s' is of an unsupported type", PLUGIN_NAME, opt_name.c_str());
-            break;
-          }
-          if (cur) {
-            TSDebug(PLUGIN_NAME, "Overridable config %s=%s", opt_name.c_str(), opt_val.c_str());
-            cur->key = key;
-            cur->type = type;
-            cur->next = NULL;
-            if (NULL == last_override) {
-              _first_override = cur;
-            } else {
-              last_override->next = cur;
-            }
-            last_override = cur;
-          }
-        } else {
-          TSError("Unknown options: %s", opt.c_str());
-        }
-      }
-      start = opt.find_first_of("@", pos2);
-    }
   }
 
   ~RemapRegex()
   {
     TSDebug(PLUGIN_NAME, "Calling destructor");
-
-    if (_rex_string) {
-      TSfree(_rex_string);
-    }
-    if (_subst) {
-      TSfree(_subst);
-    }
+    TSfree(_rex_string);
+    TSfree(_subst);
 
     if (_rex) {
       pcre_free(_rex);
@@ -255,111 +139,16 @@ class RemapRegex
     }
   }
 
+  bool initialize(const std::string& reg, const std::string& sub, const std::string& opt);
+
   // For profiling information
-  inline void
-  print(int ix, int max, const char* now)
+  void increment() { ink_atomic_increment(&(_hits), 1); }
+  void print(int ix, int max, const char* now)
   {
     fprintf(stderr, "[%s]:    Regex %d ( %s ): %.2f%%\n", now, ix, _rex_string, 100.0 * _hits / max);
   }
 
-  inline void
-  increment()
-  {
-    ink_atomic_increment(&(_hits), 1);
-  }
-
-  // Compile and study the regular expression.
-  int
-  compile(const char** error, int* erroffset)
-  {
-    char* str;
-    int ccount;
-
-    _rex = pcre_compile(_rex_string,          // the pattern
-                        _options,             // options
-                        error,                // for error message
-                        erroffset,            // for error offset
-                        NULL);                // use default character tables
-
-    if (NULL == _rex) {
-      return -1;
-    }
-
-    _extra = pcre_study(_rex, 0, error);
-    if ((_extra == NULL) && (*error != 0)) {
-      return -1;
-    }
-
-    if (pcre_fullinfo(_rex, _extra, PCRE_INFO_CAPTURECOUNT, &ccount) != 0) {
-      return -1;
-    }
-
-    // Get some info for the string substitutions
-    str = _subst;
-    _num_subs = 0;
-
-    while (str && *str) {
-      if ('$' == *str) {
-        int ix = -1;
-
-        if (isdigit(*(str+1))) {
-          ix = *(str + 1) - '0';
-        } else {
-          switch (*(str + 1)) {
-          case 'h':
-            ix = SUB_HOST;
-            break;
-          case 'f':
-            ix = SUB_FROM_HOST;
-            break;
-          case 't':
-            ix = SUB_TO_HOST;
-            break;
-          case 'p':
-            ix = SUB_PORT;
-            break;
-          case 's':
-            ix = SUB_SCHEME;
-            break;
-          case 'P':
-            ix = SUB_PATH;
-            break;
-          case 'l':
-            ix = SUB_LOWER_PATH;
-            break;
-          case 'q':
-            ix = SUB_QUERY;
-            break;
-          case 'm':
-            ix = SUB_MATRIX;
-            break;
-          case 'i':
-            ix = SUB_CLIENT_IP;
-            break;
-          default:
-            break;
-          }
-        }
-
-        if (ix > -1) {
-          if ((ix < 10) && (ix > ccount)) {
-            TSDebug(PLUGIN_NAME, "Trying to use unavailable substitution, check the regex!");
-            return -1; // No substitutions available other than $0
-          }
-
-          _sub_ix[_num_subs] = ix;
-          _sub_pos[_num_subs] = (str - _subst);
-          str += 2;
-          ++_num_subs;
-        } else { // Not a valid substitution character, so just ignore it
-          ++str;
-        }
-      } else {
-        ++str;
-      }
-    }
-    return 0;
-  }
+  int compile(const char** error, int* erroffset);
 
   // Perform the regular expression matching against a string.
   int
@@ -375,156 +164,10 @@ class RemapRegex
                      OVECCOUNT);           // number of elements in the output vector
   }
 
-  // Get the lengths of the matching string(s), taking into account variable substitutions.
-  // We also calculate a total length for the new string, which is the max length the
-  // substituted string can have (use it to allocate a buffer before calling substitute() ).
-  int
-  get_lengths(const int ovector[], int lengths[], TSRemapRequestInfo *rri, UrlComponents *req_url)
-  {
-    int len = _subst_len + 1;   // Bigger then necessary
-
-    for (int i=0; i < _num_subs; i++) {
-      int ix = _sub_ix[i];
-
-      if (ix < 10) {
-        lengths[ix] = ovector[2*ix+1] - ovector[2*ix]; // -1 - -1 == 0
-        len += lengths[ix];
-      } else {
-        int tmp_len;
-
-        switch (ix) {
-        case SUB_HOST:
-          len += req_url->host_len;
-          break;
-        case SUB_FROM_HOST:
-          TSUrlHostGet(rri->requestBufp, rri->mapFromUrl, &tmp_len);
-          len += tmp_len;
-          break;
-        case SUB_TO_HOST:
-          TSUrlHostGet(rri->requestBufp, rri->mapToUrl, &tmp_len);
-          len += tmp_len;
-          break;
-        case SUB_PORT:
-          len += 6; // One extra for snprintf()
-          break;
-        case SUB_SCHEME:
-          len += req_url->scheme_len;
-          break;
-        case SUB_PATH:
-        case SUB_LOWER_PATH:
-          len += req_url->path_len;
-          break;
-        case SUB_QUERY:
-          len += req_url->query_len;
-          break;
-        case SUB_MATRIX:
-          len += req_url->matrix_len;
-          break;
-        case SUB_CLIENT_IP:
-          len += 15; // Allow for 255.255.255.255
-          break;
-        default:
-          break;
-        }
-      }
-    }
-
-    return len;
-  }
-
-  // Perform substitution on the $0 - $9 variables in the "src" string. $0 is the entire
-  // regex that was matches, while $1 - $9 are the corresponding groups. Return the final
-  // length of the string as written to dest (not including the trailing '0').
-  int
-  substitute(char dest[], const char *src, const int ovector[], const int lengths[],
-             TSRemapRequestInfo *rri, UrlComponents *req_url, bool lowercase_substitutions)
-  {
-    if (_num_subs > 0) {
-      char* p1 = dest;
-      char* p2 = _subst;
-      int prev = 0;
-
-      for (int i=0; i < _num_subs; i++) {
-        char *start = p1;
-        int ix = _sub_ix[i];
-
-        memcpy(p1, p2, _sub_pos[i] - prev);
-        p1 += (_sub_pos[i] - prev);
-        if (ix < 10) {
-          memcpy(p1, src + ovector[2*ix], lengths[ix]);
-          p1 += lengths[ix];
-        } else {
-          const char* str = NULL;
-          int len = 0;
-
-          switch (ix) {
-          case SUB_HOST:
-            str = req_url->host;
-            len = req_url->host_len;
-            break;
-          case SUB_FROM_HOST:
-            str = TSUrlHostGet(rri->requestBufp, rri->mapFromUrl, &len);
-            break;
-          case SUB_TO_HOST:
-            str = TSUrlHostGet(rri->requestBufp, rri->mapToUrl, &len);
-            break;
-          case SUB_PORT:
-            p1 += snprintf(p1, 6, "%u", req_url->port);
-            break;
-          case SUB_SCHEME:
-            str = req_url->scheme;
-            len = req_url->scheme_len;
-            break;
-          case SUB_PATH:
-          case SUB_LOWER_PATH:
-            str = req_url->path;
-            len = req_url->path_len;
-            break;
-          case SUB_QUERY:
-            str = req_url->query;
-            len = req_url->query_len;
-            break;
-          case SUB_MATRIX:
-            str = req_url->matrix;
-            len = req_url->matrix_len;
-            break;
-          case SUB_CLIENT_IP:
-            {
-              // TODO: Finish implementing with the addr from above
-              // p1 += snprintf(p1, 15, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
-            }
-            break;
-          default:
-            break;
-          }
-          // If one of the rules fetched a read-only string, copy it in.
-          if (str && len > 0) {
-            memcpy(p1, str, len);
-            p1 += len;
-          }
-        }
-        p2 += (_sub_pos[i] - prev + 2);
-        prev = _sub_pos[i] + 2;
-
-        if (lowercase_substitutions == true || ix == SUB_LOWER_PATH) {
-           while (start < p1) {
-             *start = tolower(*start);
-             start++;
-            }
-         }
-      }
-
-      memcpy(p1, p2, _subst_len - (p2 - _subst));
-      p1 += _subst_len - (p2 - _subst);
-      *p1 = 0; // Make sure it's NULL terminated (for safety).
-      return p1 - dest;
-    } else {
-      memcpy(dest, _subst, _subst_len + 1); // No substitutions in the string, copy it all
-      return _subst_len;
-    }
-
-    return 0; // Shouldn't happen.
-  }
+  // Substitutions
+  int get_lengths(const int ovector[], int lengths[], TSRemapRequestInfo *rri, UrlComponents *req_url);
+  int substitute(char dest[], const char *src, const int ovector[], const int lengths[],
+                 TSRemapRequestInfo *rri, UrlComponents *req_url, bool lowercase_substitutions);
 
   // setter / getters for members the linked list.
   inline void set_next(RemapRegex* next) { _next = next; }
@@ -584,6 +227,368 @@ class RemapRegex
   Override* _first_override;
 };
 
+bool
+RemapRegex::initialize(const std::string& reg, const std::string& sub, const std::string& opt)
+{
+  _status = static_cast<TSHttpStatus>(0);
+
+  if (!reg.empty()) {
+    if (reg == ".") {
+      TSDebug(PLUGIN_NAME, "Rule is simple, and fast!");
+      _simple = true;
+    }
+    _rex_string = TSstrdup(reg.c_str());
+  } else
+    _rex_string = NULL;
+
+  if (!sub.empty()) {
+    _subst = TSstrdup(sub.c_str());
+    _subst_len = sub.length();
+  } else {
+    _subst = NULL;
+    _subst_len = 0;
+  }
+
+  _hits = 0;
+
+  memset(_sub_pos, 0, sizeof(_sub_pos));
+  memset(_sub_ix, 0, sizeof(_sub_ix));
+  _next = NULL;
+
+  // Parse options
+  std::string::size_type start = opt.find_first_of("@");
+  std::string::size_type pos1, pos2;
+  Override* last_override = NULL;
+
+  while (start != std::string::npos) {
+    std::string opt_val;
+
+    ++start;
+    pos1 = opt.find_first_of("=", start);
+    pos2 = opt.find_first_of(" \t\n", pos1);
+    if (pos2 == std::string::npos) {
+      pos2 = opt.length();
+    }
+
+    if (pos1 != std::string::npos) {
+      // Get the value as well
+      ++pos1;
+      opt_val = opt.substr(pos1, pos2-pos1);
+    }
+
+    // These take an option 0|1 value, without value it implies 1
+    if (opt.compare(start, 8, "caseless") == 0) {
+      _options |= PCRE_CASELESS;
+    } else if (opt.compare(start, 23, "lowercase_substitutions") == 0) {
+      _lowercase_substitutions = true;
+    } else if (opt_val.size() <= 0) {
+      // All other options have a required value
+      TSError("Malformed options: %s", opt.c_str());
+      break;
+    }
+
+    if (opt.compare(start, 6, "status") == 0) {
+      _status = static_cast<TSHttpStatus>(strtol(opt_val.c_str(), NULL, 10));
+    } else if (opt.compare(start, 14, "active_timeout") == 0) {
+      _active_timeout = strtol(opt_val.c_str(), NULL, 10);
+    } else if (opt.compare(start, 19, "no_activity_timeout") == 0) {
+      _no_activity_timeout = strtol(opt_val.c_str(), NULL, 10);
+    } else if (opt.compare(start, 15, "connect_timeout") == 0) {
+      _connect_timeout = strtol(opt_val.c_str(), NULL, 10);
+    } else if (opt.compare(start, 11, "dns_timeout") == 0) {
+      _dns_timeout = strtol(opt_val.c_str(), NULL, 10);
+    } else {
+      TSOverridableConfigKey key;
+      TSRecordDataType type;
+      std::string opt_name = opt.substr(start, pos1-start-1);
+
+      if (TS_SUCCESS == TSHttpTxnConfigFind(opt_name.c_str(), opt_name.length(), &key, &type)) {
+        Override* cur = new Override;
+
+        switch (type) {
+        case TS_RECORDDATATYPE_INT:
+          cur->data.rec_int = strtoll(opt_val.c_str(), NULL, 10);
+          break;
+        case TS_RECORDDATATYPE_FLOAT:
+          cur->data.rec_float = strtof(opt_val.c_str(), NULL);
+          break;
+        case TS_RECORDDATATYPE_STRING:
+          cur->data.rec_string = TSstrdup(opt_val.c_str());
+          cur->data_len = opt_val.size();
+          break;
+        default:
+          TSError("%s: configuration variable '%s' is of an unsupported type", PLUGIN_NAME, opt_name.c_str());
+          return false;
+          break;
+        }
+        if (cur) {
+          TSDebug(PLUGIN_NAME, "Overridable config %s=%s", opt_name.c_str(), opt_val.c_str());
+          cur->key = key;
+          cur->type = type;
+          cur->next = NULL;
+          if (NULL == last_override) {
+            _first_override = cur;
+          } else {
+            last_override->next = cur;
+          }
+          last_override = cur;
+        }
+      } else {
+        TSError("Unknown options: %s", opt.c_str());
+      }
+    }
+    start = opt.find_first_of("@", pos2);
+  }
+
+  return true;
+}
+
+// Compile and study the regular expression.
+int
+RemapRegex::compile(const char** error, int* erroffset)
+{
+  char* str;
+  int ccount;
+
+  _rex = pcre_compile(_rex_string,          // the pattern
+                      _options,             // options
+                      error,                // for error message
+                      erroffset,            // for error offset
+                      NULL);                // use default character tables
+
+  if (NULL == _rex) {
+    return -1;
+  }
+
+  _extra = pcre_study(_rex, 0, error);
+  if ((_extra == NULL) && (*error != 0)) {
+    return -1;
+  }
+
+  if (pcre_fullinfo(_rex, _extra, PCRE_INFO_CAPTURECOUNT, &ccount) != 0) {
+    return -1;
+  }
+
+  // Get some info for the string substitutions
+  str = _subst;
+  _num_subs = 0;
+
+  while (str && *str) {
+    if ('$' == *str) {
+      int ix = -1;
+
+      if (isdigit(*(str+1))) {
+        ix = *(str + 1) - '0';
+      } else {
+        switch (*(str + 1)) {
+        case 'h':
+          ix = SUB_HOST;
+          break;
+        case 'f':
+          ix = SUB_FROM_HOST;
+          break;
+        case 't':
+          ix = SUB_TO_HOST;
+          break;
+        case 'p':
+          ix = SUB_PORT;
+          break;
+        case 's':
+          ix = SUB_SCHEME;
+          break;
+        case 'P':
+          ix = SUB_PATH;
+          break;
+        case 'l':
+          ix = SUB_LOWER_PATH;
+          break;
+        case 'q':
+          ix = SUB_QUERY;
+          break;
+        case 'm':
+          ix = SUB_MATRIX;
+          break;
+        case 'i':
+          ix = SUB_CLIENT_IP;
+          break;
+        default:
+          break;
+        }
+      }
+
+      if (ix > -1) {
+        if ((ix < 10) && (ix > ccount)) {
+          TSDebug(PLUGIN_NAME, "Trying to use unavailable substitution, check the regex!");
+          return -1; // No substitutions available other than $0
+        }
+
+        _sub_ix[_num_subs] = ix;
+        _sub_pos[_num_subs] = (str - _subst);
+        str += 2;
+        ++_num_subs;
+      } else { // Not a valid substitution character, so just ignore it
+        ++str;
+      }
+    } else {
+      ++str;
+    }
+  }
+  return 0;
+}
+
+// Get the lengths of the matching string(s), taking into account variable substitutions.
+// We also calculate a total length for the new string, which is the max length the
+// substituted string can have (use it to allocate a buffer before calling substitute() ).
+int
+RemapRegex::get_lengths(const int ovector[], int lengths[], TSRemapRequestInfo *rri, UrlComponents *req_url)
+{
+  int len = _subst_len + 1;   // Bigger then necessary
+
+  for (int i=0; i < _num_subs; i++) {
+    int ix = _sub_ix[i];
+
+    if (ix < 10) {
+      lengths[ix] = ovector[2*ix+1] - ovector[2*ix]; // -1 - -1 == 0
+      len += lengths[ix];
+    } else {
+      int tmp_len;
+
+      switch (ix) {
+      case SUB_HOST:
+        len += req_url->host_len;
+        break;
+      case SUB_FROM_HOST:
+        TSUrlHostGet(rri->requestBufp, rri->mapFromUrl, &tmp_len);
+        len += tmp_len;
+        break;
+      case SUB_TO_HOST:
+        TSUrlHostGet(rri->requestBufp, rri->mapToUrl, &tmp_len);
+        len += tmp_len;
+        break;
+      case SUB_PORT:
+        len += 6; // One extra for snprintf()
+        break;
+      case SUB_SCHEME:
+        len += req_url->scheme_len;
+        break;
+      case SUB_PATH:
+      case SUB_LOWER_PATH:
+        len += req_url->path_len;
+        break;
+      case SUB_QUERY:
+        len += req_url->query_len;
+        break;
+      case SUB_MATRIX:
+        len += req_url->matrix_len;
+        break;
+      case SUB_CLIENT_IP:
+        len += 15; // Allow for 255.255.255.255
+        break;
+      default:
+        break;
+      }
+    }
+  }
+
+  return len;
+}
+
+// Perform substitution on the $0 - $9 variables in the "src" string. $0 is the entire
+// regex that was matches, while $1 - $9 are the corresponding groups. Return the final
+// length of the string as written to dest (not including the trailing '0').
+int
+RemapRegex::substitute(char dest[], const char *src, const int ovector[], const int lengths[],
+                       TSRemapRequestInfo *rri, UrlComponents *req_url, bool lowercase_substitutions)
+{
+  if (_num_subs > 0) {
+    char* p1 = dest;
+    char* p2 = _subst;
+    int prev = 0;
+
+    for (int i=0; i < _num_subs; i++) {
+      char *start = p1;
+      int ix = _sub_ix[i];
+
+      memcpy(p1, p2, _sub_pos[i] - prev);
+      p1 += (_sub_pos[i] - prev);
+      if (ix < 10) {
+        memcpy(p1, src + ovector[2*ix], lengths[ix]);
+        p1 += lengths[ix];
+      } else {
+        const char* str = NULL;
+        int len = 0;
+
+        switch (ix) {
+        case SUB_HOST:
+          str = req_url->host;
+          len = req_url->host_len;
+          break;
+        case SUB_FROM_HOST:
+          str = TSUrlHostGet(rri->requestBufp, rri->mapFromUrl, &len);
+          break;
+        case SUB_TO_HOST:
+          str = TSUrlHostGet(rri->requestBufp, rri->mapToUrl, &len);
+          break;
+        case SUB_PORT:
+          p1 += snprintf(p1, 6, "%u", req_url->port);
+          break;
+        case SUB_SCHEME:
+          str = req_url->scheme;
+          len = req_url->scheme_len;
+          break;
+        case SUB_PATH:
+        case SUB_LOWER_PATH:
+          str = req_url->path;
+          len = req_url->path_len;
+          break;
+        case SUB_QUERY:
+          str = req_url->query;
+          len = req_url->query_len;
+          break;
+        case SUB_MATRIX:
+          str = req_url->matrix;
+          len = req_url->matrix_len;
+          break;
+        case SUB_CLIENT_IP:
+          {
+            // TODO: Finish implementing with the addr from above
+            // p1 += snprintf(p1, 15, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+          }
+          break;
+        default:
+          break;
+        }
+        // If one of the rules fetched a read-only string, copy it in.
+        if (str && len > 0) {
+          memcpy(p1, str, len);
+          p1 += len;
+        }
+      }
+      p2 += (_sub_pos[i] - prev + 2);
+      prev = _sub_pos[i] + 2;
+
+      if (lowercase_substitutions == true || ix == SUB_LOWER_PATH) {
+        while (start < p1) {
+          *start = tolower(*start);
+          start++;
+        }
+      }
+    }
+
+    memcpy(p1, p2, _subst_len - (p2 - _subst));
+    p1 += _subst_len - (p2 - _subst);
+    *p1 = 0; // Make sure it's NULL terminated (for safety).
+    return p1 - dest;
+  } else {
+    memcpy(dest, _subst, _subst_len + 1); // No substitutions in the string, copy it all
+    return _subst_len;
+  }
+
+  return 0; // Shouldn't happen.
+}
+
+
+// Hold one remap instance
 struct RemapInstance
 {
   RemapInstance() :
@@ -766,10 +771,11 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf ATS_UNUSED
     }
 
     // Got a regex and substitution string
-    RemapRegex* cur = new RemapRegex(regex, subst, options);
+    RemapRegex* cur = new RemapRegex();
 
-    if (cur == NULL) {
+    if (!cur->initialize(regex, subst, options)) {
       TSError("%s: can't create a new regex remap rule", PLUGIN_NAME);
+      delete cur;
       continue;
     }
 


[07/50] [abbrv] TS-2637: add traffic_line records match option

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/NetworkUtilsRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsRemote.cc b/mgmt/api/NetworkUtilsRemote.cc
index 3bf941a..da4c9ab 100644
--- a/mgmt/api/NetworkUtilsRemote.cc
+++ b/mgmt/api/NetworkUtilsRemote.cc
@@ -61,7 +61,6 @@ extern TSInitOptionT ts_init_options;
 /**********************************************************************
  * Socket Helper Functions
  **********************************************************************/
-
 void
 set_socket_paths(const char *path)
 {
@@ -773,32 +772,25 @@ send_file_write_request(int fd, TSFileNameT file, int ver, int size, char *text)
   return err;
 }
 
-/**********************************************************************
- * send_record_get_request
- *
- * purpose: sends request to get record value from Traffic Manager
- * input: fd       - file descriptor to use
- *        rec_name - name of record to retrieve value for
- * output: TS_ERR_xx
- * format: RECORD_GET <msg_len> <rec_name>
- **********************************************************************/
-TSError
-send_record_get_request(int fd, char *rec_name)
+static TSError
+send_record_get_x_request(OpType optype, int fd, const char *rec_name)
 {
   char *msg_buf;
   int msg_pos = 0, total_len;
-  int16_t op;
+  int16_t op = (int16_t)optype;
   int32_t msg_len;
   TSError err;
 
-  if (!rec_name)
+  ink_assert(op == RECORD_GET || op == RECORD_MATCH_GET);
+
+  if (!rec_name) {
     return TS_ERR_PARAMS;
+  }
 
   total_len = SIZE_OP_T + SIZE_LEN + strlen(rec_name);
   msg_buf = (char *)ats_malloc(sizeof(char) * total_len);
 
   // fill in op type
-  op = (int16_t) RECORD_GET;
   memcpy(msg_buf + msg_pos, (void *) &op, SIZE_OP_T);
   msg_pos += SIZE_OP_T;
 
@@ -816,6 +808,35 @@ send_record_get_request(int fd, char *rec_name)
   return err;
 }
 
+/**********************************************************************
+ * send_record_get_request
+ *
+ * purpose: sends request to get record value from Traffic Manager
+ * input: fd       - file descriptor to use
+ *        rec_name - name of record to retrieve value for
+ * output: TS_ERR_xx
+ * format: RECORD_GET <msg_len> <rec_name>
+ **********************************************************************/
+TSError
+send_record_get_request(int fd, const char *rec_name)
+{
+  return send_record_get_x_request(RECORD_GET, fd, rec_name);
+}
+
+/**********************************************************************
+ * send_record_match_request
+ *
+ * purpose: sends request to get a list of matching record values from Traffic Manager
+ * input: fd       - file descriptor to use
+ *        rec_name - regex to match against record names
+ * output: TS_ERR_xx
+ * format: sequence of RECORD_GET <msg_len> <rec_name>
+ **********************************************************************/
+TSError
+send_record_match_request(int fd, const char *rec_regex)
+{
+  return send_record_get_x_request(RECORD_MATCH_GET, fd, rec_regex);
+}
 
 /*------ control functions -------------------------------------------*/
 /**********************************************************************
@@ -1231,19 +1252,25 @@ parse_file_read_reply(int fd, int *ver, int *size, char **text)
  *        rec_value - the value of the record in string format
  * output: errors on error or fill up class with response &
  *         return SUCC
- * notes: reply format = <TSError> <val_size> <rec_type> <record_value>
+ * notes: reply format = <TSError> <val_size> <name_size> <rec_type> <record_value> <record_name>
+ * Zero-length values and names are supported. If the size field is 0, the corresponding
+ * value field is not transmitted.
  * It's the responsibility of the calling function to conver the rec_value
  * based on the rec_type!!
  **********************************************************************/
 TSError
-parse_record_get_reply(int fd, TSRecordT * rec_type, void **rec_val)
+parse_record_get_reply(int fd, TSRecordT * rec_type, void **rec_val, char **rec_name)
 {
   int16_t ret_val, rec_t;
-  int32_t rec_size;
+  int32_t val_size, name_size;
   TSError err_t;
 
-  if (!rec_type || !rec_val)
+  if (!rec_type || !rec_val) {
     return TS_ERR_PARAMS;
+  }
+
+  *rec_name = NULL;
+  *rec_val = NULL;
 
   // check to see if anything to read; wait for specified time
   if (socket_read_timeout(fd, MAX_TIME_WAIT, 0) <= 0) { //time expired before ready to read
@@ -1253,49 +1280,72 @@ parse_record_get_reply(int fd, TSRecordT * rec_type, void **rec_val)
   // get the return value (TSError type)
   err_t = socket_read_conn(fd, (uint8_t *)&ret_val, SIZE_ERR_T);
   if (err_t != TS_ERR_OKAY) {
-    return err_t;
+    goto fail;
   }
 
   // if !TS_ERR_OKAY, stop reading rest of msg
   err_t = (TSError) ret_val;
   if (err_t != TS_ERR_OKAY) {
-    return err_t;
+    goto fail;
   }
 
   // now get size of record_value
-  err_t = socket_read_conn(fd, (uint8_t *)&rec_size, SIZE_LEN);
+  err_t = socket_read_conn(fd, (uint8_t *)&val_size, SIZE_LEN);
   if (err_t != TS_ERR_OKAY) {
-    return err_t;
+    goto fail;
+  }
+
+  // now get size of record name
+  err_t = socket_read_conn(fd, (uint8_t *)&name_size, SIZE_LEN);
+  if (err_t != TS_ERR_OKAY) {
+    goto fail;
   }
 
   // get the record type
   err_t = socket_read_conn(fd, (uint8_t *)&rec_t, SIZE_REC_T);
   if (err_t != TS_ERR_OKAY) {
-    return err_t;
+    goto fail;
   }
 
   *rec_type = (TSRecordT) rec_t;
 
-  // get record value
-  // allocate correct amount of memory for record value
-  if (*rec_type == TS_REC_STRING) {
-    *rec_val = ats_malloc(sizeof(char) * (rec_size + 1));
-  } else {
-    *rec_val = ats_malloc(sizeof(char) * (rec_size));
-  }
+  // get record value (if there is one)
+  if (val_size) {
+    if (*rec_type == TS_REC_STRING) {
+      *rec_val = ats_malloc(sizeof(char) * (val_size + 1));
+    } else {
+      *rec_val = ats_malloc(sizeof(char) * (val_size));
+    }
 
-  err_t = socket_read_conn(fd, (uint8_t *)(*rec_val), rec_size);
-  if (err_t != TS_ERR_OKAY) {
-    ats_free(*rec_val);
-    *rec_val = NULL;
-    return err_t;
+    err_t = socket_read_conn(fd, (uint8_t *)(*rec_val), val_size);
+    if (err_t != TS_ERR_OKAY) {
+      goto fail;
+    }
+
+    // add end of string to end of the record value
+    if (*rec_type == TS_REC_STRING) {
+      ((char *) (*rec_val))[val_size] = '\0';
+    }
   }
 
-  // add end of string to end of the record value
-  if (*rec_type == TS_REC_STRING) {
-    ((char *) (*rec_val))[rec_size] = '\0';
+  // get the record name (if there is one)
+  if (name_size) {
+    *rec_name = (char *)ats_malloc(sizeof(char) * (name_size + 1));
+    err_t = socket_read_conn(fd, (uint8_t *)(*rec_name), name_size);
+    if (err_t != TS_ERR_OKAY) {
+      goto fail;
+    }
+
+    (*rec_name)[name_size] = '\0';
   }
 
+  return TS_ERR_OKAY;
+
+fail:
+  ats_free(*rec_val);
+  ats_free(*rec_name);
+  *rec_val = NULL;
+  *rec_name = NULL;
   return err_t;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/NetworkUtilsRemote.h
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsRemote.h b/mgmt/api/NetworkUtilsRemote.h
index b30ac14..f251dc0 100644
--- a/mgmt/api/NetworkUtilsRemote.h
+++ b/mgmt/api/NetworkUtilsRemote.h
@@ -76,7 +76,8 @@ TSError send_request_bool(int fd, OpType op, bool flag);
 
 TSError send_file_read_request(int fd, TSFileNameT file);
 TSError send_file_write_request(int fd, TSFileNameT file, int ver, int size, char *text);
-TSError send_record_get_request(int fd, char *rec_name);
+TSError send_record_get_request(int fd, const char *rec_name);
+TSError send_record_match_request(int fd, const char *rec_regex);
 
 TSError send_proxy_state_set_request(int fd, TSProxyStateT state, TSCacheClearT clear);
 
@@ -93,7 +94,7 @@ TSError parse_reply_list(int fd, char **list);
 
 TSError parse_file_read_reply(int fd, int *version, int *size, char **text);
 
-TSError parse_record_get_reply(int fd, TSRecordT * rec_type, void **rec_val);
+TSError parse_record_get_reply(int fd, TSRecordT * rec_type, void **rec_val, char **rec_name);
 TSError parse_record_set_reply(int fd, TSActionNeedT * action_need);
 
 TSError parse_proxy_state_get_reply(int fd, TSProxyStateT * state);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/TSControlMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc
index c507f5b..950e3b5 100644
--- a/mgmt/api/TSControlMain.cc
+++ b/mgmt/api/TSControlMain.cc
@@ -210,198 +210,83 @@ ts_ctrl_main(void *arg)
               con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
               continue;
             }
+
             // determine which handler function to call based on operation
             switch (op_t) {
             case RECORD_GET:
               ret = handle_record_get(client_entry->sock_info, req);
-              ats_free(req);     // free memory for req
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_get\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
+              break;
+
+            case RECORD_MATCH_GET:
+              ret = handle_record_match(client_entry->sock_info, req);
+              // XXX
               break;
 
             case RECORD_SET:
               ret = handle_record_set(client_entry->sock_info, req);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_set\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case FILE_READ:
               ret = handle_file_read(client_entry->sock_info, req);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_read\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case FILE_WRITE:
               ret = handle_file_write(client_entry->sock_info, req);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_write\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case PROXY_STATE_GET:
               ret = handle_proxy_state_get(client_entry->sock_info);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_get\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case PROXY_STATE_SET:
               ret = handle_proxy_state_set(client_entry->sock_info, req);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_set\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case RECONFIGURE:
               ret = handle_reconfigure(client_entry->sock_info);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_reconfigure\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
-
               break;
 
             case RESTART:
               ret = handle_restart(client_entry->sock_info, req, false);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case BOUNCE:
               ret = handle_restart(client_entry->sock_info, req, true);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart bounce\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case STORAGE_DEVICE_CMD_OFFLINE:
               ret = handle_storage_device_cmd_offline(client_entry->sock_info, req);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_storage_device_cmd_offline\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case EVENT_RESOLVE:
               ret = handle_event_resolve(client_entry->sock_info, req);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_event_resolve\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case EVENT_GET_MLT:
               ret = handle_event_get_mlt(client_entry->sock_info);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:event_get_mlt\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case EVENT_ACTIVE:
               ret = handle_event_active(client_entry->sock_info, req);
-              ats_free(req);     // free the request allocated by preprocess_msg
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:event_active\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case SNAPSHOT_TAKE:
             case SNAPSHOT_RESTORE:
             case SNAPSHOT_REMOVE:
               ret = handle_snapshot(client_entry->sock_info, req, op_t);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:handle_snapshot\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case SNAPSHOT_GET_MLT:
               ret = handle_snapshot_get_mlt(client_entry->sock_info);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR:snapshot_get_mlt\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case DIAGS:
-              if (req) {
-                handle_diags(client_entry->sock_info, req);
-                ats_free(req);
-              }
+              ret = handle_diags(client_entry->sock_info, req);
               break;
 
             case STATS_RESET_CLUSTER:
             case STATS_RESET_NODE:
               ret = handle_stats_reset(client_entry->sock_info, req, op_t);
-              ats_free(req);
-              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
-                Debug("ts_main", "[ts_ctrl_main] ERROR: stats_reset\n");
-                remove_client(client_entry, accepted_con);
-                con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
-                continue;
-              }
               break;
 
             case UNDEFINED_OP:
@@ -409,6 +294,16 @@ ts_ctrl_main(void *arg)
               break;
 
             }                   // end switch (op_t)
+
+            ats_free(req);
+
+            if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
+              Debug("ts_main", "[ts_ctrl_main] ERROR: sending response for message op %d\n", (int)op_t);
+              remove_client(client_entry, accepted_con);
+              con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
+              continue;
+            }
+
           }                     // end if(client_entry->sock_info.fd && FD_ISSET(client_entry->sock_info.fd, &selectFDs))
 
           con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
@@ -487,16 +382,16 @@ handle_record_get(struct SocketInfo sock_info, char *req)
   // create and send reply back to client
   switch (ele->rec_type) {
   case TS_REC_INT:
-    ret = send_record_get_reply(sock_info, ret, &(ele->int_val), sizeof(TSInt), ele->rec_type);
+    ret = send_record_get_reply(sock_info, ret, &(ele->int_val), sizeof(TSInt), ele->rec_type, ele->rec_name);
     break;
   case TS_REC_COUNTER:
-    ret = send_record_get_reply(sock_info, ret, &(ele->counter_val), sizeof(TSCounter), ele->rec_type);
+    ret = send_record_get_reply(sock_info, ret, &(ele->counter_val), sizeof(TSCounter), ele->rec_type, ele->rec_name);
     break;
   case TS_REC_FLOAT:
-    ret = send_record_get_reply(sock_info, ret, &(ele->float_val), sizeof(TSFloat), ele->rec_type);
+    ret = send_record_get_reply(sock_info, ret, &(ele->float_val), sizeof(TSFloat), ele->rec_type, ele->rec_name);
     break;
   case TS_REC_STRING:
-    ret = send_record_get_reply(sock_info, ret, ele->string_val, strlen(ele->string_val), ele->rec_type);
+    ret = send_record_get_reply(sock_info, ret, ele->string_val, strlen(ele->string_val), ele->rec_type, ele->rec_name);
     break;
   default:                     // invalid record type
     ret = send_reply(sock_info, TS_ERR_FAIL);
@@ -513,6 +408,70 @@ handle_record_get(struct SocketInfo sock_info, char *req)
   return ret;
 }
 
+struct record_match_state {
+  TSError     err;
+  SocketInfo  sock;
+  DFA         regex;
+};
+
+static void
+send_record_match(RecT /* rec_type */, void *edata, int /* registered */, const char *name, int data_type, RecData *rec_val)
+{
+  record_match_state *match = (record_match_state *)edata ;
+
+  if (match->err != TS_ERR_OKAY) {
+    return;
+  }
+
+  if (match->regex.match(name) >= 0) {
+    switch (data_type) {
+    case RECD_INT:
+      match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_int), sizeof(TSInt), TS_REC_INT, name);
+      break;
+    case RECD_COUNTER:
+      match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_counter), sizeof(TSCounter), TS_REC_COUNTER, name);
+      break;
+    case RECD_STRING:
+      match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, rec_val->rec_string, rec_val->rec_string ? strlen(rec_val->rec_string): 0, TS_REC_STRING, name);
+      break;
+    case RECD_FLOAT:
+      match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_float), sizeof(TSFloat), TS_REC_FLOAT, name);
+      break;
+    default:
+      break; // skip it
+    }
+  }
+}
+
+TSError
+handle_record_match(struct SocketInfo sock_info, char *req)
+{
+  TSError ret;
+  record_match_state match;
+
+  // parse msg - don't really need since the request itself is the regex itself
+  if (!req) {
+    ret = send_reply(sock_info, TS_ERR_FAIL);
+    return ret;
+  }
+
+  if (match.regex.compile(req, RE_CASE_INSENSITIVE) != 0) {
+    ret = send_reply(sock_info, TS_ERR_FAIL);
+    return ret;
+  }
+
+  match.err = TS_ERR_OKAY;
+  match.sock = sock_info;
+
+  RecDumpRecords(RECT_NULL, send_record_match, &match);
+
+  // If successful, send a list terminator.
+  if (match.err == TS_ERR_OKAY) {
+    return send_record_get_reply(sock_info, TS_ERR_OKAY, NULL, 0, TS_REC_UNDEFINED, NULL);
+  }
+
+  return match.err;
+}
 
 /**************************************************************************
  * handle_record_set
@@ -957,7 +916,7 @@ handle_snapshot_get_mlt(struct SocketInfo sock_info)
  *        req - the diag message (already formatted with arguments)
  * output: TS_ERR_xx
  *************************************************************************/
-void
+TSError
 handle_diags(struct SocketInfo /* sock_info ATS_UNUSED */, char *req)
 {
   TSError ret;
@@ -1008,12 +967,12 @@ handle_diags(struct SocketInfo /* sock_info ATS_UNUSED */, char *req)
   if (diags_init) {
     diags->print("TSMgmtAPI", DTA(level), "%s", diag_msg);
     ats_free(diag_msg);
-    return;
+    return TS_ERR_OKAY;
   }
 
 Lerror:
   ats_free(diag_msg);
-  return;
+  return TS_ERR_FAIL;
 }
 
 /**************************************************************************

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/TSControlMain.h
----------------------------------------------------------------------
diff --git a/mgmt/api/TSControlMain.h b/mgmt/api/TSControlMain.h
index 397b8bb..b53603e 100644
--- a/mgmt/api/TSControlMain.h
+++ b/mgmt/api/TSControlMain.h
@@ -49,6 +49,7 @@ void delete_client(ClientT * client);
 void *ts_ctrl_main(void *arg);
 
 TSError handle_record_get(struct SocketInfo sock_info, char *req);
+TSError handle_record_match(struct SocketInfo sock_info, char *req);
 TSError handle_record_set(struct SocketInfo sock_info, char *req);
 
 TSError handle_file_read(struct SocketInfo sock_info, char *req);
@@ -67,7 +68,7 @@ TSError handle_event_active(struct SocketInfo sock_info, char *req);
 TSError handle_snapshot(struct SocketInfo sock_info, char *req, OpType op);
 TSError handle_snapshot_get_mlt(struct SocketInfo sock_info);
 
-void handle_diags(struct SocketInfo sock_info, char *req);
+TSError handle_diags(struct SocketInfo sock_info, char *req);
 
 TSError handle_stats_reset(struct SocketInfo sock_info, char *req, OpType op);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0389be39/mgmt/api/include/mgmtapi.h
----------------------------------------------------------------------
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index 7b88d92..786db7f 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -1174,6 +1174,12 @@ extern "C"
  */
   tsapi TSError TSRecordGetMlt(TSStringList rec_names, TSList rec_vals);
 
+/* TSRecordGetMatchMlt: gets a set of records
+ * Input:  rec_regex - regular expression to match against record names
+ * Output: TSError, TSList of TSRecordEle
+ */
+  tsapi TSError TSRecordGetMatchMlt(const char *rec_regex, TSList list);
+
 /* TSRecordSet*: sets a record w/ a known type
  * Input:  rec_name     - the name of the record (proxy.config.record_name)
  *         *_val        - the value to set the record to


[23/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: cc9f6172a59fc778ce50e9f197070bf5b420e9aa
Parents: e632b3a
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:57:13 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:57:13 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/AsyncHttpFetch.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc9f6172/lib/atscppapi/src/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc b/lib/atscppapi/src/AsyncHttpFetch.cc
index 34fb805..19dbe58 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -98,7 +98,7 @@ static int handleFetchEvents(TSCont cont, TSEvent event, void *edata) {
     LOG_DEBUG("Unable to dispatch result from AsyncFetch because promise has died.");
   }
 
-  delete fetch_provider; // we must always be sure to clean up the provider when we're done with it.
+  utils::internal::deleteAsyncHttpFetch(fetch_provider); // we must always cleans up when we're done.
   TSContDestroy(cont);
   return 0;
 }


[28/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: b8831699f030ed2f77fbeb040761a148b41582d5
Parents: 283e66c
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:58:36 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:58:36 2014 -0700

----------------------------------------------------------------------
 CHANGES | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b8831699/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ba51186..3484cf0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,5 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
-
   *) [TS-2651] atscppapi: race conditions in destruction of async providers
  
   *) [TS-2646] regex_remap: Add a new option, @caseless.


[22/50] [abbrv] git commit: TS-2624: Fix Build on Saucy

Posted by zw...@apache.org.
TS-2624: Fix Build on Saucy


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

Branch: refs/heads/lua_config
Commit: e632b3a7d382008dcf27b35a05cbea0c691e834d
Parents: b749034
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 19 14:52:49 2014 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Wed Mar 19 14:52:49 2014 -0600

----------------------------------------------------------------------
 iocore/aio/Makefile.am         | 3 +--
 iocore/eventsystem/Makefile.am | 2 +-
 mgmt/Makefile.am               | 2 +-
 proxy/Makefile.am              | 6 +++---
 4 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e632b3a7/iocore/aio/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am
index df648f8..cad3e5c 100644
--- a/iocore/aio/Makefile.am
+++ b/iocore/aio/Makefile.am
@@ -55,5 +55,4 @@ test_AIO_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
-  @LIBTCL@
-
+  @LIBTCL@ @hwloc_LIBS@

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e632b3a7/iocore/eventsystem/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index 2cceaaa..87c221f 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -90,7 +90,7 @@ test_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
-  @LIBTCL@
+  @LIBTCL@ @hwloc_LIBS@
 
 test_Buffer_SOURCES = \
   test_Buffer.cc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e632b3a7/mgmt/Makefile.am
----------------------------------------------------------------------
diff --git a/mgmt/Makefile.am b/mgmt/Makefile.am
index 56c42f0..f0566a0 100644
--- a/mgmt/Makefile.am
+++ b/mgmt/Makefile.am
@@ -103,7 +103,7 @@ traffic_manager_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/proxy/shared/liberror.a \
   $(top_builddir)/proxy/shared/libdiagsconfig.a \
-  @LIBRESOLV@ @LIBEXPAT@ @LIBPCRE@ @LIBTCL@ @LIBCAP@ \
+  @LIBRESOLV@ @LIBEXPAT@ @LIBPCRE@ @LIBTCL@ @LIBCAP@ @hwloc_LIBS@ \
   -lm
 
 # Must do it this way or the dependencies aren't detected.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e632b3a7/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index ba8645b..8ef6104 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -176,7 +176,7 @@ traffic_logcat_LDADD = \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/ts/libtsutil.la \
-  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ \
+  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
   @LIBEXPAT@ @LIBDEMANGLE@ @LIBPROFILER@ -lm
 
 traffic_logstats_SOURCES = logstats.cc
@@ -192,7 +192,7 @@ traffic_logstats_LDADD = \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/ts/libtsutil.la \
-  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ \
+  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
   @LIBEXPAT@ @LIBDEMANGLE@ @LIBPROFILER@ -lm
 
 traffic_sac_SOURCES = \
@@ -246,7 +246,7 @@ traffic_sac_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/lib/ts/libtsutil.la \
-  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ \
+  @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
   @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ -lm
 
 if BUILD_TESTS


[50/50] [abbrv] git commit: TS-2732 Run the code through indent, to follow our coding standards

Posted by zw...@apache.org.
TS-2732 Run the code through indent, to follow our coding standards


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

Branch: refs/heads/master
Commit: 4f2dc70f0e5b3a2969cb70bac77523d259a95610
Parents: 634ba75
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Apr 20 13:19:30 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Apr 20 13:19:30 2014 -0600

----------------------------------------------------------------------
 plugins/experimental/url_sig/url_sig.c | 836 ++++++++++++++--------------
 plugins/experimental/url_sig/url_sig.h |  16 +-
 2 files changed, 436 insertions(+), 416 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4f2dc70f/plugins/experimental/url_sig/url_sig.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index 0cde9d3..be85524 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -34,423 +34,443 @@
 #include <ts/ts.h>
 #include <ts/remap.h>
 
-static const char* PLUGIN_NAME = "url_sig";
-
-struct config {
-	char *map_from;
-	char *map_to;
-	TSHttpStatus err_status;
-	char *err_url;
-	char keys[MAX_KEY_NUM][MAX_KEY_LEN];
+static const char *PLUGIN_NAME = "url_sig";
+
+struct config
+{
+  char *map_from;
+  char *map_to;
+  TSHttpStatus err_status;
+  char *err_url;
+  char keys[MAX_KEY_NUM][MAX_KEY_LEN];
 };
 
-TSReturnCode TSRemapInit(TSRemapInterface* api_info, char *errbuf, int errbuf_size) {
-	if (!api_info) {
-		strncpy(errbuf, "[tsremap_init] - Invalid TSRemapInterface argument", (size_t) (errbuf_size - 1));
-		return TS_ERROR;
-	}
-
-	if (api_info->tsremap_version < TSREMAP_VERSION) {
-		snprintf(errbuf, errbuf_size - 1, "[TSRemapInit] - Incorrect API version %ld.%ld", api_info->tsremap_version >> 16,
-				(api_info->tsremap_version & 0xffff));
-		return TS_ERROR;
-	}
-
-	TSDebug(PLUGIN_NAME, "plugin is succesfully initialized");
-	return TS_SUCCESS;
+TSReturnCode
+TSRemapInit(TSRemapInterface * api_info, char *errbuf, int errbuf_size)
+{
+  if (!api_info) {
+    strncpy(errbuf, "[tsremap_init] - Invalid TSRemapInterface argument", (size_t) (errbuf_size - 1));
+    return TS_ERROR;
+  }
+
+  if (api_info->tsremap_version < TSREMAP_VERSION) {
+    snprintf(errbuf, errbuf_size - 1, "[TSRemapInit] - Incorrect API version %ld.%ld", api_info->tsremap_version >> 16,
+             (api_info->tsremap_version & 0xffff));
+    return TS_ERROR;
+  }
+
+  TSDebug(PLUGIN_NAME, "plugin is succesfully initialized");
+  return TS_SUCCESS;
 }
 
 // To force a config file reload touch remap.config and do a "traffic_line -x"
-TSReturnCode TSRemapNewInstance(int argc, char* argv[], void** ih, char* errbuf, int errbuf_size) {
-	char config_file[PATH_MAX];
-	struct config *cfg;
-
-	cfg = TSmalloc(sizeof(struct config));
-	*ih = (void *) cfg;
-
-	int i = 0;
-	for (i = 0; i < MAX_KEY_NUM; i++) {
-		cfg->keys[i][0] = '\0';
-	}
-
-	if (argc != 3) {
-		snprintf(errbuf, errbuf_size - 1, "[TSRemapNewKeyInstance] - Argument count wrong (%d)... Need exactly two pparam= (config file name).",
-				argc);
-		return TS_ERROR;
-	}
-	TSDebug(PLUGIN_NAME, "Initializing remap function of %s -> %s with config from %s", argv[0], argv[1], argv[2]);
-	cfg->map_from = TSstrndup( argv[0], strlen(argv[0]));
-	cfg->map_to = TSstrndup( argv[0], strlen(argv[1]));
-
-	const char* install_dir = TSInstallDirGet();
-	snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, "etc/trafficserver", argv[2]);
-	TSDebug(PLUGIN_NAME, "config file name: %s", config_file);
-	FILE *file = fopen(config_file, "r");
-	if (file == NULL ) {
-		snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Error opening file %s.", config_file);
-		return TS_ERROR;
-	}
-
-	char line[260];
-	int line_no = 0;
-	int keynum;
-	while (fgets(line, sizeof(line), file) != NULL ) {
-		TSDebug(PLUGIN_NAME, "LINE: %s (%d)", line, (int) strlen(line));
-		line_no++;
-		if (line[0] == '#' || strlen(line) <= 1)
-			continue;
-		char *pos = strchr(line, '=');
-		if (pos == NULL ) {
-			TSError("Error parsing line %d of file %s (%s).", line_no, config_file, line);
-		}
-		*pos = '\0';
-		char *value = pos + 1;
-	    while (isspace(*value))         // remove whitespace
-				value++;
-		pos = strchr(value, '\n');		// remove the new line, terminate the string
-		if (pos != NULL ) {
-			*pos = '\0';
-		} else {
-			snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Maximum line (%d) exceeded on line %d.", MAX_KEY_LEN, line_no);
-			return TS_ERROR;
-		}
-		if (strncmp(line, "key", 3) == 0) {
-			if (value != NULL ) {
-				if (strncmp((char *) (line + 3), "0", 1) == 0) {
-					keynum = 0;
-				} else {
-                    TSDebug(PLUGIN_NAME, ">>> %s <<<", line +3);
-					keynum = atoi((char *) (line + 3));
-					if (keynum == 0) {
-						keynum = -1; // Not a Number
-					}
-				}
-				TSDebug(PLUGIN_NAME, "key number %d == %s", keynum, value);
-				if (keynum > MAX_KEY_NUM || keynum == -1) {
-					snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Key number (%d) > MAX_KEY_NUM (%d) or NaN.", keynum, MAX_KEY_NUM);
-					return TS_ERROR;
-				}
-				strcpy(&cfg->keys[keynum][0], value);
-			}
-		} else if (strncmp(line, "error_url", 9) == 0) {
-			if (atoi(value)) {
-				cfg->err_status = atoi(value);
-			}
-			value += 3;
-			while (isspace(*value))
-				value++;
-//			if (strncmp(value, "http://", strlen("http://")) != 0) {
-//				snprintf(errbuf, errbuf_size - 1,
-//						"[TSRemapNewInstance] - Invalid config, err_status == 302, but err_url does not start with \"http://\"");
-//				return TS_ERROR;
-//			}
-			if (cfg->err_status == TS_HTTP_STATUS_MOVED_TEMPORARILY)
-				cfg->err_url = TSstrndup(value, strlen(value));
-			else cfg->err_url = NULL;
-		} else {
-			TSError("Error parsing line %d of file %s (%s).", line_no, config_file, line);
-		}
-	}
-
-	switch (cfg->err_status) {
-	case TS_HTTP_STATUS_MOVED_TEMPORARILY:
-		if (cfg->err_url == NULL ) {
-			snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Invalid config, err_status == 302, but err_url == NULL");
-			return TS_ERROR;
-		}
-		printf("[url_sig] mapping {%s -> %s} with status %d and err url %s\n", argv[0], argv[1], cfg->err_status, cfg->err_url);
-		break;
-	case TS_HTTP_STATUS_FORBIDDEN:
-		if (cfg->err_url != NULL ) {
-			snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Invalid config, err_status == 403, but err_url != NULL");
-			return TS_ERROR;
-		}
-		printf("[url_sig] mapping {%s -> %s} with status %d\n", argv[0], argv[1], cfg->err_status);
-		break;
-	default:
-		snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Return code %d not supported.", cfg->err_status);
-		return TS_ERROR;
-
-	}
-
-	i = 0;
-	for (i = 0; i < MAX_KEY_NUM; i++) {
-		if (cfg->keys[i] != NULL && strlen(cfg->keys[i]) > 0)
-			printf("[url_sig] shared secret key[%d] = %s\n", i, cfg->keys[i]);
-	}
-	fclose(file);
-	printf("%s version %s initialized.\n", PLUGIN_NAME, VERSION);
-	return TS_SUCCESS;
+TSReturnCode
+TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_size)
+{
+  char config_file[PATH_MAX];
+  struct config *cfg;
+
+  cfg = TSmalloc(sizeof(struct config));
+  *ih = (void *) cfg;
+
+  int i = 0;
+  for (i = 0; i < MAX_KEY_NUM; i++) {
+    cfg->keys[i][0] = '\0';
+  }
+
+  if (argc != 3) {
+    snprintf(errbuf, errbuf_size - 1,
+             "[TSRemapNewKeyInstance] - Argument count wrong (%d)... Need exactly two pparam= (config file name).",
+             argc);
+    return TS_ERROR;
+  }
+  TSDebug(PLUGIN_NAME, "Initializing remap function of %s -> %s with config from %s", argv[0], argv[1], argv[2]);
+  cfg->map_from = TSstrndup(argv[0], strlen(argv[0]));
+  cfg->map_to = TSstrndup(argv[0], strlen(argv[1]));
+
+  const char *install_dir = TSInstallDirGet();
+  snprintf(config_file, sizeof(config_file), "%s/%s/%s", install_dir, "etc/trafficserver", argv[2]);
+  TSDebug(PLUGIN_NAME, "config file name: %s", config_file);
+  FILE *file = fopen(config_file, "r");
+  if (file == NULL) {
+    snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Error opening file %s.", config_file);
+    return TS_ERROR;
+  }
+
+  char line[260];
+  int line_no = 0;
+  int keynum;
+  while (fgets(line, sizeof(line), file) != NULL) {
+    TSDebug(PLUGIN_NAME, "LINE: %s (%d)", line, (int) strlen(line));
+    line_no++;
+    if (line[0] == '#' || strlen(line) <= 1)
+      continue;
+    char *pos = strchr(line, '=');
+    if (pos == NULL) {
+      TSError("Error parsing line %d of file %s (%s).", line_no, config_file, line);
+    }
+    *pos = '\0';
+    char *value = pos + 1;
+    while (isspace(*value))     // remove whitespace
+      value++;
+    pos = strchr(value, '\n');  // remove the new line, terminate the string
+    if (pos != NULL) {
+      *pos = '\0';
+    } else {
+      snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Maximum line (%d) exceeded on line %d.", MAX_KEY_LEN,
+               line_no);
+      return TS_ERROR;
+    }
+    if (strncmp(line, "key", 3) == 0) {
+      if (value != NULL) {
+        if (strncmp((char *) (line + 3), "0", 1) == 0) {
+          keynum = 0;
+        } else {
+          TSDebug(PLUGIN_NAME, ">>> %s <<<", line + 3);
+          keynum = atoi((char *) (line + 3));
+          if (keynum == 0) {
+            keynum = -1;        // Not a Number
+          }
+        }
+        TSDebug(PLUGIN_NAME, "key number %d == %s", keynum, value);
+        if (keynum > MAX_KEY_NUM || keynum == -1) {
+          snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Key number (%d) > MAX_KEY_NUM (%d) or NaN.", keynum,
+                   MAX_KEY_NUM);
+          return TS_ERROR;
+        }
+        strcpy(&cfg->keys[keynum][0], value);
+      }
+    } else if (strncmp(line, "error_url", 9) == 0) {
+      if (atoi(value)) {
+        cfg->err_status = atoi(value);
+      }
+      value += 3;
+      while (isspace(*value))
+        value++;
+//                      if (strncmp(value, "http://", strlen("http://")) != 0) {
+//                              snprintf(errbuf, errbuf_size - 1,
+//                                              "[TSRemapNewInstance] - Invalid config, err_status == 302, but err_url does not start with \"http://\"");
+//                              return TS_ERROR;
+//                      }
+      if (cfg->err_status == TS_HTTP_STATUS_MOVED_TEMPORARILY)
+        cfg->err_url = TSstrndup(value, strlen(value));
+      else
+        cfg->err_url = NULL;
+    } else {
+      TSError("Error parsing line %d of file %s (%s).", line_no, config_file, line);
+    }
+  }
+
+  switch (cfg->err_status) {
+  case TS_HTTP_STATUS_MOVED_TEMPORARILY:
+    if (cfg->err_url == NULL) {
+      snprintf(errbuf, errbuf_size - 1,
+               "[TSRemapNewInstance] - Invalid config, err_status == 302, but err_url == NULL");
+      return TS_ERROR;
+    }
+    printf("[url_sig] mapping {%s -> %s} with status %d and err url %s\n", argv[0], argv[1], cfg->err_status,
+           cfg->err_url);
+    break;
+  case TS_HTTP_STATUS_FORBIDDEN:
+    if (cfg->err_url != NULL) {
+      snprintf(errbuf, errbuf_size - 1,
+               "[TSRemapNewInstance] - Invalid config, err_status == 403, but err_url != NULL");
+      return TS_ERROR;
+    }
+    printf("[url_sig] mapping {%s -> %s} with status %d\n", argv[0], argv[1], cfg->err_status);
+    break;
+  default:
+    snprintf(errbuf, errbuf_size - 1, "[TSRemapNewInstance] - Return code %d not supported.", cfg->err_status);
+    return TS_ERROR;
+
+  }
+
+  i = 0;
+  for (i = 0; i < MAX_KEY_NUM; i++) {
+    if (cfg->keys[i] != NULL && strlen(cfg->keys[i]) > 0)
+      printf("[url_sig] shared secret key[%d] = %s\n", i, cfg->keys[i]);
+  }
+  fclose(file);
+  printf("%s version %s initialized.\n", PLUGIN_NAME, VERSION);
+  return TS_SUCCESS;
 }
 
-void TSRemapDeleteInstance(void* ih) {
-	struct config *cfg;
-	cfg = (struct config *) ih;
-
-	TSError("Cleaning up...");
-	TSfree(cfg->map_from);
-	TSfree(cfg->map_to);
-	TSfree(cfg->err_url);
-	TSfree(cfg);
+void
+TSRemapDeleteInstance(void *ih)
+{
+  struct config *cfg;
+  cfg = (struct config *) ih;
+
+  TSError("Cleaning up...");
+  TSfree(cfg->map_from);
+  TSfree(cfg->map_to);
+  TSfree(cfg->err_url);
+  TSfree(cfg);
 }
 
-void err_log(char *url, char *msg) {
-	if (msg && url) {
-		TSDebug(PLUGIN_NAME, "[URL=%s]: %s", url, msg);
-		TSError("[URL=%s]: %s", url, msg); // This goes to error.log
-	} else {
-		TSError("Invalid err_log request");
-	}
+void
+err_log(char *url, char *msg)
+{
+  if (msg && url) {
+    TSDebug(PLUGIN_NAME, "[URL=%s]: %s", url, msg);
+    TSError("[URL=%s]: %s", url, msg);  // This goes to error.log
+  } else {
+    TSError("Invalid err_log request");
+  }
 }
 
-TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri) {
-	struct config *cfg;
-	cfg = (struct config *) ih;
-
-	int url_len = 0;
-	time_t expiration = 0;
-	int algorithm = -1;
-	int keyindex = -1;
-	int cmp_res;
-	int rval;
-	int i = 0;
-	int j = 0;
-	unsigned int sig_len = 0;
-
-	/* all strings are locally allocated except url... about 25k per instance*/
-	char *url;
-	char signed_part[8192] = { '\0' }; // this initializes the whole array and is needed
-	char urltokstr[8192] = { '\0' };
-	char client_ip[CIP_STRLEN] = { '\0' };
-	char ipstr[CIP_STRLEN] = { '\0' };
-	unsigned char sig[MAX_SIG_SIZE + 1];
-	char sig_string[2 * MAX_SIG_SIZE + 1];
-
-	/* these are just pointers into other allocations */
-	char *signature = NULL;
-	char *parts = NULL;
-	char *part = NULL;
-	char *p = NULL, *pp = NULL;
-	char *query = NULL;
-
-	int retval, sockfd;
-	socklen_t peer_len;
-	struct sockaddr_in peer;
-
-	url = TSUrlStringGet(rri->requestBufp, rri->requestUrl, &url_len);
-
-	if (url_len >= MAX_REQ_LEN - 1) {
-		err_log(url, "URL string too long.");
-		goto deny;
-	}
-
-	TSDebug(PLUGIN_NAME, "%s", url);
-
-	query = strstr(url, "?");
-	if (query == NULL ) {
-		err_log(url, "Has no query string.");
-		goto deny;
-	}
-
-	if (strncmp(url, "http://", strlen("http://")) != 0) {
-		err_log(url, "Invalid URL scheme - only http supported.");
-		goto deny;
-	}
-
-	/* first, parse the query string */
-	query++; /* get rid of the ? */
-	TSDebug(PLUGIN_NAME, "Query string is:%s", query);
-
-	// Client IP - this one is optional
-	p = strstr(query, CIP_QSTRING"=");
-	if (p != NULL ) {
-
-		p += strlen(CIP_QSTRING + 1);
-		pp = strstr(p, "&");
-		if ((pp - p) > CIP_STRLEN - 1 || (pp - p) < 4) {
-			err_log(url, "IP address string too long or short.");
-			goto deny;
-		}
-		strncpy(client_ip, p + strlen(CIP_QSTRING) + 1, (pp - p - (strlen(CIP_QSTRING) + 1)));
-		client_ip[pp - p - (strlen(CIP_QSTRING) + 1)] = '\0';
-		TSDebug(PLUGIN_NAME, "CIP: -%s-", client_ip);
-		retval = TSHttpTxnClientFdGet(txnp, &sockfd);
-		if (retval != TS_SUCCESS) {
-			err_log(url, "Error getting sockfd.");
-			goto deny;
-		}
-		peer_len = sizeof(peer);
-		if (getpeername(sockfd, (struct sockaddr*) &peer, &peer_len) != 0) {
-			perror("Can't get peer address:");
-		}
-		struct sockaddr_in *s = (struct sockaddr_in *) &peer;
-		inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
-		TSDebug(PLUGIN_NAME, "Peer address: -%s-", ipstr);
-		if (strcmp(ipstr, client_ip) != 0) {
-			err_log(url, "Client IP doesn't match signature.");
-			goto deny;
-		}
-	}
-	// Expiration
-	p = strstr(query, EXP_QSTRING"=");
-	if (p != NULL ) {
-		p += strlen(EXP_QSTRING) + 1;
-		expiration = atoi(p);
-		if (expiration == 0 || expiration < time(NULL )) {
-			err_log(url, "Invalid expiration, or expired.");
-			goto deny;
-		}
-		TSDebug(PLUGIN_NAME, "Exp: %d", (int) expiration);
-	} else {
-		err_log(url, "Expiration query string not found.");
-		goto deny;
-	}
-	// Algorithm
-	p = strstr(query, ALG_QSTRING"=");
-	if (p != NULL ) {
-		p += strlen(ALG_QSTRING) + 1;
-		algorithm = atoi(p);
-		// The check for a valid algorithm is later.
-		TSDebug(PLUGIN_NAME, "Algorithm: %d", algorithm);
-	} else {
-		err_log(url, "Algorithm query string not found.");
-		goto deny;
-	}
-	// Key index
-	p = strstr(query, KIN_QSTRING"=");
-	if (p != NULL ) {
-		p += strlen(KIN_QSTRING) + 1;
-		keyindex = atoi(p);
-		if (keyindex == -1) {
-			err_log(url, "Invalid key index.");
-			goto deny;
-		}
-		TSDebug(PLUGIN_NAME, "Key Index: %d", keyindex);
-	} else {
-		err_log(url, "KeyIndex query string not found.");
-		goto deny;
-	}
-	// Parts
-	p = strstr(query, PAR_QSTRING"=");
-	if (p != NULL ) {
-		p += strlen(PAR_QSTRING) + 1;
-		parts = p; // NOTE parts is not NULL terminated it is terminated by "&" of next param
-		p = strstr(parts, "&");
-		TSDebug(PLUGIN_NAME, "Parts: %.*s", (int) (p - parts), parts);
-	} else {
-		err_log(url, "PartsSigned query string not found.");
-		goto deny;
-	}
-	// And finally, the sig (has to be last)
-	p = strstr(query, SIG_QSTRING"=");
-	if (p != NULL ) {
-		p += strlen(SIG_QSTRING) + 1;
-		signature = p; // NOTE sig is not NULL terminated, it has to be 20 chars
-		if ((algorithm == USIG_HMAC_SHA1 && strlen(signature) < SHA1_SIG_SIZE) || (algorithm == USIG_HMAC_MD5 && strlen(signature) < MD5_SIG_SIZE)) {
-			err_log(url, "Signature query string too short (< 20).");
-			goto deny;
-		}
-	} else {
-		err_log(url, "Signature query string not found.");
-		goto deny;
-	}
-
-	/* have the query string, and parameters passed initial checks */
-	TSDebug(PLUGIN_NAME, "Found all needed parameters: C=%s E=%d A=%d K=%d P=%s S=%s", client_ip, (int) expiration, algorithm, keyindex, parts,
-			signature);
-
-	/* find the string that was signed - cycle through the parts letters, adding the part of the fqdn/path if it is 1 */
-	p = strstr(url, "?");
-	memcpy(urltokstr, &url[strlen("http://")], p - url - strlen("http://"));
-	part = strtok_r(urltokstr, "/", &p);
-	while (part != NULL ) {
-		if (parts[j] == '1') {
-			strcpy(signed_part + strlen(signed_part), part);
-			strcpy(signed_part + strlen(signed_part), "/");
-		}
-		if (parts[j + 1] == '0' || parts[j + 1] == '1') // This remembers the last part, meaning, if there are no more valid letters in parts
-			j++;                                        // will keep repeating the value of the last one
-		part = strtok_r(NULL, "/", &p);
-	}
-
-	signed_part[strlen(signed_part) - 1] = '?'; // chop off the last /, replace with '?'
-	p = strstr(query, SIG_QSTRING"=");
-	strncat(signed_part, query, (p - query) + strlen(SIG_QSTRING) + 1);
-
-	TSDebug(PLUGIN_NAME, "Signed string=\"%s\"", signed_part);
-
-	/* calculate the expected the signature with the right algorithm */
-	switch (algorithm) {
-	case USIG_HMAC_SHA1:
-		HMAC(EVP_sha1(), (const unsigned char *) cfg->keys[keyindex], strlen(cfg->keys[keyindex]), (const unsigned char *) signed_part,
-				strlen(signed_part), sig, &sig_len);
-		if (sig_len != SHA1_SIG_SIZE) {
-			TSDebug(PLUGIN_NAME, "sig_len: %d", sig_len);
-			err_log(url, "Calculated sig len !=  SHA1_SIG_SIZE !");
-			goto deny;
-		}
-
-		break;
-	case USIG_HMAC_MD5:
-		HMAC(EVP_md5(), (const unsigned char *) cfg->keys[keyindex], strlen(cfg->keys[keyindex]), (const unsigned char *) signed_part,
-				strlen(signed_part), sig, &sig_len);
-		if (sig_len != MD5_SIG_SIZE) {
-			TSDebug(PLUGIN_NAME, "sig_len: %d", sig_len);
-			err_log(url, "Calculated sig len !=  MD5_SIG_SIZE !");
-			goto deny;
-		}
-		break;
-	default:
-		err_log(url, "Algorithm not supported.");
-		goto deny;
-	}
-
-	for (i = 0; i < sig_len; i++) {
-		sprintf(&(sig_string[i * 2]), "%02x", sig[i]);
-	}
-
-	TSDebug(PLUGIN_NAME, "Expected signature: %s", sig_string);
-
-	/* and compare to signature that was sent */
-	cmp_res = strncmp(sig_string, signature, sig_len * 2);
-	if (cmp_res != 0) {
-		err_log(url, "Signature check failed.");
-		goto deny;
-	} else {
-		TSDebug(PLUGIN_NAME, "Signature check passed.");
-		goto allow;
-	}
-
-	/* ********* Deny ********* */
-	deny: if (url)
-		TSfree(url);
-	switch (cfg->err_status) {
-	case TS_HTTP_STATUS_MOVED_TEMPORARILY:
-		TSDebug(PLUGIN_NAME, "Redirecting to %s", cfg->err_url);
-		char *start, *end;
-		start = cfg->err_url;
-		end = start + strlen(cfg->err_url);
-		if (TSUrlParse(rri->requestBufp, rri->requestUrl, (const char **) &start, end) != TS_PARSE_DONE) {
-			err_log("url", "Error inn TSUrlParse!");
-		}
-		rri->redirect = 1;
-		break;
-	case TS_HTTP_STATUS_FORBIDDEN:
-	default:
-		/* set status and body to be 403 */
-		TSHttpTxnSetHttpRetStatus(txnp, TS_HTTP_STATUS_FORBIDDEN);
-		TSHttpTxnErrorBodySet(txnp, TSstrdup("Authorization Denied"), strlen("Authorization Denied") - 1, TSstrdup("text/plain"));
-		break;
-	}
-	return TSREMAP_DID_REMAP;
-
-	/* ********* Allow ********* */
-	allow: if (url)
-		TSfree(url);
-	/* drop the query string so we can cache-hit */
-	rval = TSUrlHttpQuerySet(rri->requestBufp, rri->requestUrl, NULL, 0);
-	if (rval != TS_SUCCESS) {
-		TSError("Error stripping query string: %d.", rval);
-	}
-	return TSREMAP_NO_REMAP;
+TSRemapStatus
+TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo * rri)
+{
+  struct config *cfg;
+  cfg = (struct config *) ih;
+
+  int url_len = 0;
+  time_t expiration = 0;
+  int algorithm = -1;
+  int keyindex = -1;
+  int cmp_res;
+  int rval;
+  int i = 0;
+  int j = 0;
+  unsigned int sig_len = 0;
+
+  /* all strings are locally allocated except url... about 25k per instance */
+  char *url;
+  char signed_part[8192] = { '\0' };    // this initializes the whole array and is needed
+  char urltokstr[8192] = { '\0' };
+  char client_ip[CIP_STRLEN] = { '\0' };
+  char ipstr[CIP_STRLEN] = { '\0' };
+  unsigned char sig[MAX_SIG_SIZE + 1];
+  char sig_string[2 * MAX_SIG_SIZE + 1];
+
+  /* these are just pointers into other allocations */
+  char *signature = NULL;
+  char *parts = NULL;
+  char *part = NULL;
+  char *p = NULL, *pp = NULL;
+  char *query = NULL;
+
+  int retval, sockfd;
+  socklen_t peer_len;
+  struct sockaddr_in peer;
+
+  url = TSUrlStringGet(rri->requestBufp, rri->requestUrl, &url_len);
+
+  if (url_len >= MAX_REQ_LEN - 1) {
+    err_log(url, "URL string too long.");
+    goto deny;
+  }
+
+  TSDebug(PLUGIN_NAME, "%s", url);
+
+  query = strstr(url, "?");
+  if (query == NULL) {
+    err_log(url, "Has no query string.");
+    goto deny;
+  }
+
+  if (strncmp(url, "http://", strlen("http://")) != 0) {
+    err_log(url, "Invalid URL scheme - only http supported.");
+    goto deny;
+  }
+
+  /* first, parse the query string */
+  query++;                      /* get rid of the ? */
+  TSDebug(PLUGIN_NAME, "Query string is:%s", query);
+
+  // Client IP - this one is optional
+  p = strstr(query, CIP_QSTRING "=");
+  if (p != NULL) {
+
+    p += strlen(CIP_QSTRING + 1);
+    pp = strstr(p, "&");
+    if ((pp - p) > CIP_STRLEN - 1 || (pp - p) < 4) {
+      err_log(url, "IP address string too long or short.");
+      goto deny;
+    }
+    strncpy(client_ip, p + strlen(CIP_QSTRING) + 1, (pp - p - (strlen(CIP_QSTRING) + 1)));
+    client_ip[pp - p - (strlen(CIP_QSTRING) + 1)] = '\0';
+    TSDebug(PLUGIN_NAME, "CIP: -%s-", client_ip);
+    retval = TSHttpTxnClientFdGet(txnp, &sockfd);
+    if (retval != TS_SUCCESS) {
+      err_log(url, "Error getting sockfd.");
+      goto deny;
+    }
+    peer_len = sizeof(peer);
+    if (getpeername(sockfd, (struct sockaddr *) &peer, &peer_len) != 0) {
+      perror("Can't get peer address:");
+    }
+    struct sockaddr_in *s = (struct sockaddr_in *) &peer;
+    inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
+    TSDebug(PLUGIN_NAME, "Peer address: -%s-", ipstr);
+    if (strcmp(ipstr, client_ip) != 0) {
+      err_log(url, "Client IP doesn't match signature.");
+      goto deny;
+    }
+  }
+  // Expiration
+  p = strstr(query, EXP_QSTRING "=");
+  if (p != NULL) {
+    p += strlen(EXP_QSTRING) + 1;
+    expiration = atoi(p);
+    if (expiration == 0 || expiration < time(NULL)) {
+      err_log(url, "Invalid expiration, or expired.");
+      goto deny;
+    }
+    TSDebug(PLUGIN_NAME, "Exp: %d", (int) expiration);
+  } else {
+    err_log(url, "Expiration query string not found.");
+    goto deny;
+  }
+  // Algorithm
+  p = strstr(query, ALG_QSTRING "=");
+  if (p != NULL) {
+    p += strlen(ALG_QSTRING) + 1;
+    algorithm = atoi(p);
+    // The check for a valid algorithm is later.
+    TSDebug(PLUGIN_NAME, "Algorithm: %d", algorithm);
+  } else {
+    err_log(url, "Algorithm query string not found.");
+    goto deny;
+  }
+  // Key index
+  p = strstr(query, KIN_QSTRING "=");
+  if (p != NULL) {
+    p += strlen(KIN_QSTRING) + 1;
+    keyindex = atoi(p);
+    if (keyindex == -1) {
+      err_log(url, "Invalid key index.");
+      goto deny;
+    }
+    TSDebug(PLUGIN_NAME, "Key Index: %d", keyindex);
+  } else {
+    err_log(url, "KeyIndex query string not found.");
+    goto deny;
+  }
+  // Parts
+  p = strstr(query, PAR_QSTRING "=");
+  if (p != NULL) {
+    p += strlen(PAR_QSTRING) + 1;
+    parts = p;                  // NOTE parts is not NULL terminated it is terminated by "&" of next param
+    p = strstr(parts, "&");
+    TSDebug(PLUGIN_NAME, "Parts: %.*s", (int) (p - parts), parts);
+  } else {
+    err_log(url, "PartsSigned query string not found.");
+    goto deny;
+  }
+  // And finally, the sig (has to be last)
+  p = strstr(query, SIG_QSTRING "=");
+  if (p != NULL) {
+    p += strlen(SIG_QSTRING) + 1;
+    signature = p;              // NOTE sig is not NULL terminated, it has to be 20 chars
+    if ((algorithm == USIG_HMAC_SHA1 && strlen(signature) < SHA1_SIG_SIZE) ||
+        (algorithm == USIG_HMAC_MD5 && strlen(signature) < MD5_SIG_SIZE)) {
+      err_log(url, "Signature query string too short (< 20).");
+      goto deny;
+    }
+  } else {
+    err_log(url, "Signature query string not found.");
+    goto deny;
+  }
+
+  /* have the query string, and parameters passed initial checks */
+  TSDebug(PLUGIN_NAME, "Found all needed parameters: C=%s E=%d A=%d K=%d P=%s S=%s", client_ip, (int) expiration,
+          algorithm, keyindex, parts, signature);
+
+  /* find the string that was signed - cycle through the parts letters, adding the part of the fqdn/path if it is 1 */
+  p = strstr(url, "?");
+  memcpy(urltokstr, &url[strlen("http://")], p - url - strlen("http://"));
+  part = strtok_r(urltokstr, "/", &p);
+  while (part != NULL) {
+    if (parts[j] == '1') {
+      strcpy(signed_part + strlen(signed_part), part);
+      strcpy(signed_part + strlen(signed_part), "/");
+    }
+    if (parts[j + 1] == '0' || parts[j + 1] == '1')     // This remembers the last part, meaning, if there are no more valid letters in parts
+      j++;                      // will keep repeating the value of the last one
+    part = strtok_r(NULL, "/", &p);
+  }
+
+  signed_part[strlen(signed_part) - 1] = '?';   // chop off the last /, replace with '?'
+  p = strstr(query, SIG_QSTRING "=");
+  strncat(signed_part, query, (p - query) + strlen(SIG_QSTRING) + 1);
+
+  TSDebug(PLUGIN_NAME, "Signed string=\"%s\"", signed_part);
+
+  /* calculate the expected the signature with the right algorithm */
+  switch (algorithm) {
+  case USIG_HMAC_SHA1:
+    HMAC(EVP_sha1(), (const unsigned char *) cfg->keys[keyindex], strlen(cfg->keys[keyindex]),
+         (const unsigned char *) signed_part, strlen(signed_part), sig, &sig_len);
+    if (sig_len != SHA1_SIG_SIZE) {
+      TSDebug(PLUGIN_NAME, "sig_len: %d", sig_len);
+      err_log(url, "Calculated sig len !=  SHA1_SIG_SIZE !");
+      goto deny;
+    }
+
+    break;
+  case USIG_HMAC_MD5:
+    HMAC(EVP_md5(), (const unsigned char *) cfg->keys[keyindex], strlen(cfg->keys[keyindex]),
+         (const unsigned char *) signed_part, strlen(signed_part), sig, &sig_len);
+    if (sig_len != MD5_SIG_SIZE) {
+      TSDebug(PLUGIN_NAME, "sig_len: %d", sig_len);
+      err_log(url, "Calculated sig len !=  MD5_SIG_SIZE !");
+      goto deny;
+    }
+    break;
+  default:
+    err_log(url, "Algorithm not supported.");
+    goto deny;
+  }
+
+  for (i = 0; i < sig_len; i++) {
+    sprintf(&(sig_string[i * 2]), "%02x", sig[i]);
+  }
+
+  TSDebug(PLUGIN_NAME, "Expected signature: %s", sig_string);
+
+  /* and compare to signature that was sent */
+  cmp_res = strncmp(sig_string, signature, sig_len * 2);
+  if (cmp_res != 0) {
+    err_log(url, "Signature check failed.");
+    goto deny;
+  } else {
+    TSDebug(PLUGIN_NAME, "Signature check passed.");
+    goto allow;
+  }
+
+  /* ********* Deny ********* */
+deny:if (url)
+    TSfree(url);
+  switch (cfg->err_status) {
+  case TS_HTTP_STATUS_MOVED_TEMPORARILY:
+    TSDebug(PLUGIN_NAME, "Redirecting to %s", cfg->err_url);
+    char *start, *end;
+    start = cfg->err_url;
+    end = start + strlen(cfg->err_url);
+    if (TSUrlParse(rri->requestBufp, rri->requestUrl, (const char **) &start, end) != TS_PARSE_DONE) {
+      err_log("url", "Error inn TSUrlParse!");
+    }
+    rri->redirect = 1;
+    break;
+  case TS_HTTP_STATUS_FORBIDDEN:
+  default:
+    /* set status and body to be 403 */
+    TSHttpTxnSetHttpRetStatus(txnp, TS_HTTP_STATUS_FORBIDDEN);
+    TSHttpTxnErrorBodySet(txnp, TSstrdup("Authorization Denied"), strlen("Authorization Denied") - 1,
+                          TSstrdup("text/plain"));
+    break;
+  }
+  return TSREMAP_DID_REMAP;
+
+  /* ********* Allow ********* */
+allow:if (url)
+    TSfree(url);
+  /* drop the query string so we can cache-hit */
+  rval = TSUrlHttpQuerySet(rri->requestBufp, rri->requestUrl, NULL, 0);
+  if (rval != TS_SUCCESS) {
+    TSError("Error stripping query string: %d.", rval);
+  }
+  return TSREMAP_NO_REMAP;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4f2dc70f/plugins/experimental/url_sig/url_sig.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.h b/plugins/experimental/url_sig/url_sig.h
index c495b4b..dd24cc7 100644
--- a/plugins/experimental/url_sig/url_sig.h
+++ b/plugins/experimental/url_sig/url_sig.h
@@ -21,21 +21,21 @@
 
 #define VERSION     "1.0"
 /* in the query string that we add to sign the url: */
-#define CIP_QSTRING "C"  /* C=24.0.33.12 designates the client IP address */
-#define EXP_QSTRING "E"  /* E=1356128799 means expires at (seconds since Unix epoch) */
-#define ALG_QSTRING "A"  /* A=1 means hashing algorithm 1 */
-#define KIN_QSTRING "K"  /* K=3 means use key number 3 */
-#define PAR_QSTRING "P"  /* P=1110 means use parts 0, 1 and 2 (and no more) for the hashing of the url after removing the 'http://' */
+#define CIP_QSTRING "C"         /* C=24.0.33.12 designates the client IP address */
+#define EXP_QSTRING "E"         /* E=1356128799 means expires at (seconds since Unix epoch) */
+#define ALG_QSTRING "A"         /* A=1 means hashing algorithm 1 */
+#define KIN_QSTRING "K"         /* K=3 means use key number 3 */
+#define PAR_QSTRING "P"         /* P=1110 means use parts 0, 1 and 2 (and no more) for the hashing of the url after removing the 'http://' */
                          /* and making the parts by doing a split("/") */
-#define SIG_QSTRING "S"  /* S=9e2828d570a4bee3c964f698b0985ee58b9f6b64 means 9e2828d570a4bee3c964f698b0985ee58b9f6b64 is the sig
-                            This one has to be the last one of the string */
+#define SIG_QSTRING "S"         /* S=9e2828d570a4bee3c964f698b0985ee58b9f6b64 means 9e2828d570a4bee3c964f698b0985ee58b9f6b64 is the sig
+                                   This one has to be the last one of the string */
 
 #define CIP_STRLEN 20
 #define EXP_STRLEN 16
 #define PAR_STRLEN 16
 #define MAX_PARTS 32
 
-#define MAX_HTTP_REQUEST_SIZE 8192 //
+#define MAX_HTTP_REQUEST_SIZE 8192      //
 
 #define MAX_SIG_SIZE 20
 #define SHA1_SIG_SIZE 20


[46/50] [abbrv] git commit: [TS-2664] atscppapi: Removing initializable value code

Posted by zw...@apache.org.
[TS-2664] atscppapi: Removing initializable value code


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

Branch: refs/heads/lua_config
Commit: 265ece127796842398ee3a00a26c1ff0761a6af4
Parents: 5622e8d
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 16:42:55 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 16:42:55 2014 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/265ece12/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b6e80db..bc207f4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2664] atscppapi: Removing initializable values
+
   *) [TS-2660] Rename StateMachineAction_t values for legibility.
 
   *) [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default


[13/50] [abbrv] git commit: And it's another year ...

Posted by zw...@apache.org.
And it's another year ...


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

Branch: refs/heads/lua_config
Commit: 44eaddf5e37252c1ebcc544439298d0b9e5af4ac
Parents: 4836e4e
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Mar 16 21:56:50 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Mar 16 21:56:50 2014 -0600

----------------------------------------------------------------------
 NOTICE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44eaddf5/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index a28f2c8..ecf66b0 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Traffic Server
-Copyright 2013 The Apache Software Foundation
+Copyright 2014 The Apache Software Foundation
 
 This product includes software developed at
   - The Apache Software Foundation (http://www.apache.org/).


[12/50] [abbrv] git commit: TS-2628 Remove the wrong notification for not, to avoid spreading bad info.

Posted by zw...@apache.org.
TS-2628 Remove the wrong notification for not, to avoid spreading bad info.


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

Branch: refs/heads/lua_config
Commit: 4836e4e27d9e17fe7f794b2c370c2d51d370a638
Parents: d3fd1e6
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Mar 16 15:03:17 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Mar 16 15:03:17 2014 -0600

----------------------------------------------------------------------
 cmd/traffic_line/traffic_line.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4836e4e2/cmd/traffic_line/traffic_line.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_line/traffic_line.cc b/cmd/traffic_line/traffic_line.cc
index 65df8db..738eb13 100644
--- a/cmd/traffic_line/traffic_line.cc
+++ b/cmd/traffic_line/traffic_line.cc
@@ -267,7 +267,7 @@ handleArgInvocation()
         printf("Set %s, restart required\n", SetVar);
         break;
       case TS_ACTION_RECONFIGURE:
-        printf("Set %s, reconfiguration required\n", SetVar);
+        // printf("Set %s, reconfiguration required\n", SetVar);
         break;
       case TS_ACTION_DYNAMIC:
       default:


[49/50] [abbrv] git commit: x

Posted by zw...@apache.org.
x


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

Branch: refs/heads/lua_config
Commit: ea5fb9f6fd4c19c70e91dfdab6c1462cc5457171
Parents: c5c92b9
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 25 21:23:03 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Mar 25 21:23:03 2014 -0600

----------------------------------------------------------------------
 proxy/Makefile.am | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ea5fb9f6/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 1056784..bd5aeba 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -251,14 +251,9 @@ traffic_sac_LDADD = \
   $(top_builddir)/iocore/eventsystem/libinkevent.a \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/lib/ts/libtsutil.la \
-<<<<<<< HEAD
-  @LUA_LIBS@ \
-  @LIBRESOLV@ @LIBPCRE@ @LIBSSL@ @LIBTCL@ \
-  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ -lm
-=======
   @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
-  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ @SPDYLAY_LIBS@ -lm
->>>>>>> origin/master
+  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ @SPDYLAY_LIBS@ -lm \
+  @LUA_LIBS@
 
 if BUILD_TESTS
   traffic_sac_SOURCES += RegressionSM.cc


[04/50] [abbrv] TS-2630: Add lib/ts/apidefs.h to place common types

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
new file mode 100644
index 0000000..b864624
--- /dev/null
+++ b/proxy/api/ts/ts.h
@@ -0,0 +1,2278 @@
+/** @file
+
+  Traffic Server SDK API header file
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+  @section developers Developers
+
+  Developers, when adding a new element to an enum, append it. DO NOT
+  insert it.  Otherwise, binary compatibility of plugins will be broken!
+
+ */
+
+#ifndef __TS_API_H__
+#define __TS_API_H__
+
+#include "apidefs.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+  /* --------------------------------------------------------------------------
+     Memory */
+#define TSmalloc(s)      _TSmalloc ((s), TS_RES_MEM_PATH)
+#define TSrealloc(p,s)   _TSrealloc ((p), (s), TS_RES_MEM_PATH)
+#define TSstrdup(p)      _TSstrdup ((p), -1, TS_RES_MEM_PATH)
+#define TSstrndup(p,n)   _TSstrdup ((p), (n), TS_RES_MEM_PATH)
+#define TSstrlcpy(d,s,l) _TSstrlcpy ((d), (s), (l))
+#define TSstrlcat(d,s,l) _TSstrlcat ((d), (s), (l))
+#define TSfree(p)        _TSfree (p)
+
+  tsapi void* _TSmalloc(size_t size, const char* path);
+  tsapi void* _TSrealloc(void* ptr, size_t size, const char* path);
+  tsapi char* _TSstrdup(const char* str, int64_t length, const char* path);
+  tsapi size_t _TSstrlcpy(char *dst, const char *str, size_t siz);
+  tsapi size_t _TSstrlcat(char *dst, const char *str, size_t siz);
+  tsapi void _TSfree(void* ptr);
+
+  /* --------------------------------------------------------------------------
+     Component object handles */
+  /**
+      Releases the TSMLoc mloc created from the TSMLoc parent.
+      If there is no parent TSMLoc, use TS_NULL_MLOC.
+
+      @param bufp marshal buffer containing the TSMLoc handle to be
+        released.
+      @param parent location of the parent object from which the handle
+        was created.
+      @param mloc location of the handle to be released.
+
+   */
+  tsapi TSReturnCode TSHandleMLocRelease(TSMBuffer bufp, TSMLoc parent, TSMLoc mloc);
+
+  /* --------------------------------------------------------------------------
+     Install and plugin locations */
+  /**
+      Gets the path of the directory in which Traffic Server is installed.
+      Use this function to specify the location of files that the
+      plugin uses.
+
+      @return pointer to Traffic Server install directory.
+
+   */
+  tsapi const char* TSInstallDirGet(void);
+
+  /**
+      Gets the path of the directory of Traffic Server configuration.
+
+      @return pointer to Traffic Server configuration directory.
+
+   */
+  tsapi const char* TSConfigDirGet(void);
+
+  /**
+      Gets the path of the plugin directory relative to the Traffic Server
+      install directory. For example, to open the file "config_ui.txt" in
+      the plugin directory:
+
+      @code
+      TSfopen("TSPluginInstallDirGet()/TSPluginDirGet()/config_ui.txt");
+      @endcode
+
+      @return pointer to plugin directory relative to Traffic Server install
+      directory.
+
+   */
+  tsapi const char* TSPluginDirGet(void);
+
+  /* --------------------------------------------------------------------------
+     Traffic Server Version */
+  /**
+      Gets the version of Traffic Server currently running. Use this
+      function to make sure that the plugin version and Traffic Server
+      version are compatible. See the SDK sample code for usage.
+
+      @return pointer to version of Traffic Server running the plugin.
+
+   */
+  tsapi const char* TSTrafficServerVersionGet(void);
+
+  /**  Get the major version of Traffic Server currently running.
+       This is the same as the first element of the string
+       returned by @c TSTrafficServerVersionGet
+
+       @return The major version as an integer.
+   */
+  int TSTrafficServerVersionGetMajor(void);
+
+  /**  Get the minor version of Traffic Server currently running.
+       This is the same as the second element of the string
+       returned by @c TSTrafficServerVersionGet
+
+       @return The minor version as an integer.
+   */
+  int TSTrafficServerVersionGetMinor(void);
+
+  /**  Get the patch version of Traffic Server currently running.
+       This is the same as the third element of the string
+       returned by @c TSTrafficServerVersionGet
+
+       @return The patch version as an integer.
+   */
+  int TSTrafficServerVersionGetPatch(void);
+
+  /* --------------------------------------------------------------------------
+     Plugin registration */
+
+  /**
+      This function registers your plugin with a particular version
+      of Traffic Server SDK. Use this function to make sure that the
+      Traffic Server version currently running also supports your plugin.
+      See the SDK sample code for usage.
+
+      @param sdk_version earliest version of the Traffic Server SDK that
+        supports your plugin.
+      @param plugin_info contains registration information about your
+        plugin. See TSPluginRegistrationInfo.
+      @return TS_ERROR if the plugin registration failed.
+
+   */
+  tsapi TSReturnCode TSPluginRegister(TSSDKVersion sdk_version, TSPluginRegistrationInfo* plugin_info);
+
+  /* --------------------------------------------------------------------------
+     Files */
+  /**
+      Opens a file for reading or writing and returns a descriptor for
+      accessing the file. The current implementation cannot open a file
+      for both reading or writing. See the SDK Programmer's Guide for
+      sample code.
+
+      @param filename file to be opened.
+      @param mode specifies whether to open the file for reading or
+        writing. If mode is "r" then the file is opened for reading.
+        If mode is "w" then the file is opened for writing. Currently
+        "r" and "w" are the only two valid modes for opening a file.
+      @return descriptor for the file that TSfopen opens. Descriptors of
+        type TSFile can be greater than 256.
+
+   */
+  tsapi TSFile TSfopen(const char* filename, const char* mode);
+
+  /**
+      Closes the file to which filep points and frees the data structures
+      and buffers associated with it. If the file was opened for writing,
+      any pending data is flushed.
+
+      @param filep file to be closed.
+
+   */
+  tsapi void TSfclose(TSFile filep);
+
+  /**
+      Attempts to read length bytes of data from the file pointed to by
+      filep into the buffer buf.
+
+      @param filep name of the file to read from.
+      @param buf buffer to read into.
+      @param length amount of data to read, in bytes.
+      @return number of bytes read. If end of the file, it returns 0.
+        If the file was not opened for reading or if an error occurs
+        while reading the file, it returns -1.
+
+   */
+  tsapi size_t TSfread(TSFile filep, void* buf, size_t length);
+
+  /**
+      Attempts to write length bytes of data from the buffer buf
+      to the file filep. Make sure that filep is open for writing.
+      You might want to check the number of bytes written (TSfwrite()
+      returns this value) against the value of length. If it is less,
+      there might be insufficient space on disk, for example.
+
+      @param filep file to write into.
+      @param buf buffer containing the data to be written.
+      @param length amount of data to write to filep, in bytes.
+      @return number of bytes written to filep. If the file was not
+        opened for writing, it returns -1. If an error occurs while
+        writing, it returns the number of bytes successfully written.
+
+   */
+  tsapi size_t TSfwrite(TSFile filep, const void* buf, size_t length);
+
+  /**
+      Flushes pending data that has been buffered up in memory from
+      previous calls to TSfwrite().
+
+      @param filep file to flush.
+
+   */
+  tsapi void TSfflush(TSFile filep);
+
+  /**
+      Reads a line from the file pointed to by filep into the buffer buf.
+      Lines are terminated by a line feed character, '\n'. The line
+      placed in the buffer includes the line feed character and is
+      terminated with a NULL. If the line is longer than length bytes
+      then only the first length-minus-1 bytes are placed in buf.
+
+      @param filep file to read from.
+      @param buf buffer to read into.
+      @param length size of the buffer to read into.
+      @return pointer to the string read into the buffer buf.
+
+   */
+  tsapi char* TSfgets(TSFile filep, char* buf, size_t length);
+
+  /* --------------------------------------------------------------------------
+     Error logging */
+  /**
+      Writes printf-style error messages to the Traffic Server error
+      log. One advantage of TSError over printf is that each call is
+      atomically placed into the error log and is not garbled with other
+      error entries. This is not an issue in single-threaded programs
+      but is a definite nuisance in multi-threaded programs.
+
+      @param fmt printf format description.
+      @param ... argument for the printf format description.
+
+  */
+  tsapi void TSError(const char* fmt, ...) TS_PRINTFLIKE(1, 2);
+
+  /* --------------------------------------------------------------------------
+     Assertions */
+  tsapi void _TSReleaseAssert(const char* txt, const char* f, int l) TS_NORETURN;
+  tsapi int _TSAssert(const char* txt, const char* f, int l);
+
+#define TSReleaseAssert(EX) \
+            ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
+
+#define TSAssert(EX) \
+            (void)((EX) || (_TSAssert(#EX, __FILE__, __LINE__)))
+
+  /* --------------------------------------------------------------------------
+     Marshal buffers */
+  /**
+      Creates a new marshal buffer and initializes the reference count
+      to 1.
+
+   */
+  tsapi TSMBuffer TSMBufferCreate(void);
+
+  /**
+      Ignores the reference count and destroys the marshal buffer bufp.
+      The internal data buffer associated with the marshal buffer is
+      also destroyed if the marshal buffer allocated it.
+
+      @param bufp marshal buffer to be destroyed.
+
+   */
+  tsapi TSReturnCode TSMBufferDestroy(TSMBuffer bufp);
+
+  /* --------------------------------------------------------------------------
+     URLs */
+  /**
+      Creates a new URL within the marshal buffer bufp. Returns a
+      location for the URL within the marshal buffer.
+
+      @param bufp marshal buffer containing the new URL.
+      @param locp pointer to a TSMLoc to store the MLoc into.
+
+   */
+  tsapi TSReturnCode TSUrlCreate(TSMBuffer bufp, TSMLoc* locp);
+
+  /**
+      Destroys the URL located at url_loc within the marshal buffer
+      bufp. Do not forget to release the TSMLoc url_loc with a call
+      to TSHandleMLocRelease().
+
+      @param bufp marshal buffer containing the URL to be destroyed.
+      @param offset location of the URL to be destroyed.
+
+   */
+  /** @deprecated There is no reason to destroy the URL, just release
+      the marshal buffers. */
+  tsapi TS_DEPRECATED TSReturnCode TSUrlDestroy(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Copies the URL located at src_url within src_bufp to a URL
+      location within the marshal buffer dest_bufp, and returns the
+      TSMLoc location of the copied URL. Unlike TSUrlCopy(), you do
+      not have to create the destination URL before cloning. Release
+      the returned TSMLoc handle with a call to TSHandleMLocRelease().
+
+      @param dest_bufp marshal buffer containing the cloned URL.
+      @param src_bufp marshal buffer containing the URL to be cloned.
+      @param src_url location of the URL to be cloned, within the marshal
+        buffer src_bufp.
+      @param locp pointer to a TSMLoc to store the MLoc into.
+
+   */
+  tsapi TSReturnCode TSUrlClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_url, TSMLoc* locp);
+
+  /**
+      Copies the contents of the URL at location src_loc within the
+      marshal buffer src_bufp to the location dest_loc within the marshal
+      buffer dest_bufp. TSUrlCopy() works correctly even if src_bufp
+      and dest_bufp point to different marshal buffers. Important: create
+      the destination URL before copying into it. Use TSUrlCreate().
+
+      @param dest_bufp marshal buffer to contain the copied URL.
+      @param dest_offset location of the URL to be copied.
+      @param src_bufp marshal buffer containing the source URL.
+      @param src_offset location of the source URL within src_bufp.
+
+   */
+  tsapi TSReturnCode TSUrlCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp, TSMLoc src_offset);
+
+  /**
+      Formats a URL stored in an TSMBuffer into an TSIOBuffer.
+
+      @param bufp marshal buffer contain the URL to be printed.
+      @param offset location of the URL within bufp.
+      @param iobufp destination TSIOBuffer for the URL.
+
+   */
+  tsapi void TSUrlPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
+
+  /**
+      Parses a URL. The start pointer is both an input and an output
+      parameter and marks the start of the URL to be parsed. After
+      a successful parse, the start pointer equals the end pointer.
+      The end pointer must be one byte after the last character you
+      want to parse. The URL parsing routine assumes that everything
+      between start and end is part of the URL. It is up to higher level
+      parsing routines, such as TSHttpHdrParseReq(), to determine the
+      actual end of the URL. Returns TS_PARSE_ERROR if an error occurs,
+      otherwise TS_PARSE_DONE is returned to indicate success.
+
+      @param bufp marshal buffer containing the URL to be parsed.
+      @param offset location of the URL to be parsed.
+      @param start points to the start of the URL to be parsed AND at
+        the end of a successful parse it will equal the end pointer.
+      @param end must be one byte after the last character.
+      @return TS_PARSE_ERROR or TS_PARSE_DONE.
+
+   */
+  tsapi TSParseResult TSUrlParse(TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
+
+  /**
+      Calculates the length of the URL located at url_loc within the
+      marshal buffer bufp if it were returned as a string. This length
+      is the same as the length returned by TSUrlStringGet().
+
+      @param bufp marshal buffer containing the URL whose length you want.
+      @param offset location of the URL within the marshal buffer bufp.
+      @return string length of the URL.
+
+   */
+  tsapi int TSUrlLengthGet(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Constructs a string representation of the URL located at url_loc
+      within bufp. TSUrlStringGet() stores the length of the allocated
+      string in the parameter length. This is the same length that
+      TSUrlLengthGet() returns. The returned string is allocated by a
+      call to TSmalloc(). It should be freed by a call to TSfree().
+      The length parameter must present, providing storage for the URL
+      string length value.
+      Note: To get the effective URL from a request, use the alternative
+            TSHttpTxnEffectiveUrlStringGet API.
+
+      @param bufp marshal buffer containing the URL you want to get.
+      @param offset location of the URL within bufp.
+      @param length string length of the URL.
+      @return The URL as a string.
+
+   */
+  tsapi char* TSUrlStringGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Retrieves the scheme portion of the URL located at url_loc within
+      the marshal buffer bufp. TSUrlSchemeGet() places the length of
+      the string in the length argument. If the length is NULL then no
+      attempt is made to dereference it.
+
+      @param bufp marshal buffer storing the URL.
+      @param offset location of the URL within bufp.
+      @param length length of the returned string.
+      @return The scheme portion of the URL, as a string.
+
+   */
+  tsapi const char* TSUrlSchemeGet(TSMBuffer bufp, TSMLoc offset, int *length);
+
+  /**
+      Sets the scheme portion of the URL located at url_loc within
+      the marshal buffer bufp to the string value. If length is -1
+      then TSUrlSchemeSet() assumes that value is null-terminated.
+      Otherwise, the length of the string value is taken to be length.
+      TSUrlSchemeSet() copies the string to within bufp, so it is OK
+      to modify or delete value after calling TSUrlSchemeSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param value value to set the URL's scheme to.
+      @param length string stored in value.
+
+   */
+  tsapi TSReturnCode TSUrlSchemeSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /* --------------------------------------------------------------------------
+     Internet specific URLs */
+  /**
+      Retrieves the user portion of the URL located at url_loc
+      within bufp. Note: the returned string is not guaranteed to
+      be null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length length of the returned string.
+      @return user portion of the URL.
+
+   */
+  tsapi const char* TSUrlUserGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the user portion of the URL located at url_loc within bufp
+      to the string value. If length is -1 then TSUrlUserSet() assumes
+      that value is null-terminated. Otherwise, the length of the string
+      value is taken to be length. TSUrlUserSet() copies the string to
+      within bufp, so it is OK to modify or delete value after calling
+      TSUrlUserSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL whose user is to be set.
+      @param value holds the new user name.
+      @param length string length of value.
+
+   */
+  tsapi TSReturnCode TSUrlUserSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+      Retrieves the password portion of the URL located at url_loc
+      within bufp. TSUrlPasswordGet() places the length of the returned
+      string in the length argument. Note: the returned string is
+      not guaranteed to be null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset
+      @param length of the returned password string.
+      @return password portion of the URL.
+
+   */
+  tsapi const char* TSUrlPasswordGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the password portion of the URL located at url_loc within
+      bufp to the string value. If length is -1 then TSUrlPasswordSet()
+      assumes that value is null-terminated. Otherwise, the length
+      of value is taken to be length. TSUrlPasswordSet() copies the
+      string to within bufp, so it is okay to modify or delete value
+      after calling TSUrlPasswordSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset
+      @param value new password.
+      @param length of the new password.
+
+   */
+  tsapi TSReturnCode TSUrlPasswordSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+      Retrieves the host portion of the URL located at url_loc
+      within bufp. Note: the returned string is not guaranteed to be
+      null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length of the returned string.
+      @return Host portion of the URL.
+
+   */
+  tsapi const char* TSUrlHostGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the host portion of the URL at url_loc to the string value.
+      If length is -1 then TSUrlHostSet() assumes that value is
+      null-terminated. Otherwise, the length of the string value is
+      taken to be length. The string is copied to within bufp, so you
+      can modify or delete value after calling TSUrlHostSet().
+
+      @param bufp marshal buffer containing the URL to modify.
+      @param offset location of the URL.
+      @param value new host name for the URL.
+      @param length string length of the new host name of the URL.
+
+   */
+  tsapi TSReturnCode TSUrlHostSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+      Retrieves the port portion of the URL located at url_loc.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @return port portion of the URL.
+
+   */
+  tsapi int TSUrlPortGet(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Sets the port portion of the URL located at url_loc.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param port new port setting for the URL.
+
+   */
+  tsapi TSReturnCode TSUrlPortSet(TSMBuffer bufp, TSMLoc offset, int port);
+
+  /* --------------------------------------------------------------------------
+     HTTP specific URLs */
+  /**
+      Retrieves the path portion of the URL located at url_loc within
+      bufp. TSUrlPathGet() places the length of the returned string in
+      the length argument. Note: the returned string is not guaranteed to
+      be null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length of the returned string.
+      @return path portion of the URL.
+
+   */
+  tsapi const char* TSUrlPathGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the path portion of the URL located at url_loc within bufp
+      to the string value. If length is -1 then TSUrlPathSet() assumes
+      that value is null-terminated. Otherwise, the length of the value
+      is taken to be length. TSUrlPathSet() copies the string into bufp,
+      so you can modify or delete value after calling TSUrlPathSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param value new path string for the URL.
+      @param length of the new path string.
+
+   */
+  tsapi TSReturnCode TSUrlPathSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /* --------------------------------------------------------------------------
+     FTP specific URLs */
+  /**
+      Retrieves the FTP type of the URL located at url_loc within bufp.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @return FTP type of the URL.
+
+   */
+  tsapi int TSUrlFtpTypeGet(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Sets the FTP type portion of the URL located at url_loc within
+      bufp to the value type.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL to modify.
+      @param type new FTP type for the URL.
+
+   */
+  tsapi TSReturnCode TSUrlFtpTypeSet(TSMBuffer bufp, TSMLoc offset, int type);
+
+  /* --------------------------------------------------------------------------
+     HTTP specific URLs */
+  /**
+      Retrieves the HTTP params portion of the URL located at url_loc
+      within bufp. The length of the returned string is in the length
+      argument. Note: the returned string is not guaranteed to be
+      null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length of the returned string.
+      @return HTTP params portion of the URL.
+
+   */
+  tsapi const char* TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the HTTP params portion of the URL located at url_loc within
+      bufp to the string value. If length is -1 that TSUrlHttpParamsSet()
+      assumes that value is null-terminated. Otherwise, the length of
+      the string value is taken to be length. TSUrlHttpParamsSet()
+      copies the string to within bufp, so you can modify or delete
+      value after calling TSUrlHttpParamsSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param value HTTP params string to set in the URL.
+      @param length string length of the new HTTP params value.
+
+   */
+  tsapi TSReturnCode TSUrlHttpParamsSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+      Retrieves the HTTP query portion of the URL located at url_loc
+      within bufp. The length of the returned string is in the length
+      argument. Note: the returned string is not guaranteed to be
+      null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length of the returned string.
+      @return HTTP query portion of the URL.
+
+   */
+  tsapi const char* TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the HTTP query portion of the URL located at url_loc within
+      bufp to value. If length is -1, the string value is assumed to
+      be null-terminated; otherwise, the length of value is taken to be
+      length. TSUrlHttpQuerySet() copies the string to within bufp, so
+      you can modify or delete value after calling TSUrlHttpQuerySet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL within bufp.
+      @param value new HTTP query string for the URL.
+      @param length of the new HTTP query string.
+
+   */
+  tsapi TSReturnCode TSUrlHttpQuerySet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+      Retrieves the HTTP fragment portion of the URL located at url_loc
+      within bufp. The length of the returned string is in the length
+      argument. Note: the returned string is not guaranteed to be
+      null-terminated.
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL.
+      @param length of the returned string.
+      @return HTTP fragment portion of the URL.
+
+   */
+  tsapi const char* TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc offset, int* length);
+
+  /**
+      Sets the HTTP fragment portion of the URL located at url_loc
+      within bufp to value. If length is -1, the string value is
+      assumed to be null-terminated; otherwise, the length of value
+      is taken to be length. TSUrlHttpFragmentSet() copies the string
+      to within bufp, so you can modify or delete value after calling
+      TSUrlHttpFragmentSet().
+
+      @param bufp marshal buffer containing the URL.
+      @param offset location of the URL within bufp.
+      @param value new HTTP fragment string for the URL.
+      @param length of the new HTTP query string.
+
+   */
+  tsapi TSReturnCode TSUrlHttpFragmentSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+
+  /**
+     Perform percent-encoding of the string in the buffer, storing the
+     new string in the destination buffer. The length parameter will be
+     set to the new (encoded) string length, or 0 if the encoding failed.
+
+     @param str the string buffer to encode.
+     @param str_len length of the string buffer.
+     @param dst destination buffer.
+     @param dst_size size of the destination buffer.
+     @param length amount of data written to the destination buffer.
+     @param map optional (can be NULL) map of characters to encode.
+
+  */
+  tsapi TSReturnCode TSStringPercentEncode(const char *str, int str_len, char *dst, size_t dst_size, size_t *length, const unsigned char *map);
+
+  /**
+     Similar to TSStringPercentEncode(), but works on a URL object.
+
+     @param bufp marshal buffer containing the URL.
+     @param offset location of the URL within bufp.
+     @param dst destination buffer.
+     @param dst_size size of the destination buffer.
+     @param length amount of data written to the destination buffer.
+     @param map optional (can be NULL) map of characters to encode.
+
+  */
+  tsapi TSReturnCode TSUrlPercentEncode(TSMBuffer bufp, TSMLoc offset, char *dst, size_t dst_size, size_t *length, const unsigned char *map);
+
+  /**
+     Perform percent-decoding of the string in the buffer, writing
+     to the output buffer. The source and destination can be the same,
+     in which case they overwrite. The decoded string is always
+     guaranteed to be no longer than the source string.
+
+     @param str the string to decode (and possibly write to).
+     @param str_len length of the input string (or 0).
+     @param dst output buffer (can be the same as src).
+     @param dst_len size of the output buffer.
+     @param length amount of data written to the destination buffer.
+
+  */
+  tsapi TSReturnCode TSStringPercentDecode(const char *str, size_t str_len, char *dst, size_t dst_size, size_t *length);
+
+
+
+  /* --------------------------------------------------------------------------
+     MIME headers */
+
+  /**
+      Creates a MIME parser. The parser's data structure contains
+      information about the header being parsed. A single MIME
+      parser can be used multiple times, though not simultaneously.
+      Before being used again, the parser must be cleared by calling
+      TSMimeParserClear().
+
+   */
+  tsapi TSMimeParser TSMimeParserCreate(void);
+
+  /**
+      Clears the specified MIME parser so that it can be used again.
+
+      @param parser to be cleared.
+
+   */
+  tsapi void TSMimeParserClear(TSMimeParser parser);
+
+  /**
+      Destroys the specified MIME parser and frees the associated memory.
+
+      @param parser to destroy.
+   */
+  tsapi void TSMimeParserDestroy(TSMimeParser parser);
+
+  /**
+      Creates a new MIME header within bufp. Release with a call to
+      TSHandleMLocRelease().
+
+      @param bufp marshal buffer to contain the new MIME header.
+      @param locp buffer pointer to contain the MLoc
+
+   */
+  tsapi TSReturnCode TSMimeHdrCreate(TSMBuffer bufp, TSMLoc* locp);
+
+  /**
+      Destroys the MIME header located at hdr_loc within bufp.
+
+      @param bufp marshal buffer containing the MIME header to destroy.
+      @param offset location of the MIME header.
+
+   */
+  tsapi TSReturnCode TSMimeHdrDestroy(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Copies a specified MIME header to a specified marshal buffer,
+      and returns the location of the copied MIME header within the
+      destination marshal buffer. Unlike TSMimeHdrCopy(), you do not
+      have to create the destination MIME header before cloning. Release
+      the returned TSMLoc handle with a call to TSHandleMLocRelease().
+
+      @param dest_bufp destination marshal buffer.
+      @param src_bufp source marshal buffer.
+      @param src_hdr location of the source MIME header.
+      @param locp where to store the location of the copied MIME header.
+
+   */
+  tsapi TSReturnCode TSMimeHdrClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc* locp);
+
+  /**
+      Copies the contents of the MIME header located at src_loc
+      within src_bufp to the MIME header located at dest_loc within
+      dest_bufp. TSMimeHdrCopy() works correctly even if src_bufp and
+      dest_bufp point to different marshal buffers. Important: you must
+      create the destination MIME header before copying into it--use
+      TSMimeHdrCreate().
+
+      @param dest_bufp is the destination marshal buffer.
+      @param dest_offset
+      @param src_bufp is the source marshal buffer.
+      @param src_offset
+
+   */
+  tsapi TSReturnCode TSMimeHdrCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp,
+                                      TSMLoc src_offset);
+
+  /**
+      Formats the MIME header located at hdr_loc within bufp into the
+      TSIOBuffer iobufp.
+
+      @param bufp marshal buffer containing the header to be copied to
+        an TSIOBuffer.
+      @param offset
+      @param iobufp target TSIOBuffer.
+
+   */
+  tsapi void TSMimeHdrPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
+
+  /**
+      Parses a MIME header. The MIME header must have already been
+      allocated and both bufp and hdr_loc must point within that header.
+      It is possible to parse a MIME header a single byte at a time
+      using repeated calls to TSMimeHdrParse(). As long as an error
+      does not occur, TSMimeHdrParse() consumes each single byte and
+      asks for more.
+
+      @param parser parses the specified MIME header.
+      @param bufp marshal buffer containing the MIME header to be parsed.
+      @param offset
+      @param start both an input and output. On input, the start
+        argument points to the current position of the buffer being
+        parsed. On return, start is modified to point past the last
+        character parsed.
+      @param end points to one byte after the end of the buffer.
+      @return One of 3 possible int values:
+        - TS_PARSE_ERROR if there is a parsing error.
+        - TS_PARSE_DONE is returned when a "\r\n\r\n" pattern is
+          encountered, indicating the end of the header.
+        - TS_PARSE_CONT is returned if parsing of the header stopped
+          because the end of the buffer was reached.
+
+   */
+  tsapi TSParseResult TSMimeHdrParse(TSMimeParser parser, TSMBuffer bufp, TSMLoc offset, const char** start,
+                                     const char* end);
+
+  /**
+      Calculates the length of the MIME header located at hdr_loc if it
+      were returned as a string. This the length of the MIME header in
+      its unparsed form.
+
+      @param bufp marshal buffer containing the MIME header.
+      @param offset location of the MIME header.
+      @return string length of the MIME header located at hdr_loc.
+
+   */
+  tsapi int TSMimeHdrLengthGet(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Removes and destroys all the MIME fields within the MIME header
+      located at hdr_loc within the marshal buffer bufp.
+
+      @param bufp marshal buffer containing the MIME header.
+      @param offset location of the MIME header.
+
+   */
+  tsapi TSReturnCode TSMimeHdrFieldsClear(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Returns a count of the number of MIME fields within the MIME header
+      located at hdr_loc within the marshal buffer bufp.
+
+      @param bufp marshal buffer containing the MIME header.
+      @param offset location of the MIME header within bufp.
+      @return number of MIME fields within the MIME header located
+        at hdr_loc.
+
+   */
+  tsapi int TSMimeHdrFieldsCount(TSMBuffer bufp, TSMLoc offset);
+
+  /**
+      Retrieves the location of a specified MIME field within the
+      MIME header located at hdr_loc within bufp. The idx parameter
+      specifies which field to retrieve. The fields are numbered from 0
+      to TSMimeHdrFieldsCount(bufp, hdr_loc) - 1. If idx does not lie
+      within that range then TSMimeHdrFieldGet returns 0. Release the
+      returned handle with a call to TSHandleMLocRelease.
+
+      @param bufp marshal buffer containing the MIME header.
+      @param hdr location of the MIME header.
+      @param idx index of the field to get with base at 0.
+      @return location of the specified MIME field.
+
+   */
+  tsapi TSMLoc TSMimeHdrFieldGet(TSMBuffer bufp, TSMLoc hdr, int idx);
+
+  /**
+      Retrieves the TSMLoc location of a specified MIME field from within
+      the MIME header located at hdr. The name and length parameters
+      specify which field to retrieve. For each MIME field in the MIME
+      header, a case insensitive string comparison is done between
+      the field name and name. If TSMimeHdrFieldFind() cannot find the
+      requested field, it returns TS_NULL_MLOC. Release the returned
+      TSMLoc handle with a call to TSHandleMLocRelease().
+
+      @param bufp marshal buffer containing the MIME header field to find.
+      @param hdr location of the MIME header containing the field.
+      @param name of the field to retrieve.
+      @param length string length of the string name. If length is -1,
+        then name is assumed to be null-terminated.
+      @return location of the requested MIME field. If the field could
+        not be found, returns TS_NULL_MLOC.
+
+   */
+  tsapi TSMLoc TSMimeHdrFieldFind(TSMBuffer bufp, TSMLoc hdr, const char* name, int length);
+
+  /**
+      Returns the TSMLoc location of a specified MIME field from within
+      the MIME header located at hdr. The retrieved_str parameter
+      specifies which field to retrieve. For each MIME field in the
+      MIME header, a pointer comparison is done between the field name
+      and retrieved_str. This is a much quicker retrieval function
+      than TSMimeHdrFieldFind() since it obviates the need for a
+      string comparison. However, retrieved_str must be one of the
+      predefined field names of the form TS_MIME_FIELD_XXX for the
+      call to succeed. Release the returned TSMLoc handle with a call
+      to TSHandleMLocRelease().
+
+      @param bufp marshal buffer containing the MIME field.
+      @param hdr location of the MIME header containing the field.
+      @param retrieved_str specifies the field to retrieve. Must be
+        one of the predefined field names of the form TS_MIME_FIELD_XXX.
+      @return location of the requested MIME field. If the requested
+        field cannot be found, returns 0.
+
+   */
+  tsapi TSReturnCode TSMimeHdrFieldAppend(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+
+  /**
+      Removes the MIME field located at field within bufp from the
+      header located at hdr within bufp. If the specified field cannot
+      be found in the list of fields associated with the header then
+      nothing is done.
+
+      Note: removing the field does not destroy the field, it only
+      detaches the field, hiding it from the printed output. The field
+      can be reattached with a call to TSMimeHdrFieldAppend(). If you
+      do not use the detached field you should destroy it with a call to
+      TSMimeHdrFieldDestroy() and release the handle field with a call
+      to TSHandleMLocRelease().
+
+      @param bufp contains the MIME field to remove.
+      @param hdr location of the header containing the MIME field to
+        be removed. This header could be an HTTP header or MIME header.
+      @param field is the location of the field to remove.
+
+   */
+  tsapi TSReturnCode TSMimeHdrFieldRemove(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+
+  tsapi TSReturnCode TSMimeHdrFieldCreate(TSMBuffer bufp, TSMLoc hdr, TSMLoc* locp);
+
+  /****************************************************************************
+   *  Create a new field and assign it a name all in one call
+   ****************************************************************************/
+  tsapi TSReturnCode TSMimeHdrFieldCreateNamed(TSMBuffer bufp, TSMLoc mh_mloc, const char* name, int name_len, TSMLoc* locp);
+
+  /**
+      Destroys the MIME field located at field within bufp. You must
+      release the TSMLoc field with a call to TSHandleMLocRelease().
+
+      @param bufp contains the MIME field to be destroyed.
+      @param hdr location of the parent header containing the field
+        to be destroyed. This could be the location of a MIME header or
+        HTTP header.
+      @param field location of the field to be destroyed.
+
+   */
+  tsapi TSReturnCode TSMimeHdrFieldDestroy(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+
+  tsapi TSReturnCode TSMimeHdrFieldClone(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMBuffer src_bufp, TSMLoc src_hdr,
+                                         TSMLoc src_field, TSMLoc* locp);
+  tsapi TSReturnCode TSMimeHdrFieldCopy(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMLoc dest_field,
+                                        TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc src_field);
+  tsapi TSReturnCode TSMimeHdrFieldCopyValues(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMLoc dest_field,
+                                              TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc src_field);
+  tsapi TSMLoc TSMimeHdrFieldNext(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+  tsapi TSMLoc TSMimeHdrFieldNextDup(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+  tsapi int TSMimeHdrFieldLengthGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+  tsapi const char* TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int* length);
+  tsapi TSReturnCode TSMimeHdrFieldNameSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, const char* name, int length);
+
+  tsapi TSReturnCode TSMimeHdrFieldValuesClear(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+  tsapi int TSMimeHdrFieldValuesCount(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+
+  tsapi const char* TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int* value_len_ptr);
+  tsapi int TSMimeHdrFieldValueIntGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
+  tsapi int64_t TSMimeHdrFieldValueInt64Get(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
+  tsapi unsigned int TSMimeHdrFieldValueUintGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
+  tsapi time_t TSMimeHdrFieldValueDateGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
+  tsapi TSReturnCode TSMimeHdrFieldValueStringSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
+                                                     const char* value, int length);
+  tsapi TSReturnCode TSMimeHdrFieldValueIntSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value);
+  tsapi TSReturnCode TSMimeHdrFieldValueInt64Set(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int64_t value);
+  tsapi TSReturnCode TSMimeHdrFieldValueUintSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
+                                                   unsigned int value);
+  tsapi TSReturnCode TSMimeHdrFieldValueDateSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, time_t value);
+
+  tsapi TSReturnCode TSMimeHdrFieldValueAppend(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
+                                                  const char* value, int length);
+  tsapi TSReturnCode TSMimeHdrFieldValueStringInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
+                                                        const char* value, int length);
+  tsapi TSReturnCode TSMimeHdrFieldValueIntInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value);
+  tsapi TSReturnCode TSMimeHdrFieldValueUintInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
+                                                      unsigned int value);
+  tsapi TSReturnCode TSMimeHdrFieldValueDateInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, time_t value);
+
+  tsapi TSReturnCode TSMimeHdrFieldValueDelete(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
+
+  /* --------------------------------------------------------------------------
+     HTTP headers */
+  tsapi TSHttpParser TSHttpParserCreate(void);
+  tsapi void TSHttpParserClear(TSHttpParser parser);
+  tsapi void TSHttpParserDestroy(TSHttpParser parser);
+
+  /**
+      Parses an HTTP request header. The HTTP header must have already
+      been created, and must reside inside the marshal buffer bufp.
+      The start argument points to the current position of the string
+      buffer being parsed. The end argument points to one byte after the
+      end of the buffer to be parsed. On return, TSHttpHdrParseReq()
+      modifies start to point past the last character parsed.
+
+      It is possible to parse an HTTP request header a single byte at
+      a time using repeated calls to TSHttpHdrParseReq(). As long as
+      an error does not occur, the TSHttpHdrParseReq() function will
+      consume that single byte and ask for more.
+
+      @param parser parses the HTTP header.
+      @param bufp marshal buffer containing the HTTP header to be parsed.
+      @param offset location of the HTTP header within bufp.
+      @param start both an input and output. On input, it points to the
+        current position of the string buffer being parsed. On return,
+        start is modified to point past the last character parsed.
+      @param end points to one byte after the end of the buffer to be parsed.
+      @return status of the parse:
+        - TS_PARSE_ERROR means there was a parsing error.
+        - TS_PARSE_DONE means that the end of the header was reached
+          (the parser encountered a "\r\n\r\n" pattern).
+        - TS_PARSE_CONT means that parsing of the header stopped because
+          the parser reached the end of the buffer (large headers can
+          span multiple buffers).
+
+   */
+  tsapi TSParseResult TSHttpHdrParseReq(TSHttpParser parser, TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
+
+  tsapi TSParseResult TSHttpHdrParseResp(TSHttpParser parser, TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
+
+  tsapi TSMLoc TSHttpHdrCreate(TSMBuffer bufp);
+
+  /**
+      Destroys the HTTP header located at hdr_loc within the marshal
+      buffer bufp. Do not forget to release the handle hdr_loc with a
+      call to TSHandleMLocRelease().
+
+   */
+  tsapi void TSHttpHdrDestroy(TSMBuffer bufp, TSMLoc offset);
+
+  tsapi TSReturnCode TSHttpHdrClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc* locp);
+
+  /**
+      Copies the contents of the HTTP header located at src_loc within
+      src_bufp to the HTTP header located at dest_loc within dest_bufp.
+      TSHttpHdrCopy() works correctly even if src_bufp and dest_bufp
+      point to different marshal buffers. Make sure that you create the
+      destination HTTP header before copying into it.
+
+      Note: TSHttpHdrCopy() appends the port number to the domain
+      of the URL portion of the header. For example, a copy of
+      http://www.example.com appears as http://www.example.com:80 in
+      the destination buffer.
+
+      @param dest_bufp marshal buffer to contain the copied header.
+      @param dest_offset location of the copied header.
+      @param src_bufp marshal buffer containing the source header.
+      @param src_offset location of the source header.
+
+   */
+  tsapi TSReturnCode TSHttpHdrCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp,
+                                   TSMLoc src_offset);
+
+  tsapi void TSHttpHdrPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
+
+  tsapi int TSHttpHdrLengthGet(TSMBuffer bufp, TSMLoc offset);
+
+  tsapi TSHttpType TSHttpHdrTypeGet(TSMBuffer bufp, TSMLoc offset);
+  tsapi TSReturnCode TSHttpHdrTypeSet(TSMBuffer bufp, TSMLoc offset, TSHttpType type);
+
+  tsapi int TSHttpHdrVersionGet(TSMBuffer bufp, TSMLoc offset);
+  tsapi TSReturnCode TSHttpHdrVersionSet(TSMBuffer bufp, TSMLoc offset, int ver);
+
+  tsapi const char* TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc offset, int* length);
+  tsapi TSReturnCode TSHttpHdrMethodSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+  tsapi TSReturnCode TSHttpHdrUrlGet(TSMBuffer bufp, TSMLoc offset, TSMLoc* locp);
+  tsapi TSReturnCode TSHttpHdrUrlSet(TSMBuffer bufp, TSMLoc offset, TSMLoc url);
+
+  tsapi TSHttpStatus TSHttpHdrStatusGet(TSMBuffer bufp, TSMLoc offset);
+  tsapi TSReturnCode TSHttpHdrStatusSet(TSMBuffer bufp, TSMLoc offset, TSHttpStatus status);
+  tsapi const char* TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc offset, int* length);
+  tsapi TSReturnCode TSHttpHdrReasonSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
+  tsapi const char* TSHttpHdrReasonLookup(TSHttpStatus status);
+
+  /* --------------------------------------------------------------------------
+     Threads */
+  tsapi TSThread TSThreadCreate(TSThreadFunc func, void* data);
+  tsapi TSThread TSThreadInit(void);
+  tsapi void TSThreadDestroy(TSThread thread);
+  tsapi TSThread TSThreadSelf(void);
+
+  /* --------------------------------------------------------------------------
+     Mutexes */
+  tsapi TSMutex TSMutexCreate(void);
+  tsapi void TSMutexLock(TSMutex mutexp);
+  tsapi TSReturnCode TSMutexLockTry(TSMutex mutexp);
+
+  tsapi void TSMutexUnlock(TSMutex mutexp);
+
+  /* --------------------------------------------------------------------------
+     cachekey */
+  /**
+      Creates (allocates memory for) a new cache key.
+   */
+  tsapi TSCacheKey TSCacheKeyCreate(void);
+
+  /**
+      Generates a key for an object to be cached (written to the cache).
+
+      @param key to be associated with the cached object. Before
+        calling TSCacheKeySetDigest() you must create the key with
+        TSCacheKeyCreate().
+      @param input string that uniquely identifies the object. In most
+        cases, it is the URL of the object.
+      @param length of the string input.
+
+   */
+  tsapi TSReturnCode TSCacheKeyDigestSet(TSCacheKey key, const char* input, int length);
+
+  tsapi TSReturnCode TSCacheKeyDigestFromUrlSet(TSCacheKey key, TSMLoc url);
+
+  /**
+      Associates a host name to the cache key. Use this function if the
+      cache has been partitioned by hostname. The hostname tells the
+      cache which volume to use for the object.
+
+      @param key of the cached object.
+      @param hostname to associate with the cache key.
+      @param host_len length of the string hostname.
+
+   */
+  tsapi TSReturnCode TSCacheKeyHostNameSet(TSCacheKey key, const char* hostname, int host_len);
+
+  tsapi TSReturnCode TSCacheKeyPinnedSet(TSCacheKey key, time_t pin_in_cache);
+
+  /**
+      Destroys a cache key. You must destroy cache keys when you are
+      finished with them, i.e. after all reads and writes are completed.
+
+      @param key to be destroyed.
+
+   */
+  tsapi TSReturnCode TSCacheKeyDestroy(TSCacheKey key);
+
+  /* --------------------------------------------------------------------------
+     cache url */
+  tsapi TSReturnCode TSCacheUrlSet(TSHttpTxn txnp, const char* url, int length);
+
+  /* --------------------------------------------------------------------------
+     Configuration */
+  tsapi unsigned int TSConfigSet(unsigned int id, void* data, TSConfigDestroyFunc funcp);
+  tsapi TSConfig TSConfigGet(unsigned int id);
+  tsapi void TSConfigRelease(unsigned int id, TSConfig configp);
+  tsapi void* TSConfigDataGet(TSConfig configp);
+
+  /* --------------------------------------------------------------------------
+     Management */
+  tsapi void TSMgmtUpdateRegister(TSCont contp, const char *plugin_name);
+  tsapi TSReturnCode TSMgmtIntGet(const char* var_name, TSMgmtInt* result);
+  tsapi TSReturnCode TSMgmtCounterGet(const char* var_name, TSMgmtCounter* result);
+  tsapi TSReturnCode TSMgmtFloatGet(const char* var_name, TSMgmtFloat* result);
+  tsapi TSReturnCode TSMgmtStringGet(const char* var_name, TSMgmtString* result);
+
+  /* --------------------------------------------------------------------------
+     Continuations */
+  tsapi TSCont TSContCreate(TSEventFunc funcp, TSMutex mutexp);
+  tsapi void TSContDestroy(TSCont contp);
+  tsapi void TSContDataSet(TSCont contp, void* data);
+  tsapi void* TSContDataGet(TSCont contp);
+  tsapi TSAction TSContSchedule(TSCont contp, TSHRTime timeout, TSThreadPool tp);
+  tsapi TSAction TSContScheduleEvery(TSCont contp, TSHRTime every /* millisecs */, TSThreadPool tp);
+  tsapi TSAction TSHttpSchedule(TSCont contp, TSHttpTxn txnp, TSHRTime timeout);
+  tsapi int TSContCall(TSCont contp, TSEvent event, void* edata);
+  tsapi TSMutex TSContMutexGet(TSCont contp);
+
+  /* --------------------------------------------------------------------------
+     Plugin lifecycle  hooks */
+  tsapi void TSLifecycleHookAdd(TSLifecycleHookID id, TSCont contp);
+  /* --------------------------------------------------------------------------
+     HTTP hooks */
+  tsapi void TSHttpHookAdd(TSHttpHookID id, TSCont contp);
+
+  /* --------------------------------------------------------------------------
+     HTTP sessions */
+  tsapi void TSHttpSsnHookAdd(TSHttpSsn ssnp, TSHttpHookID id, TSCont contp);
+  tsapi void TSHttpSsnReenable(TSHttpSsn ssnp, TSEvent event);
+  tsapi int TSHttpSsnTransactionCount(TSHttpSsn ssnp);
+
+  /* --------------------------------------------------------------------------
+     HTTP transactions */
+  tsapi void TSHttpTxnHookAdd(TSHttpTxn txnp, TSHttpHookID id, TSCont contp);
+  tsapi TSHttpSsn TSHttpTxnSsnGet(TSHttpTxn txnp);
+
+  /* Gets the client request header for a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnClientReqGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  /* Gets the client response header for a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnClientRespGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  /* Gets the server request header from a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnServerReqGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  /* Gets the server response header from a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnServerRespGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  /* Gets the cached request header for a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnCachedReqGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  /* Gets the cached response header for a specified HTTP transaction. */
+  tsapi TSReturnCode TSHttpTxnCachedRespGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+
+  tsapi TSReturnCode TSHttpTxnPristineUrlGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* url_loc);
+
+  /** Get the effective URL for the transaction.
+      The effective URL is the URL taking in to account both the explicit
+      URL in the request and the HOST field.
+
+      A possibly non-null terminated string is returned.
+
+      @note The returned string is allocated and must be freed by the caller
+      after use with @c TSfree.
+  */
+  tsapi char* TSHttpTxnEffectiveUrlStringGet(TSHttpTxn txnp,
+                                             int* length /**< String length return, may be @c NULL. */
+                                             );
+
+  tsapi void TSHttpTxnRespCacheableSet(TSHttpTxn txnp, int flag);
+  tsapi void TSHttpTxnReqCacheableSet(TSHttpTxn txnp, int flag);
+
+  /** Set flag indicating whether or not to cache the server response for
+      given TSHttpTxn
+
+      @note This should be done in the HTTP_READ_RESPONSE_HDR_HOOK or earlier.
+
+      @note If TSHttpTxnRespCacheableSet() is not working the way you expect,
+      this may be the function you should use instead.
+
+      @param txnp The transaction whose server response you do not want to store.
+      @param flag Set 0 to allow storing and 1 to disable storing.
+
+      @return TS_SUCCESS.
+  */
+  tsapi TSReturnCode TSHttpTxnServerRespNoStoreSet(TSHttpTxn txnp, int flag);
+
+  tsapi TSReturnCode TSFetchPageRespGet (TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+  tsapi char* TSFetchRespGet(TSHttpTxn txnp, int* length);
+  tsapi TSReturnCode TSHttpTxnCacheLookupStatusGet(TSHttpTxn txnp, int* lookup_status);
+
+  tsapi TSReturnCode TSHttpTxnTransformRespGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
+
+  tsapi void TSHttpTxnClientIncomingPortSet(TSHttpTxn txnp, int port);
+
+  /** Get SSL object of this session.
+      Retrieves the SSL object of the SSL connection.
+
+      @return SSL object of this session
+   */
+  tsapi void* TSHttpSsnSSLConnectionGet(TSHttpSsn ssnp); //returns SSL *
+
+  /** Get client address for transaction @a txnp.
+      Retrieves the socket address of the remote client that has
+      connected to Traffic Server for transaction @a txnp. The
+      return structure is the generic socket address storage in
+      order to be address-family agnostic. The user of this function
+      can then go on to do the appropriate thing with the type
+      specified in the ss_family field of the structure whether
+      that be for IPv4, IPv6, or any other address family.
+
+      @return Client address for connection to client in transaction @a txnp.
+
+   */
+  tsapi struct sockaddr const* TSHttpTxnClientAddrGet(TSHttpTxn txnp);
+  /** Get the incoming address.
+
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+
+      @return Local address of the client connection for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnIncomingAddrGet(TSHttpTxn txnp);
+  /** Get the origin server address.
+   *
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+
+      @return The address of the origin server for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnServerAddrGet(TSHttpTxn txnp);
+  /** Set the origin server address.
+
+      This must be invoked before the origin server address is looked up.
+      If called no lookup is done, the address @a addr is used instead.
+
+      @return @c TS_SUCCESS if the origin server address is set, @c TS_ERROR otherwise.
+  */
+  tsapi TSReturnCode TSHttpTxnServerAddrSet(TSHttpTxn txnp,
+                                            struct sockaddr const* addr /**< Address for origin server. */
+                                            );
+
+  /** Get the next hop address.
+   *
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+
+      @return The address of the next hop for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnNextHopAddrGet(TSHttpTxn txnp);
+
+  tsapi TSReturnCode TSHttpTxnClientFdGet(TSHttpTxn txnp, int* fdp);
+  tsapi TSReturnCode TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, struct sockaddr const* addr);
+  tsapi TSReturnCode TSHttpTxnOutgoingTransparencySet(TSHttpTxn txnp, int flag);
+
+  /* TS-1008: the above TXN calls for the Client conn should work with SSN */
+  tsapi struct sockaddr const* TSHttpSsnClientAddrGet(TSHttpSsn ssnp);
+  tsapi struct sockaddr const* TSHttpSsnIncomingAddrGet(TSHttpSsn ssnp);
+  tsapi TSReturnCode TSHttpSsnClientFdGet(TSHttpSsn ssnp, int* fdp);
+  /* TS-1008 END */
+
+  /** Change packet firewall mark for the client side connection
+   *
+      @note The change takes effect immediately
+      
+      @return TS_SUCCESS if the client connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnClientPacketMarkSet(TSHttpTxn txnp, int mark);
+  
+  /** Change packet firewall mark for the server side connection
+   *
+      @note The change takes effect immediately, if no OS connection has been
+      made, then this sets the mark that will be used IF an OS connection
+      is established
+      
+      @return TS_SUCCESS if the (future?) server connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnServerPacketMarkSet(TSHttpTxn txnp, int mark);
+  
+  /** Change packet TOS for the client side connection
+   *
+      @note The change takes effect immediately
+      
+      @note TOS is deprecated and replaced by DSCP, this is still used to
+      set DSCP however the first 2 bits of this value will be ignored as
+      they now belong to the ECN field.
+      
+      @return TS_SUCCESS if the client connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnClientPacketTosSet(TSHttpTxn txnp, int tos);
+  
+  /** Change packet TOS for the server side connection
+   *
+      @note The change takes effect immediately, if no OS connection has been
+      made, then this sets the mark that will be used IF an OS connection
+      is established
+      
+      @note TOS is deprecated and replaced by DSCP, this is still used to
+      set DSCP however the first 2 bits of this value will be ignored as
+      they now belong to the ECN field.
+      
+      @return TS_SUCCESS if the (future?) server connection was modified
+  */
+  tsapi TSReturnCode TSHttpTxnServerPacketTosSet(TSHttpTxn txnp, int tos);
+
+
+  tsapi void TSHttpTxnErrorBodySet(TSHttpTxn txnp, char* buf, int buflength, char* mimetype);
+
+  /**
+      Retrieves the parent proxy hostname and port, if parent
+      proxying is enabled. If parent proxying is not enabled,
+      TSHttpTxnParentProxyGet() sets hostname to NULL and port to -1.
+
+      @param txnp HTTP transaction whose parent proxy to get.
+      @param hostname of the parent proxy.
+      @param port parent proxy's port.
+
+   */
+  tsapi TSReturnCode TSHttpTxnParentProxyGet(TSHttpTxn txnp, char** hostname, int* port);
+
+  /**
+      Sets the parent proxy name and port. The string hostname is copied
+      into the TSHttpTxn; you can modify or delete the string after
+      calling TSHttpTxnParentProxySet().
+
+      @param txnp HTTP transaction whose parent proxy to set.
+      @param hostname parent proxy host name string.
+      @param port parent proxy port to set.
+
+   */
+  tsapi void TSHttpTxnParentProxySet(TSHttpTxn txnp, char* hostname, int port);
+
+  tsapi void TSHttpTxnUntransformedRespCache(TSHttpTxn txnp, int on);
+  tsapi void TSHttpTxnTransformedRespCache(TSHttpTxn txnp, int on);
+
+  /**
+      Notifies the HTTP transaction txnp that the plugin is
+      finished processing the current hook. The plugin tells the
+      transaction to either continue (TS_EVENT_HTTP_CONTINUE) or stop
+      (TS_EVENT_HTTP_ERROR).
+
+      You must always reenable the HTTP transaction after the processing
+      of each transaction event. However, never reenable twice.
+      Reenabling twice is a serious error.
+
+      @param txnp transaction to be reenabled.
+      @param event tells the transaction how to continue:
+        - TS_EVENT_HTTP_CONTINUE, which means that the transaction
+          should continue.
+        - TS_EVENT_HTTP_ERROR which terminates the transaction
+          and sends an error to the client if no response has already
+          been sent.
+
+   */
+  tsapi void TSHttpTxnReenable(TSHttpTxn txnp, TSEvent event);
+  tsapi TSReturnCode TSHttpCacheReenable(TSCacheTxn txnp, const TSEvent event, const void* data, const uint64_t size);
+  tsapi TSReturnCode TSHttpTxnFollowRedirect(TSHttpTxn txnp, int on);
+
+  tsapi void TSHttpTxnArgSet(TSHttpTxn txnp, int arg_idx, void* arg);
+  tsapi void* TSHttpTxnArgGet(TSHttpTxn txnp, int arg_idx);
+  tsapi void TSHttpSsnArgSet(TSHttpSsn ssnp, int arg_idx, void* arg);
+  tsapi void* TSHttpSsnArgGet(TSHttpSsn ssnp, int arg_idx);
+
+  /* The reserve API should only be use in TSAPI plugins, during plugin initialization! */
+  /* The lookup methods can be used anytime, but are best used during initialization as well,
+     or at least "cache" the results for best performance. */
+  tsapi TSReturnCode TSHttpArgIndexReserve(const char* name, const char* description, int* arg_idx);
+  tsapi TSReturnCode TSHttpArgIndexNameLookup(const char* name, int* arg_idx, const char** description);
+  tsapi TSReturnCode TSHttpArgIndexLookup(int arg_idx, const char** name, const char** description);
+
+  tsapi int TSHttpTxnGetMaxHttpRetBodySize(void);
+  tsapi void TSHttpTxnSetHttpRetBody(TSHttpTxn txnp, const char* body_msg, int plain_msg);
+  tsapi void TSHttpTxnSetHttpRetStatus(TSHttpTxn txnp, TSHttpStatus http_retstatus);
+
+  tsapi void TSHttpTxnActiveTimeoutSet(TSHttpTxn txnp, int timeout);
+  tsapi void TSHttpTxnConnectTimeoutSet(TSHttpTxn txnp, int timeout);
+  tsapi void TSHttpTxnDNSTimeoutSet(TSHttpTxn txnp, int timeout);
+  tsapi void TSHttpTxnNoActivityTimeoutSet(TSHttpTxn txnp, int timeout);
+
+  tsapi TSServerState TSHttpTxnServerStateGet(TSHttpTxn txnp);
+
+  /* --------------------------------------------------------------------------
+     Transaction specific debugging control  */
+
+  /**
+         Set the transaction specific debugging flag for this transaction.
+         When turned on, internal debug messages related to this transaction
+         will be written even if the debug tag isn't on.
+
+      @param txnp transaction to change.
+      @param on set to 1 to turn on, 0 to turn off.
+  */
+  tsapi void TSHttpTxnDebugSet(TSHttpTxn txnp, int on);
+  /**
+         Returns the transaction specific debugging flag for this transaction.
+
+      @param txnp transaction to check.
+      @return 1 if enabled, 0 otherwise.
+  */
+  tsapi int TSHttpTxnDebugGet(TSHttpTxn txnp);
+  /**
+         Set the session specific debugging flag for this client session.
+         When turned on, internal debug messages related to this session and all transactions
+         in the session will be written even if the debug tag isn't on.
+
+      @param ssnp Client session to change.
+      @param on set to 1 to turn on, 0 to turn off.
+  */
+  tsapi void TSHttpSsnDebugSet(TSHttpSsn ssnp, int on);
+  /**
+         Returns the transaction specific debugging flag for this client session.
+
+      @param txnp Client session to check.
+      @return 1 if enabled, 0 otherwise.
+  */
+  tsapi int TSHttpSsnDebugGet(TSHttpSsn ssnp, int *on);
+
+  /* --------------------------------------------------------------------------
+     Intercepting Http Transactions */
+
+  /**
+      Allows a plugin take over the servicing of the request as though
+      it was the origin server. contp will be sent TS_EVENT_NET_ACCEPT.
+      The edata passed with TS_NET_EVENT_ACCEPT is an TSVConn just as
+      it would be for a normal accept. The plugin must act as if it is
+      an http server and read the http request and body off the TSVConn
+      and send an http response header and body.
+
+      TSHttpTxnIntercept() must be called be called from only
+      TS_HTTP_READ_REQUEST_HOOK. Using TSHttpTxnIntercept will
+      bypass the Traffic Server cache. If response sent by the plugin
+      should be cached, use TSHttpTxnServerIntercept() instead.
+      TSHttpTxnIntercept() primary use is allow plugins to serve data
+      about their functioning directly.
+
+      TSHttpTxnIntercept() must only be called once per transaction.
+
+      @param contp continuation called to handle the interception.
+      @param txnp transaction to be intercepted.
+
+   */
+  tsapi void TSHttpTxnIntercept(TSCont contp, TSHttpTxn txnp);
+
+  /**
+      Allows a plugin take over the servicing of the request as though
+      it was the origin server. In the event a request needs to be
+      made to the server for transaction txnp, contp will be sent
+      TS_EVENT_NET_ACCEPT. The edata passed with TS_NET_EVENT_ACCEPT
+      is an TSVConn just as it would be for a normal accept. The plugin
+      must act as if it is an http server and read the http request and
+      body off the TSVConn and send an http response header and body.
+
+      TSHttpTxnInterceptServer() must be not be called after
+      the connection to the server has taken place. The last hook
+      last hook in that TSHttpTxnIntercept() can be called from is
+      TS_HTTP_READ_CACHE_HDR_HOOK. If a connection to the server is
+      not necessary, contp is not called.
+
+      The response from the plugin is cached subject to standard
+      and configured http caching rules. Should the plugin wish the
+      response not be cached, the plugin must use appropriate http
+      response headers to prevent caching. The primary purpose of
+      TSHttpTxnInterceptServer() is allow plugins to provide gateways
+      to other protocols or to allow to plugin to it's own transport for
+      the next hop to the server. TSHttpTxnInterceptServer() overrides
+      parent cache configuration.
+
+      TSHttpTxnInterceptServer() must only be called once per
+      transaction.
+
+      @param contp continuation called to handle the interception
+      @param txnp transaction to be intercepted.
+
+   */
+  tsapi void TSHttpTxnServerIntercept(TSCont contp, TSHttpTxn txnp);
+
+  /* --------------------------------------------------------------------------
+     Initiate Http Connection */
+  /**
+      Allows the plugin to initiate an http connection. The TSVConn the
+      plugin receives as the result of successful operates identically to
+      one created through TSNetConnect. Aside from allowing the plugin
+      to set the client ip and port for logging, the functionality of
+      TSHttpConnect() is identical to connecting to localhost on the
+      proxy port with TSNetConnect(). TSHttpConnect() is more efficient
+      than TSNetConnect() to localhost since it avoids the overhead of
+      passing the data through the operating system.
+
+      @param log_ip ip address (in network byte order) that connection
+        will be logged as coming from.
+      @param log_port port (in network byte order) that connection will
+        be logged as coming from.
+      @param vc will be set to point to the new TSVConn on success.
+
+   */
+  tsapi TSVConn TSHttpConnect(struct sockaddr const* addr);
+
+  tsapi TSVConn TSHttpConnectWithProtoStack(struct sockaddr const* addr,
+                                            TSClientProtoStack proto_stack);
+
+    /* --------------------------------------------------------------------------
+     Initiate Transparent Http Connection */
+  /**
+      Allows the plugin to initiate a transparent http connection. This operates
+      identically to TSHttpConnect except that it is treated as an intercepted
+      transparent connection by the session and transaction state machines.
+
+      @param client_addr the address that the resulting connection will be seen as
+      	coming from
+      @param server_addr the address that the resulting connection will be seen as
+      	attempting to connect to when intercepted
+      @param vc will be set to point to the new TSVConn on success.
+
+   */
+  tsapi TSVConn TSHttpConnectTransparent(struct sockaddr const* client_addr, struct sockaddr const * server_addr);
+
+  tsapi void TSFetchUrl(const char* request,int request_len, struct sockaddr const* addr, TSCont contp, TSFetchWakeUpOptions callback_options,TSFetchEvent event);
+  tsapi void TSFetchPages(TSFetchUrlParams_t* params);
+
+  /* Check if HTTP State machine is internal or not */
+  tsapi TSReturnCode TSHttpIsInternalRequest(TSHttpTxn txnp);
+
+  /* --------------------------------------------------------------------------
+     HTTP alternate selection */
+  tsapi TSReturnCode TSHttpAltInfoClientReqGet(TSHttpAltInfo infop, TSMBuffer* bufp, TSMLoc* offset);
+  tsapi TSReturnCode TSHttpAltInfoCachedReqGet(TSHttpAltInfo infop, TSMBuffer* bufp, TSMLoc* offset);
+  tsapi TSReturnCode TSHttpAltInfoCachedRespGet(TSHttpAltInfo infop, TSMBuffer* bufp, TSMLoc* offset);
+  tsapi void TSHttpAltInfoQualitySet(TSHttpAltInfo infop, float quality);
+
+  /* --------------------------------------------------------------------------
+     Actions */
+  tsapi void TSActionCancel(TSAction actionp);
+  tsapi int TSActionDone(TSAction actionp);
+
+  /* --------------------------------------------------------------------------
+     VConnections */
+  tsapi TSVIO TSVConnReadVIOGet(TSVConn connp);
+  tsapi TSVIO TSVConnWriteVIOGet(TSVConn connp);
+  tsapi int TSVConnClosedGet(TSVConn connp);
+
+  tsapi TSVIO TSVConnRead(TSVConn connp, TSCont contp, TSIOBuffer bufp, int64_t nbytes);
+  tsapi TSVIO TSVConnWrite(TSVConn connp, TSCont contp, TSIOBufferReader readerp, int64_t nbytes);
+  tsapi void TSVConnClose(TSVConn connp);
+  tsapi void TSVConnAbort(TSVConn connp, int error);
+  tsapi void TSVConnShutdown(TSVConn connp, int read, int write);
+
+  /* --------------------------------------------------------------------------
+     Cache VConnections */
+  tsapi int64_t TSVConnCacheObjectSizeGet(TSVConn connp);
+
+  /* --------------------------------------------------------------------------
+     Transformations */
+  tsapi TSVConn TSTransformCreate(TSEventFunc event_funcp, TSHttpTxn txnp);
+  tsapi TSVConn TSTransformOutputVConnGet(TSVConn connp);
+
+  /* --------------------------------------------------------------------------
+     Net VConnections */
+
+  tsapi struct sockaddr const* TSNetVConnRemoteAddrGet(TSVConn vc);
+
+  /**
+      Opens a network connection to the host specified by ip on the port
+      specified by port. If the connection is successfully opened, contp
+      is called back with the event TS_EVENT_NET_CONNECT and the new
+      network vconnection will be passed in the event data parameter.
+      If the connection is not successful, contp is called back with
+      the event TS_EVENT_NET_CONNECT_FAILED.
+
+      Note: on Solaris, it is possible to receive TS_EVENT_NET_CONNECT
+      even if the connection failed, because of the implementation of
+      network sockets in the underlying operating system. There is an
+      exception: if a plugin tries to open a connection to a port on
+      its own host machine, then TS_EVENT_NET_CONNECT is sent only
+      if the connection is successfully opened. In general, however,
+      your plugin needs to look for an TS_EVENT_VCONN_WRITE_READY to
+      be sure that the connection is successfully opened.
+
+      @return something allows you to check if the connection is complete,
+        or cancel the attempt to connect.
+
+   */
+  tsapi TSAction TSNetConnect(TSCont contp, /**< continuation that is called back when the attempted net connection either succeeds or fails. */
+                              struct sockaddr const* to /**< Address to which to connect. */
+  );
+
+  tsapi TSAction TSNetAccept(TSCont contp, int port, int domain, int accept_threads);
+
+  /**
+    Listen on all SSL ports for connections for the specified protocol name.
+
+    TSNetAcceptNamedProtocol registers the specified protocol for all
+    statically configured TLS ports. When a client using the TLS Next Protocol
+    Negotiation extension negotiates the requested protocol, TrafficServer will
+    route the request to the given handler. Note that the protocol is not
+    registered on ports opened by other plugins.
+
+    The event and data provided to the handler are the same as for
+    TSNetAccept(). If a connection is successfully accepted, the event code
+    will be TS_EVENT_NET_ACCEPT and the event data will be a valid TSVConn
+    bound to the accepted connection.
+
+    Neither contp nor protocol are copied. They must remain valid for the
+    lifetime of the plugin.
+
+    TSNetAcceptNamedProtocol fails if the requested protocol cannot be
+    registered on all of the configured TLS ports. If it fails, the protocol
+    will not be registered on any ports (ie.. no partial failure).
+  */
+  tsapi TSReturnCode TSNetAcceptNamedProtocol(TSCont contp, const char * protocol);
+
+  /**
+    Create a new port from the string specification used by the
+    proxy.config.http.server_ports configuration value.
+   */
+  tsapi TSPortDescriptor TSPortDescriptorParse(const char * descriptor);
+
+  /**
+     Start listening on the given port descriptor. If a connection is
+     successfully accepted, the TS_EVENT_NET_ACCEPT is delivered to the
+     continuation. The event data will be a valid TSVConn bound to the accepted
+     connection.
+   */
+  tsapi TSReturnCode TSPortDescriptorAccept(TSPortDescriptor, TSCont);
+
+  /* --------------------------------------------------------------------------
+     DNS Lookups */
+  tsapi TSAction TSHostLookup(TSCont contp, const char* hostname, size_t namelen);
+  tsapi struct sockaddr const* TSHostLookupResultAddrGet(TSHostLookupResult lookup_result);
+  /* TODO: Eventually, we might want something like this as well, but it requires
+     support for building the HostDBInfo struct:
+     tsapi void TSHostLookupResultSet(TSHttpTxn txnp, TSHostLookupResult result);
+  */
+
+  /* --------------------------------------------------------------------------
+     Cache VConnections */
+  /**
+      Asks the Traffic Server cache if the object corresponding to key
+      exists in the cache and can be read. If the object can be read,
+      the Traffic Server cache calls the continuation contp back with
+      the event TS_EVENT_CACHE_OPEN_READ. In this case, the cache also
+      passes contp a cache vconnection and contp can then initiate a
+      read operation on that vconnection using TSVConnRead.
+
+      If the object cannot be read, the cache calls contp back with
+      the event TS_EVENT_CACHE_OPEN_READ_FAILED. The user (contp)
+      has the option to cancel the action returned by TSCacheRead.
+      Note that reentrant calls are possible, i.e. the cache can call
+      back the user (contp) in the same call.
+
+      @param contp continuation to be called back if a read operation
+        is permissible.
+      @param key cache key corresponding to the object to be read.
+      @return something allowing the user to cancel or schedule the
+        cache read.
+
+   */
+  tsapi TSAction TSCacheRead(TSCont contp, TSCacheKey key);
+
+  /**
+      Asks the Traffic Server cache if contp can start writing the
+      object (corresponding to key) to the cache. If the object
+      can be written, the cache calls contp back with the event
+      TS_EVENT_CACHE_OPEN_WRITE. In this case, the cache also passes
+      contp a cache vconnection and contp can then initiate a write
+      operation on that vconnection using TSVConnWrite. The object
+      is not committed to the cache until the vconnection is closed.
+      When all data has been transferred, the user (contp) must do
+      an TSVConnClose. In case of any errors, the user MUST do an
+      TSVConnAbort(contp, 0).
+
+      If the object cannot be written, the cache calls contp back with
+      the event TS_EVENT_CACHE_OPEN_WRITE_FAILED. This can happen,
+      for example, if there is another object with the same key being
+      written to the cache. The user (contp) has the option to cancel
+      the action returned by TSCacheWrite.
+
+      Note that reentrant calls are possible, i.e. the cache can call
+      back the user (contp) in the same call.
+
+      @param contp continuation that the cache calls back (telling it
+        whether the write operation can proceed or not).
+      @param key cache key corresponding to the object to be cached.
+      @return something allowing the user to cancel or schedule the
+        cache write.
+
+   */
+  tsapi TSAction TSCacheWrite(TSCont contp, TSCacheKey key);
+
+  /**
+      Removes the object corresponding to key from the cache. If the
+      object was removed successfully, the cache calls contp back
+      with the event TS_EVENT_CACHE_REMOVE. If the object was not
+      found in the cache, the cache calls contp back with the event
+      TS_EVENT_CACHE_REMOVE_FAILED.
+
+      In both of these callbacks, the user (contp) does not have to do
+      anything. The user does not get any vconnection from the cache,
+      since no data needs to be transferred. When the cache calls
+      contp back with TS_EVENT_CACHE_REMOVE, the remove has already
+      been commited.
+
+      @param contp continuation that the cache calls back reporting the
+        success or failure of the remove.
+      @param key cache key corresponding to the object to be removed.
+      @return something allowing the user to cancel or schedule the
+        remove.
+
+   */
+  tsapi TSAction TSCacheRemove(TSCont contp, TSCacheKey key);
+  tsapi TSReturnCode TSCacheReady(int* is_ready);
+  tsapi TSAction TSCacheScan(TSCont contp, TSCacheKey key, int KB_per_second);
+
+  /* --------------------------------------------------------------------------
+     VIOs */
+  tsapi void TSVIOReenable(TSVIO viop);
+  tsapi TSIOBuffer TSVIOBufferGet(TSVIO viop);
+  tsapi TSIOBufferReader TSVIOReaderGet(TSVIO viop);
+  tsapi int64_t TSVIONBytesGet(TSVIO viop);
+  tsapi void TSVIONBytesSet(TSVIO viop, int64_t nbytes);
+  tsapi int64_t TSVIONDoneGet(TSVIO viop);
+  tsapi void TSVIONDoneSet(TSVIO viop, int64_t ndone);
+  tsapi int64_t TSVIONTodoGet(TSVIO viop);
+  tsapi TSMutex TSVIOMutexGet(TSVIO viop);
+  tsapi TSCont TSVIOContGet(TSVIO viop);
+  tsapi TSVConn TSVIOVConnGet(TSVIO viop);
+
+  /* --------------------------------------------------------------------------
+     Buffers */
+  tsapi TSIOBuffer TSIOBufferCreate(void);
+
+  /**
+      Creates a new TSIOBuffer of the specified size. With this function,
+      you can create smaller buffers than the 32K buffer created by
+      TSIOBufferCreate(). In some situations using smaller buffers can
+      improve performance.
+
+      @param index size of the new TSIOBuffer to be created.
+      @param new TSIOBuffer of the specified size.
+
+   */
+  tsapi TSIOBuffer TSIOBufferSizedCreate(TSIOBufferSizeIndex index);
+
+  /**
+      The watermark of an TSIOBuffer is the minimum number of bytes
+      of data that have to be in the buffer before calling back any
+      continuation that has initiated a read operation on this buffer.
+      TSIOBufferWaterMarkGet() will provide the size of the watermark,
+      in bytes, for a specified TSIOBuffer.
+
+      @param bufp buffer whose watermark the function gets.
+
+   */
+  tsapi int64_t TSIOBufferWaterMarkGet(TSIOBuffer bufp);
+
+  /**
+      The watermark of an TSIOBuffer is the minimum number of bytes
+      of data that have to be in the buffer before calling back any
+      continuation that has initiated a read operation on this buffer.
+      As a writer feeds data into the TSIOBuffer, no readers are called
+      back until the amount of data reaches the watermark. Setting
+      a watermark can improve performance because it avoids frequent
+      callbacks to read small amounts of data. TSIOBufferWaterMarkSet()
+      assigns a watermark to a particular TSIOBuffer.
+
+      @param bufp buffer whose water mark the function sets.
+      @param water_mark watermark setting, as a number of bytes.
+
+   */
+  tsapi void TSIOBufferWaterMarkSet(TSIOBuffer bufp, int64_t water_mark);
+
+  tsapi void TSIOBufferDestroy(TSIOBuffer bufp);
+  tsapi TSIOBufferBlock TSIOBufferStart(TSIOBuffer bufp);
+  tsapi int64_t TSIOBufferCopy(TSIOBuffer bufp, TSIOBufferReader readerp, int64_t length, int64_t offset);
+
+  /**
+      Writes length bytes of data contained in the string buf to the
+      TSIOBuffer bufp. Returns the number of bytes of data successfully
+      written to the TSIOBuffer.
+
+      @param bufp is the TSIOBuffer to write into.
+      @param buf string to write into the TSIOBuffer.
+      @param length of the string buf.
+      @return length of data successfully copied into the buffer,
+        in bytes.
+
+   */
+  tsapi int64_t TSIOBufferWrite(TSIOBuffer bufp, const void* buf, int64_t length);
+  tsapi void TSIOBufferProduce(TSIOBuffer bufp, int64_t nbytes);
+
+  tsapi TSIOBufferBlock TSIOBufferBlockNext(TSIOBufferBlock blockp);
+  tsapi const char* TSIOBufferBlockReadStart(TSIOBufferBlock blockp, TSIOBufferReader readerp, int64_t* avail);
+  tsapi int64_t TSIOBufferBlockReadAvail(TSIOBufferBlock blockp, TSIOBufferReader readerp);
+  tsapi char* TSIOBufferBlockWriteStart(TSIOBufferBlock blockp, int64_t* avail);
+  tsapi int64_t TSIOBufferBlockWriteAvail(TSIOBufferBlock blockp);
+
+  tsapi TSIOBufferReader TSIOBufferReaderAlloc(TSIOBuffer bufp);
+  tsapi TSIOBufferReader TSIOBufferReaderClone(TSIOBufferReader readerp);
+  tsapi void TSIOBufferReaderFree(TSIOBufferReader readerp);
+  tsapi TSIOBufferBlock TSIOBufferReaderStart(TSIOBufferReader readerp);
+  tsapi void TSIOBufferReaderConsume(TSIOBufferReader readerp, int64_t nbytes);
+  tsapi int64_t TSIOBufferReaderAvail(TSIOBufferReader readerp);
+
+   tsapi struct sockaddr const* TSNetVConnLocalAddrGet(TSVConn vc);
+
+  /* --------------------------------------------------------------------------
+     Stats and configs based on librecords raw stats (this is preferred API until we
+     rewrite stats). This system has a limitation of up to 1,500 stats max, controlled
+     via proxy.config.stat_api.max_stats_allowed (default is 512).
+
+     This is available as of Apache TS v2.2.*/
+  typedef enum
+  {
+    TS_STAT_PERSISTENT = 1,
+    TS_STAT_NON_PERSISTENT
+  } TSStatPersistence;
+
+  typedef enum
+  {
+    TS_STAT_SYNC_SUM = 0,
+    TS_STAT_SYNC_COUNT,
+    TS_STAT_SYNC_AVG,
+    TS_STAT_SYNC_TIMEAVG
+  } TSStatSync;
+
+  /* APIs to create new records.config configurations */
+  tsapi TSReturnCode TSMgmtStringCreate(TSRecordType rec_type, const char *name, const TSMgmtString data_default,
+                                        TSRecordUpdateType update_type, TSRecordCheckType check_type,
+                                        const char *check_regex, TSRecordAccessType access_type);
+  tsapi TSReturnCode TSMgmtIntCreate(TSRecordType rec_type, const char *name, TSMgmtInt data_default,
+                                     TSRecordUpdateType update_type, TSRecordCheckType check_type,
+                                     const char *check_regex, TSRecordAccessType access_type);
+
+  /*  Note that only TS_RECORDDATATYPE_INT is supported at this point. */
+  tsapi int TSStatCreate(const char* the_name, TSRecordDataType the_type, TSStatPersistence persist, TSStatSync sync);
+
+  tsapi void TSStatIntIncrement(int the_stat, TSMgmtInt amount);
+  tsapi void TSStatIntDecrement(int the_stat, TSMgmtInt amount);
+  /* Currently not supported. */
+  /* tsapi void TSStatFloatIncrement(int the_stat, float amount); */
+  /* tsapi void TSStatFloatDecrement(int the_stat, float amount); */
+
+  tsapi TSMgmtInt TSStatIntGet(int the_stat);
+  tsapi void TSStatIntSet(int the_stat, TSMgmtInt value);
+  /* Currently not supported. */
+  /* tsapi TSeturnCode TSStatFloatGet(int the_stat, float* value); */
+  /* tsapi TSReturnCode TSStatFloatSet(int the_stat, float value); */
+
+  tsapi TSReturnCode TSStatFindName(const char* name, int* idp);
+
+  /* --------------------------------------------------------------------------
+     tracing api */
+
+  tsapi int TSIsDebugTagSet(const char* t);
+  tsapi void TSDebug(const char* tag, const char* format_str, ...) TS_PRINTFLIKE(2, 3);
+  /**
+      Output a debug line even if the debug tag is turned off, as long as
+      debugging is enabled. Could be used as follows:
+      @code
+      TSDebugSpecifc(TSHttpTxnDebugGet(txn), "plugin_tag" , "Hello World from transaction %p", txn);
+      @endcode
+      will be printed if the plugin_tag is enabled or the transaction specific
+      debugging is turned on for txn.
+
+      @param debug_flag boolean flag.
+      @param tag Debug tag for the line.
+      @param format Format string.
+      @param ... Format arguments.
+   */
+  tsapi void TSDebugSpecific(int debug_flag, const char* tag, const char* format_str, ...) TS_PRINTFLIKE(3, 4);
+  extern int diags_on_for_plugins;
+#define TSDEBUG if (diags_on_for_plugins) TSDebug
+
+  /* --------------------------------------------------------------------------
+     logging api */
+
+  /**
+      The following enum values are flags, so they should be powers
+      of two. With the exception of TS_LOG_MODE_INVALID_FLAG, they
+      are all used to configure the creation of an TSTextLogObject
+      through the mode argument to TSTextLogObjectCreate().
+      TS_LOG_MODE_INVALID_FLAG is used internally to check the validity
+      of this argument. Insert new flags before TS_LOG_MODE_INVALID_FLAG,
+      and set TS_LOG_MODE_INVALID_FLAG to the largest power of two of
+      the enum.
+
+   */
+  enum
+  {
+    TS_LOG_MODE_ADD_TIMESTAMP = 1,
+    TS_LOG_MODE_DO_NOT_RENAME = 2,
+    TS_LOG_MODE_INVALID_FLAG = 4
+  };
+
+  /**
+      This type represents a custom log file that you create with
+      TSTextLogObjectCreate(). Your plugin writes entries into this
+      log file using TSTextLogObjectWrite().
+
+   */
+  typedef struct tsapi_textlogobject* TSTextLogObject;
+
+  typedef void (*TSRecordDumpCb) (TSRecordType rec_type, void* edata, int registered, const char* name, TSRecordDataType data_type, TSRecordData* datum);
+
+  tsapi void TSRecordDump(TSRecordType rec_type, TSRecordDumpCb callback, void* edata);
+
+  /**
+
+      Creates a new custom log file that your plugin can write to. You
+      can design the fields and inputs to the log file using the
+      TSTextLogObjectWrite() function. The logs you create are treated
+      like ordinary logs; they are rolled if log rolling is enabled. (Log
+      collation is not supported though).
+
+      @param filename new log file being created. The new log file
+        is created in the logs directory. You can specify a path to a
+        subdirectory within the log directory, e.g. subdir/filename,
+        but make sure you create the subdirectory first. If you do
+        not specify a file name extension, the extension ".log" is
+        automatically added.
+      @param mode 

<TRUNCATED>

[45/50] [abbrv] git commit: [TS-2664] Removing initializable value code

Posted by zw...@apache.org.
[TS-2664] Removing initializable value code


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

Branch: refs/heads/lua_config
Commit: 5622e8d43467a08fc03b921024b8c6a80851cd85
Parents: 5343132
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 16:42:14 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 16:42:14 2014 -0700

----------------------------------------------------------------------
 configure.ac                                    |   1 -
 lib/atscppapi/examples/Makefile.am              |   3 +-
 lib/atscppapi/examples/data_caching/Makefile.am |  34 ------
 .../examples/data_caching/data_caching.cc       |  98 ------------------
 lib/atscppapi/src/ClientRequest.cc              |   1 -
 lib/atscppapi/src/Headers.cc                    |   1 -
 lib/atscppapi/src/Makefile.am                   |   1 -
 lib/atscppapi/src/Request.cc                    |  24 +++--
 lib/atscppapi/src/Response.cc                   |  44 +++-----
 lib/atscppapi/src/Transaction.cc                |   1 -
 lib/atscppapi/src/Url.cc                        | 103 +++++++++----------
 lib/atscppapi/src/include/atscppapi/Response.h  |   2 +-
 lib/atscppapi/src/include/atscppapi/Url.h       |  10 +-
 lib/atscppapi/src/include/atscppapi/utils.h     |   6 --
 lib/atscppapi/src/utils.cc                      |   2 -
 lib/atscppapi/src/utils_internal.cc             |   7 --
 16 files changed, 82 insertions(+), 256 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 7710c5a..6883cb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1937,7 +1937,6 @@ AC_CONFIG_FILES([
   lib/atscppapi/examples/clientredirect/Makefile
   lib/atscppapi/examples/clientrequest/Makefile
   lib/atscppapi/examples/customresponse/Makefile
-  lib/atscppapi/examples/data_caching/Makefile
   lib/atscppapi/examples/globalhook/Makefile
   lib/atscppapi/examples/gzip_transformation/Makefile
   lib/atscppapi/examples/helloworld/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/examples/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/Makefile.am b/lib/atscppapi/examples/Makefile.am
index 9cbf7d6..804a346 100644
--- a/lib/atscppapi/examples/Makefile.am
+++ b/lib/atscppapi/examples/Makefile.am
@@ -19,7 +19,6 @@ SUBDIRS = helloworld \
 	  globalhook \
       transactionhook \
 	  multiple_transaction_hooks \
-	  data_caching \
 	  clientrequest \
 	  serverresponse \
 	  clientredirect \
@@ -34,4 +33,4 @@ SUBDIRS = helloworld \
 	  timeout_example \
       internal_transaction_handling \
       async_timer \
-      intercept
\ No newline at end of file
+      intercept

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/examples/data_caching/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/data_caching/Makefile.am b/lib/atscppapi/examples/data_caching/Makefile.am
deleted file mode 100644
index a0a8cd7..0000000
--- a/lib/atscppapi/examples/data_caching/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-AM_CPPFLAGS = \
-  -I$(top_srcdir)/proxy/api \
-  -I$(top_builddir)/lib/ts \
-  -I$(top_srcdir)/lib/ts \
-  -I$(top_srcdir)/lib/atscppapi/src/include \
-  -Wno-unused-variable
-  
-target=data_caching.so
-pkglibdir = ${pkglibexecdir}
-pkglib_LTLIBRARIES = data_caching.la
-data_caching_la_SOURCES = data_caching.cc
-data_caching_la_LDFLAGS = -module -avoid-version -shared -L$(top_srcdir)/lib/atscppapi/src/ -latscppapi
-
-all:
-	ln -sf .libs/$(target)
-
-clean-local:
-	rm -f $(target)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/examples/data_caching/data_caching.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/examples/data_caching/data_caching.cc b/lib/atscppapi/examples/data_caching/data_caching.cc
deleted file mode 100644
index e5c701e..0000000
--- a/lib/atscppapi/examples/data_caching/data_caching.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include <iostream>
-#include <cstdlib>
-#include <atscppapi/GlobalPlugin.h>
-#include <atscppapi/ClientRequest.h>
-#include <atscppapi/utils.h>
-
-#include <ts/ts.h>
-
-using namespace atscppapi;
-using namespace std;
-
-namespace {
-
-const string SPECIAL_HEADER("Special-Header");
-
-}
-
-class GlobalHookPlugin : public GlobalPlugin {
-public:
-  GlobalHookPlugin() {
-    registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
-    registerHook(HOOK_SEND_RESPONSE_HEADERS);
-  }
-
-  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
-    cout << "Hello from handleReadRequesHeadersPreRemap!" << endl;
-    checkForSpecialHeader(transaction.getClientRequest().getHeaders());
-    transaction.resume();
-  }
-
-  virtual void handleSendResponseHeaders(Transaction &transaction) {
-    cout << "Hello from handleSendResponseHeaders!" << endl;
-    checkForSpecialHeader(transaction.getClientRequest().getHeaders());
-    transaction.resume();
-  }
-
-private:
-  void checkForSpecialHeader(Headers &headers) {
-    Headers::iterator iter = headers.find(SPECIAL_HEADER);
-    if (iter == headers.end()) {
-      cout << "Special header is absent" << endl;
-    } else {
-      cout << "Special header is present with value " << (*iter).str() << endl;
-    }
-  }
-};
-
-namespace {
-
-int handlePostRemap(TSCont cont ATSCPPAPI_UNUSED, TSEvent event ATSCPPAPI_UNUSED, void *edata) {
-  TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
-  TSMBuffer hdr_buf;
-  TSMLoc hdr_loc, field_loc;
-  TSHttpTxnClientReqGet(txn, &hdr_buf, &hdr_loc);
-  int nullTerminatedStringLength = -1;
-  TSMimeHdrFieldCreateNamed(hdr_buf, hdr_loc, SPECIAL_HEADER.c_str(), nullTerminatedStringLength, &field_loc);
-  const char *value = "foo";
-  int insertAtBeginningIndex = 0;
-  TSMimeHdrFieldValueStringInsert(hdr_buf, hdr_loc, field_loc, insertAtBeginningIndex, value,
-                                  nullTerminatedStringLength);
-  TSMimeHdrFieldAppend(hdr_buf, hdr_loc, field_loc);
-  TSHandleMLocRelease(hdr_buf, hdr_loc, field_loc);
-  TSMLoc hdr_loc_null_parent = NULL;
-  TSHandleMLocRelease(hdr_buf, hdr_loc_null_parent, hdr_loc);
-  TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
-  return 0;
-}
-
-}
-
-void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED) {
-  int do_overwrite = 1;
-  setenv(utils::DISABLE_DATA_CACHING_ENV_FLAG.c_str(), "true", do_overwrite);
-
-  new GlobalHookPlugin();
-
-  TSMutex nullMutex = NULL;
-  TSCont globalCont = TSContCreate(handlePostRemap, nullMutex);
-  TSHttpHookAdd(TS_HTTP_POST_REMAP_HOOK, globalCont);
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/ClientRequest.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/ClientRequest.cc b/lib/atscppapi/src/ClientRequest.cc
index 8f2e602..32d7306 100644
--- a/lib/atscppapi/src/ClientRequest.cc
+++ b/lib/atscppapi/src/ClientRequest.cc
@@ -24,7 +24,6 @@
 #include <cstdlib>
 #include <ts/ts.h>
 #include "atscppapi/noncopyable.h"
-#include "InitializableValue.h"
 #include "logging_internal.h"
 
 using namespace atscppapi;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Headers.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index 7be2a90..96afbb9 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -21,7 +21,6 @@
  */
 #include "atscppapi/Headers.h"
 #include "atscppapi/shared_ptr.h"
-#include "InitializableValue.h"
 #include "logging_internal.h"
 #include <string>
 #include <cstring>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Makefile.am b/lib/atscppapi/src/Makefile.am
index b2c721b..8136744 100644
--- a/lib/atscppapi/src/Makefile.am
+++ b/lib/atscppapi/src/Makefile.am
@@ -41,7 +41,6 @@ libatscppapi_la_SOURCES = GlobalPlugin.cc \
 			  Url.cc \
 			  HttpVersion.cc \
 			  HttpMethod.cc \
-			  InitializableValue.cc \
 			  Response.cc \
 			  TransformationPlugin.cc \
 			  Logger.cc \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index ec36790..f885690 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -22,7 +22,6 @@
 #include "atscppapi/Request.h"
 #include <ts/ts.h>
 #include "atscppapi/noncopyable.h"
-#include "InitializableValue.h"
 #include "utils_internal.h"
 #include "logging_internal.h"
 
@@ -38,11 +37,12 @@ struct atscppapi::RequestState: noncopyable  {
   TSMLoc url_loc_;
   Url url_;
   Headers headers_;
-  InitializableValue<HttpMethod> method_;
-  InitializableValue<HttpVersion> version_;
+  /* method and version are stored here for the case of an unbound request */
+  HttpMethod method_;
+  HttpVersion version_;
   bool destroy_buf_;
-  RequestState() : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN, false),
-                   version_(HTTP_VERSION_UNKNOWN, false), destroy_buf_(false) { }
+  RequestState() : hdr_buf_(NULL), hdr_loc_(NULL), url_loc_(NULL), method_(HTTP_METHOD_UNKNOWN),
+                   version_(HTTP_VERSION_UNKNOWN), destroy_buf_(false) { }
 };
 
 Request::Request() {
@@ -57,8 +57,8 @@ Request::Request(void *hdr_buf, void *hdr_loc) {
 
 Request::Request(const string &url_str, HttpMethod method, HttpVersion version) {
   state_ = new RequestState();
-  state_->method_.setValue(method);
-  state_->version_.setValue(version);
+  state_->method_ = method;
+  state_->version_ = version;
   state_->destroy_buf_ = true;
   state_->hdr_buf_ = TSMBufferCreate();
   if (TSUrlCreate(state_->hdr_buf_, &state_->url_loc_) == TS_SUCCESS) {
@@ -98,7 +98,7 @@ void Request::init(void *hdr_buf, void *hdr_loc) {
 }
 
 HttpMethod Request::getMethod() const {
-  if (!state_->method_.isInitialized() && state_->hdr_buf_ && state_->hdr_loc_) {
+  if (state_->hdr_buf_ && state_->hdr_loc_) {
     int method_len;
     const char *method_str = TSHttpHdrMethodGet(state_->hdr_buf_, state_->hdr_loc_, &method_len);
     if (method_str && method_len) {
@@ -123,6 +123,8 @@ HttpMethod Request::getMethod() const {
       } else if (method_str == TS_HTTP_METHOD_TRACE) {
         state_->method_ = HTTP_METHOD_TRACE;
       }
+      LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p",
+          state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
     } else {
       LOG_ERROR("TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
           state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
@@ -136,10 +138,10 @@ Url &Request::getUrl() {
 }
 
 atscppapi::HttpVersion Request::getVersion() const {
-  if (!state_->version_.isInitialized() && state_->hdr_buf_ && state_->hdr_loc_) {
+  if (state_->hdr_buf_ && state_->hdr_loc_) {
     state_->version_ = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
-    LOG_DEBUG("Initializing request version=%d [%s] on hdr_buf=%p, hdr_loc=%p",
-        state_->version_.getValue(), HTTP_VERSION_STRINGS[state_->version_.getValue()].c_str(), state_->hdr_buf_, state_->hdr_loc_);
+    LOG_DEBUG("Request version=%d [%s] on hdr_buf=%p, hdr_loc=%p",
+        state_->version_, HTTP_VERSION_STRINGS[state_->version_].c_str(), state_->hdr_buf_, state_->hdr_loc_);
   }
   return state_->version_;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Response.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Response.cc b/lib/atscppapi/src/Response.cc
index dd7bddf..2ec042c 100644
--- a/lib/atscppapi/src/Response.cc
+++ b/lib/atscppapi/src/Response.cc
@@ -19,7 +19,6 @@
  * @file Response.cc
  */
 #include "atscppapi/Response.h"
-#include "InitializableValue.h"
 #include "atscppapi/noncopyable.h"
 #include "utils_internal.h"
 #include "logging_internal.h"
@@ -35,11 +34,8 @@ namespace atscppapi {
 struct ResponseState: noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
-  InitializableValue<HttpVersion> version_;
-  InitializableValue<HttpStatus> status_code_;
-  InitializableValue<string> reason_phrase_;
   Headers headers_;
-  ResponseState() : hdr_buf_(NULL), hdr_loc_(NULL), version_(HTTP_VERSION_UNKNOWN, false), status_code_(HTTP_STATUS_UNKNOWN, false) { }
+  ResponseState() : hdr_buf_(NULL), hdr_loc_(NULL) { }
 };
 
 }
@@ -57,61 +53,53 @@ void Response::init(void *hdr_buf, void *hdr_loc) {
 }
 
 HttpVersion Response::getVersion() const {
-  if (state_->version_.isInitialized()) {
-    return state_->version_;
-  }
+  HttpVersion ret_val = HTTP_VERSION_UNKNOWN;
   if (state_->hdr_buf_ && state_->hdr_loc_) {
-    state_->version_ = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
+    ret_val = utils::internal::getHttpVersion(state_->hdr_buf_, state_->hdr_loc_);
     LOG_DEBUG("Initializing response version to %d [%s] with hdr_buf=%p and hdr_loc=%p",
-        state_->version_.getValue(), HTTP_VERSION_STRINGS[state_->version_.getValue()].c_str(), state_->hdr_buf_, state_->hdr_loc_);
-    return state_->version_;
+        ret_val, HTTP_VERSION_STRINGS[ret_val].c_str(), state_->hdr_buf_, state_->hdr_loc_);
   }
-  return HTTP_VERSION_UNKNOWN;
+  return ret_val;
 }
 
 HttpStatus Response::getStatusCode() const {
-  if (state_->status_code_.isInitialized()) {
-    return state_->status_code_;
-  }
+  HttpStatus ret_val = HTTP_STATUS_UNKNOWN;
   if (state_->hdr_buf_ && state_->hdr_loc_) {
-    state_->status_code_ = static_cast<HttpStatus>(TSHttpHdrStatusGet(state_->hdr_buf_, state_->hdr_loc_));
+    ret_val = static_cast<HttpStatus>(TSHttpHdrStatusGet(state_->hdr_buf_, state_->hdr_loc_));
     LOG_DEBUG("Initializing response status code to %d with hdr_buf=%p and hdr_loc=%p",
-        state_->status_code_.getValue(), state_->hdr_buf_, state_->hdr_loc_);
-    return state_->status_code_;
+        ret_val, state_->hdr_buf_, state_->hdr_loc_);
   }
-
-  return HTTP_STATUS_UNKNOWN;
+  return ret_val;
 }
 
 void Response::setStatusCode(HttpStatus code) {
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     TSHttpHdrStatusSet(state_->hdr_buf_, state_->hdr_loc_, static_cast<TSHttpStatus>(code));
-    state_->status_code_ = code;
     LOG_DEBUG("Changing response status code to %d with hdr_buf=%p and hdr_loc=%p",
-        state_->status_code_.getValue(), state_->hdr_buf_, state_->hdr_loc_);
+        code, state_->hdr_buf_, state_->hdr_loc_);
   }
 }
 
-const string &Response::getReasonPhrase() const {
-  if (!state_->reason_phrase_.isInitialized() && state_->hdr_buf_ && state_->hdr_loc_) {
+string Response::getReasonPhrase() const {
+  string ret_str;
+  if (state_->hdr_buf_ && state_->hdr_loc_) {
     int length;
     const char *str = TSHttpHdrReasonGet(state_->hdr_buf_, state_->hdr_loc_, &length);
     if (str && length) {
-      state_->reason_phrase_.getValueRef().assign(str, length);
+      ret_str.assign(str, length);
       LOG_DEBUG("Initializing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p",
-          state_->reason_phrase_.getValueRef().c_str(), state_->hdr_buf_, state_->hdr_loc_);
+          ret_str.c_str(), state_->hdr_buf_, state_->hdr_loc_);
     } else {
       LOG_ERROR("TSHttpHdrReasonGet returned null string or zero length. str=%p, length=%d, hdr_buf=%p, hdr_loc=%p",
           str, length, state_->hdr_buf_, state_->hdr_loc_);
     }
   }
-  return state_->reason_phrase_; // if not initialized, we will just return an empty string
+  return ret_str; // if not initialized, we will just return an empty string
 }
 
 void Response::setReasonPhrase(const string &phrase) {
   if (state_->hdr_buf_ && state_->hdr_loc_) {
     TSHttpHdrReasonSet(state_->hdr_buf_, state_->hdr_loc_, phrase.c_str(), phrase.length());
-    state_->reason_phrase_ = phrase;
     LOG_DEBUG("Changing response reason phrase to '%s' with hdr_buf=%p and hdr_loc=%p",
         phrase.c_str(), state_->hdr_buf_, state_->hdr_loc_);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index df3f852..f5bde35 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -29,7 +29,6 @@
 #include "atscppapi/shared_ptr.h"
 #include "logging_internal.h"
 #include "utils_internal.h"
-#include "InitializableValue.h"
 #include "atscppapi/noncopyable.h"
 
 using std::map;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/Url.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Url.cc b/lib/atscppapi/src/Url.cc
index 2dce493..1b69f4c 100644
--- a/lib/atscppapi/src/Url.cc
+++ b/lib/atscppapi/src/Url.cc
@@ -22,7 +22,6 @@
 #include "atscppapi/Url.h"
 #include <ts/ts.h>
 #include "atscppapi/noncopyable.h"
-#include "InitializableValue.h"
 #include "logging_internal.h"
 
 using namespace atscppapi;
@@ -34,12 +33,6 @@ using std::string;
 struct atscppapi::UrlState: noncopyable {
   TSMBuffer hdr_buf_;
   TSMLoc url_loc_;
-  InitializableValue<string> url_string_;
-  InitializableValue<string> path_;
-  InitializableValue<string> query_;
-  InitializableValue<string> host_;
-  InitializableValue<string> scheme_;
-  InitializableValue<uint16_t> port_;
   UrlState(TSMBuffer hdr_buf, TSMLoc url_loc) :
       hdr_buf_(hdr_buf), url_loc_(url_loc) {
   }
@@ -67,94 +60,94 @@ bool inline Url::isInitialized() const {
 }
 
 void Url::reset() {
-  state_->url_string_.setInitialized(false);
-  state_->path_.setInitialized(false);
-  state_->query_.setInitialized(false);
-  state_->host_.setInitialized(false);
-  state_->scheme_.setInitialized(false);
-  state_->port_.setInitialized(false);
+
 }
 
-const std::string &Url::getUrlString() const {
-  if (isInitialized() && !state_->url_string_.isInitialized()) {
+std::string Url::getUrlString() const {
+  std::string ret_str;
+  if (isInitialized()) {
     int length;
     char *memptr = TSUrlStringGet(state_->hdr_buf_, state_->url_loc_, &length);
     if (memptr && length) {
-      state_->url_string_ = std::string(memptr, length);
+      ret_str = std::string(memptr, length);
       TSfree(memptr);
-      LOG_DEBUG("Got URL [%s]", state_->url_string_.getValue().c_str());
+      LOG_DEBUG("Got URL [%s]", ret_str.c_str());
     } else {
       LOG_ERROR("Got null/zero-length URL string; hdr_buf %p, url_loc %p, ptr %p, length %d", state_->hdr_buf_,
                 state_->url_loc_, memptr, length);
     }
   }
-  return state_->url_string_;
+  return ret_str;
 }
 
-const std::string &Url::getPath() const {
-  if (isInitialized() && !state_->path_.isInitialized()) {
+std::string Url::getPath() const {
+  std::string ret_str;
+  if (isInitialized()) {
     int length;
     const char *memptr = TSUrlPathGet(state_->hdr_buf_, state_->url_loc_, &length);
     if (memptr && length) {
-      state_->path_ = std::string(memptr, length);
+      ret_str = std::string(memptr, length);
     }
-    LOG_DEBUG("Using path [%s]", state_->path_.getValue().c_str());
+    LOG_DEBUG("Using path [%s]", ret_str.c_str());
   }
-  return state_->path_;
+  return ret_str;
 }
 
-const std::string &Url::getQuery() const {
-  if (isInitialized() && !state_->query_.isInitialized()) {
+std::string Url::getQuery() const {
+  std::string ret_str;
+  if (isInitialized()) {
     int length;
     const char *memptr = TSUrlHttpQueryGet(state_->hdr_buf_, state_->url_loc_, &length);
     if (memptr && length) {
-      state_->query_ = std::string(memptr, length);
+      ret_str = std::string(memptr, length);
     }
-    LOG_DEBUG("Using query [%s]", state_->query_.getValue().c_str());
+    LOG_DEBUG("Using query [%s]", ret_str.c_str());
   }
-  return state_->query_;
+  return ret_str;
 }
 
-const std::string &Url::getScheme() const {
-  if (isInitialized() && !state_->scheme_.isInitialized()) {
+std::string Url::getScheme() const {
+  std::string ret_str;
+  if (isInitialized()) {
     int length;
     const char *memptr = TSUrlSchemeGet(state_->hdr_buf_, state_->url_loc_, &length);
     if (memptr && length) {
-      state_->scheme_ = std::string(memptr, length);
+      ret_str = std::string(memptr, length);
     }
-    LOG_DEBUG("Using scheme [%s]", state_->scheme_.getValue().c_str());
+    LOG_DEBUG("Using scheme [%s]", ret_str.c_str());
   }
-  return state_->scheme_;
+  return ret_str;
 }
 
-const std::string &Url::getHost() const {
-  if (isInitialized() && !state_->host_.isInitialized()) {
+std::string Url::getHost() const {
+  std::string ret_str;
+  if (isInitialized()) {
     int length;
     const char *memptr = TSUrlHostGet(state_->hdr_buf_, state_->url_loc_, &length);
     if (memptr && length) {
-      state_->host_ = std::string(memptr, length);
+      ret_str = std::string(memptr, length);
     }
-    LOG_DEBUG("Using host [%s]", state_->host_.getValue().c_str());
+    LOG_DEBUG("Using host [%s]", ret_str.c_str());
   }
-  return state_->host_;
+  return ret_str;
 }
 
 uint16_t Url::getPort() const {
-  if (isInitialized() && !state_->port_.isInitialized()) {
-    state_->port_ = TSUrlPortGet(state_->hdr_buf_, state_->url_loc_);
-    LOG_DEBUG("Got port %d", state_->port_.getValue());
+  uint16_t ret_val = 0;
+  if (isInitialized()) {
+    ret_val = static_cast<uint16_t>(TSUrlPortGet(state_->hdr_buf_, state_->url_loc_));
+    LOG_DEBUG("Got port %d", ret_val);
   }
-  return state_->port_;
+  return ret_val;
 }
 
 void Url::setPath(const std::string &path) {
   if (!isInitialized()) {
-    LOG_ERROR("Not initialized");
+    LOG_ERROR("Url %p not initialized", this);
     return;
   }
-  state_->url_string_.setInitialized(false);
+
   if (TSUrlPathSet(state_->hdr_buf_, state_->url_loc_, path.c_str(), path.length()) == TS_SUCCESS) {
-    state_->path_ = path;
     LOG_DEBUG("Set path to [%s]", path.c_str());
   } else {
     LOG_ERROR("Could not set path; hdr_buf %p, url_loc %p", state_->hdr_buf_, state_->url_loc_);
@@ -163,12 +156,11 @@ void Url::setPath(const std::string &path) {
 
 void Url::setQuery(const std::string &query) {
   if (!isInitialized()) {
-    LOG_ERROR("Not initialized");
+    LOG_ERROR("Url %p not initialized", this);
     return;
   }
-  state_->url_string_.setInitialized(false);
+
   if (TSUrlHttpQuerySet(state_->hdr_buf_, state_->url_loc_, query.c_str(), query.length()) == TS_SUCCESS) {
-    state_->query_ = query;
     LOG_DEBUG("Set query to [%s]", query.c_str());
   } else {
     LOG_ERROR("Could not set query; hdr_buf %p, url_loc %p", state_->hdr_buf_, state_->url_loc_);
@@ -177,12 +169,11 @@ void Url::setQuery(const std::string &query) {
 
 void Url::setScheme(const std::string &scheme) {
   if (!isInitialized()) {
-    LOG_ERROR("Not initialized");
+    LOG_ERROR("Url %p not initialized", this);;
     return;
   }
-  state_->url_string_.setInitialized(false);
+
   if (TSUrlSchemeSet(state_->hdr_buf_, state_->url_loc_, scheme.c_str(), scheme.length()) == TS_SUCCESS) {
-    state_->scheme_ = scheme;
     LOG_DEBUG("Set scheme to [%s]", scheme.c_str());
   } else {
     LOG_ERROR("Could not set scheme; hdr_buf %p, url_loc %p", state_->hdr_buf_, state_->url_loc_);
@@ -191,12 +182,11 @@ void Url::setScheme(const std::string &scheme) {
 
 void Url::setHost(const std::string &host) {
   if (!isInitialized()) {
-    LOG_ERROR("Not initialized");
+    LOG_ERROR("Url %p not initialized", this);
     return;
   }
-  state_->url_string_.setInitialized(false);
+
   if (TSUrlHostSet(state_->hdr_buf_, state_->url_loc_, host.c_str(), host.length()) == TS_SUCCESS) {
-    state_->host_ = host;
     LOG_DEBUG("Set host to [%s]", host.c_str());
   } else {
     LOG_ERROR("Could not set host; hdr_buf %p, url_loc %p", state_->hdr_buf_, state_->url_loc_);
@@ -205,12 +195,11 @@ void Url::setHost(const std::string &host) {
 
 void Url::setPort(const uint16_t port) {
   if (!isInitialized()) {
-    LOG_ERROR("Not initialized");
+    LOG_ERROR("Url %p not initialized", this);
     return;
   }
-  state_->url_string_.setInitialized(false);
+
   if (TSUrlPortSet(state_->hdr_buf_, state_->url_loc_, port) == TS_SUCCESS) {
-    state_->port_ = port;
     LOG_DEBUG("Set port to %d", port);
   } else {
     LOG_ERROR("Could not set port; hdr_buf %p, url_loc %p", state_->hdr_buf_, state_->url_loc_);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/include/atscppapi/Response.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Response.h b/lib/atscppapi/src/include/atscppapi/Response.h
index f309bc1..c6c68f8 100644
--- a/lib/atscppapi/src/include/atscppapi/Response.h
+++ b/lib/atscppapi/src/include/atscppapi/Response.h
@@ -50,7 +50,7 @@ public:
   void setStatusCode(HttpStatus);
 
   /** @return Reason phrase of the response */
-  const std::string &getReasonPhrase() const;
+  std::string getReasonPhrase() const;
 
   /** @param New reason phrase to set */
   void setReasonPhrase(const std::string &);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/include/atscppapi/Url.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Url.h b/lib/atscppapi/src/include/atscppapi/Url.h
index 29d1ed5..1feadf8 100644
--- a/lib/atscppapi/src/include/atscppapi/Url.h
+++ b/lib/atscppapi/src/include/atscppapi/Url.h
@@ -70,27 +70,27 @@ public:
   /**
    * @return The full url as a string, such a url might be http://trafficserver.apache.org/search?q=blah
    */
-  const std::string &getUrlString() const;
+  std::string getUrlString() const;
 
   /**
    * @return The path only portion of the url, such as /search
    */
-  const std::string &getPath() const;
+  std::string getPath() const;
 
   /**
    * @return The query only portion of the url, which might be q=blah
    */
-  const std::string &getQuery() const;
+  std::string getQuery() const;
 
   /**
    * @return The scheme of the url, this will be either http or https.
    */
-  const std::string &getScheme() const;
+  std::string getScheme() const;
 
   /**
    * @return The host only of the url, this might be www.google.com
    */
-  const std::string &getHost() const;
+  std::string getHost() const;
 
   /**
    * @return The port only portion of the url, this will likely be 80 or 443.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/include/atscppapi/utils.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/utils.h b/lib/atscppapi/src/include/atscppapi/utils.h
index c0d42bf..8c91c1d 100644
--- a/lib/atscppapi/src/include/atscppapi/utils.h
+++ b/lib/atscppapi/src/include/atscppapi/utils.h
@@ -66,12 +66,6 @@ uint16_t getPort(const sockaddr *);
  */
 std::string getIpPortString(const sockaddr *);
 
-/**
- * @brief This is the environment variable that disables caching in all
- * types including InitializableValue.
- */
-extern const std::string DISABLE_DATA_CACHING_ENV_FLAG;
-
 }
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/utils.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/utils.cc b/lib/atscppapi/src/utils.cc
index d547bb2..7608281 100644
--- a/lib/atscppapi/src/utils.cc
+++ b/lib/atscppapi/src/utils.cc
@@ -26,8 +26,6 @@
 #include <ts/ts.h>
 #include "logging_internal.h"
 
-const std::string atscppapi::utils::DISABLE_DATA_CACHING_ENV_FLAG("ATSCPPAPI_DISABLE_TRANSACTION_DATA_CACHING");
-
 std::string atscppapi::utils::getIpString(const sockaddr *sockaddress) {
   if (sockaddress == NULL) {
     LOG_ERROR("Cannot work on NULL sockaddress");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5622e8d4/lib/atscppapi/src/utils_internal.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/utils_internal.cc b/lib/atscppapi/src/utils_internal.cc
index 01920d2..a63b59f 100644
--- a/lib/atscppapi/src/utils_internal.cc
+++ b/lib/atscppapi/src/utils_internal.cc
@@ -31,7 +31,6 @@
 #include "atscppapi/Transaction.h"
 #include "atscppapi/TransactionPlugin.h"
 #include "atscppapi/TransformationPlugin.h"
-#include "InitializableValue.h"
 #include "atscppapi/utils.h"
 #include "logging_internal.h"
 
@@ -96,12 +95,6 @@ void setupTransactionManagement() {
   TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, cont);
   TSHttpHookAdd(TS_HTTP_SEND_RESPONSE_HDR_HOOK, cont);
   TSHttpHookAdd(TS_HTTP_TXN_CLOSE_HOOK, cont);
-#ifndef DISABLE_TRANSACTION_DATA_CACHING
-  transaction_data_caching_enabled = (getenv(utils::DISABLE_DATA_CACHING_ENV_FLAG.c_str()) == NULL);
-#endif
-  LOG_DEBUG("Initialized transaction management with data caching %s",
-            (transaction_data_caching_enabled ? "enabled" : "disabled"));
-  // TODO is existence of env variable enough or should we expect a specific value?
 }
 
 void inline invokePluginForEvent(Plugin *plugin, TSHttpTxn ats_txn_handle, TSEvent event) {


[35/50] [abbrv] git commit: TS-2658: additional SSL certificate logging

Posted by zw...@apache.org.
TS-2658: additional SSL certificate logging

After a successful SSL handshake, log the peer certificate to the
debug log. This is useful for debugging SSL certificate authentication
and other SSL connection issues.


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

Branch: refs/heads/lua_config
Commit: 7d3f9c82e32032540908b4413c252c58e87d128c
Parents: 6986354
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 19 11:21:25 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Mar 24 16:22:48 2014 -0700

----------------------------------------------------------------------
 CHANGES                          |  6 ++-
 iocore/net/P_SSLNetVConnection.h |  2 -
 iocore/net/SSLNetVConnection.cc  | 77 +++++++++++++++++++++--------------
 3 files changed, 50 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d3f9c82/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c6d664f..da8b67e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,10 +1,12 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
-  
+
+  *) [TS-2658] Additional debug logging for SSL certificates.
+
   *) [TS-2431] Migrate Taobao SPDY plugin to ATS core.
 
   *) [TS-2651] atscppapi: race conditions in destruction of async providers
- 
+
   *) [TS-2646] regex_remap: Add a new option, @caseless.
 
   *) [TS-2647] atscppapi: Bug fixes in headers and atscppapi

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d3f9c82/iocore/net/P_SSLNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index fcb0e8c..47861e4 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -101,8 +101,6 @@ public:
   virtual ~SSLNetVConnection() { }
 
   SSL *ssl;
-  X509 *client_cert;
-  X509 *server_cert;
 
   static int advertise_next_protocol(SSL * ssl, const unsigned char ** out, unsigned * outlen, void *);
   static int select_next_protocol(SSL * ssl, const unsigned char ** out, unsigned char * outlen, const unsigned char * in, unsigned inlen, void *);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d3f9c82/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 3925de9..02f3f4a 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -56,6 +56,30 @@ make_ssl_connection(SSL_CTX * ctx, SSLNetVConnection * netvc)
   return ssl;
 }
 
+static void
+debug_certificate_name(const char * msg, X509_NAME * name)
+{
+  BIO * bio;
+
+  if (name == NULL) {
+    return;
+  }
+
+  bio = BIO_new(BIO_s_mem());
+  if (bio == NULL) {
+    return;
+  }
+
+  if (X509_NAME_print_ex(bio, name, 0 /* indent */, XN_FLAG_ONELINE) > 0) {
+    long len;
+    char * ptr;
+    len = BIO_get_mem_data(bio, &ptr);
+    Debug("ssl", "%s %.*s", msg, (int)len, ptr);
+  }
+
+  BIO_free(bio);
+}
+
 static inline int
 do_SSL_write(SSL * ssl, void *buf, int size)
 {
@@ -538,22 +562,18 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
 
   switch (ssl_error) {
   case SSL_ERROR_NONE:
-    Debug("ssl", "handshake completed successfully");
-    client_cert = SSL_get_peer_certificate(ssl);
-    if (client_cert != NULL) {
-/*	str = X509_NAME_oneline (X509_get_subject_name (client_cert), 0, 0);
-		Free (str);
-
-		str = X509_NAME_oneline (X509_get_issuer_name  (client_cert), 0, 0);
-		Free (str);
-
-		// Add any extra client cert verification stuff here.  SSL
-		// is set up in SSLNetProcessor::start to automatically verify
-		// the client cert's CA, if required.
-*/
-      X509_free(client_cert);
+    if (is_debug_tag_set("ssl")) {
+      X509 * cert = SSL_get_peer_certificate(ssl);
+
+      Debug("ssl", "SSL server handshake completed successfully");
+      if (cert) {
+        debug_certificate_name("client certificate subject CN is", X509_get_subject_name(cert));
+        debug_certificate_name("client certificate issuer CN is", X509_get_issuer_name(cert));
+        X509_free(cert);
+      }
     }
-    sslHandShakeComplete = 1;
+
+    sslHandShakeComplete = true;
 
     {
       const unsigned char * proto = NULL;
@@ -623,23 +643,18 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
   ret = SSL_connect(ssl);
   switch (SSL_get_error(ssl, ret)) {
   case SSL_ERROR_NONE:
-    Debug("ssl", "SSLNetVConnection::sslClientHandShakeEvent, handshake completed successfully");
-    server_cert = SSL_get_peer_certificate(ssl);
-
-/*	  str = X509_NAME_oneline (X509_get_subject_name (server_cert),0,0);
-	  Free (str);
-
-	  str = X509_NAME_oneline (X509_get_issuer_name  (server_cert),0,0);
-	  Free (str);
-*/
-
-/*	 Add certificate verification stuff here before
-     deallocating the certificate.
-*/
-
-    X509_free(server_cert);
-    sslHandShakeComplete = 1;
+    if (is_debug_tag_set("ssl")) {
+      X509 * cert = SSL_get_peer_certificate(ssl);
+
+      Debug("ssl", "SSL client handshake completed successfully");
+      if (cert) {
+        debug_certificate_name("server certificate subject CN is", X509_get_subject_name(cert));
+        debug_certificate_name("server certificate issuer CN is", X509_get_issuer_name(cert));
+        X509_free(cert);
+      }
+    }
 
+    sslHandShakeComplete = true;
     return EVENT_DONE;
 
   case SSL_ERROR_WANT_WRITE:


[18/50] [abbrv] git commit: TS-2646 regex_remap: Add an option for @caseless, case insentive regexes.

Posted by zw...@apache.org.
TS-2646 regex_remap: Add an option for @caseless, case insentive regexes.

Cleanup, and allow (some) config to work without parameters. Also adds docs.


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

Branch: refs/heads/lua_config
Commit: ba7d394ea8c6edf5b7a0e2294bdc71316b5e87c1
Parents: ee82dd8
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Mar 14 21:26:46 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Mar 18 18:18:55 2014 -0600

----------------------------------------------------------------------
 CHANGES                                  |  2 +
 doc/reference/plugins/regex_remap.en.rst |  5 ++
 plugins/regex_remap/regex_remap.cc       | 86 +++++++++++++++++----------
 3 files changed, 62 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ba7d394e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ed049c7..5de3a18 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2646] regex_remap: Add a new option, @caseless.
+
   *) [TS-2647] atscppapi: Bug fixes in headers and atscppapi
 
   *) [TS-2598] Expose HttpDebugNames to public plugin APIs.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ba7d394e/doc/reference/plugins/regex_remap.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/regex_remap.en.rst b/doc/reference/plugins/regex_remap.en.rst
index e9093ce..cb9d9f0 100644
--- a/doc/reference/plugins/regex_remap.en.rst
+++ b/doc/reference/plugins/regex_remap.en.rst
@@ -123,8 +123,13 @@ remap.config. The following options are available ::
     @no_activity_timeout=<nnn>  - No activity timeout (in ms)
     @connect_timeout=<nnn>      - Connect timeouts (in ms)
     @dns_timeout=<nnn>          - Connect timeouts (in ms)
+
     @overridable-config=<value> - see :ref:`ts-overridable-config`
 
+    @caseless                   - Make regular expressions case insensitive
+    @lowercase_substitutions    - Turn on (enable) lower case substitutions
+
+
 This can be useful to force a particular response for some URLs, e.g. ::
 
     ^/(ogre.*)/bad      http://www.examle.com/  @status=404

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ba7d394e/plugins/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index 519ba25..1f98442 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -117,7 +117,8 @@ class RemapRegex
 {
  public:
   RemapRegex(const std::string& reg, const std::string& sub, const std::string& opt) :
-    _num_subs(-1), _rex(NULL), _extra(NULL), _order(-1), _simple(false), _lowercase_substitutions(false),
+    _num_subs(-1), _rex(NULL), _extra(NULL), _options(0), _order(-1),
+    _simple(false), _lowercase_substitutions(false),
     _active_timeout(-1), _no_activity_timeout(-1), _connect_timeout(-1), _dns_timeout(-1),
     _first_override(NULL)
   {
@@ -158,29 +159,38 @@ class RemapRegex
 
       ++start;
       pos1 = opt.find_first_of("=", start);
-      if (pos1 == std::string::npos) {
+      pos2 = opt.find_first_of(" \t\n", pos1);
+      if (pos2 == std::string::npos) {
+        pos2 = opt.length();
+      }
+
+      if (pos1 != std::string::npos) {
+        // Get the value as well
+        ++pos1;
+        opt_val = opt.substr(pos1, pos2-pos1);
+      }
+
+      // These take an option 0|1 value, without value it implies 1
+      if (opt.compare(start, 8, "caseless") == 0) {
+        _options |= PCRE_CASELESS;
+      } else if (opt.compare(start, 23, "lowercase_substitutions") == 0) {
+        _lowercase_substitutions = true;
+      } else if (opt_val.size() <= 0) {
+        // All other options have a required value
         TSError("Malformed options: %s", opt.c_str());
         break;
       }
-      ++pos1;
-      pos2 = opt.find_first_of(" \t\n", pos1);
-      if (pos2 == std::string::npos)
-        pos2 = opt.length();
-      opt_val = opt.substr(pos1, pos2-pos1);
 
       if (opt.compare(start, 6, "status") == 0) {
-        _status = static_cast<TSHttpStatus>(atoi(opt_val.c_str()));
+        _status = static_cast<TSHttpStatus>(strtol(opt_val.c_str(), NULL, 10));
       } else if (opt.compare(start, 14, "active_timeout") == 0) {
-        _active_timeout = atoi(opt_val.c_str());
+        _active_timeout = strtol(opt_val.c_str(), NULL, 10);
       } else if (opt.compare(start, 19, "no_activity_timeout") == 0) {
-        _no_activity_timeout = atoi(opt_val.c_str());
+        _no_activity_timeout = strtol(opt_val.c_str(), NULL, 10);
       } else if (opt.compare(start, 15, "connect_timeout") == 0) {
-        _connect_timeout = atoi(opt_val.c_str());
+        _connect_timeout = strtol(opt_val.c_str(), NULL, 10);
       } else if (opt.compare(start, 11, "dns_timeout") == 0) {
-        _dns_timeout = atoi(opt_val.c_str());
-      } else if (opt.compare(start, 23, "lowercase_substitutions") == 0) {
-        _lowercase_substitutions = atoi(opt_val.c_str());
-        TSDebug(PLUGIN_NAME, "Lowercasing %d", _lowercase_substitutions);
+        _dns_timeout = strtol(opt_val.c_str(), NULL, 10);
       } else {
         TSOverridableConfigKey key;
         TSRecordDataType type;
@@ -229,15 +239,20 @@ class RemapRegex
   ~RemapRegex()
   {
     TSDebug(PLUGIN_NAME, "Calling destructor");
-    if (_rex_string)
+
+    if (_rex_string) {
       TSfree(_rex_string);
-    if (_subst)
+    }
+    if (_subst) {
       TSfree(_subst);
+    }
 
-    if (_rex)
+    if (_rex) {
       pcre_free(_rex);
-    if (_extra)
+    }
+    if (_extra) {
       pcre_free(_extra);
+    }
   }
 
   // For profiling information
@@ -261,20 +276,23 @@ class RemapRegex
     int ccount;
 
     _rex = pcre_compile(_rex_string,          // the pattern
-                        0,                    // default options
+                        _options,             // options
                         error,                // for error message
                         erroffset,            // for error offset
                         NULL);                // use default character tables
 
-    if (NULL == _rex)
+    if (NULL == _rex) {
       return -1;
+    }
 
     _extra = pcre_study(_rex, 0, error);
-    if ((_extra == NULL) && (*error != 0))
+    if ((_extra == NULL) && (*error != 0)) {
       return -1;
+    }
 
-    if (pcre_fullinfo(_rex, _extra, PCRE_INFO_CAPTURECOUNT, &ccount) != 0)
+    if (pcre_fullinfo(_rex, _extra, PCRE_INFO_CAPTURECOUNT, &ccount) != 0) {
       return -1;
+    }
 
     // Get some info for the string substitutions
     str = _subst;
@@ -550,6 +568,7 @@ class RemapRegex
 
   pcre* _rex;
   pcre_extra* _extra;
+  int _options;
   int _sub_pos[MAX_SUBS];
   int _sub_ix[MAX_SUBS];
   RemapRegex* _next;
@@ -706,11 +725,13 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf ATS_UNUSED
 
     getline(f, line);
     ++lineno;
-    if (line.empty())
+    if (line.empty()) {
       continue;
+    }
     pos1 = line.find_first_not_of(" \t\n");
-    if (line[pos1] == '#')
+    if (line[pos1] == '#') {
       continue;  // Skip comment lines
+    }
 
     if (pos1 != std::string::npos) {
       pos2 = line.find_first_of(" \t\n", pos1);
@@ -760,10 +781,11 @@ TSRemapNewInstance(int argc, char* argv[], void** ih, char* /* errbuf ATS_UNUSED
       TSDebug(PLUGIN_NAME, "Added regex=%s with subs=%s and options `%s'",
                regex.c_str(), subst.c_str(), options.c_str());
       cur->set_order(++count);
-      if (ri->first == NULL)
+      if (ri->first == NULL) {
         ri->first = cur;
-      else
+      } else {
         ri->last->set_next(cur);
+      }
       ri->last = cur;
     }
 
@@ -790,9 +812,9 @@ TSRemapDeleteInstance(void* ih)
     char now[64];
     const ink_time_t tim = time(NULL);
 
-    if (ink_ctime_r(&tim, now))
+    if (ink_ctime_r(&tim, now)) {
       now[strlen(now) - 1] = '\0';
-    else {
+    } else {
       memcpy(now, "unknown time", 12);
       *(now + 12) = '\0';
     }
@@ -870,8 +892,9 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
     if (TS_SUCCESS == TSHttpTxnClientReqGet(static_cast<TSHttpTxn>(txnp), &mBuf, &reqHttpHdrLoc)) {
       method = TSHttpHdrMethodGet(mBuf, reqHttpHdrLoc, &match_len);
       if (method && (match_len > 0)) {
-        if (match_len > 16)
+        if (match_len > 16) {
           match_len = 16;
+        }
         memcpy(match_buf, method, match_len);
       }
     }
@@ -997,8 +1020,9 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
     re = re->next();
     if (re == NULL) {
       retval = TSREMAP_NO_REMAP; // No match
-      if (ri->profile)
+      if (ri->profile) {
         ink_atomic_increment(&(ri->misses), 1);
+      }
     }
   }
 


[36/50] [abbrv] git commit: Remaporder

Posted by zw...@apache.org.
Remaporder

Clear up some of the ordering questions (how they work) and clear out some trailing whitespace


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

Branch: refs/heads/lua_config
Commit: 622157c9fd6d36e377b2c672b1680ae9a014c65d
Parents: 7d3f9c8
Author: Thomas Jackson <ja...@gmail.com>
Authored: Mon Mar 24 17:47:33 2014 -0700
Committer: Thomas Jackson <ja...@gmail.com>
Committed: Mon Mar 24 17:51:27 2014 -0700

----------------------------------------------------------------------
 doc/reference/configuration/remap.config.en.rst | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/622157c9/doc/reference/configuration/remap.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/remap.config.en.rst b/doc/reference/configuration/remap.config.en.rst
index 52cf77e..fd430a8 100644
--- a/doc/reference/configuration/remap.config.en.rst
+++ b/doc/reference/configuration/remap.config.en.rst
@@ -5,9 +5,9 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
- 
+
    http://www.apache.org/licenses/LICENSE-2.0
- 
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,11 +21,11 @@ remap.config
 
 .. configfile:: remap.config
 
-.. toctree::                                                                                                                                                                                      
+.. toctree::
    :maxdepth: 2
 
 
-The :file:`remap.config` file (by default, located in 
+The :file:`remap.config` file (by default, located in
 ``/opt/trafficserver/etc/trafficserver/``) contains mapping rules that Traffic Server
 uses to perform the following actions:
 
@@ -64,14 +64,14 @@ Traffic Server recognizes three space-delimited fields: ``type``,
     -  ``map`` --translates an incoming request URL to the appropriate
        origin server URL.
 
-    -  ``map_with_recv_port`` --exactly like 'map' except that it uses the port at 
-       which the request was received to perform the mapping instead of the port present 
-       in the request. The regex qualifier can also be used for this type. When present, 
-       'map_with_recv_port' mappings are checked first. If there is a match, then it is 
+    -  ``map_with_recv_port`` --exactly like 'map' except that it uses the port at
+       which the request was received to perform the mapping instead of the port present
+       in the request. The regex qualifier can also be used for this type. When present,
+       'map_with_recv_port' mappings are checked first. If there is a match, then it is
        chosen without evaluating the "regular" forward mapping rules.
 
-    -  ``map_with_referer`` -- extended version of 'map', which can be used to activate 
-       "deep linking protection", where target URLs are only accessible when the Referer 
+    -  ``map_with_referer`` -- extended version of 'map', which can be used to activate
+       "deep linking protection", where target URLs are only accessible when the Referer
        header is set to a URL that is allowed to link to the target.
 
     -  ``reverse_map`` --translates the URL in origin server redirect
@@ -113,12 +113,12 @@ Traffic Server recognizes three space-delimited fields: ``type``,
 Precedence
 ==========
 
-Remap rules are not processed top-down, but based on an internal
-priority
+Remap rules are not processed top-down, but based on an internal priority. Once
+these rules are executed we pick the lowest line number as the match (which
+replicates first-match-wins).
 
-1. ``map_with_recv_port``
-#. ``map`` and ``reverse_map``
-#. ``regex_map``
+1. ``map_with_recv_port`` and ```regex_map_with_recv_port```
+#. ``map`` and ``regex_map`` and ``reverse_map``
 #. ``redirect`` and ``redirect_temporary``
 #. ``regex_redirect`` and ``regex_redirect_temporary``
 
@@ -328,7 +328,7 @@ will be redirected to redirectURL. It can be used to create a so-called
 negative referer list.  If "*" was used as a referer regular expression -
 all referers are allowed.  Various combinations of "*" and "~" in a referer
 list can be used to create different filtering rules.
-    
+
 map_with_referer Examples
 -------------------------
 


[11/50] [abbrv] git commit: TS-2598 Expose HttpDebugNames to public plugin APIs

Posted by zw...@apache.org.
TS-2598 Expose HttpDebugNames to public plugin APIs


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

Branch: refs/heads/lua_config
Commit: d3fd1e674b0e6d51fd3e8f4c49ed7d5d9eeb56a3
Parents: ce6b5c7
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Mar 15 12:30:58 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Mar 15 12:30:58 2014 -0600

----------------------------------------------------------------------
 CHANGES                          |  2 ++
 doc/reference/api/TSDebug.en.rst | 12 ++++++++
 proxy/InkAPI.cc                  | 30 +++++++++++++++----
 proxy/InkAPITest.cc              | 56 +++++++++++++++++++++++++++++++++++
 proxy/api/ts/ts.h                | 26 ++++++++++++++++
 5 files changed, 120 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3fd1e67/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b68e5c3..3b64258 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2598] Expose HttpDebugNames to public plugin APIs.
+
   *) [TS-2639] Release HttpClientSession objects back to the proxy allocator.
 
   *) [TS-2637] Add traffic_line records match option.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3fd1e67/doc/reference/api/TSDebug.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSDebug.en.rst b/doc/reference/api/TSDebug.en.rst
index 430617c..7fc21db 100644
--- a/doc/reference/api/TSDebug.en.rst
+++ b/doc/reference/api/TSDebug.en.rst
@@ -32,6 +32,9 @@ Synopsis
 .. function:: void TSHttpSsnDebugSet(TSHttpSsn ssn, int on)
 .. function:: int TSHttpTxnDebugGet(TSHttpTxn txnp)
 .. function:: int TSHttpSsnDebugGet(TSHttpSsn ssn)
+.. function:: const char* TSHttpServerStateNameLookup(TSServerState state)
+.. function:: const char* TSHttpHookNameLookup(TSHttpHookID hook)
+.. function:: const char* TSHttpEventNameLookup(TSEvent event)
 .. macro:: void TSAssert(expression)
 .. macro:: void TSReleaseAssert(expression)
 
@@ -61,6 +64,11 @@ in conjunction with :func:`TSHttpTxnDebugSet`, :func:`TSHttpSsnDebugSet`,
 :func:`TSHttpTxnDebugGet` and :func:`TSHttpSsnDebugGet` to enable
 debugging on specific session and transaction objects.
 
+:func:`TSHttpServerStateNameLookup`, :func:`TSHttpHookNameLookup` and
+:func:`TSHttpEventNameLookup` converts the respective internal state to a
+string representation. This can be useful in debugging (:func:`TSDebug`),
+logging and other types notifications.
+
 Examples
 ========
 
@@ -69,6 +77,10 @@ debugging flag is enabled::
 
     #include <ts/ts.h>
 
+    // Produce information about a hook receiving an event
+    TSDebug(PLUGIN_NAME, "Entering hook=%s, event=%s",
+            TSHttpHookNameLookup(hook), TSHttpEventNameLookup(event));
+
     // Emit debug message if "tag" is enabled or the txn debug
     // flag is set.
     TSDebugSpecifc(TSHttpTxnDebugGet(txn), "tag" ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3fd1e67/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 2a2270a..00a78e1 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -21,9 +21,6 @@
   limitations under the License.
  */
 
-// Avoid complaining about the deprecated APIs.
-// #define TS_DEPRECATED
-
 #include <stdio.h>
 
 #include "libts.h"
@@ -418,12 +415,14 @@ int
 _TSAssert(const char *text, const char *file, int line)
 {
   _ink_assert(text, file, line);
+  return 0;
+}
 #else
 _TSAssert(const char *, const char *, int)
 {
-#endif
- return 0;
+  return 0;
 }
+#endif
 
 // This assert is for internal API use only.
 #if TS_USE_FAST_SDK
@@ -433,7 +432,6 @@ _TSAssert(const char *, const char *, int)
   ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
 #endif
 
-
 ////////////////////////////////////////////////////////////////////
 //
 // SDK Interoperability Support
@@ -8494,3 +8492,23 @@ TSHttpTxnIsCacheable(TSHttpTxn txnp, TSMBuffer request, TSMBuffer response)
   // Make sure these are valid response / requests, then verify if it's cacheable.
   return (req->valid() && resp->valid() && HttpTransact::is_response_cacheable(&(sm->t_state), req, resp)) ? 1: 0;
 }
+
+
+// Lookup various debug names for common HTTP types.
+const char*
+TSHttpServerStateNameLookup(TSServerState state)
+{
+  return HttpDebugNames::get_server_state_name(static_cast<HttpTransact::ServerState_t>(state));
+}
+
+const char*
+TSHttpHookNameLookup(TSHttpHookID hook)
+{
+  return HttpDebugNames::get_api_hook_name(static_cast<TSHttpHookID>(hook));
+}
+
+const char*
+TSHttpEventNameLookup(TSEvent event)
+{
+  return HttpDebugNames::get_event_name(static_cast<int>(event));
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3fd1e67/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index f558eb0..f380eb5 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7608,3 +7608,59 @@ REGRESSION_TEST(SDK_API_ENCODING) (RegressionTest * test, int /* atype ATS_UNUSE
 
   return;
 }
+
+
+
+////////////////////////////////////////////////
+// SDK_API_DEBUG_NAME_LOOKUPS
+//
+// Unit Test for API: TSHttpServerStateNameLookup
+//                    TSHttpHookNameLookup
+//                    TSHttpEventNameLookup
+////////////////////////////////////////////////
+
+REGRESSION_TEST(SDK_API_DEBUG_NAME_LOOKUPS) (RegressionTest * test, int /* atype ATS_UNUSED */, int *pstatus)
+{
+  bool success = true;
+  const char state_name[] = "INACTIVE_TIMEOUT";
+  const char hook_name[] = "TS_HTTP_READ_RESPONSE_HDR_HOOK";
+  const char event_name[] = "VC_EVENT_IMMEDIATE";
+  const char* str;
+
+  *pstatus = REGRESSION_TEST_INPROGRESS;
+
+  str = TSHttpServerStateNameLookup(TS_SRVSTATE_INACTIVE_TIMEOUT);
+  if ((strlen(str) != strlen(state_name) || strcmp(str, state_name))) {
+    SDK_RPRINT(test, "TSHttpServerStateNameLookup", "TestCase1", TC_FAIL, "Failed on %d, expected %s, got %s",
+               TS_SRVSTATE_INACTIVE_TIMEOUT, state_name, str);
+    success = false;
+  } else {
+    SDK_RPRINT(test, "TSHttpServerStateNameLookup", "TestCase1", TC_PASS, "ok");
+  }
+
+
+  str = TSHttpHookNameLookup(TS_HTTP_READ_RESPONSE_HDR_HOOK);
+  if ((strlen(str) != strlen(hook_name) || strcmp(str, hook_name))) {
+    SDK_RPRINT(test, "TSHttpHookNameLookup", "TestCase1", TC_FAIL, "Failed on %d, expected %s, got %s",
+               TS_HTTP_READ_RESPONSE_HDR_HOOK, hook_name, str);
+    success = false;
+  } else {
+    SDK_RPRINT(test, "TSHttpHookNameLookup", "TestCase1", TC_PASS, "ok");
+  }
+
+
+  str = TSHttpEventNameLookup(TS_EVENT_IMMEDIATE);
+  if ((strlen(str) != strlen(event_name) || strcmp(str, event_name))) {
+    SDK_RPRINT(test, "TSHttpEventNameLookup", "TestCase1", TC_FAIL, "Failed on %d, expected %s, got %s",
+               TS_EVENT_IMMEDIATE, hook_name, str);
+    success = false;
+  } else {
+    SDK_RPRINT(test, "TSHttpEventNameLookup", "TestCase1", TC_PASS, "ok");
+  }
+
+
+  *pstatus = success ? REGRESSION_TEST_PASSED : REGRESSION_TEST_FAILED;
+
+  return;
+}
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3fd1e67/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index b864624..02f4bf0 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -2270,6 +2270,32 @@ extern "C"
   */
   tsapi int TSHttpTxnIsCacheable(TSHttpTxn txnp, TSMBuffer request, TSMBuffer response);
 
+  /**
+     Return a string respresentation for a TSServerState value. This is useful for plugin debugging.
+
+     @param state the value of this TSServerState
+
+     @return the string representation of the state
+  */
+  tsapi const char* TSHttpServerStateNameLookup(TSServerState state);
+
+  /**
+     Return a string respresentation for a TSHttpHookID value. This is useful for plugin debugging.
+
+     @param hook the value of this TSHttpHookID
+
+     @return the string representation of the hook ID
+  */
+  tsapi const char* TSHttpHookNameLookup(TSHttpHookID hook);
+
+  /**
+     Return a string respresentation for a TSEvent value. This is useful for plugin debugging.
+
+     @param event the value of this TSHttpHookID
+
+     @return the string representation of the event
+  */
+  tsapi const char* TSHttpEventNameLookup(TSEvent event);
 
 #ifdef __cplusplus
 }


[48/50] [abbrv] git commit: Merge remote-tracking branch 'origin/master' into lua_config

Posted by zw...@apache.org.
Merge remote-tracking branch 'origin/master' into lua_config

* origin/master: (363 commits)
  TS-2564 Revert field token ordering.
  [TS-2664] atscppapi: Removing initializable value code
  [TS-2664] Removing initializable value code
  [TS-2664] Removing initializable value files
  TS-2660: rename StateMachineAction_t values with a consistent prefix
  [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default.
  [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default. This closes #66
  Fix harmless Ethread::schedule_in parameter mismatch
  TS-2661: Remove unused HttpSM::decide_cached_url method.
  Remaporder
  TS-2658: additional SSL certificate logging
  Cleanup the configure.ac in some sort of order... Minor.
  Update CHANGES with TS-2431
  TS-2431: Migrate Taobao SPDY plugin to ATS core
  TS-2431: Preparation of SPDY protocol
  TS-2431: Add autoconf options for SPDY
  [TS-2651] atscppapi: race conditions in destruction of async providers. This closes #64
  [TS-2651] atscppapi: race conditions in destruction of async providers
  [TS-2651] atscppapi: race conditions in destruction of async providers
  [TS-2651] atscppapi: race conditions in destruction of async providers
  ...

Conflicts:
	iocore/net/SSLUtils.cc
	proxy/Makefile.am


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

Branch: refs/heads/lua_config
Commit: c5c92b9491f3172e5f600502df65b1a99a2e535e
Parents: 5f436df 8d7d25d
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 25 21:19:28 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Mar 25 21:19:28 2014 -0600

----------------------------------------------------------------------
 .gitignore                                      |    6 +-
 CHANGES                                         |  261 +-
 INSTALL                                         |    4 +-
 Makefile.am                                     |    2 +-
 NOTICE                                          |    8 +-
 REVIEWERS                                       |   11 +-
 STATUS                                          |    4 +-
 build/ax_check_openssl.m4                       |  128 +
 build/crypto.m4                                 |  145 +-
 ci/jenkins/jobs.yaml                            |    8 +-
 ci/regression                                   |    2 +
 ci/tsqa/functions                               |   73 +-
 ci/tsqa/test-log-configuration                  |   15 +-
 ci/tsqa/test-multicert-loading                  |   81 +
 ci/tsqa/test-ssl-certificates                   |  135 +
 ci/tsqa/test-trafficline-metrics                |   56 +
 cmd/traffic_cop/Makefile.am                     |    2 +-
 cmd/traffic_cop/traffic_cop.cc                  |  141 +-
 cmd/traffic_line/Makefile.am                    |    2 +-
 cmd/traffic_line/traffic_line.cc                |  160 +-
 cmd/traffic_shell/CliMgmtUtils.cc               |    1 -
 cmd/traffic_shell/Makefile.am                   |    2 +-
 cmd/traffic_shell/ShowCmd.cc                    |    2 +-
 cmd/traffic_top/traffic_top.cc                  |    2 +-
 configure.ac                                    |  214 +-
 contrib/make-ssl-multicert                      |    2 +-
 contrib/python/compare_RecordsConfigcc.py       |   80 +-
 doc/admin/cluster-howto.en.rst                  |   60 +-
 doc/admin/configuring-cache.en.rst              |    4 +-
 doc/admin/configuring-traffic-server.en.rst     |   26 +-
 doc/admin/event-logging-formats.en.rst          |    4 +
 doc/admin/faqs.en.rst                           |    6 +-
 doc/admin/http-proxy-caching.en.rst             |    2 +-
 doc/admin/monitoring-traffic.en.rst             |    2 +-
 doc/admin/traffic-server-error-messages.en.rst  |   12 +-
 .../transparent-proxy/wccp-configuration.en.rst |    2 +-
 doc/admin/working-log-files.en.rst              |  276 +-
 doc/admin/working-log-files/log-formats.en.rst  |  369 --
 doc/arch/cache/cache-arch.en.rst                |   18 +-
 doc/arch/cache/cache.en.rst                     |    1 +
 doc/arch/hacking/index.en.rst                   |   32 +
 doc/arch/index.en.rst                           |    9 +-
 .../ja/LC_MESSAGES/admin/cluster-howto.en.po    |  293 ++
 .../LC_MESSAGES/admin/configuring-cache.en.po   |  578 +++
 .../admin/configuring-traffic-server.en.po      |  110 +
 .../admin/event-logging-formats.en.po           | 1007 +++++
 .../admin/explicit-proxy-caching.en.po          |  108 +
 doc/locale/ja/LC_MESSAGES/admin/faqs.en.po      |  745 ++++
 .../ja/LC_MESSAGES/admin/forward-proxy.en.po    |  139 +
 .../ja/LC_MESSAGES/admin/getting-started.en.po  |  333 ++
 .../LC_MESSAGES/admin/hierachical-caching.en.po |  169 +
 .../LC_MESSAGES/admin/http-proxy-caching.en.po  | 1870 ++++++++++
 doc/locale/ja/LC_MESSAGES/admin/index.en.po     |  628 ++++
 .../LC_MESSAGES/admin/monitoring-traffic.en.po  |  142 +
 .../LC_MESSAGES/admin/performance-tuning.en.po  |   57 +
 .../admin/reverse-proxy-http-redirects.en.po    |  611 +++
 .../ja/LC_MESSAGES/admin/security-options.en.po |  482 +++
 .../admin/traffic-server-error-messages.en.po   |  857 +++++
 .../LC_MESSAGES/admin/transparent-proxy.en.po   |  203 +
 .../admin/transparent-proxy/bridge.en.po        |  283 ++
 .../admin/transparent-proxy/build.en.po         |   96 +
 .../admin/transparent-proxy/router-inline.en.po |  147 +
 .../transparent-proxy/wccp-configuration.en.po  |  285 ++
 .../LC_MESSAGES/admin/working-log-files.en.po   | 1442 ++++++++
 .../admin/working-log-files/log-formats.en.po   |  530 +++
 .../ja/LC_MESSAGES/arch/cache/cache-api.en.po   |   48 +
 .../LC_MESSAGES/arch/cache/cache-appendix.en.po |  238 ++
 .../ja/LC_MESSAGES/arch/cache/cache-arch.en.po  | 2091 +++++++++++
 .../arch/cache/cache-data-structures.en.po      |  273 ++
 .../ja/LC_MESSAGES/arch/cache/cache.en.po       |   20 +
 .../ja/LC_MESSAGES/arch/cache/ram-cache.en.po   |  256 ++
 .../LC_MESSAGES/arch/cache/tier-storage.en.po   |  209 ++
 .../ja/LC_MESSAGES/arch/hacking/index.en.po     |   27 +
 doc/locale/ja/LC_MESSAGES/arch/index.en.po      |   47 +
 .../ja/LC_MESSAGES/arch/proposals/hostdb.en.po  |  357 ++
 doc/locale/ja/LC_MESSAGES/glossary.en.po        |  269 ++
 doc/locale/ja/LC_MESSAGES/index.po              |   58 +
 .../ja/LC_MESSAGES/reference/api/TSAPI.en.po    |  305 ++
 .../ja/LC_MESSAGES/reference/api/TSDebug.en.po  |  102 +
 .../reference/api/TSHttpHookAdd.en.po           |  117 +
 .../reference/api/TSHttpOverridableConfig.en.po |   93 +
 .../reference/api/TSHttpParserCreate.en.po      |  107 +
 .../reference/api/TSHttpTxnMilestoneGet.en.po   |  244 ++
 .../reference/api/TSIOBufferCreate.en.po        |  108 +
 .../reference/api/TSInstallDirGet.en.po         |   69 +
 .../reference/api/TSLifecycleHookAdd.en.po      |  177 +
 .../reference/api/TSMBufferCreate.en.po         |  104 +
 .../api/TSMimeHdrFieldValueStringGet.en.po      |  117 +
 .../reference/api/TSPluginInit.en.po            |   77 +
 .../ja/LC_MESSAGES/reference/api/TSRemap.en.po  |  130 +
 .../api/TSTrafficServerVersionGet.en.po         |   53 +
 .../ja/LC_MESSAGES/reference/api/TSTypes.en.po  |  106 +
 .../LC_MESSAGES/reference/api/TSUrlCreate.en.po |   98 +
 .../reference/api/TSUrlHostGet.en.po            |   85 +
 .../reference/api/TSUrlHostSet.en.po            |   77 +
 .../reference/api/TSUrlPercentEncode.en.po      |   76 +
 .../reference/api/TSUrlStringGet.en.po          |   73 +
 .../ja/LC_MESSAGES/reference/api/TSmalloc.en.po |  122 +
 .../ja/LC_MESSAGES/reference/api/index.en.po    |   16 +
 .../LC_MESSAGES/reference/commands/index.en.po  |   16 +
 .../reference/commands/traffic_cop.en.po        |   69 +
 .../reference/commands/traffic_line.en.po       |  202 +
 .../reference/commands/traffic_logcat.en.po     |  116 +
 .../reference/commands/traffic_logstats.en.po   |   28 +
 .../reference/commands/traffic_manager.en.po    |   24 +
 .../reference/commands/traffic_server.en.po     |   32 +
 .../reference/commands/traffic_shell.en.po      |   24 +
 .../reference/commands/traffic_top.en.po        |   20 +
 .../LC_MESSAGES/reference/commands/tspush.en.po |   24 +
 .../LC_MESSAGES/reference/commands/tstop.en.po  |   20 +
 .../LC_MESSAGES/reference/commands/tsxs.en.po   |   24 +
 .../reference/configuration/cache.config.en.po  |  294 ++
 .../configuration/congestion.config.en.po       |  366 ++
 .../configuration/hosting.config.en.po          |  110 +
 .../reference/configuration/icp.config.en.po    |  163 +
 .../reference/configuration/index.en.po         |   16 +
 .../configuration/ip_allow.config.en.po         |   79 +
 .../configuration/log_hosts.config.en.po        |   68 +
 .../configuration/logs_xml.config.en.po         |  512 +++
 .../reference/configuration/parent.config.en.po |  259 ++
 .../reference/configuration/plugin.config.en.po |   73 +
 .../configuration/records.config.en.po          | 3473 ++++++++++++++++++
 .../reference/configuration/remap.config.en.po  |  717 ++++
 .../configuration/splitdns.config.en.po         |  181 +
 .../configuration/ssl_multicert.config.en.po    |  276 ++
 .../configuration/storage.config.en.po          |  240 ++
 .../reference/configuration/update.config.en.po |  423 +++
 .../reference/configuration/volume.config.en.po |   97 +
 .../reference/plugins/authproxy.en.po           |  109 +
 .../reference/plugins/balancer.en.po            |  102 +
 .../reference/plugins/buffer_upload.en.po       |  117 +
 .../reference/plugins/cacheurl.en.po            |  120 +
 .../reference/plugins/combo_handler.en.po       |   93 +
 .../reference/plugins/conf_remap.en.po          |   68 +
 .../ja/LC_MESSAGES/reference/plugins/esi.en.po  |   20 +
 .../reference/plugins/geoip_acl.en.po           |  101 +
 .../ja/LC_MESSAGES/reference/plugins/gzip.en.po |  141 +
 .../reference/plugins/header_filter.en.po       |  136 +
 .../reference/plugins/header_rewrite.en.po      |  161 +
 .../LC_MESSAGES/reference/plugins/hipes.en.po   |  197 +
 .../LC_MESSAGES/reference/plugins/index.en.po   |   71 +
 .../reference/plugins/metalink.en.po            |  148 +
 .../reference/plugins/mysql_remap.en.po         |  107 +
 .../reference/plugins/regex_remap.en.po         |  138 +
 .../plugins/stale_while_revalidate.en.po        |   20 +
 .../reference/plugins/stats_over_http.en.po     |   51 +
 .../LC_MESSAGES/reference/plugins/ts_lua.en.po  |  455 +++
 .../LC_MESSAGES/reference/plugins/xdebug.en.po  |   64 +
 .../ja/LC_MESSAGES/sdk/actions-guide.en.po      |  104 +
 .../sdk/actions-guide/hosts-lookup-api.en.po    |   38 +
 .../ja/LC_MESSAGES/sdk/adding-statistics.en.po  |   72 +
 .../adding-statistics/coupled-statistics.en.po  |  115 +
 .../viewing-statistics-using-traffic-line.en.po |   35 +
 .../ja/LC_MESSAGES/sdk/continuations.en.po      |  161 +
 .../how-to-activate-continuations.en.po         |   41 +
 .../writing-handler-functions.en.po             |  388 ++
 .../ja/LC_MESSAGES/sdk/getting-started.en.po    |  320 ++
 .../sdk/getting-started/a-simple-plugin.en.po   |  135 +
 .../getting-started/naming-conventions.en.po    |   68 +
 ...ugin-registration-and-version-checking.en.po |   44 +
 .../sdk/header-based-plugin-examples.en.po      |   93 +
 .../basic-authorization-plugin.en.po            |   41 +
 ...nd-getting-a-handle-to-the-transaction.en.po |   22 +
 .../setting-a-transaction-hook.en.po            |   60 +
 .../working-with-http-headers.en.po             |   33 +
 .../blacklist-plugin.en.po                      |   82 +
 ...essing-the-transaction-being-processed.en.po |   53 +
 .../setting-a-global-hook.en.po                 |   38 +
 .../setting-up-a-transaction-hook.en.po         |   73 +
 .../working-with-http-header-functions.en.po    |   33 +
 .../how-to-create-trafficserver-plugins.en.po   |  292 ++
 .../roadmap-for-creating-plugins.en.po          |  130 +
 .../ja/LC_MESSAGES/sdk/http-headers.en.po       |  159 +
 ...de-to-trafficserver-http-header-system.en.po |   47 +
 ...uplicate-mime-fields-are-not-coalesced.en.po |   34 +
 ...ys-belong-to-an-associated-mime-header.en.po |   56 +
 .../release-marshal-buffer-handles.en.po        |   76 +
 .../sdk/http-headers/http-headers.en.po         |  468 +++
 .../sdk/http-headers/marshal-buffers.en.po      |  100 +
 .../sdk/http-headers/mime-headers.en.po         |  933 +++++
 .../ja/LC_MESSAGES/sdk/http-headers/urls.en.po  |  214 ++
 .../sdk/http-hooks-and-transactions.en.po       |   89 +
 .../adding-hooks.en.po                          |  265 ++
 .../http-alternate-selection.en.po              |  137 +
 .../http-sessions.en.po                         |   75 +
 .../http-transactions.en.po                     |  170 +
 .../initiate-http-connection.en.po              |   28 +
 .../intercepting-http-transactions.en.po        |   32 +
 .../sdk/http-transformation-plugin.en.po        |  184 +
 .../append-transform-plugin.en.po               |  208 ++
 ...le-buffered-null-transformation-plugin.en.po |  191 +
 .../sample-null-transformation-plugin.en.po     |  175 +
 doc/locale/ja/LC_MESSAGES/sdk/index.en.po       |   55 +
 doc/locale/ja/LC_MESSAGES/sdk/io-guide.en.po    |  284 ++
 .../sdk/io-guide/guide-to-cache-api.en.po       |   63 +
 .../io-guide/guide-to-cache-api/errors.en.po    |   36 +
 .../io-guide/guide-to-cache-api/example.en.po   |   70 +
 .../how-to-do-a-cache-remove.en.po              |   35 +
 .../how-to-do-a-cache-write.en.po               |   38 +
 .../LC_MESSAGES/sdk/io-guide/io-buffers.en.po   |   61 +
 .../sdk/io-guide/net-vconnections.en.po         |   37 +
 .../sdk/io-guide/transformations.en.po          |  207 ++
 .../ja/LC_MESSAGES/sdk/io-guide/vios.en.po      |  105 +
 .../LC_MESSAGES/sdk/misc-interface-guide.en.po  |   72 +
 .../memory-allocation.en.po                     |   68 +
 .../misc-interface-guide/thread-functions.en.po |   54 +
 .../misc-interface-guide/tsfopen-family.en.po   |   79 +
 doc/locale/ja/LC_MESSAGES/sdk/mutex-guide.en.po |  306 ++
 .../LC_MESSAGES/sdk/new-protocol-plugins.en.po  |  525 +++
 .../LC_MESSAGES/sdk/plugin-configurations.en.po |   91 +
 .../ja/LC_MESSAGES/sdk/plugin-management.en.po  |   20 +
 .../guide-to-the-logging-api.en.po              |  142 +
 ...-trafficserver-settings-and-statistics.en.po |   79 +
 doc/locale/ja/LC_MESSAGES/sdk/preface.en.po     |   43 +
 .../sdk/preface/how-to-use-this-book.en.po      |  203 +
 .../sdk/preface/typographical-conventions.en.po |   54 +
 .../ja/LC_MESSAGES/sdk/remap-plugin.en.po       |   96 +
 .../sdk/remap-plugin/example-query-remap.en.po  |   92 +
 .../ja/LC_MESSAGES/sdk/sample-source-code.en.po |   60 +
 .../LC_MESSAGES/sdk/troubleshooting-tips.en.po  |   47 +
 .../debugging-memory-leaks.en.po                |   30 +
 .../unable-to-debug-tags.en.po                  |  144 +
 .../unable-to-load-plugins.en.po                |   50 +
 .../troubleshooting-tips/using-a-debugger.en.po |   40 +
 doc/reference/api/TSDebug.en.rst                |   14 +-
 doc/reference/api/TSRemap.en.rst                |    2 +-
 doc/reference/api/TSmalloc.en.rst               |    2 +-
 doc/reference/commands/traffic_cop.en.rst       |   19 +-
 doc/reference/commands/traffic_line.en.rst      |  793 +---
 doc/reference/configuration/cache.config.en.rst |   17 +-
 .../configuration/congestion.config.en.rst      |    3 +-
 .../configuration/hosting.config.en.rst         |    7 +-
 .../configuration/logs_xml.config.en.rst        |   14 +-
 .../configuration/plugin.config.en.rst          |    2 +-
 .../configuration/records.config.en.rst         |  181 +-
 doc/reference/configuration/remap.config.en.rst |   37 +-
 .../configuration/ssl_multicert.config.en.rst   |   32 +-
 .../configuration/storage.config.en.rst         |    3 +-
 doc/reference/plugins/authproxy.en.rst          |    2 +-
 doc/reference/plugins/buffer_upload.en.rst      |    2 +
 doc/reference/plugins/cacheurl.en.rst           |    2 +
 doc/reference/plugins/combo_handler.en.rst      |    2 +
 doc/reference/plugins/conf_remap.en.rst         |   22 +-
 doc/reference/plugins/esi.en.rst                |    2 +
 doc/reference/plugins/geoip_acl.en.rst          |    2 +
 doc/reference/plugins/gzip.en.rst               |    2 +
 doc/reference/plugins/header_filter.en.rst      |  132 -
 doc/reference/plugins/header_rewrite.en.rst     |   72 +-
 doc/reference/plugins/hipes.en.rst              |    2 +
 doc/reference/plugins/index.en.rst              |    5 +-
 doc/reference/plugins/metafilter.en.rst         |  111 -
 doc/reference/plugins/metalink.en.rst           |  125 +
 doc/reference/plugins/mysql_remap.en.rst        |    2 +
 doc/reference/plugins/regex_remap.en.rst        |    8 +
 doc/reference/plugins/s3_auth.en.rst            |   84 +
 .../plugins/stale_while_revalidate.en.rst       |    2 +
 doc/reference/plugins/stats_over_http.en.rst    |    2 +
 doc/reference/plugins/ts_lua.en.rst             |    2 +
 doc/reference/plugins/xdebug.en.rst             |    2 +
 doc/sdk/continuations.en.rst                    |   16 +-
 doc/sdk/http-headers.en.rst                     |   13 +-
 doc/sdk/index.en.rst                            |    8 +-
 example/Makefile.am                             |   10 +-
 example/secure-link/readme.txt                  |   19 +
 example/secure-link/secure-link.c               |  201 +
 iocore/aio/AIO.cc                               |   10 +-
 iocore/aio/Makefile.am                          |    6 +-
 iocore/cache/Cache.cc                           |  169 +-
 iocore/cache/CacheDir.cc                        |    2 +-
 iocore/cache/CacheRead.cc                       |   25 +-
 iocore/cache/CacheTest.cc                       |   72 +
 iocore/cache/I_Cache.h                          |   22 +
 iocore/cache/I_CacheDefs.h                      |    2 +-
 iocore/cache/Makefile.am                        |    3 +-
 iocore/cache/P_CacheDisk.h                      |    2 +-
 iocore/cluster/Makefile.am                      |    3 +-
 iocore/dns/DNS.cc                               |   85 +-
 iocore/dns/P_DNSProcessor.h                     |    6 +-
 iocore/eventsystem/I_IOBuffer.h                 |    1 +
 iocore/eventsystem/Makefile.am                  |    5 +-
 iocore/eventsystem/P_IOBuffer.h                 |   14 +-
 iocore/eventsystem/ProtectedQueue.cc            |    2 +-
 iocore/eventsystem/UnixEventProcessor.cc        |  140 +-
 iocore/hostdb/HostDB.cc                         |   12 +-
 iocore/net/AcceptCont.cc                        |   41 +
 iocore/net/I_AcceptCont.h                       |   48 +
 iocore/net/I_Net.h                              |    1 +
 iocore/net/I_NetProcessor.h                     |    1 +
 iocore/net/I_NetVConnection.h                   |    4 +
 iocore/net/Makefile.am                          |   10 +-
 iocore/net/Net.cc                               |   28 +-
 iocore/net/P_Net.h                              |    1 +
 iocore/net/P_NetAccept.h                        |    2 +
 iocore/net/P_ProtocolAcceptCont.h               |   50 +
 iocore/net/P_ProtocolNetAccept.h                |   62 +
 iocore/net/P_SSLCertLookup.h                    |    3 +
 iocore/net/P_SSLConfig.h                        |    5 +
 iocore/net/P_SSLNetAccept.h                     |    1 +
 iocore/net/P_SSLNetVConnection.h                |   16 +-
 iocore/net/P_SSLNextProtocolAccept.h            |    2 +-
 iocore/net/P_SSLNextProtocolSet.h               |    4 +-
 iocore/net/P_SSLUtils.h                         |   73 +-
 iocore/net/P_UnixNetVConnection.h               |    9 +
 iocore/net/ProtocolAcceptCont.cc                |   73 +
 iocore/net/ProtocolNetAccept.cc                 |   68 +
 iocore/net/SSLCertLookup.cc                     |   44 +-
 iocore/net/SSLConfig.cc                         |   20 +-
 iocore/net/SSLNetAccept.cc                      |   16 +-
 iocore/net/SSLNetProcessor.cc                   |    3 +
 iocore/net/SSLNetVConnection.cc                 |  204 +-
 iocore/net/SSLNextProtocolAccept.cc             |    2 +-
 iocore/net/SSLNextProtocolSet.cc                |   20 +-
 iocore/net/SSLUtils.cc                          |  741 +++-
 iocore/net/UnixConnection.cc                    |    2 +
 iocore/net/UnixNetAccept.cc                     |   71 +-
 iocore/net/UnixNetProcessor.cc                  |   20 +-
 iocore/net/UnixNetVConnection.cc                |   95 +-
 iocore/net/test_certlookup.cc                   |   13 +-
 iocore/utils/Machine.cc                         |   20 +-
 lib/atscppapi/Makefile.am                       |    3 +-
 lib/atscppapi/examples/Makefile.am              |    4 +-
 .../examples/async_http_fetch/AsyncHttpFetch.cc |   16 +-
 .../examples/clientredirect/ClientRedirect.cc   |    2 +-
 .../examples/clientrequest/ClientRequest.cc     |    3 +-
 .../examples/customresponse/CustomResponse.cc   |    2 +-
 lib/atscppapi/examples/data_caching/Makefile.am |   34 -
 .../examples/data_caching/data_caching.cc       |   98 -
 .../examples/globalhook/GlobalHookPlugin.cc     |    2 +-
 .../GzipTransformationPlugin.cc                 |    2 +-
 .../examples/helloworld/HelloWorldPlugin.cc     |    2 +-
 lib/atscppapi/examples/intercept/Makefile.am    |   29 +
 lib/atscppapi/examples/intercept/intercept.cc   |   55 +
 .../InternalTransactionHandling.cc              |    4 +-
 .../examples/logger_example/LoggerExample.cc    |    2 +-
 .../MultipleTransactionHookPlugins.cc           |    2 +-
 .../NullTransformationPlugin.cc                 |    3 +-
 .../examples/post_buffer/PostBuffer.cc          |    4 +-
 .../examples/remap_plugin/RemapPlugin.cc        |    2 +-
 .../examples/serverresponse/ServerResponse.cc   |    2 +-
 .../examples/stat_example/StatExample.cc        |    4 +-
 .../timeout_example/TimeoutExamplePlugin.cc     |    4 +-
 .../transactionhook/TransactionHookPlugin.cc    |    2 +-
 lib/atscppapi/src/AsyncHttpFetch.cc             |   43 +-
 lib/atscppapi/src/AsyncTimer.cc                 |    4 +-
 lib/atscppapi/src/ClientRequest.cc              |    1 -
 lib/atscppapi/src/GzipDeflateTransformation.cc  |   10 +-
 lib/atscppapi/src/GzipInflateTransformation.cc  |    3 +-
 lib/atscppapi/src/Headers.cc                    |  208 +-
 lib/atscppapi/src/InitializableValue.cc         |   29 -
 lib/atscppapi/src/InterceptPlugin.cc            |  330 ++
 lib/atscppapi/src/Makefile.am                   |    8 +-
 lib/atscppapi/src/Request.cc                    |   24 +-
 lib/atscppapi/src/Response.cc                   |   44 +-
 lib/atscppapi/src/Transaction.cc                |    1 -
 lib/atscppapi/src/TransformationPlugin.cc       |   13 +-
 lib/atscppapi/src/Url.cc                        |  103 +-
 lib/atscppapi/src/include/InitializableValue.h  |   90 -
 .../src/include/atscppapi/AsyncHttpFetch.h      |    7 +-
 lib/atscppapi/src/include/atscppapi/Headers.h   |  168 +-
 .../src/include/atscppapi/InterceptPlugin.h     |   98 +
 lib/atscppapi/src/include/atscppapi/Response.h  |    2 +-
 lib/atscppapi/src/include/atscppapi/Url.h       |   10 +-
 .../src/include/atscppapi/shared_ptr.h          |   14 +-
 lib/atscppapi/src/include/atscppapi/utils.h     |   10 +-
 lib/atscppapi/src/include/utils_internal.h      |   10 +
 lib/atscppapi/src/utils.cc                      |    2 -
 lib/atscppapi/src/utils_internal.cc             |    7 -
 lib/perl/Makefile.am                            |    2 +-
 lib/perl/lib/Apache/TS.pm                       |   73 -
 lib/perl/lib/Apache/TS.pm.in                    |   90 +
 lib/perl/lib/Apache/TS/AdminClient.pm           |  163 +-
 lib/records/I_RecCore.h                         |   20 +-
 lib/records/I_RecDefs.h                         |   39 +-
 lib/records/I_RecEvents.h                       |    3 +
 lib/records/I_RecMutex.h                        |    1 +
 lib/records/I_RecProcess.h                      |    4 +-
 lib/records/P_RecCore.cc                        |   64 +-
 lib/records/P_RecCore.h                         |    4 -
 lib/records/P_RecUtils.h                        |    9 +-
 lib/records/RecCore.cc                          |   71 +-
 lib/records/RecHttp.cc                          |   10 +-
 lib/records/RecMutex.cc                         |   11 +-
 lib/records/RecProcess.cc                       |    2 +-
 lib/records/RecUtils.cc                         |   20 +-
 lib/records/test_RecProcess.i                   |   12 +-
 lib/records/test_RecordsConfig.cc               |   10 +-
 lib/ts/Compatability.h                          |    1 -
 lib/ts/EventNotify.cc                           |    5 +-
 lib/ts/List.h                                   |    1 -
 lib/ts/Makefile.am                              |    5 +-
 lib/ts/SimpleTokenizer.h                        |    1 -
 lib/ts/Tokenizer.cc                             |    2 +-
 lib/ts/apidefs.h.in                             | 1174 ++++++
 lib/ts/ink_args.cc                              |    9 +-
 lib/ts/ink_args.h                               |    2 +-
 lib/ts/ink_atomic.h                             |    2 +-
 lib/ts/ink_base64.cc                            |    1 -
 lib/ts/ink_cap.cc                               |    5 +
 lib/ts/ink_cap.h                                |    9 +-
 lib/ts/ink_config.h.in                          |    4 +-
 lib/ts/ink_defs.cc                              |   18 +-
 lib/ts/ink_file.cc                              |   11 +-
 lib/ts/ink_hash_table.cc                        |    1 -
 lib/ts/ink_hrtime.cc                            |    4 +-
 lib/ts/ink_hrtime.h                             |   49 +-
 lib/ts/ink_lockfile.h                           |    1 -
 lib/ts/ink_memory.cc                            |   20 +
 lib/ts/ink_memory.h                             |  112 +-
 lib/ts/ink_mutex.cc                             |   42 +-
 lib/ts/ink_mutex.h                              |   14 +-
 lib/ts/ink_queue.cc                             |    1 -
 lib/ts/ink_queue_ext.cc                         |    1 -
 lib/ts/ink_queue_ext.h                          |    2 +-
 lib/ts/ink_resource.cc                          |   23 +-
 lib/ts/ink_resource.h                           |  114 +-
 lib/ts/libts.h                                  |    1 -
 lib/wccp/Makefile.am                            |    1 -
 mgmt/BaseManager.h                              |    9 +-
 mgmt/LocalManager.cc                            |   39 +-
 mgmt/Makefile.am                                |    7 +-
 mgmt/MultiFile.cc                               |    1 -
 mgmt/ProcessManager.cc                          |    5 +-
 mgmt/RecordsConfig.cc                           |   31 +-
 mgmt/api/CoreAPI.cc                             |   23 +
 mgmt/api/CoreAPI.h                              |    2 +
 mgmt/api/CoreAPIRemote.cc                       |  125 +-
 mgmt/api/EventCallback.cc                       |    1 -
 mgmt/api/GenericParser.h                        |    1 -
 mgmt/api/INKMgmtAPI.cc                          |   15 +
 mgmt/api/Makefile.am                            |    3 +-
 mgmt/api/NetworkUtilsDefs.h                     |    2 +
 mgmt/api/NetworkUtilsLocal.cc                   |   30 +-
 mgmt/api/NetworkUtilsLocal.h                    |    2 +-
 mgmt/api/NetworkUtilsRemote.cc                  |  650 ++--
 mgmt/api/NetworkUtilsRemote.h                   |    6 +-
 mgmt/api/TSControlMain.cc                       |  241 +-
 mgmt/api/TSControlMain.h                        |    4 +-
 mgmt/api/include/mgmtapi.h                      |   14 +-
 mgmt/utils/ExpandingArray.cc                    |    2 +-
 mgmt/web2/WebHttpMessage.cc                     |    1 -
 mgmt/web2/WebHttpSession.cc                     |    1 -
 plugins/Makefile.am                             |    1 -
 plugins/cacheurl/Makefile.am                    |    2 +-
 plugins/cacheurl/cacheurl.c                     |  436 ---
 plugins/cacheurl/cacheurl.cc                    |  445 +++
 plugins/conf_remap/conf_remap.cc                |  109 +-
 plugins/experimental/Makefile.am                |    2 +
 plugins/experimental/escalate/Makefile.am       |   22 +
 plugins/experimental/escalate/escalate.cc       |  166 +
 .../experimental/healthchecks/healthchecks.c    |    6 +-
 plugins/experimental/metalink/README            |   50 +-
 plugins/experimental/metalink/metalink.cc       |  405 +-
 .../experimental/metalink/test/chunkedEncoding  |   97 +
 .../metalink/test/chunkedEncodingDisconnect     |   97 +
 .../experimental/metalink/test/clientDisconnect |   94 +
 .../experimental/metalink/test/contentLength    |   99 +
 .../metalink/test/contentLengthDisconnect       |   92 +
 .../test/finalChunkedEncodingDisconnect         |  110 +
 plugins/experimental/metalink/test/http09       |   84 +
 plugins/experimental/metalink/test/longer       |   92 +
 plugins/experimental/metalink/test/notModified  |   77 +
 .../test/shortChunkedEncodingDisconnect         |   96 +
 .../metalink/test/shortClientDisconnect         |   90 +
 .../metalink/test/shortContentLengthDisconnect  |   93 +
 plugins/experimental/metalink/test/zero         |   90 +
 plugins/experimental/remap_stats/remap_stats.c  |  108 +-
 plugins/experimental/s3_auth/Makefile.am        |   21 +
 plugins/experimental/s3_auth/s3_auth.cc         |  528 +++
 plugins/header_filter/Makefile.am               |   21 -
 plugins/header_filter/README                    |   95 -
 plugins/header_filter/example.conf              |   38 -
 plugins/header_filter/header_filter.cc          |  215 --
 plugins/header_filter/lulu.h                    |   76 -
 plugins/header_filter/rules.cc                  |  335 --
 plugins/header_filter/rules.h                   |  176 -
 plugins/header_rewrite/Makefile.am              |    3 +-
 plugins/header_rewrite/README                   |  230 +-
 plugins/header_rewrite/condition.h              |    4 +-
 plugins/header_rewrite/expander.cc              |  138 +
 plugins/header_rewrite/expander.h               |   49 +
 plugins/header_rewrite/factory.cc               |    2 +
 plugins/header_rewrite/header_rewrite.cc        |  217 +-
 plugins/header_rewrite/lulu.h                   |    4 +-
 plugins/header_rewrite/operator.h               |  138 -
 plugins/header_rewrite/operators.cc             |   78 +-
 plugins/header_rewrite/operators.h              |   19 +
 plugins/header_rewrite/parser.cc                |    2 +-
 plugins/header_rewrite/resources.cc             |    7 +-
 plugins/header_rewrite/resources.h              |    1 -
 plugins/header_rewrite/ruleset.cc               |    4 +-
 plugins/header_rewrite/value.h                  |   13 +-
 plugins/regex_remap/regex_remap.cc              |  796 ++--
 plugins/stats_over_http/stats_over_http.c       |    2 +-
 proxy/FetchSM.cc                                |  559 ++-
 proxy/FetchSM.h                                 |   92 +-
 proxy/ICPStats.cc                               |   52 +-
 proxy/InkAPI.cc                                 |  507 ++-
 proxy/InkAPIInternal.h                          |    6 +-
 proxy/InkAPITest.cc                             |   80 +-
 proxy/Main.cc                                   |  106 +-
 proxy/Main.h                                    |   10 -
 proxy/Makefile.am                               |   23 +-
 proxy/Plugin.cc                                 |   34 +-
 proxy/PluginVC.h                                |    8 +-
 proxy/Prefetch.cc                               |   22 +-
 proxy/Prefetch.h                                |    8 -
 proxy/SocksProxy.cc                             |   10 +-
 proxy/api/ts/InkAPIPrivateIOCore.h              |    4 +
 proxy/api/ts/experimental.h                     |  123 +-
 proxy/api/ts/ts.h                               | 2304 ++++++++++++
 proxy/api/ts/ts.h.in                            | 3301 -----------------
 proxy/config/body_factory/default/Makefile.am   |    1 +
 .../body_factory/default/access#redirect_url    |    2 +-
 .../body_factory/default/connect#dns_failed     |    2 +-
 .../body_factory/default/connect#failed_connect |    2 +-
 .../config/body_factory/default/connect#hangup  |    2 +-
 proxy/config/body_factory/default/default       |    2 +-
 .../default/request#invalid_content_length      |   15 +
 .../default/request#no_content_length           |    2 +-
 .../body_factory/default/request#syntax_error   |    2 +-
 .../body_factory/default/response#bad_response  |    2 +-
 .../body_factory/default/response#bad_version   |    2 +-
 .../body_factory/default/urlrouting#no_mapping  |    2 +-
 proxy/config/records.config.default.in          |    9 +-
 proxy/config/remap.config.default               |    8 +
 proxy/config/ssl_multicert.config.default       |   11 +-
 proxy/hdrs/HTTP.cc                              |   51 +-
 proxy/hdrs/HdrToken.cc                          |   25 +-
 proxy/hdrs/HdrToken.h                           |    9 +-
 proxy/hdrs/MIME.cc                              |   26 +-
 proxy/hdrs/MIME.h                               |   11 +
 proxy/hdrs/URL.cc                               |   14 +
 proxy/hdrs/URL.h                                |    6 +
 proxy/http/HttpAccept.cc                        |   98 -
 proxy/http/HttpAccept.h                         |  198 -
 proxy/http/HttpAcceptCont.cc                    |   98 +
 proxy/http/HttpAcceptCont.h                     |  198 +
 proxy/http/HttpClientSession.cc                 |   11 +-
 proxy/http/HttpClientSession.h                  |    1 -
 proxy/http/HttpConfig.cc                        |  595 +--
 proxy/http/HttpConfig.h                         |   15 +-
 proxy/http/HttpDebugNames.cc                    |  178 +-
 proxy/http/HttpProxyAPIEnums.h                  |   47 +
 proxy/http/HttpProxyServerMain.cc               |   55 +-
 proxy/http/HttpSM.cc                            |  336 +-
 proxy/http/HttpSM.h                             |   16 +-
 proxy/http/HttpServerSession.cc                 |    4 +-
 proxy/http/HttpServerSession.h                  |   11 +-
 proxy/http/HttpSessionManager.cc                |   56 +-
 proxy/http/HttpSessionManager.h                 |   17 +
 proxy/http/HttpTransact.cc                      |  618 +++-
 proxy/http/HttpTransact.h                       |  179 +-
 proxy/http/HttpTransactHeaders.cc               |   26 +-
 proxy/http/HttpTransactHeaders.h                |    1 +
 proxy/http/HttpTunnel.cc                        |   53 +-
 proxy/http/HttpTunnel.h                         |   25 +-
 proxy/http/HttpUpdateSM.cc                      |   24 +-
 proxy/http/Makefile.am                          |   13 +-
 proxy/http/RegressionHttpTransact.cc            |  103 +
 proxy/http/remap/Makefile.am                    |    3 +-
 proxy/http/remap/RemapConfig.cc                 |  102 +-
 proxy/http/remap/RemapProcessor.cc              |   16 +-
 proxy/http/remap/UrlMapping.cc                  |    7 +-
 proxy/logging/Log.cc                            |  112 +-
 proxy/logging/Log.h                             |    4 +-
 proxy/logging/LogAccess.cc                      |   50 +-
 proxy/logging/LogAccess.h                       |    3 +-
 proxy/logging/LogAccessHttp.cc                  |   43 +-
 proxy/logging/LogAccessHttp.h                   |    2 +-
 proxy/logging/LogConfig.cc                      |    4 +-
 proxy/logging/LogFile.cc                        |   27 -
 proxy/logging/LogFormat.cc                      |  108 +-
 proxy/logging/LogFormat.h                       |    1 +
 proxy/logging/LogPredefined.cc                  |    2 +-
 proxy/logging/LogStandalone.cc                  |   19 +-
 proxy/logging/Makefile.am                       |    3 +-
 proxy/shared/Makefile.am                        |    4 +-
 proxy/spdy/Makefile.am                          |   48 +
 proxy/spdy/P_SpdyAcceptCont.h                   |   46 +
 proxy/spdy/P_SpdyCallbacks.h                    |  248 ++
 proxy/spdy/P_SpdyCommon.h                       |   75 +
 proxy/spdy/P_SpdySM.h                           |  129 +
 proxy/spdy/SpdyAcceptCont.cc                    |   47 +
 proxy/spdy/SpdyCallbacks.cc                     |  513 +++
 proxy/spdy/SpdyCommon.cc                        |  136 +
 proxy/spdy/SpdySM.cc                            |  415 +++
 proxy/tests/test_logstats_json                  |    2 +-
 proxy/tests/test_logstats_summary               |    2 +-
 rc/trafficserver.in                             |    6 +-
 tools/Makefile.am                               |   11 +-
 tools/jtest/jtest.cc                            |   16 +-
 tools/traffic_shell.pl                          |  900 +++++
 592 files changed, 56966 insertions(+), 11652 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c5c92b94/configure.ac
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c5c92b94/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --cc iocore/net/SSLUtils.cc
index b1d8cdc,b96823e..f0219d5
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@@ -23,9 -23,9 +23,11 @@@
  #include "libts.h"
  #include "I_Layout.h"
  #include "P_Net.h"
 +#include "luaConfig.h"
 +#include "lua.hpp"
+ #include "ink_cap.h"
  
+ #include <string>
  #include <openssl/err.h>
  #include <openssl/bio.h>
  #include <openssl/pem.h>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c5c92b94/proxy/Main.cc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c5c92b94/proxy/Makefile.am
----------------------------------------------------------------------
diff --cc proxy/Makefile.am
index 38d0c8a,6dfc816..1056784
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@@ -45,9 -45,8 +45,7 @@@ AM_CPPFLAGS = 
    -I$(top_srcdir)/mgmt \
    -I$(top_srcdir)/mgmt/preparse \
    -I$(top_srcdir)/mgmt/utils \
-   -I$(top_builddir)/proxy/api/ts \
-   -I$(top_srcdir)/lib \
 -  -I$(top_srcdir)/proxy/api/ts \
 -  -I$(top_srcdir)/lib
 +  $(LUA_CFLAGS)
  
  noinst_HEADERS = \
    ConfigParse.h \
@@@ -121,9 -117,10 +118,10 @@@ if BUILD_TEST
      RegressionSM.cc
  endif
  
 -traffic_server_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 +traffic_server_LDFLAGS = @LUA_LUAJIT_LDFLAGS@ @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
  traffic_server_LDADD = \
    http/libhttp.a \
+   spdy/libspdy.a \
    http/remap/libhttp_remap.a \
    congest/libCongestionControl.a \
    logging/liblogging.a \
@@@ -150,9 -147,8 +148,9 @@@
    $(top_builddir)/iocore/eventsystem/libinkevent.a \
    $(which_libts) \
    @hwloc_LIBS@ \
 +  @LUA_LIBS@ \
    @LIBPCRE@ \
-   @LIBSSL@ \
+   @OPENSSL_LIBS@ \
    @LIBTCL@ \
    @LIBEXPAT@ \
    @LIBDEMANGLE@ \
@@@ -222,12 -219,12 +221,13 @@@ traffic_sac_SOURCES = 
    Plugin.cc \
    InkAPI.cc \
    FetchSM.cc \
 -  InkIOCoreAPI.cc
 +  InkIOCoreAPI.cc \
 +  luaConfig.cc
  
 -traffic_sac_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 +traffic_sac_LDFLAGS = @LUA_LUAJIT_LDFLAGS@ @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
  traffic_sac_LDADD = \
    http/libhttp.a \
+   spdy/libspdy.a \
    shared/libdiagsconfig.a \
    http/remap/libhttp_remap.a \
    congest/libCongestionControl.a \
@@@ -251,9 -248,8 +251,14 @@@
    $(top_builddir)/iocore/eventsystem/libinkevent.a \
    $(top_builddir)/lib/records/librecprocess.a \
    $(top_builddir)/lib/ts/libtsutil.la \
++<<<<<<< HEAD
 +  @LUA_LIBS@ \
 +  @LIBRESOLV@ @LIBPCRE@ @LIBSSL@ @LIBTCL@ \
 +  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ -lm
++=======
+   @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
+   @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ @SPDYLAY_LIBS@ -lm
++>>>>>>> origin/master
  
  if BUILD_TESTS
    traffic_sac_SOURCES += RegressionSM.cc


[42/50] [abbrv] TS-2660: rename StateMachineAction_t values with a consistent prefix

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/http/HttpTransact.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 636a81e..b712b63 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -457,67 +457,61 @@ public:
   ////////////////////////////////////////////////
   enum StateMachineAction_t
   {
-    STATE_MACHINE_ACTION_UNDEFINED = 0,
-
-    DNS_LOOKUP,
-    REVERSE_DNS_LOOKUP,
-    //AUTH_LOOKUP,
-
-    CACHE_LOOKUP,
-    CACHE_ISSUE_WRITE,
-    CACHE_ISSUE_WRITE_TRANSFORM,
-    ISSUE_CACHE_DELETE,
-    PREPARE_CACHE_UPDATE,
-    ISSUE_CACHE_UPDATE,
-
-    ICP_QUERY,
-
-    ORIGIN_SERVER_OPEN,
-    ORIGIN_SERVER_RAW_OPEN,
-    OS_RR_MARK_DOWN,
-
-    READ_PUSH_HDR,
-    STORE_PUSH_BODY,
-
-    PROXY_INTERNAL_CACHE_DELETE,
-    PROXY_INTERNAL_CACHE_NOOP,
-    PROXY_INTERNAL_CACHE_UPDATE_HEADERS,
-    PROXY_INTERNAL_CACHE_WRITE,
-    PROXY_INTERNAL_100_RESPONSE,
-    PROXY_INTERNAL_REQUEST,
-    PROXY_SEND_ERROR_CACHE_NOOP,
-#ifdef PROXY_DRAIN
-    PROXY_DRAIN_REQUEST_BODY,
-#endif /* PROXY_DRAIN */
+    SM_ACTION_UNDEFINED = 0,
 
-    SEND_QUERY_TO_INCOMING_ROUTER,
-    SERVE_FROM_CACHE,
-    SERVER_READ,
-    SERVER_PARSE_NEXT_HDR,
-    TRANSFORM_READ,
+    // SM_ACTION_AUTH_LOOKUP,
+    SM_ACTION_DNS_LOOKUP,
+    SM_ACTION_DNS_REVERSE_LOOKUP,
 
-    SSL_TUNNEL,
-    EXTENSION_METHOD_TUNNEL,
+    SM_ACTION_CACHE_LOOKUP,
+    SM_ACTION_CACHE_ISSUE_WRITE,
+    SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM,
+    SM_ACTION_CACHE_PREPARE_UPDATE,
+    SM_ACTION_CACHE_ISSUE_UPDATE,
 
-    CONTINUE,
+    SM_ACTION_ICP_QUERY,
 
-    HTTP_API_SM_START,
-    
-    HTTP_API_READ_REQUEST_HDR,
-    HTTP_API_PRE_REMAP,
-    HTTP_REMAP_REQUEST,
-    HTTP_API_POST_REMAP,
-    HTTP_POST_REMAP_SKIP,
-    HTTP_POST_REMAP_UPGRADE,
-
-    HTTP_API_OS_DNS,
-    HTTP_API_SEND_REQUEST_HDR,
-    HTTP_API_READ_CACHE_HDR,
-    HTTP_API_CACHE_LOOKUP_COMPLETE,
-    HTTP_API_READ_RESPONSE_HDR,
-    HTTP_API_SEND_RESPONSE_HDR,
-    REDIRECT_READ,
-    HTTP_API_SM_SHUTDOWN
+    SM_ACTION_ORIGIN_SERVER_OPEN,
+    SM_ACTION_ORIGIN_SERVER_RAW_OPEN,
+    SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN,
+
+    SM_ACTION_READ_PUSH_HDR,
+    SM_ACTION_STORE_PUSH_BODY,
+
+    SM_ACTION_INTERNAL_CACHE_DELETE,
+    SM_ACTION_INTERNAL_CACHE_NOOP,
+    SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS,
+    SM_ACTION_INTERNAL_CACHE_WRITE,
+    SM_ACTION_INTERNAL_100_RESPONSE,
+    SM_ACTION_INTERNAL_REQUEST,
+    SM_ACTION_SEND_ERROR_CACHE_NOOP,
+
+#ifdef PROXY_DRAIN
+    SM_ACTION_DRAIN_REQUEST_BODY,
+#endif /* PROXY_DRAIN */
+
+    SM_ACTION_SERVE_FROM_CACHE,
+    SM_ACTION_SERVER_READ,
+    SM_ACTION_SERVER_PARSE_NEXT_HDR,
+    SM_ACTION_TRANSFORM_READ,
+    SM_ACTION_SSL_TUNNEL,
+    SM_ACTION_CONTINUE,
+
+    SM_ACTION_API_SM_START,
+    SM_ACTION_API_READ_REQUEST_HDR,
+    SM_ACTION_API_PRE_REMAP,
+    SM_ACTION_API_POST_REMAP,
+    SM_ACTION_API_OS_DNS,
+    SM_ACTION_API_SEND_REQUEST_HDR,
+    SM_ACTION_API_READ_CACHE_HDR,
+    SM_ACTION_API_CACHE_LOOKUP_COMPLETE,
+    SM_ACTION_API_READ_RESPONSE_HDR,
+    SM_ACTION_API_SEND_RESPONSE_HDR,
+    SM_ACTION_API_SM_SHUTDOWN,
+
+    SM_ACTION_REMAP_REQUEST,
+    SM_ACTION_POST_REMAP_SKIP,
+    SM_ACTION_REDIRECT_READ
   };
 
   enum TransferEncoding_t
@@ -1040,7 +1034,7 @@ public:
         pre_transform_source(SOURCE_NONE),
         req_flavor(REQ_FLAVOR_FWDPROXY),
         pending_work(NULL),
-        cdn_saved_next_action(STATE_MACHINE_ACTION_UNDEFINED),
+        cdn_saved_next_action(SM_ACTION_UNDEFINED),
         cdn_saved_transact_return_point(NULL),
         cdn_remap_complete(false),
         first_dns_lookup(true),
@@ -1048,8 +1042,8 @@ public:
         cache_lookup_result(CACHE_LOOKUP_NONE),
         backdoor_request(false),
         cop_test_page(false),
-        next_action(STATE_MACHINE_ACTION_UNDEFINED),
-        api_next_action(STATE_MACHINE_ACTION_UNDEFINED),
+        next_action(SM_ACTION_UNDEFINED),
+        api_next_action(SM_ACTION_UNDEFINED),
         transact_return_point(NULL),
         is_upgrade_request(false),
         post_remap_upgrade_return_point(NULL),
@@ -1102,12 +1096,12 @@ public:
         api_server_addr_set(false),
         api_update_cached_object(UPDATE_CACHED_OBJECT_NONE),
         api_lock_url(LOCK_URL_FIRST),
-        saved_update_next_action(STATE_MACHINE_ACTION_UNDEFINED),
+        saved_update_next_action(SM_ACTION_UNDEFINED),
         saved_update_cache_action(CACHE_DO_UNDEFINED),
         stale_icp_lookup(false),
         url_map(),
         pCongestionEntry(NULL),
-        congest_saved_next_action(STATE_MACHINE_ACTION_UNDEFINED),
+        congest_saved_next_action(SM_ACTION_UNDEFINED),
         congestion_control_crat(0),
         congestion_congested_or_failed(0),
         congestion_connection_opened(0),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/http/HttpUpdateSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpUpdateSM.cc b/proxy/http/HttpUpdateSM.cc
index 8ff409b..a5b604e 100644
--- a/proxy/http/HttpUpdateSM.cc
+++ b/proxy/http/HttpUpdateSM.cc
@@ -103,10 +103,10 @@ HttpUpdateSM::handle_api_return()
 {
 
   switch (t_state.api_next_action) {
-  case HttpTransact::HTTP_API_SM_START:
+  case HttpTransact::SM_ACTION_API_SM_START:
     call_transact_and_set_next_state(&HttpTransact::ModifyRequest);
     return;
-  case HttpTransact::HTTP_API_SEND_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
     // we have further processing to do
     //  based on what t_state.next_action is
     break;
@@ -116,7 +116,7 @@ HttpUpdateSM::handle_api_return()
   }
 
   switch (t_state.next_action) {
-  case HttpTransact::TRANSFORM_READ:
+  case HttpTransact::SM_ACTION_TRANSFORM_READ:
     {
       if (t_state.cache_info.transform_action == HttpTransact::CACHE_DO_WRITE) {
         // Transform output cachable so initiate the transfer
@@ -153,11 +153,11 @@ HttpUpdateSM::handle_api_return()
       }
       break;
     }
-  case HttpTransact::PROXY_INTERNAL_CACHE_WRITE:
-  case HttpTransact::SERVER_READ:
-  case HttpTransact::PROXY_INTERNAL_CACHE_NOOP:
-  case HttpTransact::PROXY_SEND_ERROR_CACHE_NOOP:
-  case HttpTransact::SERVE_FROM_CACHE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_WRITE:
+  case HttpTransact::SM_ACTION_SERVER_READ:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_SERVE_FROM_CACHE:
     {
       cb_event = HTTP_SCH_UPDATE_EVENT_NOT_CACHED;
       t_state.squid_codes.log_code = SQUID_LOG_TCP_MISS;
@@ -165,10 +165,10 @@ HttpUpdateSM::handle_api_return()
       return;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_DELETE:
-  case HttpTransact::PROXY_INTERNAL_CACHE_UPDATE_HEADERS:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS:
     {
-      if (t_state.next_action == HttpTransact::PROXY_INTERNAL_CACHE_DELETE) {
+      if (t_state.next_action == HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE) {
         cb_event = HTTP_SCH_UPDATE_EVENT_DELETED;
       } else {
         cb_event = HTTP_SCH_UPDATE_EVENT_UPDATED;
@@ -192,7 +192,7 @@ HttpUpdateSM::set_next_state()
   if (t_state.cache_info.action == HttpTransact::CACHE_DO_NO_ACTION ||
       t_state.cache_info.action == HttpTransact::CACHE_DO_SERVE) {
 
-    if (t_state.next_action == HttpTransact::SERVE_FROM_CACHE) {
+    if (t_state.next_action == HttpTransact::SM_ACTION_SERVE_FROM_CACHE) {
       cb_event = HTTP_SCH_UPDATE_EVENT_NO_ACTION;
       t_state.squid_codes.log_code = SQUID_LOG_TCP_HIT;
     } else {


[24/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers


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

Branch: refs/heads/lua_config
Commit: 5ae5dda47b99fdcdb4e99498693c877c0af5c4e7
Parents: cc9f617
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:57:17 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:57:17 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/AsyncTimer.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ae5dda4/lib/atscppapi/src/AsyncTimer.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncTimer.cc b/lib/atscppapi/src/AsyncTimer.cc
index 975af3c..995cc48 100644
--- a/lib/atscppapi/src/AsyncTimer.cc
+++ b/lib/atscppapi/src/AsyncTimer.cc
@@ -63,8 +63,7 @@ int handleTimerEvent(TSCont cont, TSEvent event, void *edata) {
 
 AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms) {
   state_ = new AsyncTimerState(type, period_in_ms, initial_period_in_ms, this);
-  TSMutex null_mutex = NULL;
-  state_->cont_ = TSContCreate(handleTimerEvent, null_mutex);
+  state_->cont_ = TSContCreate(handleTimerEvent, TSMutexCreate());
   TSContDataSet(state_->cont_, static_cast<void *>(state_));
 }
 
@@ -92,6 +91,7 @@ void AsyncTimer::run(shared_ptr<AsyncDispatchControllerBase> dispatch_controller
 }
 
 AsyncTimer::~AsyncTimer() {
+  TSMutexLock(TSContMutexGet(state_->cont_));
   if (state_->initial_timer_action_) {
     LOG_DEBUG("Canceling initial timer action");
     TSActionCancel(state_->initial_timer_action_);


[31/50] [abbrv] git commit: TS-2431: Preparation of SPDY protocol

Posted by zw...@apache.org.
TS-2431: Preparation of SPDY protocol

*) Create basic data structures for SPDY protocal, such as:
   SpdyAcceptCont.

*) SPDY will share the same port number with HTTP protocol, ATS can
   recognize them by detecting the first byte of client request.

*) HttpAccept looks like a subclass of NetAccept. To avoid confusing,
   rename HttpAccept to HttpAcceptCont.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>


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

Branch: refs/heads/lua_config
Commit: f90f3a488323ccb8b98c5571ef6cf035f1be51a9
Parents: f1a005e
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Wed Dec 11 21:21:53 2013 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Fri Mar 21 01:29:21 2014 +0800

----------------------------------------------------------------------
 configure.ac                         |   1 +
 iocore/net/AcceptCont.cc             |  41 +++++++
 iocore/net/I_AcceptCont.h            |  48 ++++++++
 iocore/net/I_Net.h                   |   1 +
 iocore/net/I_NetProcessor.h          |   1 +
 iocore/net/Makefile.am               |   8 ++
 iocore/net/P_Net.h                   |   1 +
 iocore/net/P_NetAccept.h             |   2 +
 iocore/net/P_ProtocolAcceptCont.h    |  50 ++++++++
 iocore/net/P_ProtocolNetAccept.h     |  62 ++++++++++
 iocore/net/P_SSLNetAccept.h          |   1 +
 iocore/net/P_SSLNextProtocolAccept.h |   2 +-
 iocore/net/P_SSLNextProtocolSet.h    |   2 +-
 iocore/net/P_UnixNetVConnection.h    |   9 ++
 iocore/net/ProtocolAcceptCont.cc     |  73 +++++++++++
 iocore/net/ProtocolNetAccept.cc      |  68 ++++++++++
 iocore/net/SSLNetAccept.cc           |  16 ++-
 iocore/net/SSLNetVConnection.cc      |   3 +-
 iocore/net/SSLNextProtocolAccept.cc  |   2 +-
 iocore/net/SSLNextProtocolSet.cc     |   5 +-
 iocore/net/UnixNetAccept.cc          |  69 +++++++----
 iocore/net/UnixNetProcessor.cc       |  20 ++-
 iocore/net/UnixNetVConnection.cc     |  95 +++++++++++++-
 lib/ts/apidefs.h.in                  |   3 +
 proxy/InkAPI.cc                      |   6 +-
 proxy/Makefile.am                    |  12 +-
 proxy/SocksProxy.cc                  |   6 +-
 proxy/api/ts/InkAPIPrivateIOCore.h   |   4 +
 proxy/http/HttpAccept.cc             |  98 ---------------
 proxy/http/HttpAccept.h              | 198 ------------------------------
 proxy/http/HttpAcceptCont.cc         |  98 +++++++++++++++
 proxy/http/HttpAcceptCont.h          | 198 ++++++++++++++++++++++++++++++
 proxy/http/HttpProxyServerMain.cc    |  42 ++++---
 proxy/http/Makefile.am               |   7 +-
 proxy/spdy/Makefile.am               |  38 ++++++
 proxy/spdy/P_SpdyAcceptCont.h        |  46 +++++++
 proxy/spdy/SpdyAcceptCont.cc         |  37 ++++++
 37 files changed, 1004 insertions(+), 369 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index f87674d..796158e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2010,6 +2010,7 @@ AC_CONFIG_FILES([
   proxy/http/Makefile
   proxy/http/remap/Makefile
   proxy/logging/Makefile
+  proxy/spdy/Makefile
   rc/Makefile
   rc/trafficserver
   rc/trafficserver.conf

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/AcceptCont.cc
----------------------------------------------------------------------
diff --git a/iocore/net/AcceptCont.cc b/iocore/net/AcceptCont.cc
new file mode 100644
index 0000000..e112230
--- /dev/null
+++ b/iocore/net/AcceptCont.cc
@@ -0,0 +1,41 @@
+/** @file
+
+  AcceptCont
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "I_AcceptCont.h"
+#include "P_Net.h"
+
+AcceptCont::AcceptCont(ProxyMutex *amutex)
+    : Continuation(amutex)
+{
+  SET_HANDLER(&AcceptCont::mainEvent);
+}
+
+AcceptCont::~AcceptCont()
+{
+}
+
+void *
+AcceptCont::createNetAccept()
+{
+    return (NEW(new NetAccept));
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/I_AcceptCont.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_AcceptCont.h b/iocore/net/I_AcceptCont.h
new file mode 100644
index 0000000..2d59e1e
--- /dev/null
+++ b/iocore/net/I_AcceptCont.h
@@ -0,0 +1,48 @@
+/** @file
+
+  AcceptCont
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#ifndef I_AcceptCont_H_
+#define I_AcceptCont_H_
+#include "I_Net.h"
+#include "I_VConnection.h"
+
+class AcceptCont: public Continuation
+{
+public:
+  AcceptCont(ProxyMutex *amutex);
+  ~AcceptCont();
+
+  //
+  // Virtual function allows creation of an SSLNetAccept
+  // or NetAccept transparent to NetProcessor.
+  //
+  // This function should return a pointer
+  // of NetAccept or its subclass.
+  //
+  virtual void *createNetAccept();
+
+private:
+  virtual int mainEvent(int event, void * netvc) = 0;
+};
+
+#endif /* I_AcceptCont_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/I_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Net.h b/iocore/net/I_Net.h
index 78f3d62..a98b6a3 100644
--- a/iocore/net/I_Net.h
+++ b/iocore/net/I_Net.h
@@ -91,6 +91,7 @@ extern int net_config_poll_timeout;
 
 #include "I_NetVConnection.h"
 #include "I_NetProcessor.h"
+#include "I_AcceptCont.h"
 
 void ink_net_init(ModuleVersion version);
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/I_NetProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index 3deae4c..68ce117 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -100,6 +100,7 @@ public:
     AcceptOptions() { this->reset(); }
     /// Reset all values to defaults.
     self& reset();
+    bool create_default_NetAccept;
   };
 
   /**

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 4575e9e..efbfa86 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -52,6 +52,8 @@ libinknet_a_SOURCES = \
   I_UDPNet.h \
   I_UDPPacket.h \
   Inline.cc \
+  I_AcceptCont.h \
+  AcceptCont.cc \
   Net.cc \
   NetVConnection.cc \
   P_CompletionUtil.h \
@@ -61,6 +63,9 @@ libinknet_a_SOURCES = \
   P_Net.h \
   P_NetAccept.h \
   P_NetVConnection.h \
+  P_ProtocolNetAccept.h \
+  P_ProtocolAcceptCont.h \
+  P_Socks.h \
   P_SSLCertLookup.h \
   P_SSLConfig.h \
   P_SSLNetAccept.h \
@@ -81,6 +86,9 @@ libinknet_a_SOURCES = \
   P_UnixNetVConnection.h \
   P_UnixPollDescriptor.h \
   P_UnixUDPConnection.h \
+  ProtocolNetAccept.cc \
+  ProtocolAcceptCont.cc \
+  Socks.cc \
   SSLCertLookup.cc \
   SSLConfig.cc \
   SSLNetAccept.cc \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index 13ab617..db9acc6 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -104,6 +104,7 @@ do { \
 #include "P_NetVCTest.h"
 #include "P_LibBulkIO.h"
 
+#include "P_ProtocolNetAccept.h"
 #include "P_SSLNetVConnection.h"
 #include "P_SSLNetProcessor.h"
 #include "P_SSLNetAccept.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_NetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h
index 3a82e4b..762a601 100644
--- a/iocore/net/P_NetAccept.h
+++ b/iocore/net/P_NetAccept.h
@@ -106,11 +106,13 @@ struct NetAccept:public Continuation
   virtual UnixNetVConnection *allocateThread(EThread *t);
   virtual void freeThread(UnixNetVConnection *vc, EThread *t);
   virtual UnixNetVConnection *allocateGlobal();
+  virtual UnixNetVConnection *createSuitableVC(EThread *t, Connection &con);
   virtual EventType getEtype();
 
   void init_accept_loop(const char *);
   virtual void init_accept(EThread * t = NULL);
   virtual void init_accept_per_thread();
+  virtual NetAccept *clone();
   // 0 == success
   int do_listen(bool non_blocking, bool transparent = false);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_ProtocolAcceptCont.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_ProtocolAcceptCont.h b/iocore/net/P_ProtocolAcceptCont.h
new file mode 100644
index 0000000..7631e5c
--- /dev/null
+++ b/iocore/net/P_ProtocolAcceptCont.h
@@ -0,0 +1,50 @@
+/** @file
+
+  ProtocolAcceptCont
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#ifndef P_ProtocolAcceptCont_H_
+#define P_ProtocolAcceptCont_H_
+
+#include "I_AcceptCont.h"
+
+class ProtocolAcceptCont: public AcceptCont
+{
+public:
+  ProtocolAcceptCont(): AcceptCont(NULL)
+  {
+    memset(endpoint, 0, TS_PROTO_MAX * sizeof(AcceptCont *));
+    SET_HANDLER(&ProtocolAcceptCont::mainEvent);
+  }
+  ~ProtocolAcceptCont() {}
+
+  void *createNetAccept();
+  void registerEndpoint(TSProtoType type, Continuation *ep);
+
+private:
+  int mainEvent(int event, void * netvc);
+  ProtocolAcceptCont(const ProtocolAcceptCont &); // disabled
+  ProtocolAcceptCont& operator =(const ProtocolAcceptCont&); // disabled
+
+  Continuation *endpoint[TS_PROTO_MAX];
+};
+
+#endif /* P_ProtocolAcceptCont_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_ProtocolNetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_ProtocolNetAccept.h b/iocore/net/P_ProtocolNetAccept.h
new file mode 100644
index 0000000..ac49571
--- /dev/null
+++ b/iocore/net/P_ProtocolNetAccept.h
@@ -0,0 +1,62 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+/****************************************************************************
+
+  P_ProtocolNetAccept.h
+
+
+   NetAccept is a generalized facility which allows
+   Connections of different classes to be accepted either
+   from a blockable thread or by adaptive polling.
+
+   It is used by the NetProcessor and the ClusterProcessor
+   and should be considered PRIVATE to processor implementations.
+
+
+
+ ****************************************************************************/
+#if !defined (_ProtocolNetAccept_h_)
+#define _ProtocolNetAccept_h_
+
+#include "libts.h"
+#include "P_NetAccept.h"
+#include "P_Connection.h"
+
+class Event;
+class UnixNetVConnection;
+
+//
+// NetAccept
+// Handles accepting connections.
+//
+struct ProtocolNetAccept: public NetAccept
+{
+  virtual UnixNetVConnection *createSuitableVC(EThread *t, Connection &con);
+  virtual NetAccept *clone();
+
+  ProtocolNetAccept() {}
+  virtual ~ProtocolNetAccept() {}
+
+};
+#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_SSLNetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetAccept.h b/iocore/net/P_SSLNetAccept.h
index e9a8f7b..6d963a3 100644
--- a/iocore/net/P_SSLNetAccept.h
+++ b/iocore/net/P_SSLNetAccept.h
@@ -57,6 +57,7 @@ struct SSLNetAccept: public NetAccept
   virtual UnixNetVConnection *allocateGlobal();
   virtual EventType getEtype();
   virtual void init_accept_per_thread();
+  virtual NetAccept *clone();
 
   SSLNetAccept()
     { };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_SSLNextProtocolAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNextProtocolAccept.h b/iocore/net/P_SSLNextProtocolAccept.h
index c3ee575..342485a 100644
--- a/iocore/net/P_SSLNextProtocolAccept.h
+++ b/iocore/net/P_SSLNextProtocolAccept.h
@@ -31,7 +31,7 @@
 #include "P_SSLNextProtocolSet.h"
 #include "I_IOBuffer.h"
 
-class SSLNextProtocolAccept: public Continuation
+class SSLNextProtocolAccept: public AcceptCont
 {
 public:
   SSLNextProtocolAccept(Continuation *);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_SSLNextProtocolSet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNextProtocolSet.h b/iocore/net/P_SSLNextProtocolSet.h
index e25f50d..d3c37b6 100644
--- a/iocore/net/P_SSLNextProtocolSet.h
+++ b/iocore/net/P_SSLNextProtocolSet.h
@@ -40,7 +40,7 @@ public:
   bool advertiseProtocols(const unsigned char ** out, unsigned * len) const;
 
   Continuation * findEndpoint(const char *) const;
-  Continuation * findEndpoint(const unsigned char *, unsigned, TSClientProtoStack *) const;
+  Continuation * findEndpoint(const unsigned char *, unsigned, TSClientProtoStack *, const char **) const;
 
   struct NextProtocolEndpoint
   {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/P_UnixNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index abdf4ba..0e4eae8 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -41,6 +41,13 @@ class UnixNetVConnection;
 class NetHandler;
 struct PollDescriptor;
 
+enum SpdyProbeState
+{
+  SPDY_PROBE_STATE_NONE,
+  SPDY_PROBE_STATE_BEGIN,
+  SPDY_PROBE_STATE_END
+};
+
 TS_INLINE void
 NetVCOptions::reset()
 {
@@ -233,6 +240,8 @@ public:
   ink_hrtime submit_time;
   OOB_callback *oob_ptr;
   bool from_accept_thread;
+  SpdyProbeState probe_state;
+  const char *selected_next_protocol;
 
   int startEvent(int event, Event *e);
   int acceptEvent(int event, Event *e);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/ProtocolAcceptCont.cc
----------------------------------------------------------------------
diff --git a/iocore/net/ProtocolAcceptCont.cc b/iocore/net/ProtocolAcceptCont.cc
new file mode 100644
index 0000000..2e73b77
--- /dev/null
+++ b/iocore/net/ProtocolAcceptCont.cc
@@ -0,0 +1,73 @@
+/** @file
+
+  ProtocolAcceptCont
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "P_ProtocolAcceptCont.h"
+#include "P_SSLNextProtocolAccept.h"
+#include "P_Net.h"
+#include "I_Machine.h"
+#include "Error.h"
+
+void *
+ProtocolAcceptCont::createNetAccept()
+{
+  return ((NetAccept *) NEW(new ProtocolNetAccept));
+}
+
+void
+ProtocolAcceptCont::registerEndpoint(TSProtoType type, Continuation *ep)
+{
+  endpoint[type] = ep;
+}
+
+int
+ProtocolAcceptCont::mainEvent(int event, void *netvc)
+{
+  ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
+  ink_release_assert((event == NET_EVENT_ACCEPT) ? (netvc!= 0) : (1));
+
+  if (event == NET_EVENT_ACCEPT) {
+    TSProtoType proto_type;
+    UnixNetVConnection *vc = (UnixNetVConnection *)netvc;
+
+    if (vc->proto_stack & (1u << TS_PROTO_TLS)) {
+      proto_type = TS_PROTO_TLS;
+    } else if (vc->proto_stack & (1u << TS_PROTO_HTTP)) {
+      proto_type = TS_PROTO_HTTP;
+    } else if (vc->proto_stack & (1u << TS_PROTO_SPDY)) {
+      proto_type = TS_PROTO_SPDY;
+    } else {
+      Warning("Invalid protocol stack:%x", vc->proto_stack);
+      return EVENT_CONT;
+    }
+
+    if (endpoint[proto_type])
+      endpoint[proto_type]->handleEvent(NET_EVENT_ACCEPT, netvc);
+    else
+      Warning("Unregistered protocol type:%x", proto_type);
+
+    return EVENT_CONT;
+  }
+
+  MachineFatal("Protocol Accept received fatal error: errno = %d", -((int)(intptr_t)netvc));
+  return EVENT_CONT;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/ProtocolNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/ProtocolNetAccept.cc b/iocore/net/ProtocolNetAccept.cc
new file mode 100644
index 0000000..c4257e2
--- /dev/null
+++ b/iocore/net/ProtocolNetAccept.cc
@@ -0,0 +1,68 @@
+/** @file
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "ink_config.h"
+#include "P_Net.h"
+#include "P_ProtocolNetAccept.h"
+
+UnixNetVConnection *
+ProtocolNetAccept::createSuitableVC(EThread *t, Connection &con)
+{
+  UnixNetVConnection *vc;
+
+  if (etype == SSLNetProcessor::ET_SSL && etype) {
+    // SSL protocol
+    if (t)
+      vc = (UnixNetVConnection *)THREAD_ALLOC(sslNetVCAllocator, t);
+    else
+      vc = (UnixNetVConnection *)sslNetVCAllocator.alloc();
+    vc->proto_stack = (1u << TS_PROTO_TLS);
+  } else {
+    if (t)
+      vc = THREAD_ALLOC(netVCAllocator, t);
+    else
+      vc = netVCAllocator.alloc();
+
+#if TS_HAS_SPDY
+    vc->probe_state = SPDY_PROBE_STATE_BEGIN;
+#else
+    vc->probe_state = SPDY_PROBE_STATE_NONE;
+#endif
+
+    //
+    // Protocol stack may be changed by
+    // following call of SpdyProbe()
+    //
+    vc->proto_stack = (1u << TS_PROTO_HTTP);
+  }
+
+  vc->con = con;
+  return vc;
+}
+
+NetAccept *
+ProtocolNetAccept::clone()
+{
+  NetAccept *na;
+  na = NEW(new ProtocolNetAccept);
+  *na = *this;
+  return na;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/SSLNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetAccept.cc b/iocore/net/SSLNetAccept.cc
index a321f89..6aa5ed9 100644
--- a/iocore/net/SSLNetAccept.cc
+++ b/iocore/net/SSLNetAccept.cc
@@ -70,10 +70,9 @@ SSLNetAccept::init_accept_per_thread()
   NetAccept *a = this;
   n = eventProcessor.n_threads_for_type[SSLNetProcessor::ET_SSL];
   for (i = 0; i < n; i++) {
-    if (i < n - 1) {
-      a = NEW(new SSLNetAccept);
-      *a = *this;
-    } else
+    if (i < n - 1)
+      a = clone();
+    else
       a = this;
     EThread *t = eventProcessor.eventthread[SSLNetProcessor::ET_SSL][i];
 
@@ -84,3 +83,12 @@ SSLNetAccept::init_accept_per_thread()
     t->schedule_every(a, period, etype);
   }
 }
+
+NetAccept *
+SSLNetAccept::clone()
+{
+  NetAccept *na;
+  na = NEW(new SSLNetAccept);
+  *na = *this;
+  return na;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index b55dcf7..3925de9 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -578,7 +578,8 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
         // If there's no NPN set, we should not have done this negotiation.
         ink_assert(this->npnSet != NULL);
 
-        this->npnEndpoint = this->npnSet->findEndpoint(proto, len, &this->proto_stack);
+        this->npnEndpoint = this->npnSet->findEndpoint(proto, len, &this->proto_stack,
+                                                       &this->selected_next_protocol);
         this->npnSet = NULL;
 
         ink_assert(this->npnEndpoint != NULL);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/SSLNextProtocolAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolAccept.cc b/iocore/net/SSLNextProtocolAccept.cc
index bfc2f0b..746995b 100644
--- a/iocore/net/SSLNextProtocolAccept.cc
+++ b/iocore/net/SSLNextProtocolAccept.cc
@@ -147,7 +147,7 @@ SSLNextProtocolAccept::unregisterEndpoint(
 }
 
 SSLNextProtocolAccept::SSLNextProtocolAccept(Continuation * ep)
-    : Continuation(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep)
+    : AcceptCont(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep)
 {
   SET_HANDLER(&SSLNextProtocolAccept::mainEvent);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/SSLNextProtocolSet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index 148a6d1..ed0a5e3 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -133,7 +133,8 @@ SSLNextProtocolSet::unregisterEndpoint(const char * proto, Continuation * ep)
 
 Continuation *
 SSLNextProtocolSet::findEndpoint(const unsigned char * proto, unsigned len,
-                                 TSClientProtoStack *proto_stack) const
+                                 TSClientProtoStack *proto_stack,
+                                 const char **selected_protocol) const
 {
   for (const NextProtocolEndpoint * ep = this->endpoints.head;
         ep != NULL; ep = this->endpoints.next(ep)) {
@@ -141,6 +142,8 @@ SSLNextProtocolSet::findEndpoint(const unsigned char * proto, unsigned len,
     if (sz == len && memcmp(ep->protocol, proto, len) == 0) {
       if (proto_stack)
         *proto_stack = ep->proto_stack;
+      if (selected_protocol)
+        *selected_protocol = ep->protocol;
       return ep->endpoint;
     }
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index c038a2e..af4d8f9 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -223,10 +223,9 @@ NetAccept::init_accept_per_thread()
   NetAccept *a;
   n = eventProcessor.n_threads_for_type[ET_NET];
   for (i = 0; i < n; i++) {
-    if (i < n - 1) {
-      a = NEW(new NetAccept);
-      *a = *this;
-    } else
+    if (i < n - 1)
+      a = clone();
+    else
       a = this;
     EThread *t = eventProcessor.eventthread[ET_NET][i];
     PollDescriptor *pd = get_PollDescriptor(t);
@@ -237,6 +236,14 @@ NetAccept::init_accept_per_thread()
   }
 }
 
+NetAccept *
+NetAccept::clone()
+{
+  NetAccept *na;
+  na = NEW(new NetAccept);
+  *na = *this;
+  return na;
+}
 
 int
 NetAccept::do_listen(bool non_blocking, bool transparent)
@@ -264,6 +271,20 @@ NetAccept::do_listen(bool non_blocking, bool transparent)
   return res;
 }
 
+UnixNetVConnection *
+NetAccept::createSuitableVC(EThread *t, Connection &con)
+{
+  UnixNetVConnection *vc;
+
+  if (t)
+    vc = allocateThread(t);
+  else
+    vc = allocateGlobal();
+
+  vc->con = con;
+
+  return vc;
+}
 
 int
 NetAccept::do_blocking_accept(EThread * t)
@@ -271,18 +292,11 @@ NetAccept::do_blocking_accept(EThread * t)
   int res = 0;
   int loop = accept_till_done;
   UnixNetVConnection *vc = NULL;
+  Connection con;
 
   //do-while for accepting all the connections
   //added by YTS Team, yamsat
   do {
-    vc = (UnixNetVConnection *)alloc_cache;
-    if (likely(!vc)) {
-      //vc = allocateThread(t);
-      vc = allocateGlobal(); // Bypass proxy / thread allocator
-      vc->from_accept_thread = true;
-      vc->id = net_next_connection_number();
-      alloc_cache = vc;
-    }
     ink_hrtime now = ink_get_hrtime();
 
     // Throttle accepts
@@ -297,7 +311,7 @@ NetAccept::do_blocking_accept(EThread * t)
       now = ink_get_hrtime();
     }
 
-    if ((res = server.accept(&vc->con)) < 0) {
+    if ((res = server.accept(&con)) < 0) {
     Lerror:
       int seriousness = accept_error_seriousness(res);
       if (seriousness >= 0) {   // not so bad
@@ -314,16 +328,23 @@ NetAccept::do_blocking_accept(EThread * t)
       }
       return -1;
     }
-    check_emergency_throttle(vc->con);
+
+    // Use 'NULL' to Bypass thread allocator
+    vc = createSuitableVC(NULL, con);
+    if (!vc)
+      return -1;
+    vc->from_accept_thread = true;
+    vc->id = net_next_connection_number();
     alloc_cache = NULL;
 
+    check_emergency_throttle(con);
+
     NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
     vc->submit_time = now;
     ats_ip_copy(&vc->server_addr, &vc->con.addr);
     vc->set_is_transparent(server.f_inbound_transparent);
     vc->mutex = new_ProxyMutex();
     vc->action_ = *action_;
-    vc->proto_stack = (1u << TS_PROTO_HTTP);
     SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::acceptEvent);
     //eventProcessor.schedule_imm(vc, getEtype());
     eventProcessor.schedule_imm_signal(vc, getEtype());
@@ -384,6 +405,7 @@ NetAccept::acceptFastEvent(int event, void *ep)
   (void) event;
   (void) e;
   int bufsz, res;
+  Connection con;
 
   PollDescriptor *pd = get_PollDescriptor(e->ethread);
   UnixNetVConnection *vc = NULL;
@@ -394,10 +416,10 @@ NetAccept::acceptFastEvent(int event, void *ep)
       ifd = -1;
       return EVENT_CONT;
     }
-    vc = allocateThread(e->ethread);
 
-    socklen_t sz = sizeof(vc->con.addr);
-    int fd = socketManager.accept(server.fd, &vc->con.addr.sa, &sz);
+    socklen_t sz = sizeof(con.addr);
+    int fd = socketManager.accept(server.fd, &con.addr.sa, &sz);
+    con.fd = fd;
 
     if (likely(fd >= 0)) {
       Debug("iocore_net", "accepted a new socket: %d", fd);
@@ -443,6 +465,11 @@ NetAccept::acceptFastEvent(int event, void *ep)
       do {
         res = safe_nonblocking(fd);
       } while (res < 0 && (errno == EAGAIN || errno == EINTR));
+
+      vc = createSuitableVC(e->ethread, con);
+      if (!vc)
+        goto Ldone;
+
     } else {
       res = fd;
     }
@@ -453,20 +480,15 @@ NetAccept::acceptFastEvent(int event, void *ep)
           || res == -EPIPE
 #endif
         ) {
-        ink_assert(vc->con.fd == NO_FD);
-        ink_assert(!vc->link.next && !vc->link.prev);
-        freeThread(vc, e->ethread);
         goto Ldone;
       } else if (accept_error_seriousness(res) >= 0) {
         check_transient_accept_error(res);
-        freeThread(vc, e->ethread);
         goto Ldone;
       }
       if (!action_->cancelled)
         action_->continuation->handleEvent(EVENT_ERROR, (void *)(intptr_t)res);
       goto Lerror;
     }
-    vc->con.fd = fd;
 
     NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
     vc->id = net_next_connection_number();
@@ -478,7 +500,6 @@ NetAccept::acceptFastEvent(int event, void *ep)
     vc->thread = e->ethread;
 
     vc->nh = get_NetHandler(e->ethread);
-    vc->proto_stack = (1u << TS_PROTO_HTTP);
 
     SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::mainEvent);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index eaae439..ce59bbe 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -46,6 +46,7 @@ NetProcessor::AcceptOptions::reset()
   packet_mark = 0;
   packet_tos = 0;
   f_inbound_transparent = false;
+  create_default_NetAccept = true;
   return *this;
 }
 
@@ -84,16 +85,22 @@ NetProcessor::main_accept(Continuation *cont, SOCKET fd, AcceptOptions const& op
 Action *
 UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions const& opt)
 {
-  EventType et = opt.etype; // setEtype requires non-const ref.
-  NetAccept *na = createNetAccept();
+  EventType upgraded_etype = opt.etype; // setEtype requires non-const ref.
+  AcceptCont *acceptCont = static_cast<AcceptCont *>(cont);
   EThread *thread = this_ethread();
   ProxyMutex *mutex = thread->mutex;
   int accept_threads = opt.accept_threads; // might be changed.
   IpEndpoint accept_ip; // local binding address.
   char thr_name[MAX_THREAD_NAME_LENGTH];
 
+  NetAccept *na;
+  if (opt.create_default_NetAccept)
+    na = createNetAccept();
+  else
+    na = (NetAccept *)acceptCont->createNetAccept();
+
   // Potentially upgrade to SSL.
-  upgradeEtype(et);
+  upgradeEtype(upgraded_etype);
 
   // Fill in accept thread from configuration if necessary.
   if (opt.accept_threads < 0) {
@@ -137,7 +144,7 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
   na->sockopt_flags = opt.sockopt_flags;
   na->packet_mark = opt.packet_mark;
   na->packet_tos = opt.packet_tos;
-  na->etype = opt.etype;
+  na->etype = upgraded_etype;
   na->backdoor = opt.backdoor;
   if (na->callback_on_open)
     na->mutex = cont->mutex;
@@ -147,7 +154,10 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
         NetAccept *a;
 
         for (int i=1; i < accept_threads; ++i) {
-          a = createNetAccept();
+          if (opt.create_default_NetAccept)
+            a = createNetAccept();
+          else
+            a = (NetAccept *)acceptCont->createNetAccept();
           *a = *na;
           snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i-1, ats_ip_port_host_order(&accept_ip));
           a->init_accept_loop(thr_name);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/iocore/net/UnixNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index bf1dc0a..8a919c5 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -38,6 +38,84 @@ typedef struct iovec IOVec;
 #define NET_MAX_IOV UIO_MAXIOV
 #endif
 
+struct SpdyProbeCont:public Continuation
+{
+  MIOBuffer buf;
+  unsigned char data;
+  SpdyProbeCont(): data(0)
+  {
+    SET_HANDLER(&SpdyProbeCont::mainEvent);
+  }
+
+  int mainEvent(int event, void *e);
+};
+
+static ClassAllocator<SpdyProbeCont> spdyProberContAllocator("spdyProberContAllocator");
+
+SpdyProbeCont *
+new_SpdyProbeCont(UnixNetVConnection *vc)
+{
+  SpdyProbeCont *c = spdyProberContAllocator.alloc();
+  c->buf.clear();
+  c->buf.set(&c->data, sizeof c->data);
+  c->buf._writer->fill(-(sizeof c->data));
+  c->mutex = vc->mutex;
+  return c;
+}
+void
+free_SpdyProbeCont(SpdyProbeCont *c)
+{
+  c->mutex.clear();
+  c->buf.clear();
+  spdyProberContAllocator.free(c);
+}
+
+inline int
+SpdyProbeCont::mainEvent(int event, void *e) {
+  UnixNetVConnection *vc = (UnixNetVConnection *) ((VIO *) e)->vc_server;
+  vc->probe_state = SPDY_PROBE_STATE_END;
+
+  switch (event) {
+  case VC_EVENT_EOS:
+  case VC_EVENT_ERROR:
+  case VC_EVENT_INACTIVITY_TIMEOUT:
+  case VC_EVENT_ACTIVE_TIMEOUT:
+    vc->do_io_close();
+    free_SpdyProbeCont(this);
+    return EVENT_DONE;
+  case VC_EVENT_READ_COMPLETE:
+    if ((data & 0x80) != 0) {
+      //
+      // SPDY Request
+      //
+      free_SpdyProbeCont(this);
+      vc->proto_stack = (1u << TS_PROTO_SPDY);
+      vc->action_.continuation->handleEvent(NET_EVENT_ACCEPT, vc);
+      return EVENT_DONE;
+    } else {
+      //
+      // HTTP Request
+      //
+      free_SpdyProbeCont(this);
+      vc->action_.continuation->handleEvent(NET_EVENT_ACCEPT, vc);
+      return EVENT_DONE;
+    }
+  default:
+    ink_release_assert(!"unexpected event");
+  }
+  return EVENT_CONT;
+}
+
+int SpdyProbeStart(UnixNetVConnection *vc)
+{
+  SpdyProbeCont *spdyProbeCont= new_SpdyProbeCont(vc);
+  //
+  // TODO: make it configurable
+  //
+  vc->set_inactivity_timeout(HRTIME_SECONDS(30));
+  vc->do_io_read(spdyProbeCont, 1, &spdyProbeCont->buf);
+  return EVENT_CONT;
+}
 // Global
 ClassAllocator<UnixNetVConnection> netVCAllocator("netVCAllocator");
 
@@ -259,8 +337,12 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
         }
         b = b->next;
       }
+      ink_assert(vc->probe_state != SPDY_PROBE_STATE_BEGIN || niov == 1);
       if (niov == 1) {
-        r = socketManager.read(vc->con.fd, tiovec[0].iov_base, tiovec[0].iov_len);
+        if (vc->probe_state == SPDY_PROBE_STATE_BEGIN) {
+          r = recv(vc->con.fd, tiovec[0].iov_base, tiovec[0].iov_len, MSG_PEEK);
+        } else
+          r = socketManager.read(vc->con.fd, tiovec[0].iov_base, tiovec[0].iov_len);
       } else {
         r = socketManager.readv(vc->con.fd, &tiovec[0], niov);
       }
@@ -801,7 +883,8 @@ UnixNetVConnection::UnixNetVConnection()
 #endif
     active_timeout(NULL), nh(NULL),
     id(0), flags(0), recursion(0), submit_time(0), oob_ptr(0),
-    from_accept_thread(false)
+    from_accept_thread(false), probe_state(SPDY_PROBE_STATE_NONE),
+    selected_next_protocol(NULL)
 {
   memset(&local_addr, 0, sizeof local_addr);
   memset(&server_addr, 0, sizeof server_addr);
@@ -988,7 +1071,13 @@ UnixNetVConnection::acceptEvent(int event, Event *e)
     UnixNetVConnection::set_inactivity_timeout(inactivity_timeout_in);
   if (active_timeout_in)
     UnixNetVConnection::set_active_timeout(active_timeout_in);
-  action_.continuation->handleEvent(NET_EVENT_ACCEPT, this);
+  if (probe_state == SPDY_PROBE_STATE_NONE)
+    action_.continuation->handleEvent(NET_EVENT_ACCEPT, this);
+  else {
+    ink_assert(probe_state == SPDY_PROBE_STATE_BEGIN);
+    SpdyProbeStart(this);
+  }
+
   return EVENT_DONE;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/lib/ts/apidefs.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index 86a650f..0356921 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -117,6 +117,9 @@ extern "C"
     TS_PROTO_SPDY = 13,
     TS_PROTO_RTMP = 14,
     TS_PROTO_WBSK = 15, /* WebSocket */
+
+    /* MAX value of TSProtoType  */
+    TS_PROTO_MAX
   } TSProtoType;
 
   typedef uint32_t TSClientProtoStack;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 00a78e1..682f889 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -51,7 +51,7 @@
 #include "PluginVC.h"
 #include "api/ts/experimental.h"
 #include "ICP.h"
-#include "HttpAccept.h"
+#include "HttpAcceptCont.h"
 #include "PluginVC.h"
 #include "FetchSM.h"
 #include "HttpDebugNames.h"
@@ -6082,8 +6082,8 @@ TSHttpAltInfoQualitySet(TSHttpAltInfo infop, float quality)
   info->m_qvalue = quality;
 }
 
-extern HttpAccept *plugin_http_accept;
-extern HttpAccept *plugin_http_transparent_accept;
+extern HttpAcceptCont *plugin_http_accept;
+extern HttpAcceptCont *plugin_http_transparent_accept;
 
 TSVConn
 TSHttpConnect(sockaddr const* addr)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 8ef6104..6dfc816 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -17,7 +17,7 @@
 #  limitations under the License.
 
 # Note that hdrs is targeted from ../Makefile.am
-SUBDIRS = congest http logging config
+SUBDIRS = congest http spdy logging config
 noinst_LIBRARIES =
 bin_PROGRAMS = \
   traffic_server \
@@ -52,11 +52,10 @@ noinst_HEADERS = \
   ConfigParse.h \
   Show.h
 
-
 if STATIC_LIBTS
-   which_libts = $(top_builddir)/lib/ts/.libs/libtsutil.a
+    which_libts = $(top_builddir)/lib/ts/.libs/libtsutil.a
 else
-   which_libts = $(top_builddir)/lib/ts/libtsutil.la
+    which_libts = $(top_builddir)/lib/ts/libtsutil.la
 endif
 
 EXTRA_DIST = InkAPITestTool.cc example_alarm_bin.sh example_prep.sh
@@ -121,6 +120,7 @@ endif
 traffic_server_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 traffic_server_LDADD = \
   http/libhttp.a \
+  spdy/libspdy.a \
   http/remap/libhttp_remap.a \
   congest/libCongestionControl.a \
   logging/liblogging.a \
@@ -157,6 +157,7 @@ traffic_server_LDADD = \
   @LIBZ@ \
   @LIBLZMA@ \
   @LIBPROFILER@ \
+  @SPDYLAY_LIBS@ \
   -lm
 
 if BUILD_LUA_SUPPORT
@@ -223,6 +224,7 @@ traffic_sac_SOURCES = \
 traffic_sac_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 traffic_sac_LDADD = \
   http/libhttp.a \
+  spdy/libspdy.a \
   shared/libdiagsconfig.a \
   http/remap/libhttp_remap.a \
   congest/libCongestionControl.a \
@@ -247,7 +249,7 @@ traffic_sac_LDADD = \
   $(top_builddir)/lib/records/librecprocess.a \
   $(top_builddir)/lib/ts/libtsutil.la \
   @LIBRESOLV@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBTCL@ @hwloc_LIBS@ \
-  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ -lm
+  @LIBEXPAT@ @LIBDEMANGLE@ @LIBZ@ @LIBLZMA@ @LIBPROFILER@ @SPDYLAY_LIBS@ -lm
 
 if BUILD_TESTS
   traffic_sac_SOURCES += RegressionSM.cc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/SocksProxy.cc
----------------------------------------------------------------------
diff --git a/proxy/SocksProxy.cc b/proxy/SocksProxy.cc
index e447f12..d855689 100644
--- a/proxy/SocksProxy.cc
+++ b/proxy/SocksProxy.cc
@@ -31,7 +31,7 @@
 #include "StatSystem.h"
 #include "P_Net.h"
 #include "I_OneWayTunnel.h"
-#include "HttpAccept.h"
+#include "HttpAcceptCont.h"
 
 enum
 {
@@ -145,14 +145,14 @@ SocksProxy::mainEvent(int event, void *data)
 
     switch (state) {
     case HTTP_REQ:{
-      HttpAccept::Options ha_opt;
+      HttpAcceptCont::Options ha_opt;
       //This is a WRITE_COMPLETE. vio->nbytes == vio->ndone is true
 
       SOCKSPROXY_INC_STAT(socksproxy_http_connections_stat);
       Debug("SocksProxy", "Handing over the HTTP request\n");
 
       ha_opt.transport_type = clientVC->attributes;
-      HttpAccept http_accept(ha_opt);
+      HttpAcceptCont http_accept(ha_opt);
       http_accept.mainEvent(NET_EVENT_ACCEPT, clientVC);
       state = ALL_DONE;
       break;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/api/ts/InkAPIPrivateIOCore.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/InkAPIPrivateIOCore.h b/proxy/api/ts/InkAPIPrivateIOCore.h
index 26e3fac..97a9bcd 100644
--- a/proxy/api/ts/InkAPIPrivateIOCore.h
+++ b/proxy/api/ts/InkAPIPrivateIOCore.h
@@ -51,6 +51,10 @@ public:
 
   void handle_event_count(int event);
   int handle_event(int event, void *edata);
+  virtual void *createNetAccept()
+  {
+    return (NEW(new NetAccept));
+  }
 
 public:
   void *mdata;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/HttpAccept.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAccept.cc b/proxy/http/HttpAccept.cc
deleted file mode 100644
index 9fb0066..0000000
--- a/proxy/http/HttpAccept.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "HttpAccept.h"
-#include "IPAllow.h"
-#include "HttpClientSession.h"
-#include "I_Machine.h"
-#include "Error.h"
-
-int
-HttpAccept::mainEvent(int event, void *data)
-{
-  ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
-  ink_release_assert((event == NET_EVENT_ACCEPT) ? (data != 0) : (1));
-
-  if (event == NET_EVENT_ACCEPT) {
-    ////////////////////////////////////////////////////
-    // if client address forbidden, close immediately //
-    ////////////////////////////////////////////////////
-    NetVConnection *netvc = static_cast<NetVConnection *>(data);
-    sockaddr const* client_ip = netvc->get_remote_addr();
-    uint32_t acl_method_mask = 0;
-    ip_port_text_buffer ipb;
-    IpAllow::scoped_config ipallow;
-
-    // The backdoor port is now only bound to "localhost", so no
-    // reason to check for if it's incoming from "localhost" or not.
-    if (backdoor) {
-      acl_method_mask = IpAllow::AllMethodMask();
-    } else if (ipallow && ((acl_method_mask = ipallow->match(client_ip)) == 0)) {
-      Warning("client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
-      netvc->do_io_close();
-
-      return VC_EVENT_CONT;
-    }
-
-    netvc->attributes = transport_type;
-
-    if (is_debug_tag_set("http_seq"))
-      Debug("http_seq", "[HttpAccept:mainEvent %p] accepted connection from %s transport type = %d", netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
-
-    HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
-
-   // copy over session related data.
-    new_session->f_outbound_transparent = f_outbound_transparent;
-    new_session->f_transparent_passthrough = f_transparent_passthrough;
-    new_session->outbound_ip4 = outbound_ip4;
-    new_session->outbound_ip6 = outbound_ip6;
-    new_session->outbound_port = outbound_port;
-    new_session->host_res_style = ats_host_res_from(client_ip->sa_family, host_res_preference);
-    new_session->acl_method_mask = acl_method_mask;
-
-    new_session->new_connection(netvc, backdoor);
-
-    return EVENT_CONT;
-  }
-
-  /////////////////
-  // EVENT_ERROR //
-  /////////////////
-  if (((long) data) == -ECONNABORTED) {
-    /////////////////////////////////////////////////
-    // Under Solaris, when accept() fails and sets //
-    // errno to EPROTO, it means the client has    //
-    // sent a TCP reset before the connection has  //
-    // been accepted by the server...  Note that   //
-    // in 2.5.1 with the Internet Server Supplement//
-    // and also in 2.6 the errno for this case has //
-    // changed from EPROTO to ECONNABORTED.        //
-    /////////////////////////////////////////////////
-
-    // FIX: add time to user_agent_hangup
-    HTTP_SUM_DYN_STAT(http_ua_msecs_counts_errors_pre_accept_hangups_stat, 0);
-  }
-
-  MachineFatal("HTTP accept received fatal error: errno = %d", -((int)(intptr_t)data));
-  return EVENT_CONT;
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/HttpAccept.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAccept.h b/proxy/http/HttpAccept.h
deleted file mode 100644
index 30d68e6..0000000
--- a/proxy/http/HttpAccept.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#if !defined (_HttpAccept_h_)
-#define _HttpAccept_h_
-
-#include "libts.h"
-#include "P_EventSystem.h"
-#include "HttpConfig.h"
-#include "HTTP.h"
-
-namespace detail {
-  /** Options for @c HttpAccept.
-
-      @internal This is done as a separate class for two reasons.
-
-      The first is that in current usage many instances are created
-      with the same options so (for the client) this is easier and
-      more efficient than passing options directly to the @c
-      HttpAccept or calling setters.
-
-      The second is that @c HttpAccept is not provided with any thread
-      safety because it is intended as an immutable object. Putting
-      the setters here and not there makes that clearer.
-
-      We don't do this directly as nested class because we want to
-      inherit the data members rather than duplicate the declarations
-      and initializations.
-   */
-  class HttpAcceptOptions {
-  private:
-    typedef HttpAcceptOptions self; ///< Self reference type.
-  public:
-    HttpAcceptOptions();
-
-    // Connection type (HttpProxyPort::TransportType)
-    int transport_type;
-    /// Set the transport type.
-    self& setTransportType(int);
-    /// Local address to bind for outbound connections.
-    IpAddr outbound_ip4;
-    /// Local address to bind for outbound connections.
-    IpAddr outbound_ip6;
-    /// Set the outbound IP address to @a ip.
-    self& setOutboundIp(IpAddr& ip);
-    /// Set the outbound IP address to @a ip.
-    self& setOutboundIp(IpEndpoint* ip);
-    /// Local port for outbound connection.
-    uint16_t outbound_port;
-    /// Set outbound port.
-    self& setOutboundPort(uint16_t);
-    /// Outbound transparent.
-    bool f_outbound_transparent;
-    /// Set outbound transparency.
-    self& setOutboundTransparent(bool);
-    /// Transparent pass-through.
-    bool f_transparent_passthrough;
-    /// Set transparent passthrough.
-    self& setTransparentPassthrough(bool);
-    /// Accepting backdoor connections.
-    bool backdoor;
-    /// Set backdoor accept.
-    self& setBackdoor(bool);
-    /// Host address resolution preference order.
-    HostResPreferenceOrder host_res_preference;
-    /// Set the host query preference.
-    self& setHostResPreference(HostResPreferenceOrder const);
-  };
-
-  inline HttpAcceptOptions::HttpAcceptOptions()
-    : transport_type(0)
-    , outbound_port(0)
-    , f_outbound_transparent(false)
-    , f_transparent_passthrough(false)
-    , backdoor(false)
-  {
-    memcpy(host_res_preference, host_res_default_preference_order, sizeof(host_res_preference));
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setTransportType(int type) {
-    transport_type =  type;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setOutboundIp(IpAddr& ip) {
-    if (ip.isIp4()) outbound_ip4 = ip;
-    else if (ip.isIp6()) outbound_ip6 = ip;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setOutboundIp(IpEndpoint* ip) {
-    if (ip->isIp4()) outbound_ip4 = *ip;
-    else if (ip->isIp6()) outbound_ip6 = *ip;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setOutboundPort(uint16_t port) {
-    outbound_port = port;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setOutboundTransparent(bool flag) {
-    f_outbound_transparent = flag;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setTransparentPassthrough(bool flag) {
-    f_transparent_passthrough = flag;
-    return *this;
-  }
-
- inline HttpAcceptOptions&
-  HttpAcceptOptions::setBackdoor(bool flag) {
-    backdoor = flag;
-    return *this;
-  }
-
-  inline HttpAcceptOptions&
-  HttpAcceptOptions::setHostResPreference(HostResPreferenceOrder const order) {
-    memcpy(host_res_preference, order, sizeof(host_res_preference));
-    return *this;
-  }
-}
-
-/**
-   The continuation mutex is NULL to allow parellel accepts in NT. No
-   state is recorded by the handler and values are required to be set
-   during construction via the @c Options struct and never changed. So
-   a NULL mutex is safe.
-
-   Most of the state is simply passed on to the @c ClientSession after
-   an accept. It is done here because this is the least bad pathway
-   from the top level configuration to the HTTP session.
-*/
-
-class HttpAccept: public Continuation, private detail::HttpAcceptOptions
-{
-private:
-  typedef HttpAccept self; ///< Self reference type.
-public:
-  /** Construction options.
-      Provide an easier to remember typedef for clients.
-  */
-  typedef detail::HttpAcceptOptions Options;
-
-  /** Default constructor.
-    
-      @internal We don't use a static default options object because of
-      initialization order issues. It is important to pick up data that is read
-      from the config file and a static is initialized long before that point.
-  */
-  HttpAccept(Options const& opt = Options())
-    : Continuation(NULL)
-    , detail::HttpAcceptOptions(opt) // copy these.
-  {
-    SET_HANDLER(&HttpAccept::mainEvent);
-    return;
-  }
-
-  ~HttpAccept()
-  {
-    return;
-  }
-
-  int mainEvent(int event, void *netvc);
-
-private:
-    HttpAccept(const HttpAccept &);
-    HttpAccept & operator =(const HttpAccept &);
-};
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/HttpAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAcceptCont.cc b/proxy/http/HttpAcceptCont.cc
new file mode 100644
index 0000000..d3744e7
--- /dev/null
+++ b/proxy/http/HttpAcceptCont.cc
@@ -0,0 +1,98 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "HttpAcceptCont.h"
+#include "IPAllow.h"
+#include "HttpClientSession.h"
+#include "I_Machine.h"
+#include "Error.h"
+
+int
+HttpAcceptCont::mainEvent(int event, void *data)
+{
+  ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
+  ink_release_assert((event == NET_EVENT_ACCEPT) ? (data != 0) : (1));
+
+  if (event == NET_EVENT_ACCEPT) {
+    ////////////////////////////////////////////////////
+    // if client address forbidden, close immediately //
+    ////////////////////////////////////////////////////
+    NetVConnection *netvc = static_cast<NetVConnection *>(data);
+    sockaddr const* client_ip = netvc->get_remote_addr();
+    uint32_t acl_method_mask = 0;
+    ip_port_text_buffer ipb;
+    IpAllow::scoped_config ipallow;
+
+    // The backdoor port is now only bound to "localhost", so no
+    // reason to check for if it's incoming from "localhost" or not.
+    if (backdoor) {
+      acl_method_mask = IpAllow::AllMethodMask();
+    } else if (ipallow && ((acl_method_mask = ipallow->match(client_ip)) == 0)) {
+      Warning("client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
+      netvc->do_io_close();
+
+      return VC_EVENT_CONT;
+    }
+
+    netvc->attributes = transport_type;
+
+    if (is_debug_tag_set("http_seq"))
+      Debug("http_seq", "[HttpAcceptCont:mainEvent %p] accepted connection from %s transport type = %d", netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
+
+    HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
+
+   // copy over session related data.
+    new_session->f_outbound_transparent = f_outbound_transparent;
+    new_session->f_transparent_passthrough = f_transparent_passthrough;
+    new_session->outbound_ip4 = outbound_ip4;
+    new_session->outbound_ip6 = outbound_ip6;
+    new_session->outbound_port = outbound_port;
+    new_session->host_res_style = ats_host_res_from(client_ip->sa_family, host_res_preference);
+    new_session->acl_method_mask = acl_method_mask;
+
+    new_session->new_connection(netvc, backdoor);
+
+    return EVENT_CONT;
+  }
+
+  /////////////////
+  // EVENT_ERROR //
+  /////////////////
+  if (((long) data) == -ECONNABORTED) {
+    /////////////////////////////////////////////////
+    // Under Solaris, when accept() fails and sets //
+    // errno to EPROTO, it means the client has    //
+    // sent a TCP reset before the connection has  //
+    // been accepted by the server...  Note that   //
+    // in 2.5.1 with the Internet Server Supplement//
+    // and also in 2.6 the errno for this case has //
+    // changed from EPROTO to ECONNABORTED.        //
+    /////////////////////////////////////////////////
+
+    // FIX: add time to user_agent_hangup
+    HTTP_SUM_DYN_STAT(http_ua_msecs_counts_errors_pre_accept_hangups_stat, 0);
+  }
+
+  MachineFatal("HTTP accept received fatal error: errno = %d", -((int)(intptr_t)data));
+  return EVENT_CONT;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/HttpAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAcceptCont.h b/proxy/http/HttpAcceptCont.h
new file mode 100644
index 0000000..5b8c437
--- /dev/null
+++ b/proxy/http/HttpAcceptCont.h
@@ -0,0 +1,198 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#if !defined (_HttpAcceptCont_h_)
+#define _HttpAcceptCont_h_
+
+#include "libts.h"
+#include "P_EventSystem.h"
+#include "HttpConfig.h"
+#include "HTTP.h"
+#include "I_Net.h"
+
+namespace detail {
+  /** Options for @c HttpAcceptCont.
+
+      @internal This is done as a separate class for two reasons.
+
+      The first is that in current usage many instances are created
+      with the same options so (for the client) this is easier and
+      more efficient than passing options directly to the @c
+      HttpAcceptCont or calling setters.
+
+      The second is that @c HttpAcceptCont is not provided with any thread
+      safety because it is intended as an immutable object. Putting
+      the setters here and not there makes that clearer.
+
+      We don't do this directly as nested class because we want to
+      inherit the data members rather than duplicate the declarations
+      and initializations.
+   */
+  class HttpAcceptContOptions {
+  private:
+    typedef HttpAcceptContOptions self; ///< Self reference type.
+  public:
+    HttpAcceptContOptions();
+
+    // Connection type (HttpProxyPort::TransportType)
+    int transport_type;
+    /// Set the transport type.
+    self& setTransportType(int);
+    /// Local address to bind for outbound connections.
+    IpAddr outbound_ip4;
+    /// Local address to bind for outbound connections.
+    IpAddr outbound_ip6;
+    /// Set the outbound IP address to @a ip.
+    self& setOutboundIp(IpAddr& ip);
+    /// Set the outbound IP address to @a ip.
+    self& setOutboundIp(IpEndpoint* ip);
+    /// Local port for outbound connection.
+    uint16_t outbound_port;
+    /// Set outbound port.
+    self& setOutboundPort(uint16_t);
+    /// Outbound transparent.
+    bool f_outbound_transparent;
+    /// Set outbound transparency.
+    self& setOutboundTransparent(bool);
+    /// Transparent pass-through.
+    bool f_transparent_passthrough;
+    /// Set transparent passthrough.
+    self& setTransparentPassthrough(bool);
+    /// Accepting backdoor connections.
+    bool backdoor;
+    /// Set backdoor accept.
+    self& setBackdoor(bool);
+    /// Host address resolution preference order.
+    HostResPreferenceOrder host_res_preference;
+    /// Set the host query preference.
+    self& setHostResPreference(HostResPreferenceOrder const);
+  };
+
+  inline HttpAcceptContOptions::HttpAcceptContOptions()
+    : transport_type(0)
+    , outbound_port(0)
+    , f_outbound_transparent(false)
+    , f_transparent_passthrough(false)
+    , backdoor(false)
+  {
+    memcpy(host_res_preference, host_res_default_preference_order, sizeof(host_res_preference));
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setTransportType(int type) {
+    transport_type =  type;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setOutboundIp(IpAddr& ip) {
+    if (ip.isIp4()) outbound_ip4 = ip;
+    else if (ip.isIp6()) outbound_ip6 = ip;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setOutboundIp(IpEndpoint* ip) {
+    if (ip->isIp4()) outbound_ip4 = *ip;
+    else if (ip->isIp6()) outbound_ip6 = *ip;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setOutboundPort(uint16_t port) {
+    outbound_port = port;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setOutboundTransparent(bool flag) {
+    f_outbound_transparent = flag;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setTransparentPassthrough(bool flag) {
+    f_transparent_passthrough = flag;
+    return *this;
+  }
+
+ inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setBackdoor(bool flag) {
+    backdoor = flag;
+    return *this;
+  }
+
+  inline HttpAcceptContOptions&
+  HttpAcceptContOptions::setHostResPreference(HostResPreferenceOrder const order) {
+    memcpy(host_res_preference, order, sizeof(host_res_preference));
+    return *this;
+  }
+}
+
+/**
+   The continuation mutex is NULL to allow parellel accepts in NT. No
+   state is recorded by the handler and values are required to be set
+   during construction via the @c Options struct and never changed. So
+   a NULL mutex is safe.
+
+   Most of the state is simply passed on to the @c ClientSession after
+   an accept. It is done here because this is the least bad pathway
+   from the top level configuration to the HTTP session.
+*/
+
+class HttpAcceptCont: public AcceptCont, private detail::HttpAcceptContOptions
+{
+private:
+  typedef HttpAcceptCont self; ///< Self reference type.
+public:
+  /** Construction options.
+      Provide an easier to remember typedef for clients.
+  */
+  typedef detail::HttpAcceptContOptions Options;
+
+  /** Default constructor.
+      @internal We don't use a static default options object because of
+      initialization order issues. It is important to pick up data that is read
+      from the config file and a static is initialized long before that point.
+  */
+  HttpAcceptCont(Options const& opt = Options())
+    : AcceptCont(NULL)
+    , detail::HttpAcceptContOptions(opt) // copy these.
+  {
+    SET_HANDLER(&HttpAcceptCont::mainEvent);
+    return;
+  }
+
+  ~HttpAcceptCont()
+  {
+    return;
+  }
+
+  int mainEvent(int event, void *netvc);
+
+private:
+    HttpAcceptCont(const HttpAcceptCont &);
+    HttpAcceptCont & operator =(const HttpAcceptCont &);
+};
+
+#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 662856a..8988253 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -26,7 +26,7 @@
 #include "Main.h"
 #include "Error.h"
 #include "HttpConfig.h"
-#include "HttpAccept.h"
+#include "HttpAcceptCont.h"
 #include "ReverseProxy.h"
 #include "HttpSessionManager.h"
 #include "HttpUpdateSM.h"
@@ -35,9 +35,11 @@
 #include "HttpTunnel.h"
 #include "Tokenizer.h"
 #include "P_SSLNextProtocolAccept.h"
+#include "P_ProtocolAcceptCont.h"
+#include "P_SpdyAcceptCont.h"
 
-HttpAccept *plugin_http_accept = NULL;
-HttpAccept *plugin_http_transparent_accept = 0;
+HttpAcceptCont *plugin_http_accept = NULL;
+HttpAcceptCont *plugin_http_transparent_accept = 0;
 
 static SLL<SSLNextProtocolAccept> ssl_plugin_acceptors;
 static ink_mutex ssl_plugin_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -135,9 +137,10 @@ static void
 MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned nthreads)
 {
   NetProcessor::AcceptOptions& net_opt = acceptor._net_opt;
-  HttpAccept::Options         accept_opt;
+  HttpAcceptCont::Options         accept_opt;
 
   net_opt = make_net_accept_options(port, nthreads);
+  net_opt.create_default_NetAccept = false;
   REC_ReadConfigInteger(net_opt.recv_bufsize, "proxy.config.net.sock_recv_buffer_size_in");
   REC_ReadConfigInteger(net_opt.send_bufsize, "proxy.config.net.sock_send_buffer_size_in");
   REC_ReadConfigInteger(net_opt.packet_mark, "proxy.config.net.sock_packet_mark_in");
@@ -160,21 +163,24 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned
     accept_opt.outbound_ip6 = HttpConfig::m_master.outbound_ip6;
   }
 
-  if (port.isSSL()) {
-    HttpAccept * accept = NEW(new HttpAccept(accept_opt));
-    SSLNextProtocolAccept * ssl = NEW(new SSLNextProtocolAccept(accept));
+  HttpAcceptCont *http = NEW(new HttpAcceptCont(accept_opt));
+  SpdyAcceptCont *spdy = NEW(new SpdyAcceptCont(http));
+  SSLNextProtocolAccept *ssl = NEW(new SSLNextProtocolAccept(http));
+  ProtocolAcceptCont *proto = NEW(new ProtocolAcceptCont());
+
+  proto->registerEndpoint(TS_PROTO_TLS, ssl);
+  proto->registerEndpoint(TS_PROTO_HTTP, http);
+  proto->registerEndpoint(TS_PROTO_SPDY, spdy);
 
+  if (port.isSSL()) {
     // ALPN selects the first server-offered protocol, so make sure that we offer HTTP/1.1 first.
-    ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_1, accept);
-    ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_0, accept);
+    ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_1, http);
+    ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_0, http);
 
     ink_scoped_mutex lock(ssl_plugin_mutex);
     ssl_plugin_acceptors.push(ssl);
-
-    acceptor._accept = ssl;
-  } else {
-    acceptor._accept = NEW(new HttpAccept(accept_opt));
   }
+  acceptor._accept = proto;
 }
 
 /** Set up all the accepts and sockets.
@@ -197,14 +203,14 @@ init_HttpProxyServer(int n_accept_threads)
   //   port but without going through the operating system
   //
   if (plugin_http_accept == NULL) {
-    plugin_http_accept = NEW(new HttpAccept);
+    plugin_http_accept = NEW(new HttpAcceptCont);
     plugin_http_accept->mutex = new_ProxyMutex();
   }
   // Same as plugin_http_accept except outbound transparent.
   if (! plugin_http_transparent_accept) {
-    HttpAccept::Options ha_opt;
+    HttpAcceptCont::Options ha_opt;
     ha_opt.setOutboundTransparent(true);
-    plugin_http_transparent_accept = NEW(new HttpAccept(ha_opt));
+    plugin_http_transparent_accept = NEW(new HttpAcceptCont(ha_opt));
     plugin_http_transparent_accept->mutex = new_ProxyMutex();
   }
   ink_mutex_init(&ssl_plugin_mutex, "SSL Acceptor List");
@@ -262,7 +268,7 @@ void
 start_HttpProxyServerBackDoor(int port, int accept_threads)
 {
   NetProcessor::AcceptOptions opt;
-  HttpAccept::Options ha_opt;
+  HttpAcceptCont::Options ha_opt;
 
   opt.local_port = port;
   opt.accept_threads = accept_threads;
@@ -271,5 +277,5 @@ start_HttpProxyServerBackDoor(int port, int accept_threads)
   opt.backdoor = true;
   
   // The backdoor only binds the loopback interface
-  netProcessor.main_accept(NEW(new HttpAccept(ha_opt)), NO_FD, opt);
+  netProcessor.main_accept(NEW(new HttpAcceptCont(ha_opt)), NO_FD, opt);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/http/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am
index c413ed7..a71d287 100644
--- a/proxy/http/Makefile.am
+++ b/proxy/http/Makefile.am
@@ -31,14 +31,15 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/proxy/hdrs \
   -I$(top_srcdir)/proxy/shared \
   -I$(top_srcdir)/proxy/http/remap \
-  -I$(top_srcdir)/proxy/logging
+  -I$(top_srcdir)/proxy/logging \
+  -I$(top_srcdir)/proxy/spdy
 
 noinst_HEADERS = HttpProxyServerMain.h
 noinst_LIBRARIES = libhttp.a
 
 libhttp_a_SOURCES = \
-  HttpAccept.cc \
-  HttpAccept.h \
+  HttpAcceptCont.cc \
+  HttpAcceptCont.h \
   HttpBodyFactory.cc \
   HttpBodyFactory.h \
   HttpCacheSM.cc \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/spdy/Makefile.am b/proxy/spdy/Makefile.am
new file mode 100644
index 0000000..63911e1
--- /dev/null
+++ b/proxy/spdy/Makefile.am
@@ -0,0 +1,38 @@
+# Makefile.am for the traffic/iocore/net hierarchy
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+AM_CPPFLAGS = \
+  $(iocore_include_dirs) \
+  -I$(top_srcdir)/lib \
+  -I$(top_srcdir)/lib/records \
+  -I$(top_srcdir)/lib/ts \
+  -I$(top_srcdir)/proxy \
+  -I$(top_srcdir)/proxy/api \
+  -I$(top_srcdir)/proxy/hdrs \
+  -I$(top_srcdir)/proxy/shared \
+  -I$(top_srcdir)/proxy/spdy \
+  -I$(top_srcdir)/mgmt \
+  -I$(top_srcdir)/mgmt/preparse \
+  -I$(top_srcdir)/mgmt/utils \
+  @SPDYLAY_CFLAGS@
+
+noinst_LIBRARIES = libspdy.a
+
+libspdy_a_SOURCES = \
+  P_SpdyAcceptCont.h \
+  SpdyAcceptCont.cc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/spdy/P_SpdyAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyAcceptCont.h b/proxy/spdy/P_SpdyAcceptCont.h
new file mode 100644
index 0000000..88aea02
--- /dev/null
+++ b/proxy/spdy/P_SpdyAcceptCont.h
@@ -0,0 +1,46 @@
+/** @file
+
+  SpdyAcceptCont
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#ifndef P_SpdyAcceptCont_H_
+#define P_SpdyAcceptCont_H_
+
+#include "P_Net.h"
+#include "P_EventSystem.h"
+#include "P_UnixNet.h"
+#include "I_IOBuffer.h"
+
+class SpdyAcceptCont: public AcceptCont
+{
+public:
+  SpdyAcceptCont(Continuation *ep);
+  ~SpdyAcceptCont() {}
+
+private:
+  int mainEvent(int event, void *netvc);
+  SpdyAcceptCont(const SpdyAcceptCont &); // disabled
+  SpdyAcceptCont& operator =(const SpdyAcceptCont&); // disabled
+
+  Continuation *endpoint;
+};
+
+#endif /* P_SpdyAcceptCont_H_ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f90f3a48/proxy/spdy/SpdyAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyAcceptCont.cc b/proxy/spdy/SpdyAcceptCont.cc
new file mode 100644
index 0000000..b9efc80
--- /dev/null
+++ b/proxy/spdy/SpdyAcceptCont.cc
@@ -0,0 +1,37 @@
+/** @file
+
+  SpdyNetAccept
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "P_SpdyAcceptCont.h"
+
+SpdyAcceptCont::SpdyAcceptCont(Continuation *ep)
+    : AcceptCont(new_ProxyMutex()), endpoint(ep)
+{
+  SET_HANDLER(&SpdyAcceptCont::mainEvent);
+}
+
+int
+SpdyAcceptCont::mainEvent(int event, void *netvc)
+{
+  printf("spdy accepted\n");
+  return 0;
+}


[17/50] [abbrv] git commit: Use URL_REMAP_FOR_OS in preference to 2

Posted by zw...@apache.org.
Use URL_REMAP_FOR_OS in preference to 2


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

Branch: refs/heads/lua_config
Commit: ee82dd80a7599f9864296a49e0a6cae8e6c430e3
Parents: fc974bf
Author: James Peach <jp...@apache.org>
Authored: Tue Mar 18 13:00:39 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 18 13:00:39 2014 -0700

----------------------------------------------------------------------
 proxy/http/HttpSM.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ee82dd80/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index db7a1e0..02ea660 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -6866,7 +6866,7 @@ HttpSM::set_next_state()
         t_state.dns_info.lookup_success = true;
         call_transact_and_set_next_state(NULL);
         break;
-      } else if (url_remap_mode == 2 && t_state.first_dns_lookup) {
+      } else if (url_remap_mode == HttpTransact::URL_REMAP_FOR_OS && t_state.first_dns_lookup) {
         DebugSM("cdn", "Skipping DNS Lookup");
         // skip the DNS lookup
         t_state.first_dns_lookup = false;


[34/50] [abbrv] git commit: Cleanup the configure.ac in some sort of order... Minor.

Posted by zw...@apache.org.
Cleanup the configure.ac in some sort of order... Minor.


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

Branch: refs/heads/lua_config
Commit: 69863546051991aa7486046220219f01fd7f5e1d
Parents: 829be64
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Mar 24 15:21:10 2014 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Mar 24 15:21:10 2014 -0600

----------------------------------------------------------------------
 configure.ac | 62 +++++++++++++++++++++++++++----------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/69863546/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 796158e..7710c5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1930,37 +1930,37 @@ AC_CONFIG_FILES([
   iocore/net/Makefile
   iocore/utils/Makefile
   lib/Makefile
-  lib/records/Makefile
-  lib/ts/Makefile
-  lib/ts/apidefs.h
-  lib/ts/ink_config.h
-  lib/tsconfig/Makefile
   lib/atscppapi/Makefile
-  lib/atscppapi/src/Makefile
   lib/atscppapi/examples/Makefile
-  lib/atscppapi/examples/helloworld/Makefile
-  lib/atscppapi/examples/globalhook/Makefile
-  lib/atscppapi/examples/transactionhook/Makefile
-  lib/atscppapi/examples/multiple_transaction_hooks/Makefile
-  lib/atscppapi/examples/clientrequest/Makefile
-  lib/atscppapi/examples/data_caching/Makefile
-  lib/atscppapi/examples/serverresponse/Makefile
+  lib/atscppapi/examples/async_http_fetch/Makefile
+  lib/atscppapi/examples/async_timer/Makefile
   lib/atscppapi/examples/clientredirect/Makefile
+  lib/atscppapi/examples/clientrequest/Makefile
   lib/atscppapi/examples/customresponse/Makefile
+  lib/atscppapi/examples/data_caching/Makefile
+  lib/atscppapi/examples/globalhook/Makefile
+  lib/atscppapi/examples/gzip_transformation/Makefile
+  lib/atscppapi/examples/helloworld/Makefile
+  lib/atscppapi/examples/intercept/Makefile
+  lib/atscppapi/examples/internal_transaction_handling/Makefile
+  lib/atscppapi/examples/logger_example/Makefile
+  lib/atscppapi/examples/multiple_transaction_hooks/Makefile
   lib/atscppapi/examples/null_transformation_plugin/Makefile
   lib/atscppapi/examples/post_buffer/Makefile
-  lib/atscppapi/examples/logger_example/Makefile
-  lib/atscppapi/examples/stat_example/Makefile
-  lib/atscppapi/examples/async_http_fetch/Makefile
   lib/atscppapi/examples/remap_plugin/Makefile
-  lib/atscppapi/examples/gzip_transformation/Makefile
+  lib/atscppapi/examples/serverresponse/Makefile
+  lib/atscppapi/examples/stat_example/Makefile
   lib/atscppapi/examples/timeout_example/Makefile
-  lib/atscppapi/examples/internal_transaction_handling/Makefile
-  lib/atscppapi/examples/async_timer/Makefile
-  lib/atscppapi/examples/intercept/Makefile
-  lib/wccp/Makefile
+  lib/atscppapi/examples/transactionhook/Makefile
+  lib/atscppapi/src/Makefile
   lib/perl/Makefile
   lib/perl/lib/Apache/TS.pm
+  lib/records/Makefile
+  lib/ts/Makefile
+  lib/ts/apidefs.h
+  lib/ts/ink_config.h
+  lib/tsconfig/Makefile
+  lib/wccp/Makefile
   mgmt/Makefile
   mgmt/api/Makefile
   mgmt/api/include/Makefile
@@ -1972,6 +1972,11 @@ AC_CONFIG_FILES([
   plugins/Makefile
   plugins/cacheurl/Makefile
   plugins/conf_remap/Makefile
+  plugins/gzip/Makefile
+  plugins/header_rewrite/Makefile
+  plugins/libloader/Makefile
+  plugins/regex_remap/Makefile
+  plugins/stats_over_http/Makefile
   plugins/experimental/Makefile
   plugins/experimental/authproxy/Makefile
   plugins/experimental/balancer/Makefile
@@ -1981,22 +1986,17 @@ AC_CONFIG_FILES([
   plugins/experimental/escalate/Makefile
   plugins/experimental/esi/Makefile
   plugins/experimental/geoip_acl/Makefile
-  plugins/experimental/lua/Makefile
+  plugins/experimental/healthchecks/Makefile
   plugins/experimental/hipes/Makefile
-  plugins/experimental/ts_lua/Makefile
+  plugins/experimental/lua/Makefile
   plugins/experimental/metalink/Makefile
+  plugins/experimental/remap_stats/Makefile
   plugins/experimental/rfc5861/Makefile
   plugins/experimental/s3_auth/Makefile
   plugins/experimental/spdy/Makefile
   plugins/experimental/tcp_info/Makefile
-  plugins/experimental/healthchecks/Makefile
-  plugins/experimental/remap_stats/Makefile
+  plugins/experimental/ts_lua/Makefile
   plugins/experimental/xdebug/Makefile
-  plugins/gzip/Makefile
-  plugins/libloader/Makefile
-  plugins/header_rewrite/Makefile
-  plugins/regex_remap/Makefile
-  plugins/stats_over_http/Makefile
   proxy/Makefile
   proxy/api/ts/Makefile
   proxy/config/Makefile
@@ -2006,10 +2006,10 @@ AC_CONFIG_FILES([
   proxy/config/storage.config.default
   proxy/congest/Makefile
   proxy/hdrs/Makefile
-  proxy/shared/Makefile
   proxy/http/Makefile
   proxy/http/remap/Makefile
   proxy/logging/Makefile
+  proxy/shared/Makefile
   proxy/spdy/Makefile
   rc/Makefile
   rc/trafficserver


[16/50] [abbrv] git commit: TS-2637: fix traffic_line -r and -m

Posted by zw...@apache.org.
TS-2637: fix traffic_line -r and -m

Fix traffic_line -r by passing the correct record name.

Fix traffic_line -m by initializing the record element before
fetching it. In this case the response string value can be missing
if it is NULL.

Add an integration test (this currently fails because
proxy.config.cache.ram_cache.use_seen_filter is not defined
correctly).


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

Branch: refs/heads/lua_config
Commit: fc974bf7cc11f0e6d419da095cccf0d35bae098b
Parents: e2c6954
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 17 16:38:57 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Mar 17 16:42:42 2014 -0700

----------------------------------------------------------------------
 ci/tsqa/test-trafficline-metrics | 56 +++++++++++++++++++++++++++++++++++
 mgmt/api/CoreAPIRemote.cc        |  4 +--
 mgmt/api/TSControlMain.cc        |  8 +++--
 3 files changed, 64 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/ci/tsqa/test-trafficline-metrics
----------------------------------------------------------------------
diff --git a/ci/tsqa/test-trafficline-metrics b/ci/tsqa/test-trafficline-metrics
new file mode 100755
index 0000000..1f28cbd
--- /dev/null
+++ b/ci/tsqa/test-trafficline-metrics
@@ -0,0 +1,56 @@
+#! /usr/bin/env bash
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+TSQA_TSXS=${TSQA_TSXS:-/opt/ats/bin/tsxs}
+TSQA_TESTNAME=$(basename $0)
+source $(dirname $0)/functions
+
+# Use traffic_line -m to list all the configuration variables. Verify their values with
+# traffic_line -r. This tests the TSRecordGet() and TSRecordGetMatchMult() remote APIs.
+check() {
+  local key
+  local val1
+  local val2
+
+  local bindir=$(bindir)
+
+  tsexec traffic_line -m proxy.config | while read key val1 ; do
+    val2=$(TS_ROOT=$TSQA_ROOT $bindir/traffic_line -r $key)
+    if [ "$?" != "0" ]; then
+      fail failed to fetch value for $key
+    elif [ "$val1" != "$val1" ] ; then
+      fail value mismatch for $key, expected:\"$val1\", received:\"$val2\"
+    fi
+  done
+}
+
+bootstrap
+
+# If Traffic Server is not up, bring it up ...
+alive cop || startup || fatal unable to start Traffic Server
+trap shutdown 0 EXIT
+
+# Wait for traffic_manager to start.
+alive manager
+msgwait 1
+
+check
+
+exit $TSQA_FAIL
+
+# vim: set sw=2 ts=2 et :

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index 0dc360a..c15979e 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -487,7 +487,7 @@ mgmt_record_get_reply(TSRecordEle * rec_ele)
   void *val;
   char *name;
 
-  rec_ele->rec_name = NULL;
+  ink_zero(*rec_ele);
   rec_ele->rec_type = TS_REC_UNDEFINED;
 
   // parse the reply to get record value and type
@@ -536,7 +536,7 @@ MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
   }
 
   // create and send request
-  ret = send_record_get_request(main_socket_fd, rec_ele->rec_name);
+  ret = send_record_get_request(main_socket_fd, rec_name);
   if (ret != TS_ERR_OKAY) {
     return ret;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc974bf7/mgmt/api/TSControlMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc
index 950e3b5..97a7613 100644
--- a/mgmt/api/TSControlMain.cc
+++ b/mgmt/api/TSControlMain.cc
@@ -219,7 +219,6 @@ ts_ctrl_main(void *arg)
 
             case RECORD_MATCH_GET:
               ret = handle_record_match(client_entry->sock_info, req);
-              // XXX
               break;
 
             case RECORD_SET:
@@ -432,7 +431,12 @@ send_record_match(RecT /* rec_type */, void *edata, int /* registered */, const
       match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_counter), sizeof(TSCounter), TS_REC_COUNTER, name);
       break;
     case RECD_STRING:
-      match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, rec_val->rec_string, rec_val->rec_string ? strlen(rec_val->rec_string): 0, TS_REC_STRING, name);
+      // For NULL string parameters, end the literal "NULL" to match the behavior of MgmtRecordGet().
+      if (rec_val->rec_string) {
+        match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, rec_val->rec_string, strlen(rec_val->rec_string), TS_REC_STRING, name);
+      } else {
+        match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, (void *)"NULL", strlen("NULL"), TS_REC_STRING, name);
+      }
       break;
     case RECD_FLOAT:
       match->err = send_record_get_reply(match->sock, TS_ERR_OKAY, &(rec_val->rec_float), sizeof(TSFloat), TS_REC_FLOAT, name);


[41/50] [abbrv] git commit: [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default.

Posted by zw...@apache.org.
[TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default.


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

Branch: refs/heads/lua_config
Commit: 7b82da6d48e42989426546be0b1ead0b05f1141d
Parents: f6a1cd7
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 10:56:52 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 10:56:52 2014 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b82da6d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0f20b07..e675d47 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
+ 
+  *) [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default
 
   *) [TS-2661] Remove unused HttpSM::decided_cached_url.
 


[03/50] [abbrv] TS-2630: Add lib/ts/apidefs.h to place common types

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
deleted file mode 100644
index 2beb595..0000000
--- a/proxy/api/ts/ts.h.in
+++ /dev/null
@@ -1,3398 +0,0 @@
-/** @file
-
-  Traffic Server SDK API header file
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-  @section developers Developers
-
-  Developers, when adding a new element to an enum, append it. DO NOT
-  insert it.  Otherwise, binary compatibility of plugins will be broken!
-
- */
-
-#ifndef __TS_API_H__
-#define __TS_API_H__
-
-/* GENERATED FILE WARNING!  DO NOT EDIT ts.h
- *
- * You must modify ts.h.in instead.
- *
- */
-
-#include <stdint.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#ifndef tsapi
-#define tsapi
-#endif
-
-#if !defined(TS_PRINTFLIKE)
-#if defined(__GNUC__) || defined(__clang__)
-#define TS_PRINTFLIKE(fmt, arg) __attribute__((format(printf, fmt, arg)))
-#else
-#define TS_PRINTFLIKE(fmt, arg)
-#endif
-#endif
-
-#if !defined(TS_NORETURN)
-#if defined(__GNUC__) || defined(__clang__)
-#define TS_NORETURN __attribute__((noreturn))
-#else
-#define TS_NORETURN
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-  /* Version info
-   */
-#define TS_VERSION_STRING             "@TS_VERSION_STRING@"
-#define TS_VERSION_NUMBER              @TS_VERSION_NUMBER@
-#define TS_VERSION_MAJOR               @TS_VERSION_MAJOR@
-#define TS_VERSION_MINOR               @TS_VERSION_MINOR@
-#define TS_VERSION_MICRO               @TS_VERSION_MICRO@
-
-#define TS_HTTP_VERSION(a,b)  ((((a) & 0xFFFF) << 16) | ((b) & 0xFFFF))
-#define TS_HTTP_MINOR(v)      ((v) & 0xFFFF)
-#define TS_HTTP_MAJOR(v)      (((v) >> 16) & 0xFFFF)
-#define __TS_RES_PATH(x)   #x
-#define _TS_RES_PATH(x)    __TS_RES_PATH (x)
-#define TS_RES_PATH(x)     x __FILE__ ":" _TS_RES_PATH (__LINE__)
-#define TS_RES_MEM_PATH    TS_RES_PATH ("memory/")
-#define TS_MAX_USER_NAME_LEN 256
-
-#ifndef TS_DEPRECATED
-#define TS_DEPRECATED __attribute__ ((deprecated))
-#endif
-
-  /**
-      TSClientProtoStack represents what protocols are used by
-      the client. It may be composed by several TSProtoType.
-
-      The value of TSProtoType indicates bit-offset that can
-      be mapped to TSClientProtoStack by bit shifting.
-
-      For example, TLS+SPDY can be mapped to protocol stack:
-        proto_stack = (1u << TS_PROTO_TLS) | (1u << TS_PROTO_SPDY)
-
-      For the sake of brevity, TS_PROTO_TCP is usually omitted in
-      protocol stack.
-   */
-  typedef enum {
-    /* Transport protocols (0~11) */
-    TS_PROTO_UDP = 0,
-    TS_PROTO_TCP = 1,
-    TS_PROTO_TLS = 2,   /* TLS/SSL */
-
-    /* Application protocols (12~31) */
-    TS_PROTO_HTTP = 12,
-    TS_PROTO_SPDY = 13,
-    TS_PROTO_RTMP = 14,
-    TS_PROTO_WBSK = 15, /* WebSocket */
-  } TSProtoType;
-
-  typedef uint32_t TSClientProtoStack;
-
-  /**
-      The following struct is used by TSPluginRegister(). It stores
-      registration information about the plugin.
-
-   */
-  typedef struct
-  {
-    char* plugin_name;
-    char* vendor_name;
-    char* support_email;
-  } TSPluginRegistrationInfo;
-
-  /**
-      This set of enums are possible values returned by
-      TSHttpHdrParseReq() and TSHttpHdrParseResp().
-
-   */
-  typedef enum
-  {
-    TS_PARSE_ERROR = -1,
-    TS_PARSE_DONE = 0,
-    TS_PARSE_OK = 1,
-    TS_PARSE_CONT = 2
-  } TSParseResult;
-
-  /**
-      This set of enums represents the possible HTTP types that
-      can be assigned to an HTTP header. When a header is created
-      with TSHttpHdrCreate(), it is automatically assigned a type of
-      TS_HTTP_TYPE_UNKNOWN. You can modify the HTTP type ONCE after it
-      the header is created, using TSHttpHdrTypeSet(). After setting the
-      HTTP type once, you cannot set it again. Use TSHttpHdrTypeGet()
-      to obtain the TSHttpType of an HTTP header.
-
-   */
-  typedef enum
-  {
-    TS_HTTP_TYPE_UNKNOWN,
-    TS_HTTP_TYPE_REQUEST,
-    TS_HTTP_TYPE_RESPONSE
-  } TSHttpType;
-
-  /**
-      This set of enums represents possible return values from
-      TSHttpHdrStatusGet(), which retrieves the status code from an
-      HTTP response header (TSHttpHdrStatusGet() retrieves status codes
-      only from headers of type TS_HTTP_TYPE_RESPONSE). You can also set
-      the TSHttpStatus of a response header using TSHttpHdrStatusSet().
-
-   */
-  typedef enum
-  {
-    TS_HTTP_STATUS_NONE = 0,
-
-    TS_HTTP_STATUS_CONTINUE = 100,
-    TS_HTTP_STATUS_SWITCHING_PROTOCOL = 101,
-
-    TS_HTTP_STATUS_OK = 200,
-    TS_HTTP_STATUS_CREATED = 201,
-    TS_HTTP_STATUS_ACCEPTED = 202,
-    TS_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
-    TS_HTTP_STATUS_NO_CONTENT = 204,
-    TS_HTTP_STATUS_RESET_CONTENT = 205,
-    TS_HTTP_STATUS_PARTIAL_CONTENT = 206,
-    TS_HTTP_STATUS_MULTI_STATUS = 207,
-    TS_HTTP_STATUS_ALREADY_REPORTED = 208,
-    TS_HTTP_STATUS_IM_USED = 211,
-
-    TS_HTTP_STATUS_MULTIPLE_CHOICES = 300,
-    TS_HTTP_STATUS_MOVED_PERMANENTLY = 301,
-    TS_HTTP_STATUS_MOVED_TEMPORARILY = 302,
-    TS_HTTP_STATUS_SEE_OTHER = 303,
-    TS_HTTP_STATUS_NOT_MODIFIED = 304,
-    TS_HTTP_STATUS_USE_PROXY = 305,
-    TS_HTTP_STATUS_TEMPORARY_REDIRECT = 307,
-    TS_HTTP_STATUS_PERMANENT_REDIRECT = 308,
-
-    TS_HTTP_STATUS_BAD_REQUEST = 400,
-    TS_HTTP_STATUS_UNAUTHORIZED = 401,
-    TS_HTTP_STATUS_PAYMENT_REQUIRED = 402,
-    TS_HTTP_STATUS_FORBIDDEN = 403,
-    TS_HTTP_STATUS_NOT_FOUND = 404,
-    TS_HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
-    TS_HTTP_STATUS_NOT_ACCEPTABLE = 406,
-    TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
-    TS_HTTP_STATUS_REQUEST_TIMEOUT = 408,
-    TS_HTTP_STATUS_CONFLICT = 409,
-    TS_HTTP_STATUS_GONE = 410,
-    TS_HTTP_STATUS_LENGTH_REQUIRED = 411,
-    TS_HTTP_STATUS_PRECONDITION_FAILED = 412,
-    TS_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413,
-    TS_HTTP_STATUS_REQUEST_URI_TOO_LONG = 414,
-    TS_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,
-    TS_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
-    TS_HTTP_STATUS_EXPECTATION_FAILED = 417,
-    TS_HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
-    TS_HTTP_STATUS_LOCKED = 423,
-    TS_HTTP_STATUS_FAILED_DEPENDENCY = 424,
-    TS_HTTP_STATUS_UPGRADE_REQUIRED = 426,
-    TS_HTTP_STATUS_PRECONDITION_REQUIRED = 428,
-    TS_HTTP_STATUS_TOO_MANY_REQUESTS = 429,
-    TS_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
-
-    TS_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
-    TS_HTTP_STATUS_NOT_IMPLEMENTED = 501,
-    TS_HTTP_STATUS_BAD_GATEWAY = 502,
-    TS_HTTP_STATUS_SERVICE_UNAVAILABLE = 503,
-    TS_HTTP_STATUS_GATEWAY_TIMEOUT = 504,
-    TS_HTTP_STATUS_HTTPVER_NOT_SUPPORTED = 505,
-    TS_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506,
-    TS_HTTP_STATUS_INSUFFICIENT_STORAGE = 507,
-    TS_HTTP_STATUS_LOOP_DETECTED = 508,
-    TS_HTTP_STATUS_NOT_EXTENDED = 510,
-    TS_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
-
-  } TSHttpStatus;
-
-  /**
-      This set of enums represents the possible hooks where you can
-      set up continuation callbacks. The functions used to register a
-      continuation for a particular hook are:
-
-      TSHttpHookAdd: adds a global hook. You can globally add
-      any hook except for
-       - TS_HTTP_REQUEST_TRANSFORM_HOOK
-       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
-       - TS_HTTP_RESPONSE_CLIENT_HOOK
-
-      The following hooks can ONLY be added globally:
-       - TS_HTTP_SELECT_ALT_HOOK
-       - TS_HTTP_SSN_START_HOOK
-       - TS_HTTP_SSN_CLOSE_HOOK
-
-      TSHttpSsnHookAdd: adds a transaction hook to each transaction
-      within a session. You can only use transaction hooks with this call:
-       - TS_HTTP_READ_REQUEST_HDR_HOOK
-       - TS_HTTP_OS_DNS_HOOK
-       - TS_HTTP_SEND_REQUEST_HDR_HOOK
-       - TS_HTTP_READ_CACHE_HDR_HOOK
-       - TS_HTTP_READ_RESPONSE_HDR_HOOK
-       - TS_HTTP_SEND_RESPONSE_HDR_HOOK
-       - TS_HTTP_REQUEST_TRANSFORM_HOOK
-       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
-       - TS_HTTP_RESPONSE_CLIENT_HOOK
-       - TS_HTTP_TXN_START_HOOK
-       - TS_HTTP_TXN_CLOSE_HOOK
-
-      TSHttpTxnHookAdd: adds a callback at a specific point within
-      an HTTP transaction. The following hooks can be used with this
-      function:
-       - TS_HTTP_READ_REQUEST_HDR_HOOK
-       - TS_HTTP_OS_DNS_HOOK
-       - TS_HTTP_SEND_REQUEST_HDR_HOOK
-       - TS_HTTP_READ_CACHE_HDR_HOOK
-       - TS_HTTP_READ_RESPONSE_HDR_HOOK
-       - TS_HTTP_SEND_RESPONSE_HDR_HOOK
-       - TS_HTTP_REQUEST_TRANSFORM_HOOK
-       - TS_HTTP_RESPONSE_TRANSFORM_HOOK
-       - TS_HTTP_TXN_CLOSE_HOOK
-
-      The two transform hooks can ONLY be added as transaction hooks.
-
-      TS_HTTP_LAST_HOOK _must_ be the last element. Only right place
-      to insert a new element is just before TS_HTTP_LAST_HOOK.
-
-   */
-  typedef enum
-  {
-    TS_HTTP_READ_REQUEST_HDR_HOOK,
-    TS_HTTP_OS_DNS_HOOK,
-    TS_HTTP_SEND_REQUEST_HDR_HOOK,
-    TS_HTTP_READ_CACHE_HDR_HOOK,
-    TS_HTTP_READ_RESPONSE_HDR_HOOK,
-    TS_HTTP_SEND_RESPONSE_HDR_HOOK,
-    TS_HTTP_REQUEST_TRANSFORM_HOOK,
-    TS_HTTP_RESPONSE_TRANSFORM_HOOK,
-    TS_HTTP_SELECT_ALT_HOOK,
-    TS_HTTP_TXN_START_HOOK,
-    TS_HTTP_TXN_CLOSE_HOOK,
-    TS_HTTP_SSN_START_HOOK,
-    TS_HTTP_SSN_CLOSE_HOOK,
-    TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK,
-    TS_HTTP_PRE_REMAP_HOOK,
-    TS_HTTP_POST_REMAP_HOOK,
-    TS_HTTP_RESPONSE_CLIENT_HOOK,
-    TS_HTTP_LAST_HOOK
-  } TSHttpHookID;
-  #define TS_HTTP_READ_REQUEST_PRE_REMAP_HOOK TS_HTTP_PRE_REMAP_HOOK  /* backwards compat */
-
-  /** Plugin lifecycle hooks.
-
-      These are called during lifecycle events of a plugin. They
-      should be set in the plugin initialization function. The
-      continuation is invoked with an event ID specified for each hook
-      and @c NULL for the event data.
-
-      TS_LIFECYCLE_PORTS_INITIALIZED_HOOK
-
-        called once, after the HTTP proxy port data structures have
-        been initialized. In particular, SSL related calls that depend
-        on accept endpoints may be invoked. After this hook is
-        finished, the proxy port sockets are opened and connections
-        are accepted.
-
-        Event: TS_EVENT_LIFECYCLE_PORTS_INITIALIZED
-
-      TS_LIFECYCLE_PORTS_READY_HOOK
-
-        called once, after the sockets have been opened and the accept
-        threads have been started. That is, the ports are ready to
-        accept connections. This is *not* guaranteed to be called
-        before the first connection is accepted.
-
-        Event: TS_EVENT_LIFECYCLE_PORTS_READY_HOOK
-
-      TS_LIFECYCLE_CACHE_READY_HOOK
-
-        called once, after the cache has finished its
-        initialization. It is either online or has failed when this
-        hook is called.
-
-        Event: TS_EVENT_LIFECYCLE_CACHE_READY
-
-      TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK
-
-        called every time after a server SSL_CTX has finished the initialization.
-        It exposes the initialized SSL_CTX pointer.
-
-        Event: TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED
-
-      TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK
-
-        called once, after the client SSL_CTX has finished the initialization.
-        It exposes the initialized SSL_CTX pointer.
-
-        Event: TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED
-
-      Ordering guarantees:
-
-      - TS_LIFECYCLE_PORTS_INITIALIZED_HOOK before TS_LIFECYCLE_PORTS_READY_HOOK.
-
-      NOTE! ONLY the orderings EXPLICITLY mentioned above are guaranteed.
-      
-   */
-  typedef enum
-  {
-    TS_LIFECYCLE_PORTS_INITIALIZED_HOOK,
-    TS_LIFECYCLE_PORTS_READY_HOOK,
-    TS_LIFECYCLE_CACHE_READY_HOOK,
-    TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK,
-    TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK,
-    TS_LIFECYCLE_LAST_HOOK
-  } TSLifecycleHookID;
-
-  /**
-      TSEvents are sent to continuations when they are called back.
-      The TSEvent provides the continuation's handler function with
-      information about the callback. Based on the event it receives,
-      the handler function can decide what to do.
-
-   */
-  typedef enum
-  {
-    TS_EVENT_NONE = 0,
-    TS_EVENT_IMMEDIATE = 1,
-    TS_EVENT_TIMEOUT = 2,
-    TS_EVENT_ERROR = 3,
-    TS_EVENT_CONTINUE = 4,
-
-    TS_EVENT_VCONN_READ_READY = 100,
-    TS_EVENT_VCONN_WRITE_READY = 101,
-    TS_EVENT_VCONN_READ_COMPLETE = 102,
-    TS_EVENT_VCONN_WRITE_COMPLETE = 103,
-    TS_EVENT_VCONN_EOS = 104,
-    TS_EVENT_VCONN_INACTIVITY_TIMEOUT = 105,
-
-    TS_EVENT_NET_CONNECT = 200,
-    TS_EVENT_NET_CONNECT_FAILED = 201,
-    TS_EVENT_NET_ACCEPT = 202,
-    TS_EVENT_NET_ACCEPT_FAILED = 204,
-
-    /* EVENTS 206 - 212 for internal use */
-    TS_EVENT_INTERNAL_206 = 206,
-    TS_EVENT_INTERNAL_207 = 207,
-    TS_EVENT_INTERNAL_208 = 208,
-    TS_EVENT_INTERNAL_209 = 209,
-    TS_EVENT_INTERNAL_210 = 210,
-    TS_EVENT_INTERNAL_211 = 211,
-    TS_EVENT_INTERNAL_212 = 212,
-
-    TS_EVENT_HOST_LOOKUP = 500,
-    TS_EVENT_CACHE_OPEN_READ = 1102,
-    TS_EVENT_CACHE_OPEN_READ_FAILED = 1103,
-    TS_EVENT_CACHE_OPEN_WRITE = 1108,
-    TS_EVENT_CACHE_OPEN_WRITE_FAILED = 1109,
-    TS_EVENT_CACHE_REMOVE = 1112,
-    TS_EVENT_CACHE_REMOVE_FAILED = 1113,
-    TS_EVENT_CACHE_SCAN = 1120,
-    TS_EVENT_CACHE_SCAN_FAILED = 1121,
-    TS_EVENT_CACHE_SCAN_OBJECT = 1122,
-    TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED = 1123,
-    TS_EVENT_CACHE_SCAN_OPERATION_FAILED = 1124,
-    TS_EVENT_CACHE_SCAN_DONE = 1125,
-
-    TS_EVENT_CACHE_LOOKUP = 1126,
-    TS_EVENT_CACHE_READ = 1127,
-    TS_EVENT_CACHE_DELETE = 1128,
-    TS_EVENT_CACHE_WRITE = 1129,
-    TS_EVENT_CACHE_WRITE_HEADER = 1130,
-    TS_EVENT_CACHE_CLOSE = 1131,
-    TS_EVENT_CACHE_LOOKUP_READY = 1132,
-    TS_EVENT_CACHE_LOOKUP_COMPLETE = 1133,
-    TS_EVENT_CACHE_READ_READY = 1134,
-    TS_EVENT_CACHE_READ_COMPLETE = 1135,
-
-    /* EVENT 1200 for internal use */
-    TS_EVENT_INTERNAL_1200 = 1200,
-
-    /* EVENT 3900 is corresponding to event AIO_EVENT_DONE defined in I_AIO.h */
-    TS_AIO_EVENT_DONE = 3900,
-
-    TS_EVENT_HTTP_CONTINUE = 60000,
-    TS_EVENT_HTTP_ERROR = 60001,
-    TS_EVENT_HTTP_READ_REQUEST_HDR = 60002,
-    TS_EVENT_HTTP_OS_DNS = 60003,
-    TS_EVENT_HTTP_SEND_REQUEST_HDR = 60004,
-    TS_EVENT_HTTP_READ_CACHE_HDR = 60005,
-    TS_EVENT_HTTP_READ_RESPONSE_HDR = 60006,
-    TS_EVENT_HTTP_SEND_RESPONSE_HDR = 60007,
-    TS_EVENT_HTTP_REQUEST_TRANSFORM = 60008,
-    TS_EVENT_HTTP_RESPONSE_TRANSFORM = 60009,
-    TS_EVENT_HTTP_SELECT_ALT = 60010,
-    TS_EVENT_HTTP_TXN_START = 60011,
-    TS_EVENT_HTTP_TXN_CLOSE = 60012,
-    TS_EVENT_HTTP_SSN_START = 60013,
-    TS_EVENT_HTTP_SSN_CLOSE = 60014,
-    TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE = 60015,
-    TS_EVENT_HTTP_PRE_REMAP = 60016,
-    TS_EVENT_HTTP_POST_REMAP = 60017,
-    TS_EVENT_LIFECYCLE_PORTS_INITIALIZED = 60018,
-    TS_EVENT_LIFECYCLE_PORTS_READY = 60019,
-    TS_EVENT_LIFECYCLE_CACHE_READY = 60020,
-    TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED = 60021,
-    TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED = 60022,
-    TS_EVENT_MGMT_UPDATE = 60100,
-
-    /* EVENTS 60200 - 60202 for internal use */
-    TS_EVENT_INTERNAL_60200 = 60200,
-    TS_EVENT_INTERNAL_60201 = 60201,
-    TS_EVENT_INTERNAL_60202 = 60202
-  } TSEvent;
-  #define TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP TS_EVENT_HTTP_PRE_REMAP /* backwards compat */
-
-  typedef enum
-  { TS_SRVSTATE_STATE_UNDEFINED = 0,
-    TS_SRVSTATE_ACTIVE_TIMEOUT,
-    TS_SRVSTATE_BAD_INCOMING_RESPONSE,
-    TS_SRVSTATE_CONNECTION_ALIVE,
-    TS_SRVSTATE_CONNECTION_CLOSED,
-    TS_SRVSTATE_CONNECTION_ERROR,
-    TS_SRVSTATE_INACTIVE_TIMEOUT,
-    TS_SRVSTATE_OPEN_RAW_ERROR,
-    TS_SRVSTATE_PARSE_ERROR,
-    TS_SRVSTATE_TRANSACTION_COMPLETE,
-    TS_SRVSTATE_CONGEST_CONTROL_CONGESTED_ON_F,
-    TS_SRVSTATE_CONGEST_CONTROL_CONGESTED_ON_M
-  } TSServerState;
-
-  typedef enum
-  {
-    TS_LOOKUP_UNDEFINED_LOOKUP,
-    TS_LOOKUP_ICP_SUGGESTED_HOST,
-    TS_LOOKUP_PARENT_PROXY,
-    TS_LOOKUP_ORIGIN_SERVER,
-    TS_LOOKUP_INCOMING_ROUTER,
-    TS_LOOKUP_HOST_NONE
-  } TSLookingUpType;
-
-  typedef enum
-  {
-    TS_CACHE_LOOKUP_MISS,
-    TS_CACHE_LOOKUP_HIT_STALE,
-    TS_CACHE_LOOKUP_HIT_FRESH,
-    TS_CACHE_LOOKUP_SKIPPED
-  } TSCacheLookupResult;
-
-  typedef enum
-  {
-    TS_CACHE_DATA_TYPE_NONE,
-    TS_CACHE_DATA_TYPE_HTTP,
-    TS_CACHE_DATA_TYPE_OTHER
-  } TSCacheDataType;
-
-  typedef enum
-  {
-    TS_CACHE_ERROR_NO_DOC = -20400,
-    TS_CACHE_ERROR_DOC_BUSY = -20401,
-    TS_CACHE_ERROR_NOT_READY = -20407
-  } TSCacheError;
-
-  typedef enum
-  {
-    TS_CACHE_SCAN_RESULT_DONE = 0,
-    TS_CACHE_SCAN_RESULT_CONTINUE = 1,
-    TS_CACHE_SCAN_RESULT_DELETE = 10,
-    TS_CACHE_SCAN_RESULT_DELETE_ALL_ALTERNATES,
-    TS_CACHE_SCAN_RESULT_UPDATE,
-    TS_CACHE_SCAN_RESULT_RETRY
-  } TSCacheScanResult;
-
-  typedef enum
-  {
-    TS_VC_CLOSE_ABORT = -1,
-    TS_VC_CLOSE_NORMAL = 1
-  } TSVConnCloseFlags;
-
-  typedef enum
-  {
-    TS_IOBUFFER_SIZE_INDEX_128 = 0,
-    TS_IOBUFFER_SIZE_INDEX_256 = 1,
-    TS_IOBUFFER_SIZE_INDEX_512 = 2,
-    TS_IOBUFFER_SIZE_INDEX_1K = 3,
-    TS_IOBUFFER_SIZE_INDEX_2K = 4,
-    TS_IOBUFFER_SIZE_INDEX_4K = 5,
-    TS_IOBUFFER_SIZE_INDEX_8K = 6,
-    TS_IOBUFFER_SIZE_INDEX_16K = 7,
-    TS_IOBUFFER_SIZE_INDEX_32K = 8
-  } TSIOBufferSizeIndex;
-
-  /**
-      Starting 2.0, SDK now follows same versioning as Traffic Server.
-   */
-  typedef enum
-  {
-    TS_SDK_VERSION_2_0 = 0,
-    TS_SDK_VERSION_3_0
-  } TSSDKVersion;
-
-  typedef enum
-  {
-    TS_ERROR = -1,
-    TS_SUCCESS = 0
-  } TSReturnCode;
-
-  typedef enum
-  {
-    NO_CALLBACK = 0,
-    AFTER_HEADER ,
-    AFTER_BODY
-  } TSFetchWakeUpOptions;
-
-#ifndef _HTTP_PROXY_API_ENUMS_H_
-#define _HTTP_PROXY_API_ENUMS_H_
-  /// Server session sharing values - match
-  /// Must be identical to definition in HttpProxyAPIEnums.h
-  typedef enum
-  {
-    TS_SERVER_SESSION_SHARING_MATCH_NONE,
-    TS_SERVER_SESSION_SHARING_MATCH_BOTH,
-    TS_SERVER_SESSION_SHARING_MATCH_IP,
-    TS_SERVER_SESSION_SHARING_MATCH_HOST
-  } TSServerSessionSharingMatchType;
-
-  /// Server session sharing values - pool
-  /// Must be identical to definition in HttpProxyAPIEnums.h
-  typedef enum
-  {
-    TS_SERVER_SESSION_SHARING_POOL_GLOBAL,
-    TS_SERVER_SESSION_SHARING_POOL_THREAD
-  } TSServerSessionSharingPoolType;
-#endif
-
-  /* librecords types */
-
-  /* The values of this enum must match enum RecT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDTYPE_NULL = 0,
-      TS_RECORDTYPE_CONFIG = 1,
-      TS_RECORDTYPE_PROCESS = 2,
-      TS_RECORDTYPE_NODE = 4,
-      TS_RECORDTYPE_CLUSTER = 8,
-      TS_RECORDTYPE_LOCAL = 16,
-      TS_RECORDTYPE_PLUGIN = 32,
-      TS_RECORDTYPE_ALL = 63
-    } TSRecordType;
-
-  /* The values of this enum must match enum RecDataT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDDATATYPE_NULL = 0,
-      TS_RECORDDATATYPE_INT,
-      TS_RECORDDATATYPE_FLOAT,
-      TS_RECORDDATATYPE_STRING,
-      TS_RECORDDATATYPE_COUNTER,
-      TS_RECORDDATATYPE_STAT_CONST,
-      TS_RECORDDATATYPE_STAT_FX,
-      TS_RECORDDATATYPE_MAX
-    } TSRecordDataType;
-
-  typedef union
-  {
-    int64_t rec_int;
-    float rec_float;
-    char* rec_string;
-    int64_t rec_counter;
-  } TSRecordData;
-
-  /* The values of this enum must match enum RecPersistT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDP_NULL,
-      TS_RECORDP_PERSISTENT,
-      TS_RECORDP_NON_PERSISTENT
-    } TSRecordPersistType;
-
-  /* The values of this enum must match enum RecUpdateT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDUPDATE_NULL,
-      TS_RECORDUPDATE_DYNAMIC,
-      TS_RECORDUPDATE_RESTART_TS,
-      TS_RECORDUPDATE_RESTART_TM,
-      TS_RECORDUPDATE_RESTART_TC
-    } TSRecordUpdateType;
-
-  /* The values of this enum must match enum RecCheckT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDCHECK_NULL,
-      TS_RECORDCHECK_STR,
-      TS_RECORDCHECK_INT,
-      TS_RECORDCHECK_IP
-    } TSRecordCheckType;
-
-  /* The values of this enum must match enum RecModeT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDMODE_NULL,
-      TS_RECORDMODE_CLIENT,
-      TS_RECORDMODE_SERVER,
-      TS_RECORDMODE_STAND_ALONE
-    } TSRecordModeType;
-
-  /* The values of this enum must match enum RecAccessT in I_RecDefs.h */
-  typedef enum
-    {
-      TS_RECORDACCESS_NULL,
-      TS_RECORDACCESS_NO_ACCESS,
-      TS_RECORDACCESS_READ_ONLY
-    } TSRecordAccessType;
-
-  typedef enum
-  {
-    TS_CONFIG_NULL = -1,
-    TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR,
-    TS_CONFIG_HTTP_CHUNKING_ENABLED,
-    TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED,
-    TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME,
-    TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE,
-    TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN,
-    TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT,
-    TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT,
-    TS_CONFIG_HTTP_SHARE_SERVER_SESSIONS, // DEPRECATED
-    TS_CONFIG_HTTP_SERVER_SESSION_SHARING_POOL,
-    TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH,
-    TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT,
-    TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT,
-    TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT,
-    TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT,
-    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM,
-    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER,
-    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT,
-    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE,
-    TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP,
-    TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP,
-    TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
-    TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
-    TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND,
-    TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
-    TS_CONFIG_HTTP_CACHE_HTTP,
-    TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL,
-    TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,
-    TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE,
-    TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE,
-    TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE,
-    TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES,
-    TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION,
-    TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC,
-    TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS,
-    TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR,
-    TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR,
-    TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,
-    TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME,
-    TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME,
-    TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME,
-    TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE,
-    TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN,
-    TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT,
-    TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN,
-    TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT,
-    TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT,
-    TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS,
-    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES,
-    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER,
-    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
-    TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
-    TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
-    TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
-    TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
-    TS_CONFIG_HTTP_CACHE_FUZZ_TIME,
-    TS_CONFIG_HTTP_CACHE_FUZZ_MIN_TIME,
-    TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
-    TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT,
-    TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
-    TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR,
-    TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY,
-    TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD,
-    TS_CONFIG_NET_SOCK_PACKET_MARK_OUT,
-    TS_CONFIG_NET_SOCK_PACKET_TOS_OUT,
-    TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE,
-    TS_CONFIG_HTTP_CHUNKING_SIZE,
-    TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
-    TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
-    TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
-    TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
-    TS_CONFIG_HTTP_NORMALIZE_AE_GZIP,
-    TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
-    TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
-    TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
-    TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
-    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
-    TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
-    TS_CONFIG_HTTP_ACCEPT_ENCODING_FILTER_ENABLED,
-    TS_CONFIG_SSL_HSTS_MAX_AGE,
-    TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS,
-    TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME,
-    TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES,
-    TS_CONFIG_LAST_ENTRY
-  } TSOverridableConfigKey;
-
-  /* The TASK pool of threads is the primary method of off-loading continuations from the
-     net-threads. Configure this with proxy.config.task_threads in records.config. */
-  typedef enum
-    {
-      TS_THREAD_POOL_DEFAULT = -1,
-      TS_THREAD_POOL_NET,
-      TS_THREAD_POOL_TASK,
-      /* unlikely you should use these */
-      TS_THREAD_POOL_SSL,
-      TS_THREAD_POOL_DNS,
-      TS_THREAD_POOL_REMAP,
-      TS_THREAD_POOL_CLUSTER,
-      TS_THREAD_POOL_UDP
-    } TSThreadPool;
-
-  typedef int64_t TSHRTime;
-
-  /* The TSMilestonesType is an enum defining all the various milestones ("timers") that
-     we track for a request. */
-  typedef enum
-    {
-      TS_MILESTONE_NULL = -1,
-      TS_MILESTONE_UA_BEGIN,
-      TS_MILESTONE_UA_READ_HEADER_DONE,
-      TS_MILESTONE_UA_BEGIN_WRITE,
-      TS_MILESTONE_UA_CLOSE,
-      TS_MILESTONE_SERVER_FIRST_CONNECT,
-      TS_MILESTONE_SERVER_CONNECT,
-      TS_MILESTONE_SERVER_CONNECT_END,
-      TS_MILESTONE_SERVER_BEGIN_WRITE,
-      TS_MILESTONE_SERVER_FIRST_READ,
-      TS_MILESTONE_SERVER_READ_HEADER_DONE,
-      TS_MILESTONE_SERVER_CLOSE,
-      TS_MILESTONE_CACHE_OPEN_READ_BEGIN,
-      TS_MILESTONE_CACHE_OPEN_READ_END,
-      TS_MILESTONE_CACHE_OPEN_WRITE_BEGIN,
-      TS_MILESTONE_CACHE_OPEN_WRITE_END,
-      TS_MILESTONE_DNS_LOOKUP_BEGIN,
-      TS_MILESTONE_DNS_LOOKUP_END,
-      TS_MILESTONE_SM_START,
-      TS_MILESTONE_SM_FINISH,
-      TS_MILESTONE_LAST_ENTRY
-    } TSMilestonesType;
-
-
-  /* These typedefs are used with the corresponding TSMgmt*Get functions
-     for storing the values retrieved by those functions. For example,
-     TSMgmtCounterGet() retrieves an TSMgmtCounter. */
-  typedef int64_t TSMgmtInt;
-  typedef int64_t TSMgmtCounter;
-  typedef float TSMgmtFloat;
-  typedef char* TSMgmtString;
-
-  typedef struct tsapi_file* TSFile;
-
-  typedef struct tsapi_mloc* TSMLoc;
-  typedef struct tsapi_mbuffer* TSMBuffer;
-  typedef struct tsapi_httpssn* TSHttpSsn;
-  typedef struct tsapi_httptxn* TSHttpTxn;
-  typedef struct tsapi_httpaltinfo* TSHttpAltInfo;
-  typedef struct tsapi_mimeparser* TSMimeParser;
-  typedef struct tsapi_httpparser* TSHttpParser;
-  typedef struct tsapi_cachekey* TSCacheKey;
-  typedef struct tsapi_cachehttpinfo* TSCacheHttpInfo;
-  typedef struct tsapi_cachetxn* TSCacheTxn;
-
-  typedef struct tsapi_port* TSPortDescriptor;
-  typedef struct tsapi_vio* TSVIO;
-  typedef struct tsapi_thread* TSThread;
-  typedef struct tsapi_mutex* TSMutex;
-  typedef struct tsapi_config* TSConfig;
-  typedef struct tsapi_cont* TSCont;
-  typedef struct tsapi_cont* TSVConn; /* a VConn is really a specialized TSCont */
-  typedef struct tsapi_action* TSAction;
-  typedef struct tsapi_iobuffer* TSIOBuffer;
-  typedef struct tsapi_iobufferdata* TSIOBufferData;
-  typedef struct tsapi_bufferblock* TSIOBufferBlock;
-  typedef struct tsapi_bufferreader* TSIOBufferReader;
-  typedef struct tsapi_hostlookupresult* TSHostLookupResult;
-  typedef struct tsapi_aiocallback* TSAIOCallback;
-
-  typedef void *(*TSThreadFunc) (void* data);
-  typedef int (*TSEventFunc) (TSCont contp, TSEvent event, void* edata);
-  typedef void (*TSConfigDestroyFunc) (void* data);
-
-  typedef struct
-  {
-    int success_event_id;
-    int failure_event_id;
-    int timeout_event_id;
-  } TSFetchEvent;
-
-  typedef struct TSFetchUrlParams
-  {
-    const char* request;
-    int request_len;
-    struct sockaddr_storage ip;
-    int port;
-    TSCont contp;
-    TSFetchEvent events;
-    TSFetchWakeUpOptions options;
-    struct TSFetchUrlParams* next;
-  } TSFetchUrlParams_t;
-
-  /* --------------------------------------------------------------------------
-     Init */
-
-  /**
-      This function must be defined by all plugins. Traffic Server
-      calls this initialization routine when it loads the plugin (at
-      startup), and sets argc and argv appropriately based on the values
-      in plugin.config.
-
-      @param argc the number of initial values specified in plugin.config,
-        plus one. If only the name of your plugin shared object is
-        specified in plugin.config, argc=1.
-      @param argv the vector of arguments. The length of argv is argc.
-        argv[0] is the name of the plugin shared library. Subsequent
-        values of argv are initialization values specified in
-        plugin.config.
-
-   */
-  extern tsapi void TSPluginInit(int argc, const char* argv[]);
-
-  /* --------------------------------------------------------------------------
-     URL schemes */
-  extern tsapi const char* TS_URL_SCHEME_FILE;
-  extern tsapi const char* TS_URL_SCHEME_FTP;
-  extern tsapi const char* TS_URL_SCHEME_GOPHER;
-  extern tsapi const char* TS_URL_SCHEME_HTTP;
-  extern tsapi const char* TS_URL_SCHEME_HTTPS;
-  extern tsapi const char* TS_URL_SCHEME_MAILTO;
-  extern tsapi const char* TS_URL_SCHEME_NEWS;
-  extern tsapi const char* TS_URL_SCHEME_NNTP;
-  extern tsapi const char* TS_URL_SCHEME_PROSPERO;
-  extern tsapi const char* TS_URL_SCHEME_TELNET;
-  extern tsapi const char* TS_URL_SCHEME_TUNNEL;
-  extern tsapi const char* TS_URL_SCHEME_WAIS;
-  extern tsapi const char* TS_URL_SCHEME_PNM;
-  extern tsapi const char* TS_URL_SCHEME_RTSP;
-  extern tsapi const char* TS_URL_SCHEME_RTSPU;
-  extern tsapi const char* TS_URL_SCHEME_MMS;
-  extern tsapi const char* TS_URL_SCHEME_MMSU;
-  extern tsapi const char* TS_URL_SCHEME_MMST;
-
-  /* --------------------------------------------------------------------------
-     URL scheme string lengths */
-  extern tsapi int TS_URL_LEN_FILE;
-  extern tsapi int TS_URL_LEN_FTP;
-  extern tsapi int TS_URL_LEN_GOPHER;
-  extern tsapi int TS_URL_LEN_HTTP;
-  extern tsapi int TS_URL_LEN_HTTPS;
-  extern tsapi int TS_URL_LEN_MAILTO;
-  extern tsapi int TS_URL_LEN_NEWS;
-  extern tsapi int TS_URL_LEN_NNTP;
-  extern tsapi int TS_URL_LEN_PROSPERO;
-  extern tsapi int TS_URL_LEN_TELNET;
-  extern tsapi int TS_URL_LEN_WAIS;
-
-  /* --------------------------------------------------------------------------
-     MIME fields */
-  extern tsapi const char* TS_MIME_FIELD_ACCEPT;
-  extern tsapi const char* TS_MIME_FIELD_ACCEPT_CHARSET;
-  extern tsapi const char* TS_MIME_FIELD_ACCEPT_ENCODING;
-  extern tsapi const char* TS_MIME_FIELD_ACCEPT_LANGUAGE;
-  extern tsapi const char* TS_MIME_FIELD_ACCEPT_RANGES;
-  extern tsapi const char* TS_MIME_FIELD_AGE;
-  extern tsapi const char* TS_MIME_FIELD_ALLOW;
-  extern tsapi const char* TS_MIME_FIELD_APPROVED;
-  extern tsapi const char* TS_MIME_FIELD_AUTHORIZATION;
-  extern tsapi const char* TS_MIME_FIELD_BYTES;
-  extern tsapi const char* TS_MIME_FIELD_CACHE_CONTROL;
-  extern tsapi const char* TS_MIME_FIELD_CLIENT_IP;
-  extern tsapi const char* TS_MIME_FIELD_CONNECTION;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_BASE;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_ENCODING;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_LANGUAGE;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_LENGTH;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_LOCATION;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_MD5;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_RANGE;
-  extern tsapi const char* TS_MIME_FIELD_CONTENT_TYPE;
-  extern tsapi const char* TS_MIME_FIELD_CONTROL;
-  extern tsapi const char* TS_MIME_FIELD_COOKIE;
-  extern tsapi const char* TS_MIME_FIELD_DATE;
-  extern tsapi const char* TS_MIME_FIELD_DISTRIBUTION;
-  extern tsapi const char* TS_MIME_FIELD_ETAG;
-  extern tsapi const char* TS_MIME_FIELD_EXPECT;
-  extern tsapi const char* TS_MIME_FIELD_EXPIRES;
-  extern tsapi const char* TS_MIME_FIELD_FOLLOWUP_TO;
-  extern tsapi const char* TS_MIME_FIELD_FROM;
-  extern tsapi const char* TS_MIME_FIELD_HOST;
-  extern tsapi const char* TS_MIME_FIELD_IF_MATCH;
-  extern tsapi const char* TS_MIME_FIELD_IF_MODIFIED_SINCE;
-  extern tsapi const char* TS_MIME_FIELD_IF_NONE_MATCH;
-  extern tsapi const char* TS_MIME_FIELD_IF_RANGE;
-  extern tsapi const char* TS_MIME_FIELD_IF_UNMODIFIED_SINCE;
-  extern tsapi const char* TS_MIME_FIELD_KEEP_ALIVE;
-  extern tsapi const char* TS_MIME_FIELD_KEYWORDS;
-  extern tsapi const char* TS_MIME_FIELD_LAST_MODIFIED;
-  extern tsapi const char* TS_MIME_FIELD_LINES;
-  extern tsapi const char* TS_MIME_FIELD_LOCATION;
-  extern tsapi const char* TS_MIME_FIELD_MAX_FORWARDS;
-  extern tsapi const char* TS_MIME_FIELD_MESSAGE_ID;
-  extern tsapi const char* TS_MIME_FIELD_NEWSGROUPS;
-  extern tsapi const char* TS_MIME_FIELD_ORGANIZATION;
-  extern tsapi const char* TS_MIME_FIELD_PATH;
-  extern tsapi const char* TS_MIME_FIELD_PRAGMA;
-  extern tsapi const char* TS_MIME_FIELD_PROXY_AUTHENTICATE;
-  extern tsapi const char* TS_MIME_FIELD_PROXY_AUTHORIZATION;
-  extern tsapi const char* TS_MIME_FIELD_PROXY_CONNECTION;
-  extern tsapi const char* TS_MIME_FIELD_PUBLIC;
-  extern tsapi const char* TS_MIME_FIELD_RANGE;
-  extern tsapi const char* TS_MIME_FIELD_REFERENCES;
-  extern tsapi const char* TS_MIME_FIELD_REFERER;
-  extern tsapi const char* TS_MIME_FIELD_REPLY_TO;
-  extern tsapi const char* TS_MIME_FIELD_RETRY_AFTER;
-  extern tsapi const char* TS_MIME_FIELD_SENDER;
-  extern tsapi const char* TS_MIME_FIELD_SERVER;
-  extern tsapi const char* TS_MIME_FIELD_SET_COOKIE;
-  extern tsapi const char* TS_MIME_FIELD_STRICT_TRANSPORT_SECURITY;
-  extern tsapi const char* TS_MIME_FIELD_SUBJECT;
-  extern tsapi const char* TS_MIME_FIELD_SUMMARY;
-  extern tsapi const char* TS_MIME_FIELD_TE;
-  extern tsapi const char* TS_MIME_FIELD_TRANSFER_ENCODING;
-  extern tsapi const char* TS_MIME_FIELD_UPGRADE;
-  extern tsapi const char* TS_MIME_FIELD_USER_AGENT;
-  extern tsapi const char* TS_MIME_FIELD_VARY;
-  extern tsapi const char* TS_MIME_FIELD_VIA;
-  extern tsapi const char* TS_MIME_FIELD_WARNING;
-  extern tsapi const char* TS_MIME_FIELD_WWW_AUTHENTICATE;
-  extern tsapi const char* TS_MIME_FIELD_XREF;
-  extern tsapi const char* TS_MIME_FIELD_X_FORWARDED_FOR;
-
-  /* --------------------------------------------------------------------------
-     MIME fields string lengths */
-  extern tsapi int TS_MIME_LEN_ACCEPT;
-  extern tsapi int TS_MIME_LEN_ACCEPT_CHARSET;
-  extern tsapi int TS_MIME_LEN_ACCEPT_ENCODING;
-  extern tsapi int TS_MIME_LEN_ACCEPT_LANGUAGE;
-  extern tsapi int TS_MIME_LEN_ACCEPT_RANGES;
-  extern tsapi int TS_MIME_LEN_AGE;
-  extern tsapi int TS_MIME_LEN_ALLOW;
-  extern tsapi int TS_MIME_LEN_APPROVED;
-  extern tsapi int TS_MIME_LEN_AUTHORIZATION;
-  extern tsapi int TS_MIME_LEN_BYTES;
-  extern tsapi int TS_MIME_LEN_CACHE_CONTROL;
-  extern tsapi int TS_MIME_LEN_CLIENT_IP;
-  extern tsapi int TS_MIME_LEN_CONNECTION;
-  extern tsapi int TS_MIME_LEN_CONTENT_BASE;
-  extern tsapi int TS_MIME_LEN_CONTENT_ENCODING;
-  extern tsapi int TS_MIME_LEN_CONTENT_LANGUAGE;
-  extern tsapi int TS_MIME_LEN_CONTENT_LENGTH;
-  extern tsapi int TS_MIME_LEN_CONTENT_LOCATION;
-  extern tsapi int TS_MIME_LEN_CONTENT_MD5;
-  extern tsapi int TS_MIME_LEN_CONTENT_RANGE;
-  extern tsapi int TS_MIME_LEN_CONTENT_TYPE;
-  extern tsapi int TS_MIME_LEN_CONTROL;
-  extern tsapi int TS_MIME_LEN_COOKIE;
-  extern tsapi int TS_MIME_LEN_DATE;
-  extern tsapi int TS_MIME_LEN_DISTRIBUTION;
-  extern tsapi int TS_MIME_LEN_ETAG;
-  extern tsapi int TS_MIME_LEN_EXPECT;
-  extern tsapi int TS_MIME_LEN_EXPIRES;
-  extern tsapi int TS_MIME_LEN_FOLLOWUP_TO;
-  extern tsapi int TS_MIME_LEN_FROM;
-  extern tsapi int TS_MIME_LEN_HOST;
-  extern tsapi int TS_MIME_LEN_IF_MATCH;
-  extern tsapi int TS_MIME_LEN_IF_MODIFIED_SINCE;
-  extern tsapi int TS_MIME_LEN_IF_NONE_MATCH;
-  extern tsapi int TS_MIME_LEN_IF_RANGE;
-  extern tsapi int TS_MIME_LEN_IF_UNMODIFIED_SINCE;
-  extern tsapi int TS_MIME_LEN_KEEP_ALIVE;
-  extern tsapi int TS_MIME_LEN_KEYWORDS;
-  extern tsapi int TS_MIME_LEN_LAST_MODIFIED;
-  extern tsapi int TS_MIME_LEN_LINES;
-  extern tsapi int TS_MIME_LEN_LOCATION;
-  extern tsapi int TS_MIME_LEN_MAX_FORWARDS;
-  extern tsapi int TS_MIME_LEN_MESSAGE_ID;
-  extern tsapi int TS_MIME_LEN_NEWSGROUPS;
-  extern tsapi int TS_MIME_LEN_ORGANIZATION;
-  extern tsapi int TS_MIME_LEN_PATH;
-  extern tsapi int TS_MIME_LEN_PRAGMA;
-  extern tsapi int TS_MIME_LEN_PROXY_AUTHENTICATE;
-  extern tsapi int TS_MIME_LEN_PROXY_AUTHORIZATION;
-  extern tsapi int TS_MIME_LEN_PROXY_CONNECTION;
-  extern tsapi int TS_MIME_LEN_PUBLIC;
-  extern tsapi int TS_MIME_LEN_RANGE;
-  extern tsapi int TS_MIME_LEN_REFERENCES;
-  extern tsapi int TS_MIME_LEN_REFERER;
-  extern tsapi int TS_MIME_LEN_REPLY_TO;
-  extern tsapi int TS_MIME_LEN_RETRY_AFTER;
-  extern tsapi int TS_MIME_LEN_SENDER;
-  extern tsapi int TS_MIME_LEN_SERVER;
-  extern tsapi int TS_MIME_LEN_SET_COOKIE;
-  extern tsapi int TS_MIME_LEN_STRICT_TRANSPORT_SECURITY;
-  extern tsapi int TS_MIME_LEN_SUBJECT;
-  extern tsapi int TS_MIME_LEN_SUMMARY;
-  extern tsapi int TS_MIME_LEN_TE;
-  extern tsapi int TS_MIME_LEN_TRANSFER_ENCODING;
-  extern tsapi int TS_MIME_LEN_UPGRADE;
-  extern tsapi int TS_MIME_LEN_USER_AGENT;
-  extern tsapi int TS_MIME_LEN_VARY;
-  extern tsapi int TS_MIME_LEN_VIA;
-  extern tsapi int TS_MIME_LEN_WARNING;
-  extern tsapi int TS_MIME_LEN_WWW_AUTHENTICATE;
-  extern tsapi int TS_MIME_LEN_XREF;
-  extern tsapi int TS_MIME_LEN_X_FORWARDED_FOR;
-
-  /* --------------------------------------------------------------------------
-     HTTP values */
-  extern tsapi const char* TS_HTTP_VALUE_BYTES;
-  extern tsapi const char* TS_HTTP_VALUE_CHUNKED;
-  extern tsapi const char* TS_HTTP_VALUE_CLOSE;
-  extern tsapi const char* TS_HTTP_VALUE_COMPRESS;
-  extern tsapi const char* TS_HTTP_VALUE_DEFLATE;
-  extern tsapi const char* TS_HTTP_VALUE_GZIP;
-  extern tsapi const char* TS_HTTP_VALUE_IDENTITY;
-  extern tsapi const char* TS_HTTP_VALUE_KEEP_ALIVE;
-  extern tsapi const char* TS_HTTP_VALUE_MAX_AGE;
-  extern tsapi const char* TS_HTTP_VALUE_MAX_STALE;
-  extern tsapi const char* TS_HTTP_VALUE_MIN_FRESH;
-  extern tsapi const char* TS_HTTP_VALUE_MUST_REVALIDATE;
-  extern tsapi const char* TS_HTTP_VALUE_NONE;
-  extern tsapi const char* TS_HTTP_VALUE_NO_CACHE;
-  extern tsapi const char* TS_HTTP_VALUE_NO_STORE;
-  extern tsapi const char* TS_HTTP_VALUE_NO_TRANSFORM;
-  extern tsapi const char* TS_HTTP_VALUE_ONLY_IF_CACHED;
-  extern tsapi const char* TS_HTTP_VALUE_PRIVATE;
-  extern tsapi const char* TS_HTTP_VALUE_PROXY_REVALIDATE;
-  extern tsapi const char* TS_HTTP_VALUE_PUBLIC;
-
-  /* --------------------------------------------------------------------------
-     HTTP values string lengths */
-  extern tsapi int TS_HTTP_LEN_BYTES;
-  extern tsapi int TS_HTTP_LEN_CHUNKED;
-  extern tsapi int TS_HTTP_LEN_CLOSE;
-  extern tsapi int TS_HTTP_LEN_COMPRESS;
-  extern tsapi int TS_HTTP_LEN_DEFLATE;
-  extern tsapi int TS_HTTP_LEN_GZIP;
-  extern tsapi int TS_HTTP_LEN_IDENTITY;
-  extern tsapi int TS_HTTP_LEN_KEEP_ALIVE;
-  extern tsapi int TS_HTTP_LEN_MAX_AGE;
-  extern tsapi int TS_HTTP_LEN_MAX_STALE;
-  extern tsapi int TS_HTTP_LEN_MIN_FRESH;
-  extern tsapi int TS_HTTP_LEN_MUST_REVALIDATE;
-  extern tsapi int TS_HTTP_LEN_NONE;
-  extern tsapi int TS_HTTP_LEN_NO_CACHE;
-  extern tsapi int TS_HTTP_LEN_NO_STORE;
-  extern tsapi int TS_HTTP_LEN_NO_TRANSFORM;
-  extern tsapi int TS_HTTP_LEN_ONLY_IF_CACHED;
-  extern tsapi int TS_HTTP_LEN_PRIVATE;
-  extern tsapi int TS_HTTP_LEN_PROXY_REVALIDATE;
-  extern tsapi int TS_HTTP_LEN_PUBLIC;
-
-  /* --------------------------------------------------------------------------
-     HTTP methods */
-  extern tsapi const char* TS_HTTP_METHOD_CONNECT;
-  extern tsapi const char* TS_HTTP_METHOD_DELETE;
-  extern tsapi const char* TS_HTTP_METHOD_GET;
-  extern tsapi const char* TS_HTTP_METHOD_HEAD;
-  extern tsapi const char* TS_HTTP_METHOD_ICP_QUERY;
-  extern tsapi const char* TS_HTTP_METHOD_OPTIONS;
-  extern tsapi const char* TS_HTTP_METHOD_POST;
-  extern tsapi const char* TS_HTTP_METHOD_PURGE;
-  extern tsapi const char* TS_HTTP_METHOD_PUT;
-  extern tsapi const char* TS_HTTP_METHOD_TRACE;
-  extern tsapi const char* TS_HTTP_METHOD_PUSH;
-
-  /* --------------------------------------------------------------------------
-     HTTP methods string lengths */
-  extern tsapi int TS_HTTP_LEN_CONNECT;
-  extern tsapi int TS_HTTP_LEN_DELETE;
-  extern tsapi int TS_HTTP_LEN_GET;
-  extern tsapi int TS_HTTP_LEN_HEAD;
-  extern tsapi int TS_HTTP_LEN_ICP_QUERY;
-  extern tsapi int TS_HTTP_LEN_OPTIONS;
-  extern tsapi int TS_HTTP_LEN_POST;
-  extern tsapi int TS_HTTP_LEN_PURGE;
-  extern tsapi int TS_HTTP_LEN_PUT;
-  extern tsapi int TS_HTTP_LEN_TRACE;
-  extern tsapi int TS_HTTP_LEN_PUSH;
-
-  /* --------------------------------------------------------------------------
-     TLS Next Protocol well-known protocol names. */
-  extern tsapi const char * TS_NPN_PROTOCOL_HTTP_1_0;
-  extern tsapi const char * TS_NPN_PROTOCOL_HTTP_1_1;
-  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_1;
-  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_2;
-  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_3;
-
-  /* --------------------------------------------------------------------------
-     MLoc Constants */
-  /**
-      Use TS_NULL_MLOC as the parent in calls that require a parent
-      when an TSMLoc does not have a parent TSMLoc. For example if
-      the TSMLoc is obtained by a call to TSHttpTxnClientReqGet(),
-
-   */
-  extern tsapi const TSMLoc TS_NULL_MLOC;
-
-  /* --------------------------------------------------------------------------
-     Memory */
-#define TSmalloc(s)      _TSmalloc ((s), TS_RES_MEM_PATH)
-#define TSrealloc(p,s)   _TSrealloc ((p), (s), TS_RES_MEM_PATH)
-#define TSstrdup(p)      _TSstrdup ((p), -1, TS_RES_MEM_PATH)
-#define TSstrndup(p,n)   _TSstrdup ((p), (n), TS_RES_MEM_PATH)
-#define TSstrlcpy(d,s,l) _TSstrlcpy ((d), (s), (l))
-#define TSstrlcat(d,s,l) _TSstrlcat ((d), (s), (l))
-#define TSfree(p)        _TSfree (p)
-
-  tsapi void* _TSmalloc(size_t size, const char* path);
-  tsapi void* _TSrealloc(void* ptr, size_t size, const char* path);
-  tsapi char* _TSstrdup(const char* str, int64_t length, const char* path);
-  tsapi size_t _TSstrlcpy(char *dst, const char *str, size_t siz);
-  tsapi size_t _TSstrlcat(char *dst, const char *str, size_t siz);
-  tsapi void _TSfree(void* ptr);
-
-  /* --------------------------------------------------------------------------
-     Component object handles */
-  /**
-      Releases the TSMLoc mloc created from the TSMLoc parent.
-      If there is no parent TSMLoc, use TS_NULL_MLOC.
-
-      @param bufp marshal buffer containing the TSMLoc handle to be
-        released.
-      @param parent location of the parent object from which the handle
-        was created.
-      @param mloc location of the handle to be released.
-
-   */
-  tsapi TSReturnCode TSHandleMLocRelease(TSMBuffer bufp, TSMLoc parent, TSMLoc mloc);
-
-  /* --------------------------------------------------------------------------
-     Install and plugin locations */
-  /**
-      Gets the path of the directory in which Traffic Server is installed.
-      Use this function to specify the location of files that the
-      plugin uses.
-
-      @return pointer to Traffic Server install directory.
-
-   */
-  tsapi const char* TSInstallDirGet(void);
-
-  /**
-      Gets the path of the directory of Traffic Server configuration.
-
-      @return pointer to Traffic Server configuration directory.
-
-   */
-  tsapi const char* TSConfigDirGet(void);
-
-  /**
-      Gets the path of the plugin directory relative to the Traffic Server
-      install directory. For example, to open the file "config_ui.txt" in
-      the plugin directory:
-
-      @code
-      TSfopen("TSPluginInstallDirGet()/TSPluginDirGet()/config_ui.txt");
-      @endcode
-
-      @return pointer to plugin directory relative to Traffic Server install
-      directory.
-
-   */
-  tsapi const char* TSPluginDirGet(void);
-
-  /* --------------------------------------------------------------------------
-     Traffic Server Version */
-  /**
-      Gets the version of Traffic Server currently running. Use this
-      function to make sure that the plugin version and Traffic Server
-      version are compatible. See the SDK sample code for usage.
-
-      @return pointer to version of Traffic Server running the plugin.
-
-   */
-  tsapi const char* TSTrafficServerVersionGet(void);
-
-  /**  Get the major version of Traffic Server currently running.
-       This is the same as the first element of the string
-       returned by @c TSTrafficServerVersionGet
-
-       @return The major version as an integer.
-   */
-  int TSTrafficServerVersionGetMajor(void);
-
-  /**  Get the minor version of Traffic Server currently running.
-       This is the same as the second element of the string
-       returned by @c TSTrafficServerVersionGet
-
-       @return The minor version as an integer.
-   */
-  int TSTrafficServerVersionGetMinor(void);
-
-  /**  Get the patch version of Traffic Server currently running.
-       This is the same as the third element of the string
-       returned by @c TSTrafficServerVersionGet
-
-       @return The patch version as an integer.
-   */
-  int TSTrafficServerVersionGetPatch(void);
-
-  /* --------------------------------------------------------------------------
-     Plugin registration */
-
-  /**
-      This function registers your plugin with a particular version
-      of Traffic Server SDK. Use this function to make sure that the
-      Traffic Server version currently running also supports your plugin.
-      See the SDK sample code for usage.
-
-      @param sdk_version earliest version of the Traffic Server SDK that
-        supports your plugin.
-      @param plugin_info contains registration information about your
-        plugin. See TSPluginRegistrationInfo.
-      @return TS_ERROR if the plugin registration failed.
-
-   */
-  tsapi TSReturnCode TSPluginRegister(TSSDKVersion sdk_version, TSPluginRegistrationInfo* plugin_info);
-
-  /* --------------------------------------------------------------------------
-     Files */
-  /**
-      Opens a file for reading or writing and returns a descriptor for
-      accessing the file. The current implementation cannot open a file
-      for both reading or writing. See the SDK Programmer's Guide for
-      sample code.
-
-      @param filename file to be opened.
-      @param mode specifies whether to open the file for reading or
-        writing. If mode is "r" then the file is opened for reading.
-        If mode is "w" then the file is opened for writing. Currently
-        "r" and "w" are the only two valid modes for opening a file.
-      @return descriptor for the file that TSfopen opens. Descriptors of
-        type TSFile can be greater than 256.
-
-   */
-  tsapi TSFile TSfopen(const char* filename, const char* mode);
-
-  /**
-      Closes the file to which filep points and frees the data structures
-      and buffers associated with it. If the file was opened for writing,
-      any pending data is flushed.
-
-      @param filep file to be closed.
-
-   */
-  tsapi void TSfclose(TSFile filep);
-
-  /**
-      Attempts to read length bytes of data from the file pointed to by
-      filep into the buffer buf.
-
-      @param filep name of the file to read from.
-      @param buf buffer to read into.
-      @param length amount of data to read, in bytes.
-      @return number of bytes read. If end of the file, it returns 0.
-        If the file was not opened for reading or if an error occurs
-        while reading the file, it returns -1.
-
-   */
-  tsapi size_t TSfread(TSFile filep, void* buf, size_t length);
-
-  /**
-      Attempts to write length bytes of data from the buffer buf
-      to the file filep. Make sure that filep is open for writing.
-      You might want to check the number of bytes written (TSfwrite()
-      returns this value) against the value of length. If it is less,
-      there might be insufficient space on disk, for example.
-
-      @param filep file to write into.
-      @param buf buffer containing the data to be written.
-      @param length amount of data to write to filep, in bytes.
-      @return number of bytes written to filep. If the file was not
-        opened for writing, it returns -1. If an error occurs while
-        writing, it returns the number of bytes successfully written.
-
-   */
-  tsapi size_t TSfwrite(TSFile filep, const void* buf, size_t length);
-
-  /**
-      Flushes pending data that has been buffered up in memory from
-      previous calls to TSfwrite().
-
-      @param filep file to flush.
-
-   */
-  tsapi void TSfflush(TSFile filep);
-
-  /**
-      Reads a line from the file pointed to by filep into the buffer buf.
-      Lines are terminated by a line feed character, '\n'. The line
-      placed in the buffer includes the line feed character and is
-      terminated with a NULL. If the line is longer than length bytes
-      then only the first length-minus-1 bytes are placed in buf.
-
-      @param filep file to read from.
-      @param buf buffer to read into.
-      @param length size of the buffer to read into.
-      @return pointer to the string read into the buffer buf.
-
-   */
-  tsapi char* TSfgets(TSFile filep, char* buf, size_t length);
-
-  /* --------------------------------------------------------------------------
-     Error logging */
-  /**
-      Writes printf-style error messages to the Traffic Server error
-      log. One advantage of TSError over printf is that each call is
-      atomically placed into the error log and is not garbled with other
-      error entries. This is not an issue in single-threaded programs
-      but is a definite nuisance in multi-threaded programs.
-
-      @param fmt printf format description.
-      @param ... argument for the printf format description.
-
-  */
-  tsapi void TSError(const char* fmt, ...) TS_PRINTFLIKE(1, 2);
-
-  /* --------------------------------------------------------------------------
-     Assertions */
-  tsapi void _TSReleaseAssert(const char* txt, const char* f, int l) TS_NORETURN;
-  tsapi int _TSAssert(const char* txt, const char* f, int l);
-
-#define TSReleaseAssert(EX) \
-            ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
-
-#define TSAssert(EX) \
-            (void)((EX) || (_TSAssert(#EX, __FILE__, __LINE__)))
-
-  /* --------------------------------------------------------------------------
-     Marshal buffers */
-  /**
-      Creates a new marshal buffer and initializes the reference count
-      to 1.
-
-   */
-  tsapi TSMBuffer TSMBufferCreate(void);
-
-  /**
-      Ignores the reference count and destroys the marshal buffer bufp.
-      The internal data buffer associated with the marshal buffer is
-      also destroyed if the marshal buffer allocated it.
-
-      @param bufp marshal buffer to be destroyed.
-
-   */
-  tsapi TSReturnCode TSMBufferDestroy(TSMBuffer bufp);
-
-  /* --------------------------------------------------------------------------
-     URLs */
-  /**
-      Creates a new URL within the marshal buffer bufp. Returns a
-      location for the URL within the marshal buffer.
-
-      @param bufp marshal buffer containing the new URL.
-      @param locp pointer to a TSMLoc to store the MLoc into.
-
-   */
-  tsapi TSReturnCode TSUrlCreate(TSMBuffer bufp, TSMLoc* locp);
-
-  /**
-      Destroys the URL located at url_loc within the marshal buffer
-      bufp. Do not forget to release the TSMLoc url_loc with a call
-      to TSHandleMLocRelease().
-
-      @param bufp marshal buffer containing the URL to be destroyed.
-      @param offset location of the URL to be destroyed.
-
-   */
-  /** @deprecated There is no reason to destroy the URL, just release
-      the marshal buffers. */
-  tsapi TS_DEPRECATED TSReturnCode TSUrlDestroy(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Copies the URL located at src_url within src_bufp to a URL
-      location within the marshal buffer dest_bufp, and returns the
-      TSMLoc location of the copied URL. Unlike TSUrlCopy(), you do
-      not have to create the destination URL before cloning. Release
-      the returned TSMLoc handle with a call to TSHandleMLocRelease().
-
-      @param dest_bufp marshal buffer containing the cloned URL.
-      @param src_bufp marshal buffer containing the URL to be cloned.
-      @param src_url location of the URL to be cloned, within the marshal
-        buffer src_bufp.
-      @param locp pointer to a TSMLoc to store the MLoc into.
-
-   */
-  tsapi TSReturnCode TSUrlClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_url, TSMLoc* locp);
-
-  /**
-      Copies the contents of the URL at location src_loc within the
-      marshal buffer src_bufp to the location dest_loc within the marshal
-      buffer dest_bufp. TSUrlCopy() works correctly even if src_bufp
-      and dest_bufp point to different marshal buffers. Important: create
-      the destination URL before copying into it. Use TSUrlCreate().
-
-      @param dest_bufp marshal buffer to contain the copied URL.
-      @param dest_offset location of the URL to be copied.
-      @param src_bufp marshal buffer containing the source URL.
-      @param src_offset location of the source URL within src_bufp.
-
-   */
-  tsapi TSReturnCode TSUrlCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp, TSMLoc src_offset);
-
-  /**
-      Formats a URL stored in an TSMBuffer into an TSIOBuffer.
-
-      @param bufp marshal buffer contain the URL to be printed.
-      @param offset location of the URL within bufp.
-      @param iobufp destination TSIOBuffer for the URL.
-
-   */
-  tsapi void TSUrlPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
-
-  /**
-      Parses a URL. The start pointer is both an input and an output
-      parameter and marks the start of the URL to be parsed. After
-      a successful parse, the start pointer equals the end pointer.
-      The end pointer must be one byte after the last character you
-      want to parse. The URL parsing routine assumes that everything
-      between start and end is part of the URL. It is up to higher level
-      parsing routines, such as TSHttpHdrParseReq(), to determine the
-      actual end of the URL. Returns TS_PARSE_ERROR if an error occurs,
-      otherwise TS_PARSE_DONE is returned to indicate success.
-
-      @param bufp marshal buffer containing the URL to be parsed.
-      @param offset location of the URL to be parsed.
-      @param start points to the start of the URL to be parsed AND at
-        the end of a successful parse it will equal the end pointer.
-      @param end must be one byte after the last character.
-      @return TS_PARSE_ERROR or TS_PARSE_DONE.
-
-   */
-  tsapi TSParseResult TSUrlParse(TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
-
-  /**
-      Calculates the length of the URL located at url_loc within the
-      marshal buffer bufp if it were returned as a string. This length
-      is the same as the length returned by TSUrlStringGet().
-
-      @param bufp marshal buffer containing the URL whose length you want.
-      @param offset location of the URL within the marshal buffer bufp.
-      @return string length of the URL.
-
-   */
-  tsapi int TSUrlLengthGet(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Constructs a string representation of the URL located at url_loc
-      within bufp. TSUrlStringGet() stores the length of the allocated
-      string in the parameter length. This is the same length that
-      TSUrlLengthGet() returns. The returned string is allocated by a
-      call to TSmalloc(). It should be freed by a call to TSfree().
-      The length parameter must present, providing storage for the URL
-      string length value.
-      Note: To get the effective URL from a request, use the alternative
-            TSHttpTxnEffectiveUrlStringGet API.
-
-      @param bufp marshal buffer containing the URL you want to get.
-      @param offset location of the URL within bufp.
-      @param length string length of the URL.
-      @return The URL as a string.
-
-   */
-  tsapi char* TSUrlStringGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Retrieves the scheme portion of the URL located at url_loc within
-      the marshal buffer bufp. TSUrlSchemeGet() places the length of
-      the string in the length argument. If the length is NULL then no
-      attempt is made to dereference it.
-
-      @param bufp marshal buffer storing the URL.
-      @param offset location of the URL within bufp.
-      @param length length of the returned string.
-      @return The scheme portion of the URL, as a string.
-
-   */
-  tsapi const char* TSUrlSchemeGet(TSMBuffer bufp, TSMLoc offset, int *length);
-
-  /**
-      Sets the scheme portion of the URL located at url_loc within
-      the marshal buffer bufp to the string value. If length is -1
-      then TSUrlSchemeSet() assumes that value is null-terminated.
-      Otherwise, the length of the string value is taken to be length.
-      TSUrlSchemeSet() copies the string to within bufp, so it is OK
-      to modify or delete value after calling TSUrlSchemeSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param value value to set the URL's scheme to.
-      @param length string stored in value.
-
-   */
-  tsapi TSReturnCode TSUrlSchemeSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /* --------------------------------------------------------------------------
-     Internet specific URLs */
-  /**
-      Retrieves the user portion of the URL located at url_loc
-      within bufp. Note: the returned string is not guaranteed to
-      be null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length length of the returned string.
-      @return user portion of the URL.
-
-   */
-  tsapi const char* TSUrlUserGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the user portion of the URL located at url_loc within bufp
-      to the string value. If length is -1 then TSUrlUserSet() assumes
-      that value is null-terminated. Otherwise, the length of the string
-      value is taken to be length. TSUrlUserSet() copies the string to
-      within bufp, so it is OK to modify or delete value after calling
-      TSUrlUserSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL whose user is to be set.
-      @param value holds the new user name.
-      @param length string length of value.
-
-   */
-  tsapi TSReturnCode TSUrlUserSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-      Retrieves the password portion of the URL located at url_loc
-      within bufp. TSUrlPasswordGet() places the length of the returned
-      string in the length argument. Note: the returned string is
-      not guaranteed to be null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset
-      @param length of the returned password string.
-      @return password portion of the URL.
-
-   */
-  tsapi const char* TSUrlPasswordGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the password portion of the URL located at url_loc within
-      bufp to the string value. If length is -1 then TSUrlPasswordSet()
-      assumes that value is null-terminated. Otherwise, the length
-      of value is taken to be length. TSUrlPasswordSet() copies the
-      string to within bufp, so it is okay to modify or delete value
-      after calling TSUrlPasswordSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset
-      @param value new password.
-      @param length of the new password.
-
-   */
-  tsapi TSReturnCode TSUrlPasswordSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-      Retrieves the host portion of the URL located at url_loc
-      within bufp. Note: the returned string is not guaranteed to be
-      null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length of the returned string.
-      @return Host portion of the URL.
-
-   */
-  tsapi const char* TSUrlHostGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the host portion of the URL at url_loc to the string value.
-      If length is -1 then TSUrlHostSet() assumes that value is
-      null-terminated. Otherwise, the length of the string value is
-      taken to be length. The string is copied to within bufp, so you
-      can modify or delete value after calling TSUrlHostSet().
-
-      @param bufp marshal buffer containing the URL to modify.
-      @param offset location of the URL.
-      @param value new host name for the URL.
-      @param length string length of the new host name of the URL.
-
-   */
-  tsapi TSReturnCode TSUrlHostSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-      Retrieves the port portion of the URL located at url_loc.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @return port portion of the URL.
-
-   */
-  tsapi int TSUrlPortGet(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Sets the port portion of the URL located at url_loc.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param port new port setting for the URL.
-
-   */
-  tsapi TSReturnCode TSUrlPortSet(TSMBuffer bufp, TSMLoc offset, int port);
-
-  /* --------------------------------------------------------------------------
-     HTTP specific URLs */
-  /**
-      Retrieves the path portion of the URL located at url_loc within
-      bufp. TSUrlPathGet() places the length of the returned string in
-      the length argument. Note: the returned string is not guaranteed to
-      be null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length of the returned string.
-      @return path portion of the URL.
-
-   */
-  tsapi const char* TSUrlPathGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the path portion of the URL located at url_loc within bufp
-      to the string value. If length is -1 then TSUrlPathSet() assumes
-      that value is null-terminated. Otherwise, the length of the value
-      is taken to be length. TSUrlPathSet() copies the string into bufp,
-      so you can modify or delete value after calling TSUrlPathSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param value new path string for the URL.
-      @param length of the new path string.
-
-   */
-  tsapi TSReturnCode TSUrlPathSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /* --------------------------------------------------------------------------
-     FTP specific URLs */
-  /**
-      Retrieves the FTP type of the URL located at url_loc within bufp.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @return FTP type of the URL.
-
-   */
-  tsapi int TSUrlFtpTypeGet(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Sets the FTP type portion of the URL located at url_loc within
-      bufp to the value type.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL to modify.
-      @param type new FTP type for the URL.
-
-   */
-  tsapi TSReturnCode TSUrlFtpTypeSet(TSMBuffer bufp, TSMLoc offset, int type);
-
-  /* --------------------------------------------------------------------------
-     HTTP specific URLs */
-  /**
-      Retrieves the HTTP params portion of the URL located at url_loc
-      within bufp. The length of the returned string is in the length
-      argument. Note: the returned string is not guaranteed to be
-      null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length of the returned string.
-      @return HTTP params portion of the URL.
-
-   */
-  tsapi const char* TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the HTTP params portion of the URL located at url_loc within
-      bufp to the string value. If length is -1 that TSUrlHttpParamsSet()
-      assumes that value is null-terminated. Otherwise, the length of
-      the string value is taken to be length. TSUrlHttpParamsSet()
-      copies the string to within bufp, so you can modify or delete
-      value after calling TSUrlHttpParamsSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param value HTTP params string to set in the URL.
-      @param length string length of the new HTTP params value.
-
-   */
-  tsapi TSReturnCode TSUrlHttpParamsSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-      Retrieves the HTTP query portion of the URL located at url_loc
-      within bufp. The length of the returned string is in the length
-      argument. Note: the returned string is not guaranteed to be
-      null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length of the returned string.
-      @return HTTP query portion of the URL.
-
-   */
-  tsapi const char* TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the HTTP query portion of the URL located at url_loc within
-      bufp to value. If length is -1, the string value is assumed to
-      be null-terminated; otherwise, the length of value is taken to be
-      length. TSUrlHttpQuerySet() copies the string to within bufp, so
-      you can modify or delete value after calling TSUrlHttpQuerySet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL within bufp.
-      @param value new HTTP query string for the URL.
-      @param length of the new HTTP query string.
-
-   */
-  tsapi TSReturnCode TSUrlHttpQuerySet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-      Retrieves the HTTP fragment portion of the URL located at url_loc
-      within bufp. The length of the returned string is in the length
-      argument. Note: the returned string is not guaranteed to be
-      null-terminated.
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL.
-      @param length of the returned string.
-      @return HTTP fragment portion of the URL.
-
-   */
-  tsapi const char* TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc offset, int* length);
-
-  /**
-      Sets the HTTP fragment portion of the URL located at url_loc
-      within bufp to value. If length is -1, the string value is
-      assumed to be null-terminated; otherwise, the length of value
-      is taken to be length. TSUrlHttpFragmentSet() copies the string
-      to within bufp, so you can modify or delete value after calling
-      TSUrlHttpFragmentSet().
-
-      @param bufp marshal buffer containing the URL.
-      @param offset location of the URL within bufp.
-      @param value new HTTP fragment string for the URL.
-      @param length of the new HTTP query string.
-
-   */
-  tsapi TSReturnCode TSUrlHttpFragmentSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-
-  /**
-     Perform percent-encoding of the string in the buffer, storing the
-     new string in the destination buffer. The length parameter will be
-     set to the new (encoded) string length, or 0 if the encoding failed.
-
-     @param str the string buffer to encode.
-     @param str_len length of the string buffer.
-     @param dst destination buffer.
-     @param dst_size size of the destination buffer.
-     @param length amount of data written to the destination buffer.
-     @param map optional (can be NULL) map of characters to encode.
-
-  */
-  tsapi TSReturnCode TSStringPercentEncode(const char *str, int str_len, char *dst, size_t dst_size, size_t *length, const unsigned char *map);
-
-  /**
-     Similar to TSStringPercentEncode(), but works on a URL object.
-
-     @param bufp marshal buffer containing the URL.
-     @param offset location of the URL within bufp.
-     @param dst destination buffer.
-     @param dst_size size of the destination buffer.
-     @param length amount of data written to the destination buffer.
-     @param map optional (can be NULL) map of characters to encode.
-
-  */
-  tsapi TSReturnCode TSUrlPercentEncode(TSMBuffer bufp, TSMLoc offset, char *dst, size_t dst_size, size_t *length, const unsigned char *map);
-
-  /**
-     Perform percent-decoding of the string in the buffer, writing
-     to the output buffer. The source and destination can be the same,
-     in which case they overwrite. The decoded string is always
-     guaranteed to be no longer than the source string.
-
-     @param str the string to decode (and possibly write to).
-     @param str_len length of the input string (or 0).
-     @param dst output buffer (can be the same as src).
-     @param dst_len size of the output buffer.
-     @param length amount of data written to the destination buffer.
-
-  */
-  tsapi TSReturnCode TSStringPercentDecode(const char *str, size_t str_len, char *dst, size_t dst_size, size_t *length);
-
-
-
-  /* --------------------------------------------------------------------------
-     MIME headers */
-
-  /**
-      Creates a MIME parser. The parser's data structure contains
-      information about the header being parsed. A single MIME
-      parser can be used multiple times, though not simultaneously.
-      Before being used again, the parser must be cleared by calling
-      TSMimeParserClear().
-
-   */
-  tsapi TSMimeParser TSMimeParserCreate(void);
-
-  /**
-      Clears the specified MIME parser so that it can be used again.
-
-      @param parser to be cleared.
-
-   */
-  tsapi void TSMimeParserClear(TSMimeParser parser);
-
-  /**
-      Destroys the specified MIME parser and frees the associated memory.
-
-      @param parser to destroy.
-   */
-  tsapi void TSMimeParserDestroy(TSMimeParser parser);
-
-  /**
-      Creates a new MIME header within bufp. Release with a call to
-      TSHandleMLocRelease().
-
-      @param bufp marshal buffer to contain the new MIME header.
-      @param locp buffer pointer to contain the MLoc
-
-   */
-  tsapi TSReturnCode TSMimeHdrCreate(TSMBuffer bufp, TSMLoc* locp);
-
-  /**
-      Destroys the MIME header located at hdr_loc within bufp.
-
-      @param bufp marshal buffer containing the MIME header to destroy.
-      @param offset location of the MIME header.
-
-   */
-  tsapi TSReturnCode TSMimeHdrDestroy(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Copies a specified MIME header to a specified marshal buffer,
-      and returns the location of the copied MIME header within the
-      destination marshal buffer. Unlike TSMimeHdrCopy(), you do not
-      have to create the destination MIME header before cloning. Release
-      the returned TSMLoc handle with a call to TSHandleMLocRelease().
-
-      @param dest_bufp destination marshal buffer.
-      @param src_bufp source marshal buffer.
-      @param src_hdr location of the source MIME header.
-      @param locp where to store the location of the copied MIME header.
-
-   */
-  tsapi TSReturnCode TSMimeHdrClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc* locp);
-
-  /**
-      Copies the contents of the MIME header located at src_loc
-      within src_bufp to the MIME header located at dest_loc within
-      dest_bufp. TSMimeHdrCopy() works correctly even if src_bufp and
-      dest_bufp point to different marshal buffers. Important: you must
-      create the destination MIME header before copying into it--use
-      TSMimeHdrCreate().
-
-      @param dest_bufp is the destination marshal buffer.
-      @param dest_offset
-      @param src_bufp is the source marshal buffer.
-      @param src_offset
-
-   */
-  tsapi TSReturnCode TSMimeHdrCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp,
-                                      TSMLoc src_offset);
-
-  /**
-      Formats the MIME header located at hdr_loc within bufp into the
-      TSIOBuffer iobufp.
-
-      @param bufp marshal buffer containing the header to be copied to
-        an TSIOBuffer.
-      @param offset
-      @param iobufp target TSIOBuffer.
-
-   */
-  tsapi void TSMimeHdrPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
-
-  /**
-      Parses a MIME header. The MIME header must have already been
-      allocated and both bufp and hdr_loc must point within that header.
-      It is possible to parse a MIME header a single byte at a time
-      using repeated calls to TSMimeHdrParse(). As long as an error
-      does not occur, TSMimeHdrParse() consumes each single byte and
-      asks for more.
-
-      @param parser parses the specified MIME header.
-      @param bufp marshal buffer containing the MIME header to be parsed.
-      @param offset
-      @param start both an input and output. On input, the start
-        argument points to the current position of the buffer being
-        parsed. On return, start is modified to point past the last
-        character parsed.
-      @param end points to one byte after the end of the buffer.
-      @return One of 3 possible int values:
-        - TS_PARSE_ERROR if there is a parsing error.
-        - TS_PARSE_DONE is returned when a "\r\n\r\n" pattern is
-          encountered, indicating the end of the header.
-        - TS_PARSE_CONT is returned if parsing of the header stopped
-          because the end of the buffer was reached.
-
-   */
-  tsapi TSParseResult TSMimeHdrParse(TSMimeParser parser, TSMBuffer bufp, TSMLoc offset, const char** start,
-                                     const char* end);
-
-  /**
-      Calculates the length of the MIME header located at hdr_loc if it
-      were returned as a string. This the length of the MIME header in
-      its unparsed form.
-
-      @param bufp marshal buffer containing the MIME header.
-      @param offset location of the MIME header.
-      @return string length of the MIME header located at hdr_loc.
-
-   */
-  tsapi int TSMimeHdrLengthGet(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Removes and destroys all the MIME fields within the MIME header
-      located at hdr_loc within the marshal buffer bufp.
-
-      @param bufp marshal buffer containing the MIME header.
-      @param offset location of the MIME header.
-
-   */
-  tsapi TSReturnCode TSMimeHdrFieldsClear(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Returns a count of the number of MIME fields within the MIME header
-      located at hdr_loc within the marshal buffer bufp.
-
-      @param bufp marshal buffer containing the MIME header.
-      @param offset location of the MIME header within bufp.
-      @return number of MIME fields within the MIME header located
-        at hdr_loc.
-
-   */
-  tsapi int TSMimeHdrFieldsCount(TSMBuffer bufp, TSMLoc offset);
-
-  /**
-      Retrieves the location of a specified MIME field within the
-      MIME header located at hdr_loc within bufp. The idx parameter
-      specifies which field to retrieve. The fields are numbered from 0
-      to TSMimeHdrFieldsCount(bufp, hdr_loc) - 1. If idx does not lie
-      within that range then TSMimeHdrFieldGet returns 0. Release the
-      returned handle with a call to TSHandleMLocRelease.
-
-      @param bufp marshal buffer containing the MIME header.
-      @param hdr location of the MIME header.
-      @param idx index of the field to get with base at 0.
-      @return location of the specified MIME field.
-
-   */
-  tsapi TSMLoc TSMimeHdrFieldGet(TSMBuffer bufp, TSMLoc hdr, int idx);
-
-  /**
-      Retrieves the TSMLoc location of a specified MIME field from within
-      the MIME header located at hdr. The name and length parameters
-      specify which field to retrieve. For each MIME field in the MIME
-      header, a case insensitive string comparison is done between
-      the field name and name. If TSMimeHdrFieldFind() cannot find the
-      requested field, it returns TS_NULL_MLOC. Release the returned
-      TSMLoc handle with a call to TSHandleMLocRelease().
-
-      @param bufp marshal buffer containing the MIME header field to find.
-      @param hdr location of the MIME header containing the field.
-      @param name of the field to retrieve.
-      @param length string length of the string name. If length is -1,
-        then name is assumed to be null-terminated.
-      @return location of the requested MIME field. If the field could
-        not be found, returns TS_NULL_MLOC.
-
-   */
-  tsapi TSMLoc TSMimeHdrFieldFind(TSMBuffer bufp, TSMLoc hdr, const char* name, int length);
-
-  /**
-      Returns the TSMLoc location of a specified MIME field from within
-      the MIME header located at hdr. The retrieved_str parameter
-      specifies which field to retrieve. For each MIME field in the
-      MIME header, a pointer comparison is done between the field name
-      and retrieved_str. This is a much quicker retrieval function
-      than TSMimeHdrFieldFind() since it obviates the need for a
-      string comparison. However, retrieved_str must be one of the
-      predefined field names of the form TS_MIME_FIELD_XXX for the
-      call to succeed. Release the returned TSMLoc handle with a call
-      to TSHandleMLocRelease().
-
-      @param bufp marshal buffer containing the MIME field.
-      @param hdr location of the MIME header containing the field.
-      @param retrieved_str specifies the field to retrieve. Must be
-        one of the predefined field names of the form TS_MIME_FIELD_XXX.
-      @return location of the requested MIME field. If the requested
-        field cannot be found, returns 0.
-
-   */
-  tsapi TSReturnCode TSMimeHdrFieldAppend(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-
-  /**
-      Removes the MIME field located at field within bufp from the
-      header located at hdr within bufp. If the specified field cannot
-      be found in the list of fields associated with the header then
-      nothing is done.
-
-      Note: removing the field does not destroy the field, it only
-      detaches the field, hiding it from the printed output. The field
-      can be reattached with a call to TSMimeHdrFieldAppend(). If you
-      do not use the detached field you should destroy it with a call to
-      TSMimeHdrFieldDestroy() and release the handle field with a call
-      to TSHandleMLocRelease().
-
-      @param bufp contains the MIME field to remove.
-      @param hdr location of the header containing the MIME field to
-        be removed. This header could be an HTTP header or MIME header.
-      @param field is the location of the field to remove.
-
-   */
-  tsapi TSReturnCode TSMimeHdrFieldRemove(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-
-  tsapi TSReturnCode TSMimeHdrFieldCreate(TSMBuffer bufp, TSMLoc hdr, TSMLoc* locp);
-
-  /****************************************************************************
-   *  Create a new field and assign it a name all in one call
-   ****************************************************************************/
-  tsapi TSReturnCode TSMimeHdrFieldCreateNamed(TSMBuffer bufp, TSMLoc mh_mloc, const char* name, int name_len, TSMLoc* locp);
-
-  /**
-      Destroys the MIME field located at field within bufp. You must
-      release the TSMLoc field with a call to TSHandleMLocRelease().
-
-      @param bufp contains the MIME field to be destroyed.
-      @param hdr location of the parent header containing the field
-        to be destroyed. This could be the location of a MIME header or
-        HTTP header.
-      @param field location of the field to be destroyed.
-
-   */
-  tsapi TSReturnCode TSMimeHdrFieldDestroy(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-
-  tsapi TSReturnCode TSMimeHdrFieldClone(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMBuffer src_bufp, TSMLoc src_hdr,
-                                         TSMLoc src_field, TSMLoc* locp);
-  tsapi TSReturnCode TSMimeHdrFieldCopy(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMLoc dest_field,
-                                        TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc src_field);
-  tsapi TSReturnCode TSMimeHdrFieldCopyValues(TSMBuffer dest_bufp, TSMLoc dest_hdr, TSMLoc dest_field,
-                                              TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc src_field);
-  tsapi TSMLoc TSMimeHdrFieldNext(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-  tsapi TSMLoc TSMimeHdrFieldNextDup(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-  tsapi int TSMimeHdrFieldLengthGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-  tsapi const char* TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int* length);
-  tsapi TSReturnCode TSMimeHdrFieldNameSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, const char* name, int length);
-
-  tsapi TSReturnCode TSMimeHdrFieldValuesClear(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-  tsapi int TSMimeHdrFieldValuesCount(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-
-  tsapi const char* TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int* value_len_ptr);
-  tsapi int TSMimeHdrFieldValueIntGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
-  tsapi int64_t TSMimeHdrFieldValueInt64Get(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
-  tsapi unsigned int TSMimeHdrFieldValueUintGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
-  tsapi time_t TSMimeHdrFieldValueDateGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field);
-  tsapi TSReturnCode TSMimeHdrFieldValueStringSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
-                                                     const char* value, int length);
-  tsapi TSReturnCode TSMimeHdrFieldValueIntSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value);
-  tsapi TSReturnCode TSMimeHdrFieldValueInt64Set(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int64_t value);
-  tsapi TSReturnCode TSMimeHdrFieldValueUintSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
-                                                   unsigned int value);
-  tsapi TSReturnCode TSMimeHdrFieldValueDateSet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, time_t value);
-
-  tsapi TSReturnCode TSMimeHdrFieldValueAppend(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
-                                                  const char* value, int length);
-  tsapi TSReturnCode TSMimeHdrFieldValueStringInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
-                                                        const char* value, int length);
-  tsapi TSReturnCode TSMimeHdrFieldValueIntInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, int value);
-  tsapi TSReturnCode TSMimeHdrFieldValueUintInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx,
-                                                      unsigned int value);
-  tsapi TSReturnCode TSMimeHdrFieldValueDateInsert(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, time_t value);
-
-  tsapi TSReturnCode TSMimeHdrFieldValueDelete(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx);
-
-  /* --------------------------------------------------------------------------
-     HTTP headers */
-  tsapi TSHttpParser TSHttpParserCreate(void);
-  tsapi void TSHttpParserClear(TSHttpParser parser);
-  tsapi void TSHttpParserDestroy(TSHttpParser parser);
-
-  /**
-      Parses an HTTP request header. The HTTP header must have already
-      been created, and must reside inside the marshal buffer bufp.
-      The start argument points to the current position of the string
-      buffer being parsed. The end argument points to one byte after the
-      end of the buffer to be parsed. On return, TSHttpHdrParseReq()
-      modifies start to point past the last character parsed.
-
-      It is possible to parse an HTTP request header a single byte at
-      a time using repeated calls to TSHttpHdrParseReq(). As long as
-      an error does not occur, the TSHttpHdrParseReq() function will
-      consume that single byte and ask for more.
-
-      @param parser parses the HTTP header.
-      @param bufp marshal buffer containing the HTTP header to be parsed.
-      @param offset location of the HTTP header within bufp.
-      @param start both an input and output. On input, it points to the
-        current position of the string buffer being parsed. On return,
-        start is modified to point past the last character parsed.
-      @param end points to one byte after the end of the buffer to be parsed.
-      @return status of the parse:
-        - TS_PARSE_ERROR means there was a parsing error.
-        - TS_PARSE_DONE means that the end of the header was reached
-          (the parser encountered a "\r\n\r\n" pattern).
-        - TS_PARSE_CONT means that parsing of the header stopped because
-          the parser reached the end of the buffer (large headers can
-          span multiple buffers).
-
-   */
-  tsapi TSParseResult TSHttpHdrParseReq(TSHttpParser parser, TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
-
-  tsapi TSParseResult TSHttpHdrParseResp(TSHttpParser parser, TSMBuffer bufp, TSMLoc offset, const char** start, const char* end);
-
-  tsapi TSMLoc TSHttpHdrCreate(TSMBuffer bufp);
-
-  /**
-      Destroys the HTTP header located at hdr_loc within the marshal
-      buffer bufp. Do not forget to release the handle hdr_loc with a
-      call to TSHandleMLocRelease().
-
-   */
-  tsapi void TSHttpHdrDestroy(TSMBuffer bufp, TSMLoc offset);
-
-  tsapi TSReturnCode TSHttpHdrClone(TSMBuffer dest_bufp, TSMBuffer src_bufp, TSMLoc src_hdr, TSMLoc* locp);
-
-  /**
-      Copies the contents of the HTTP header located at src_loc within
-      src_bufp to the HTTP header located at dest_loc within dest_bufp.
-      TSHttpHdrCopy() works correctly even if src_bufp and dest_bufp
-      point to different marshal buffers. Make sure that you create the
-      destination HTTP header before copying into it.
-
-      Note: TSHttpHdrCopy() appends the port number to the domain
-      of the URL portion of the header. For example, a copy of
-      http://www.example.com appears as http://www.example.com:80 in
-      the destination buffer.
-
-      @param dest_bufp marshal buffer to contain the copied header.
-      @param dest_offset location of the copied header.
-      @param src_bufp marshal buffer containing the source header.
-      @param src_offset location of the source header.
-
-   */
-  tsapi TSReturnCode TSHttpHdrCopy(TSMBuffer dest_bufp, TSMLoc dest_offset, TSMBuffer src_bufp,
-                                   TSMLoc src_offset);
-
-  tsapi void TSHttpHdrPrint(TSMBuffer bufp, TSMLoc offset, TSIOBuffer iobufp);
-
-  tsapi int TSHttpHdrLengthGet(TSMBuffer bufp, TSMLoc offset);
-
-  tsapi TSHttpType TSHttpHdrTypeGet(TSMBuffer bufp, TSMLoc offset);
-  tsapi TSReturnCode TSHttpHdrTypeSet(TSMBuffer bufp, TSMLoc offset, TSHttpType type);
-
-  tsapi int TSHttpHdrVersionGet(TSMBuffer bufp, TSMLoc offset);
-  tsapi TSReturnCode TSHttpHdrVersionSet(TSMBuffer bufp, TSMLoc offset, int ver);
-
-  tsapi const char* TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc offset, int* length);
-  tsapi TSReturnCode TSHttpHdrMethodSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-  tsapi TSReturnCode TSHttpHdrUrlGet(TSMBuffer bufp, TSMLoc offset, TSMLoc* locp);
-  tsapi TSReturnCode TSHttpHdrUrlSet(TSMBuffer bufp, TSMLoc offset, TSMLoc url);
-
-  tsapi TSHttpStatus TSHttpHdrStatusGet(TSMBuffer bufp, TSMLoc offset);
-  tsapi TSReturnCode TSHttpHdrStatusSet(TSMBuffer bufp, TSMLoc offset, TSHttpStatus status);
-  tsapi const char* TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc offset, int* length);
-  tsapi TSReturnCode TSHttpHdrReasonSet(TSMBuffer bufp, TSMLoc offset, const char* value, int length);
-  tsapi const char* TSHttpHdrReasonLookup(TSHttpStatus status);
-
-  /* ------------------------------------------------------------

<TRUNCATED>

[29/50] [abbrv] git commit: [TS-2651] atscppapi: race conditions in destruction of async providers. This closes #64

Posted by zw...@apache.org.
[TS-2651] atscppapi: race conditions in destruction of async providers. This closes #64


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

Branch: refs/heads/lua_config
Commit: 89c7daeef6257b14d0b94dd71b46c390308c91d9
Parents: b883169
Author: Brian Geffon <br...@apache.org>
Authored: Wed Mar 19 15:58:54 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Wed Mar 19 15:58:54 2014 -0700

----------------------------------------------------------------------
 CHANGES | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/89c7daee/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3484cf0..72526cd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
+  
   *) [TS-2651] atscppapi: race conditions in destruction of async providers
  
   *) [TS-2646] regex_remap: Add a new option, @caseless.


[20/50] [abbrv] git commit: Ignore the new apidefs.h, which is generated

Posted by zw...@apache.org.
Ignore the new apidefs.h, which is generated


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

Branch: refs/heads/lua_config
Commit: 083833120496f3dc01feace969069e745f305c3f
Parents: df0938a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Mar 19 13:29:50 2014 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Mar 19 13:29:50 2014 -0700

----------------------------------------------------------------------
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08383312/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7ba5f45..e14ee33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,7 @@ cmd/traffic_top/traffic_top
 
 lib/ts/ink_autoconf.h
 lib/ts/ink_config.h
+lib/ts/apidefs.h
 lib/ts/stamp-h1
 lib/ts/CompileParseRules
 lib/ts/ParseRulesCType


[47/50] [abbrv] git commit: TS-2564 Revert field token ordering.

Posted by zw...@apache.org.
TS-2564 Revert field token ordering.


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

Branch: refs/heads/lua_config
Commit: 8d7d25db897269988bcc1df662cd77d5707c34c4
Parents: 265ece1
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Tue Mar 25 18:48:53 2014 -0500
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Tue Mar 25 18:48:53 2014 -0500

----------------------------------------------------------------------
 iocore/cache/I_CacheDefs.h | 2 +-
 proxy/hdrs/HdrToken.cc     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8d7d25db/iocore/cache/I_CacheDefs.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_CacheDefs.h b/iocore/cache/I_CacheDefs.h
index 6b25873..e41709a 100644
--- a/iocore/cache/I_CacheDefs.h
+++ b/iocore/cache/I_CacheDefs.h
@@ -34,7 +34,7 @@
 #define CACHE_ALT_REMOVED           -2
 
 #define CACHE_DB_MAJOR_VERSION      23
-#define CACHE_DB_MINOR_VERSION      0
+#define CACHE_DB_MINOR_VERSION      1
 
 #define CACHE_DIR_MAJOR_VERSION     18
 #define CACHE_DIR_MINOR_VERSION     0

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8d7d25db/proxy/hdrs/HdrToken.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrToken.cc b/proxy/hdrs/HdrToken.cc
index f47115d..2a2909a 100644
--- a/proxy/hdrs/HdrToken.cc
+++ b/proxy/hdrs/HdrToken.cc
@@ -107,7 +107,6 @@ static const char *_hdrtoken_strs[] = {
   "Sender",                     // NNTP
   "Server",
   "Set-Cookie",
-  "Strict-Transport-Security",
   "Subject",                    // NNTP
   "Summary",                    // NNTP
   "Transfer-Encoding",
@@ -189,6 +188,7 @@ static const char *_hdrtoken_strs[] = {
   "X-ID",
   "X-Forwarded-For",
   "TE",
+  "Strict-Transport-Security"
 };
 
 static HdrTokenTypeBinding _hdrtoken_strs_type_initializers[] = {
@@ -446,7 +446,6 @@ static const char *_hdrtoken_commonly_tokenized_strs[] = {
   "Sender",                     // NNTP
   "Server",
   "Set-Cookie",
-  "Strict-Transport-Security",
   "Subject",                    // NNTP
   "Summary",                    // NNTP
   "Transfer-Encoding",
@@ -528,6 +527,7 @@ static const char *_hdrtoken_commonly_tokenized_strs[] = {
   "X-ID",
   "X-Forwarded-For",
   "TE",
+  "Strict-Transport-Security"
 };
 
 /*-------------------------------------------------------------------------


[40/50] [abbrv] git commit: [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default. This closes #66

Posted by zw...@apache.org.
[TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default. This closes #66


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

Branch: refs/heads/lua_config
Commit: f6a1cd7c3e04fa5e680a1731c1cb83c5ccaf5d23
Parents: 8dd20f5
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 10:56:32 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 10:56:32 2014 -0700

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f6a1cd7c/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index e98e70a..3621399 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -404,7 +404,7 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.http.keep_alive_enabled_out", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.keep_alive_post_out", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.keep_alive_post_out", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http.chunking_enabled", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,


[44/50] [abbrv] git commit: [TS-2664] Removing initializable value files

Posted by zw...@apache.org.
[TS-2664] Removing initializable value files


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

Branch: refs/heads/lua_config
Commit: 53431324ddc54ede890d3a7274648057b6cabfaf
Parents: 70599ab
Author: Brian Geffon <br...@apache.org>
Authored: Tue Mar 25 14:18:19 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Tue Mar 25 14:18:19 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/InitializableValue.cc        | 29 -------
 lib/atscppapi/src/include/InitializableValue.h | 90 ---------------------
 2 files changed, 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53431324/lib/atscppapi/src/InitializableValue.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InitializableValue.cc b/lib/atscppapi/src/InitializableValue.cc
deleted file mode 100644
index a0d87af..0000000
--- a/lib/atscppapi/src/InitializableValue.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/**
- * @file InitializableValue.cc
- */
-
-#include "InitializableValue.h"
-
-#ifdef DISABLE_TRANSACTION_DATA_CACHING
-bool atscppapi::transaction_data_caching_enabled = false;
-#else
-bool atscppapi::transaction_data_caching_enabled = true;
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/53431324/lib/atscppapi/src/include/InitializableValue.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/InitializableValue.h b/lib/atscppapi/src/include/InitializableValue.h
deleted file mode 100644
index 8d20320..0000000
--- a/lib/atscppapi/src/include/InitializableValue.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/**
- * @file InitializableValue.h
- */
-
-#pragma once
-#ifndef ATSCPPAPI_INITIALIZABLEVALUE_H_
-#define ATSCPPAPI_INITIALIZABLEVALUE_H_
-
-namespace atscppapi {
-
-// cannot be static as InitializableValue is a template and a static
-// member of that would be instantiated once for every type the
-// template is instantiated
-extern bool transaction_data_caching_enabled;
-
-/**
- * @private
- */
-template <typename Type> class InitializableValue {
-public:
-  InitializableValue() : initialized_(false) { }
-  explicit InitializableValue(Type value, bool initialized = true) : value_(value), initialized_(initialized) { }
-
-  inline void setValue(const Type &value) {
-    value_ = value;
-    initialized_ = true;
-  }
-
-  inline bool isInitialized() const {
-#ifdef DISABLE_TRANSACTION_DATA_CACHING
-    return false;
-#endif
-    return transaction_data_caching_enabled && initialized_;
-  }
-
-  inline Type &getValueRef() {
-    return value_;
-  }
-
-  inline Type getValue() {
-    return value_;
-  }
-
-  inline const Type &getValueRef() const {
-    return value_;
-  }
-
-  inline void setInitialized(bool initialized = true) {
-    initialized_ = initialized;
-  }
-
-  inline operator Type&() {
-    return value_;
-  }
-
-  inline operator const Type&() const {
-    return value_;
-  }
-
-  inline InitializableValue<Type> &operator=(const Type& value) {
-    setValue(value);
-    return *this;
-  }
-
-private:
-  Type value_;
-  bool initialized_;
-};
-
-}
-
-#endif /* ATSCPPAPI_INITIALIZABLEVALUE_H_ */


[38/50] [abbrv] git commit: Fix harmless Ethread::schedule_in parameter mismatch

Posted by zw...@apache.org.
Fix harmless Ethread::schedule_in parameter mismatch


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

Branch: refs/heads/lua_config
Commit: 80156aecec9ac8cb24c28e720d71a721fc0f46a7
Parents: 059b9c8
Author: James Peach <jp...@apache.org>
Authored: Tue Mar 25 09:29:49 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 25 09:31:31 2014 -0700

----------------------------------------------------------------------
 proxy/http/HttpClientSession.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/80156aec/proxy/http/HttpClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc
index 208ada6..aac7ef8 100644
--- a/proxy/http/HttpClientSession.cc
+++ b/proxy/http/HttpClientSession.cc
@@ -474,7 +474,7 @@ HttpClientSession::state_api_callout(int event, void * /* data ATS_UNUSED */)
           plugin_lock = MUTEX_TAKE_TRY_LOCK(cur_hook->m_cont->mutex, mutex->thread_holding);
           if (!plugin_lock) {
             SET_HANDLER(&HttpClientSession::state_api_callout);
-            mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(10), ET_NET);
+            mutex->thread_holding->schedule_in(this, HRTIME_MSECONDS(10));
             return 0;
           }
         } else {


[02/50] [abbrv] TS-2630: Add lib/ts/apidefs.h to place common types

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/congest/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/congest/Makefile.am b/proxy/congest/Makefile.am
index d89d136..48a01c1 100644
--- a/proxy/congest/Makefile.am
+++ b/proxy/congest/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/proxy \
-  -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/preparse \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/http/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am
index 0f7646a..c413ed7 100644
--- a/proxy/http/Makefile.am
+++ b/proxy/http/Makefile.am
@@ -20,9 +20,7 @@ SUBDIRS = remap
 
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/lib \
   -I$(top_srcdir)/lib/records \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/http/remap/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am
index 8dd3d38..5b89dec 100644
--- a/proxy/http/remap/Makefile.am
+++ b/proxy/http/remap/Makefile.am
@@ -21,9 +21,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/utils \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/logging/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/logging/Makefile.am b/proxy/logging/Makefile.am
index dfa45be..6fb9fcb 100644
--- a/proxy/logging/Makefile.am
+++ b/proxy/logging/Makefile.am
@@ -21,9 +21,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts \
-  -I$(top_builddir)/proxy \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/proxy/http/remap \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/175dbca3/proxy/shared/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/shared/Makefile.am b/proxy/shared/Makefile.am
index 92b72af..9fbdd16 100644
--- a/proxy/shared/Makefile.am
+++ b/proxy/shared/Makefile.am
@@ -37,7 +37,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir) \
   -I$(top_srcdir)/proxy/api/ts \
-  -I$(top_builddir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/http \
   -I$(top_srcdir)/proxy/hdrs \


[43/50] [abbrv] git commit: TS-2660: rename StateMachineAction_t values with a consistent prefix

Posted by zw...@apache.org.
TS-2660: rename StateMachineAction_t values with a consistent prefix

  - All values are named SM_ACTION_XXX
  - Redundant works, like HTTP and PROXY are removed.
  - Where common tokens are use, these are grouped to the left, as
    in SM_ACTION_DNS and SM_ACTION_CACHE.
  - Removes unused actions SEND_QUERY_TO_INCOMING_ROUTER and
    EXTENSION_METHOD_TUNNEL.
  - Remove unused state HTTP_POST_REMAP_UPGRADE.


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

Branch: refs/heads/lua_config
Commit: 70599abf90c5f67d9d6c4e320cba3289f1b3df5e
Parents: 7b82da6
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 24 10:42:33 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 25 12:42:32 2014 -0700

----------------------------------------------------------------------
 CHANGES                      |   4 +-
 proxy/InkAPI.cc              |   2 +-
 proxy/http/HttpDebugNames.cc | 179 ++++++++++++------------
 proxy/http/HttpSM.cc         | 203 ++++++++++++++--------------
 proxy/http/HttpTransact.cc   | 277 +++++++++++++++++++-------------------
 proxy/http/HttpTransact.h    | 118 ++++++++--------
 proxy/http/HttpUpdateSM.cc   |  24 ++--
 7 files changed, 397 insertions(+), 410 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e675d47..b6e80db 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
- 
+
+  *) [TS-2660] Rename StateMachineAction_t values for legibility.
+
   *) [TS-2662] Re-enable KEEP_ALIVE_POST_OUT by default
 
   *) [TS-2661] Remove unused HttpSM::decided_cached_url.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index c5fb465..c9bb9ec 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -4988,7 +4988,7 @@ TSHttpTxnRedirectRequest(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc url_loc)
   s->request_sent_time = 0;
   s->response_received_time = 0;
   s->cache_info.write_lock_state = HttpTransact::CACHE_WL_INIT;
-  s->next_action = HttpTransact::REDIRECT_READ;
+  s->next_action = HttpTransact::SM_ACTION_REDIRECT_READ;
 
   return TS_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/http/HttpDebugNames.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpDebugNames.cc b/proxy/http/HttpDebugNames.cc
index 0211294..4e907cf 100644
--- a/proxy/http/HttpDebugNames.cc
+++ b/proxy/http/HttpDebugNames.cc
@@ -266,138 +266,127 @@ const char *
 HttpDebugNames::get_action_name(HttpTransact::StateMachineAction_t e)
 {
   switch (e) {
-  case HttpTransact::STATE_MACHINE_ACTION_UNDEFINED:
-    return ("STATE_UNDEFINED");
+  case HttpTransact::SM_ACTION_UNDEFINED:
+    return ("SM_ACTION_UNDEFINED");
 
-  case HttpTransact::CACHE_ISSUE_WRITE:
-    return ("CACHE_ISSUE_WRITE");
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE:
+    return ("SM_ACTION_CACHE_ISSUE_WRITE");
 
-  case HttpTransact::CACHE_ISSUE_WRITE_TRANSFORM:
-    return ("CACHE_ISSUE_WRITE_TRANSFORM");
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM:
+    return ("SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM");
 
-  case HttpTransact::CACHE_LOOKUP:
-    return ("CACHE_LOOKUP");
+  case HttpTransact::SM_ACTION_CACHE_LOOKUP:
+    return ("SM_ACTION_CACHE_LOOKUP");
 
-  case HttpTransact::DNS_LOOKUP:
-    return ("DNS_LOOKUP");
+  case HttpTransact::SM_ACTION_DNS_LOOKUP:
+    return ("SM_ACTION_DNS_LOOKUP");
 
-  case HttpTransact::REVERSE_DNS_LOOKUP:
-    return ("REVERSE_DNS_LOOKUP");
+  case HttpTransact::SM_ACTION_DNS_REVERSE_LOOKUP:
+    return ("SM_ACTION_DNS_REVERSE_LOOKUP");
 
-  case HttpTransact::ICP_QUERY:
-    return ("ICP_QUERY");
+  case HttpTransact::SM_ACTION_ICP_QUERY:
+    return ("SM_ACTION_ICP_QUERY");
 
-  case HttpTransact::ISSUE_CACHE_DELETE:
-    return ("ISSUE_CACHE_DELETE");
+  case HttpTransact::SM_ACTION_CACHE_PREPARE_UPDATE:
+    return ("SM_ACTION_CACHE_PREPARE_UPDATE");
 
-  case HttpTransact::PREPARE_CACHE_UPDATE:
-    return ("PREPARE_CACHE_UPDATE");
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_UPDATE:
+    return ("SM_ACTION_CACHE_ISSUE_UPDATE");
 
-  case HttpTransact::ISSUE_CACHE_UPDATE:
-    return ("ISSUE_CACHE_UPDATE");
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN:
+    return ("SM_ACTION_ORIGIN_SERVER_OPEN");
 
-  case HttpTransact::ORIGIN_SERVER_OPEN:
-    return ("ORIGIN_SERVER_OPEN");
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN:
+    return ("SM_ACTION_ORIGIN_SERVER_RAW_OPEN");
 
-  case HttpTransact::ORIGIN_SERVER_RAW_OPEN:
-    return ("ORIGIN_SERVER_RAW_OPEN");
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN:
+    return ("SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN");
 
-  case HttpTransact::OS_RR_MARK_DOWN:
-    return ("OS_RR_MARK_DOWN");
+  case HttpTransact::SM_ACTION_READ_PUSH_HDR:
+    return ("SM_ACTION_READ_PUSH_HDR");
 
-  case HttpTransact::READ_PUSH_HDR:
-    return ("READ_PUSH_HDR");
+  case HttpTransact::SM_ACTION_STORE_PUSH_BODY:
+    return ("SM_ACTION_STORE_PUSH_BODY");
 
-  case HttpTransact::STORE_PUSH_BODY:
-    return ("STORE_PUSH_BODY");
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_WRITE:
+    return ("SM_ACTION_INTERNAL_CACHE_WRITE");
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_WRITE:
-    return ("PROXY_INTERNAL_CACHE_WRITE");
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE:
+    return ("SM_ACTION_INTERNAL_CACHE_DELETE");
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_DELETE:
-    return ("PROXY_INTERNAL_CACHE_DELETE");
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_NOOP:
+    return ("SM_ACTION_INTERNAL_CACHE_NOOP");
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_NOOP:
-    return ("PROXY_INTERNAL_CACHE_NOOP");
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS:
+    return ("SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS");
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_UPDATE_HEADERS:
-    return ("PROXY_INTERNAL_CACHE_UPDATE_HEADERS");
+  case HttpTransact::SM_ACTION_INTERNAL_REQUEST:
+    return ("SM_ACTION_INTERNAL_REQUEST");
 
-  case HttpTransact::PROXY_INTERNAL_REQUEST:
-    return ("PROXY_INTERNAL_REQUEST");
+  case HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP:
+    return ("SM_ACTION_SEND_ERROR_CACHE_NOOP");
 
-  case HttpTransact::PROXY_SEND_ERROR_CACHE_NOOP:
-    return ("PROXY_SEND_ERROR_CACHE_NOOP");
+  case HttpTransact::SM_ACTION_SERVE_FROM_CACHE:
+    return ("SM_ACTION_SERVE_FROM_CACHE");
 
-  case HttpTransact::SERVE_FROM_CACHE:
-    return ("SERVE_FROM_CACHE");
+  case HttpTransact::SM_ACTION_SERVER_READ:
+    return ("SM_ACTION_SERVER_READ");
 
-  case HttpTransact::SERVER_READ:
-    return ("SERVER_READ");
+  case HttpTransact::SM_ACTION_SSL_TUNNEL:
+    return ("SM_ACTION_SSL_TUNNEL");
 
-  case HttpTransact::SSL_TUNNEL:
-    return ("SSL_TUNNEL");
+  case HttpTransact::SM_ACTION_CONTINUE:
+    return ("SM_ACTION_CONTINUE");
 
-  case HttpTransact::CONTINUE:
-    return ("CONTINUE");
+  case HttpTransact::SM_ACTION_API_READ_REQUEST_HDR:
+    return ("SM_ACTION_API_READ_REQUEST_HDR");
 
-  case HttpTransact::HTTP_API_READ_REQUEST_HDR:
-    return ("API_READ_REQUEST_HDR");
+  case HttpTransact::SM_ACTION_API_OS_DNS:
+    return ("SM_ACTION_API_OS_DNS");
 
-  case HttpTransact::HTTP_API_OS_DNS:
-    return ("API_OS_DNS");
+  case HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR:
+    return ("SM_ACTION_API_SEND_REQUEST_HDR");
 
-  case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
-    return ("API_SEND_REQUEST_HDR");
+  case HttpTransact::SM_ACTION_API_READ_CACHE_HDR:
+    return ("SM_ACTION_API_READ_CACHE_HDR");
 
-  case HttpTransact::HTTP_API_READ_CACHE_HDR:
-    return ("API_READ_CACHE_HDR");
+  case HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE:
+    return ("SM_ACTION_API_CACHE_LOOKUP_COMPLETE");
 
-  case HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE:
-    return ("API_CACHE_LOOKUP_COMPLETE");
+  case HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR:
+    return ("SM_ACTION_API_READ_RESPONSE_HDR");
 
-  case HttpTransact::HTTP_API_READ_RESPONSE_HDR:
-    return ("API_READ_RESPONSE_HDR");
+  case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
+    return ("SM_ACTION_API_SEND_RESPONSE_HDR");
 
-  case HttpTransact::HTTP_API_SEND_RESPONSE_HDR:
-    return ("API_SEND_RESPONSE_HDR");
+  case HttpTransact::SM_ACTION_INTERNAL_100_RESPONSE:
+    return ("SM_ACTION_INTERNAL_100_RESPONSE");
 
-  case HttpTransact::PROXY_INTERNAL_100_RESPONSE:
-    return ("PROXY_INTERNAL_100_RESPONSE");
+  case HttpTransact::SM_ACTION_SERVER_PARSE_NEXT_HDR:
+    return ("SM_ACTION_SERVER_PARSE_NEXT_HDR");
 
-  case HttpTransact::SERVER_PARSE_NEXT_HDR:
-    return ("SERVER_PARSE_NEXT_HDR");
-
-  case HttpTransact::TRANSFORM_READ:
-    return ("TRANSFORM_READ");
+  case HttpTransact::SM_ACTION_TRANSFORM_READ:
+    return ("SM_ACTION_TRANSFORM_READ");
 
 #ifdef PROXY_DRAIN
-  case HttpTransact::PROXY_DRAIN_REQUEST_BODY:
-    return ("PROXY_DRAIN_REQUEST_BODY");
+  case HttpTransact::SM_ACTION_DRAIN_REQUEST_BODY:
+    return ("SM_ACTION_DRAIN_REQUEST_BODY");
 #endif /* PROXY_DRAIN */
 
-  //case HttpTransact::AUTH_LOOKUP:
-  //  return ("AUTH_LOOKUP");
-  case HttpTransact::SEND_QUERY_TO_INCOMING_ROUTER:
-    return ("SEND_QUERY_TO_INCOMING_ROUTER");
-  case HttpTransact::EXTENSION_METHOD_TUNNEL:
-    return ("EXTENSION_METHOD_TUNNEL");
-  case HttpTransact::HTTP_API_SM_START:
-    return ("HTTP_API_SM_START");
-  case HttpTransact::REDIRECT_READ:
-    return ("REDIRECT_READ");
-  case HttpTransact::HTTP_API_SM_SHUTDOWN:
-    return ("HTTP_API_SM_SHUTDOWN");
-  case HttpTransact::HTTP_REMAP_REQUEST:
-    return ("HTTP_REMAP_REQUEST");
-  case HttpTransact::HTTP_API_PRE_REMAP:
-    return ("HTTP_API_PRE_REMAP");
-  case HttpTransact::HTTP_API_POST_REMAP:
-    return ("HTTP_API_POST_REMAP");
-  case HttpTransact::HTTP_POST_REMAP_SKIP:
-    return ("HTTP_POST_REMAP_SKIP");
-  case HttpTransact::HTTP_POST_REMAP_UPGRADE:
-    return ("HTTP_POST_REMAP_UPGRADE");
+  case HttpTransact::SM_ACTION_API_SM_START:
+    return ("SM_ACTION_API_SM_START");
+  case HttpTransact::SM_ACTION_REDIRECT_READ:
+    return ("SM_ACTION_REDIRECT_READ");
+  case HttpTransact::SM_ACTION_API_SM_SHUTDOWN:
+    return ("SM_ACTION_API_SM_SHUTDOWN");
+  case HttpTransact::SM_ACTION_REMAP_REQUEST:
+    return ("SM_ACTION_REMAP_REQUEST");
+  case HttpTransact::SM_ACTION_API_PRE_REMAP:
+    return ("SM_ACTION_API_PRE_REMAP");
+  case HttpTransact::SM_ACTION_API_POST_REMAP:
+    return ("SM_ACTION_API_POST_REMAP");
+  case HttpTransact::SM_ACTION_POST_REMAP_SKIP:
+    return ("SM_ACTION_POST_REMAP_SKIP");
   }
 
   return ("unknown state name");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 2cb19eb..0f25682 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -314,7 +314,7 @@ HttpSM::HttpSM()
     transform_info(), post_transform_info(), has_active_plugin_agents(false),
     second_cache_sm(NULL),
     default_handler(NULL), pending_action(NULL), historical_action(NULL),
-    last_action(HttpTransact::STATE_MACHINE_ACTION_UNDEFINED),
+    last_action(HttpTransact::SM_ACTION_UNDEFINED),
     // TODO:  Now that bodies can be empty, should the body counters be set to -1 ? TS-2213
     client_request_hdr_bytes(0), client_request_body_bytes(0),
     server_request_hdr_bytes(0), server_request_body_bytes(0),
@@ -468,7 +468,7 @@ HttpSM::state_add_to_list(int event, void * /* data ATS_UNUSED */)
       HttpSMList[bucket].sm_list.push(this);
   }
 
-  t_state.api_next_action = HttpTransact::HTTP_API_SM_START;
+  t_state.api_next_action = HttpTransact::SM_ACTION_API_SM_START;
   do_api_callout();
   return EVENT_DONE;
 }
@@ -1427,16 +1427,17 @@ HttpSM::state_api_callout(int event, void *data)
   callout_state = HTTP_API_NO_CALLOUT;
   switch (api_next) {
   case API_RETURN_CONTINUE:
-    if (t_state.api_next_action == HttpTransact::HTTP_API_SEND_RESPONSE_HDR)
+    if (t_state.api_next_action == HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR) {
       do_redirect();
+    }
     handle_api_return();
     break;
   case API_RETURN_DEFERED_CLOSE:
-    ink_assert(t_state.api_next_action == HttpTransact::HTTP_API_SM_SHUTDOWN);
+    ink_assert(t_state.api_next_action == HttpTransact::SM_ACTION_API_SM_SHUTDOWN);
     do_api_callout();
     break;
   case API_RETURN_DEFERED_SERVER_ERROR:
-    ink_assert(t_state.api_next_action == HttpTransact::HTTP_API_SEND_REQUEST_HDR);
+    ink_assert(t_state.api_next_action == HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR);
     ink_assert(t_state.current.state != HttpTransact::CONNECTION_ALIVE);
     call_transact_and_set_next_state(HttpTransact::HandleResponse);
     break;
@@ -1469,25 +1470,25 @@ void
 HttpSM::handle_api_return()
 {
   switch (t_state.api_next_action) {
-  case HttpTransact::HTTP_API_SM_START:
+  case HttpTransact::SM_ACTION_API_SM_START:
     if (t_state.client_info.port_attribute == HttpProxyPort::TRANSPORT_BLIND_TUNNEL) {
       setup_blind_tunnel_port();
     } else {
       setup_client_read_request_header();
     }
     return;
-  case HttpTransact::HTTP_API_PRE_REMAP:
-  case HttpTransact::HTTP_API_POST_REMAP:
-  case HttpTransact::HTTP_API_READ_REQUEST_HDR:
-  case HttpTransact::HTTP_API_OS_DNS:
-  case HttpTransact::HTTP_API_READ_CACHE_HDR:
-  case HttpTransact::HTTP_API_READ_RESPONSE_HDR:
-  case HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE:
+  case HttpTransact::SM_ACTION_API_PRE_REMAP:
+  case HttpTransact::SM_ACTION_API_POST_REMAP:
+  case HttpTransact::SM_ACTION_API_READ_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_OS_DNS:
+  case HttpTransact::SM_ACTION_API_READ_CACHE_HDR:
+  case HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE:
     // this part is added for automatic redirect
-    if (t_state.api_next_action == HttpTransact::HTTP_API_READ_RESPONSE_HDR && t_state.api_release_server_session) {
+    if (t_state.api_next_action == HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR && t_state.api_release_server_session) {
       t_state.api_release_server_session = false;
       release_server_session();
-    } else if (t_state.api_next_action == HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE &&
+    } else if (t_state.api_next_action == HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE &&
                t_state.api_cleanup_cache_read &&
                t_state.api_update_cached_object != HttpTransact::UPDATE_CACHED_OBJECT_PREPARE) {
       t_state.api_cleanup_cache_read = false;
@@ -1499,10 +1500,10 @@ HttpSM::handle_api_return()
     }
     call_transact_and_set_next_state(NULL);
     return;
-  case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR:
     setup_server_send_request();
     return;
-  case HttpTransact::HTTP_API_SEND_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
     // Set back the inactivity timeout
     if (ua_session) {
       ua_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_no_activity_timeout_in));
@@ -1510,7 +1511,7 @@ HttpSM::handle_api_return()
     // we have further processing to do
     //  based on what t_state.next_action is
     break;
-  case HttpTransact::HTTP_API_SM_SHUTDOWN:
+  case HttpTransact::SM_ACTION_API_SM_SHUTDOWN:
     state_remove_from_list(EVENT_NONE, NULL);
     return;
   default:
@@ -1519,14 +1520,14 @@ HttpSM::handle_api_return()
   }
 
   switch (t_state.next_action) {
-  case HttpTransact::TRANSFORM_READ:
+  case HttpTransact::SM_ACTION_TRANSFORM_READ:
     {
       HttpTunnelProducer *p = setup_transfer_from_transform();
       perform_transform_cache_write_action();
       tunnel.tunnel_run(p);
       break;
     }
-  case HttpTransact::SERVER_READ:
+  case HttpTransact::SM_ACTION_SERVER_READ:
     {
       if (unlikely(t_state.did_upgrade_succeed)) {
        // We've sucessfully handled the upgrade, let's now setup
@@ -1543,14 +1544,14 @@ HttpSM::handle_api_return()
       }
       break;
     }
-  case HttpTransact::SERVE_FROM_CACHE:
+  case HttpTransact::SM_ACTION_SERVE_FROM_CACHE:
     {
       setup_cache_read_transfer();
       tunnel.tunnel_run();
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_WRITE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_WRITE:
     {
       if (cache_sm.cache_write_vc) {
         setup_internal_transfer(&HttpSM::tunnel_handler_cache_fill);
@@ -1560,16 +1561,16 @@ HttpSM::handle_api_return()
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_NOOP:
-  case HttpTransact::PROXY_INTERNAL_CACHE_DELETE:
-  case HttpTransact::PROXY_INTERNAL_CACHE_UPDATE_HEADERS:
-  case HttpTransact::PROXY_SEND_ERROR_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS:
+  case HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP:
     {
       setup_internal_transfer(&HttpSM::tunnel_handler);
       break;
     }
 
-  case HttpTransact::REDIRECT_READ:
+  case HttpTransact::SM_ACTION_REDIRECT_READ:
     {
       call_transact_and_set_next_state(HttpTransact::HandleRequest);
       break;
@@ -1834,7 +1835,7 @@ HttpSM::state_read_server_response_header(int event, void *data)
 
     t_state.current.state = HttpTransact::CONNECTION_ALIVE;
     t_state.transact_return_point = HttpTransact::HandleResponse;
-    t_state.api_next_action = HttpTransact::HTTP_API_READ_RESPONSE_HDR;
+    t_state.api_next_action = HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR;
 
     // YTS Team, yamsat Plugin
     // Incrementing redirection_tries according to config parameter
@@ -2349,7 +2350,7 @@ HttpSM::state_cache_open_write(int event, void *data)
     //  the cache write.  If this is the case, forward the event
     //  to the transform read state as it will know how to
     //  handle it
-    if (t_state.next_action == HttpTransact::CACHE_ISSUE_WRITE_TRANSFORM) {
+    if (t_state.next_action == HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM) {
       state_common_wait_for_transform_read(&transform_info, &HttpSM::tunnel_handler, event, data);
 
       return 0;
@@ -2380,7 +2381,7 @@ HttpSM::state_cache_open_write(int event, void *data)
 inline void
 HttpSM::setup_cache_lookup_complete_api()
 {
-  t_state.api_next_action = HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE;
+  t_state.api_next_action = HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE;
   do_api_callout();
 }
 
@@ -4673,38 +4674,38 @@ HttpSM::do_api_callout_internal()
   }
 
   switch (t_state.api_next_action) {
-  case HttpTransact::HTTP_API_SM_START:
+  case HttpTransact::SM_ACTION_API_SM_START:
     cur_hook_id = TS_HTTP_TXN_START_HOOK;
     break;
-  case HttpTransact::HTTP_API_PRE_REMAP:
+  case HttpTransact::SM_ACTION_API_PRE_REMAP:
     cur_hook_id = TS_HTTP_PRE_REMAP_HOOK;
     break;
-  case HttpTransact::HTTP_API_POST_REMAP:
+  case HttpTransact::SM_ACTION_API_POST_REMAP:
     cur_hook_id = TS_HTTP_POST_REMAP_HOOK;
     break;
-  case HttpTransact::HTTP_API_READ_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_READ_REQUEST_HDR:
     cur_hook_id = TS_HTTP_READ_REQUEST_HDR_HOOK;
     break;
-  case HttpTransact::HTTP_API_OS_DNS:
+  case HttpTransact::SM_ACTION_API_OS_DNS:
     cur_hook_id = TS_HTTP_OS_DNS_HOOK;
     break;
-  case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR:
     cur_hook_id = TS_HTTP_SEND_REQUEST_HDR_HOOK;
     break;
-  case HttpTransact::HTTP_API_READ_CACHE_HDR:
+  case HttpTransact::SM_ACTION_API_READ_CACHE_HDR:
     cur_hook_id = TS_HTTP_READ_CACHE_HDR_HOOK;
     break;
-  case HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE:
+  case HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE:
     cur_hook_id = TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK;
     break;
-  case HttpTransact::HTTP_API_READ_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR:
     cur_hook_id = TS_HTTP_READ_RESPONSE_HDR_HOOK;
     break;
-  case HttpTransact::HTTP_API_SEND_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
     cur_hook_id = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
     milestones.ua_begin_write = ink_get_hrtime();
     break;
-  case HttpTransact::HTTP_API_SM_SHUTDOWN:
+  case HttpTransact::SM_ACTION_API_SM_SHUTDOWN:
     if (callout_state == HTTP_API_IN_CALLOUT || callout_state == HTTP_API_DEFERED_SERVER_ERROR) {
       callout_state = HTTP_API_DEFERED_CLOSE;
       return;
@@ -5503,7 +5504,7 @@ HttpSM::attach_server_session(HttpServerSession * s)
 void
 HttpSM::setup_server_send_request_api()
 {
-  t_state.api_next_action = HttpTransact::HTTP_API_SEND_REQUEST_HDR;
+  t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR;
   do_api_callout();
 }
 
@@ -5773,7 +5774,7 @@ HttpSM::setup_error_transfer()
     // Since we need to send the error message, call the API
     //   function
     ink_assert(t_state.internal_msg_buffer_size > 0);
-    t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+    t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
     do_api_callout();
   } else {
     DebugSM("http", "[setup_error_transfer] Now closing connection ...");
@@ -6395,7 +6396,7 @@ HttpSM::kill_this()
     //  if the plugin receives event we must reset
     //  the terminate_flag
     terminate_sm = false;
-    t_state.api_next_action = HttpTransact::HTTP_API_SM_SHUTDOWN;
+    t_state.api_next_action = HttpTransact::SM_ACTION_API_SM_SHUTDOWN;
     do_api_callout();
   }
   // The reentrancy_count is still valid up to this point since
@@ -6760,29 +6761,28 @@ HttpSM::set_next_state()
   // Use the returned "next action" code to set the next state handler //
   ///////////////////////////////////////////////////////////////////////
   switch (t_state.next_action) {
-  case HttpTransact::HTTP_API_READ_REQUEST_HDR:
-  case HttpTransact::HTTP_API_PRE_REMAP:
-  case HttpTransact::HTTP_API_POST_REMAP:
-  case HttpTransact::HTTP_API_OS_DNS:
-  case HttpTransact::HTTP_API_SEND_REQUEST_HDR:
-  case HttpTransact::HTTP_API_READ_CACHE_HDR:
-  case HttpTransact::HTTP_API_READ_RESPONSE_HDR:
-  case HttpTransact::HTTP_API_SEND_RESPONSE_HDR:
-  case HttpTransact::HTTP_API_CACHE_LOOKUP_COMPLETE:
+  case HttpTransact::SM_ACTION_API_READ_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_PRE_REMAP:
+  case HttpTransact::SM_ACTION_API_POST_REMAP:
+  case HttpTransact::SM_ACTION_API_OS_DNS:
+  case HttpTransact::SM_ACTION_API_SEND_REQUEST_HDR:
+  case HttpTransact::SM_ACTION_API_READ_CACHE_HDR:
+  case HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR:
+  case HttpTransact::SM_ACTION_API_CACHE_LOOKUP_COMPLETE:
     {
       t_state.api_next_action = t_state.next_action;
       do_api_callout();
       break;
     }
-  
-  case HttpTransact::HTTP_POST_REMAP_UPGRADE:
-  case HttpTransact::HTTP_POST_REMAP_SKIP:
+
+  case HttpTransact::SM_ACTION_POST_REMAP_SKIP:
     {
       call_transact_and_set_next_state(NULL);
       break;
     }
-  
-  case HttpTransact::HTTP_REMAP_REQUEST:
+
+  case HttpTransact::SM_ACTION_REMAP_REQUEST:
     {
       if (!remapProcessor.using_separate_thread()) {
         do_remap_request(true); /* run inline */
@@ -6795,8 +6795,8 @@ HttpSM::set_next_state()
       }
       break;
     }
-  
-  case HttpTransact::DNS_LOOKUP:
+
+  case HttpTransact::SM_ACTION_DNS_LOOKUP:
     {
       sockaddr const* addr;
 
@@ -6875,24 +6875,24 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::REVERSE_DNS_LOOKUP:
+  case HttpTransact::SM_ACTION_DNS_REVERSE_LOOKUP:
     {
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_hostdb_reverse_lookup);
       do_hostdb_reverse_lookup();
       break;
     }
 
-  case HttpTransact::CACHE_LOOKUP:
+  case HttpTransact::SM_ACTION_CACHE_LOOKUP:
     {
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_cache_open_read);
       do_cache_lookup_and_read();
       break;
     }
 
-  case HttpTransact::ORIGIN_SERVER_OPEN:
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN:
     {
-      if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
-        t_state.congest_saved_next_action = HttpTransact::ORIGIN_SERVER_OPEN;
+      if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::SM_ACTION_UNDEFINED)) {
+        t_state.congest_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN;
         HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_congestion_control_lookup);
         if (!do_congestion_control_lookup())
           break;
@@ -6925,19 +6925,19 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::SERVER_PARSE_NEXT_HDR:
+  case HttpTransact::SM_ACTION_SERVER_PARSE_NEXT_HDR:
     {
       setup_server_read_response_header();
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_100_RESPONSE:
+  case HttpTransact::SM_ACTION_INTERNAL_100_RESPONSE:
     {
       setup_100_continue_transfer();
       break;
     }
 
-  case HttpTransact::SERVER_READ:
+  case HttpTransact::SM_ACTION_SERVER_READ:
     {
       t_state.source = HttpTransact::SOURCE_HTTP_ORIGIN_SERVER;
 
@@ -6949,7 +6949,7 @@ HttpSM::set_next_state()
         tunnel.tunnel_run(p);
       } else {
         ink_assert((t_state.hdr_info.client_response.valid()? true : false) == true);
-        t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+        t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
 
         if (hooks_set) {
           do_api_callout_internal();
@@ -6962,7 +6962,7 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::SERVE_FROM_CACHE:
+  case HttpTransact::SM_ACTION_SERVE_FROM_CACHE:
     {
       ink_assert(t_state.cache_info.action == HttpTransact::CACHE_DO_SERVE ||
                  t_state.cache_info.action == HttpTransact::CACHE_DO_SERVE_AND_DELETE ||
@@ -6985,7 +6985,7 @@ HttpSM::set_next_state()
         t_state.hdr_info.cache_response.copy(&t_state.hdr_info.client_response);
 
         perform_cache_write_action();
-        t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+        t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
         if (hooks_set) {
           do_api_callout_internal();
         } else {
@@ -6996,7 +6996,7 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::CACHE_ISSUE_WRITE:
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE:
     {
       ink_assert(cache_sm.cache_write_vc == NULL);
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_cache_open_write);
@@ -7006,14 +7006,14 @@ HttpSM::set_next_state()
 
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_WRITE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_WRITE:
     {
-      t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+      t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
       do_api_callout();
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_NOOP:
     {
       if (server_entry == NULL || server_entry->in_tunnel == false) {
         release_server_session();
@@ -7021,16 +7021,16 @@ HttpSM::set_next_state()
       // If we're in state SEND_API_RESPONSE_HDR, it means functions
       // registered to hook SEND_RESPONSE_HDR have already been called. So we do not
       // need to call do_api_callout. Otherwise TS loops infinitely in this state !
-      if (t_state.api_next_action == HttpTransact::HTTP_API_SEND_RESPONSE_HDR) {
+      if (t_state.api_next_action == HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR) {
         handle_api_return();
       } else {
-        t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+        t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
         do_api_callout();
       }
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_DELETE:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE:
     {
       // Nuke all the alternates since this is mostly likely
       //   the result of a delete method
@@ -7038,31 +7038,31 @@ HttpSM::set_next_state()
       do_cache_delete_all_alts(NULL);
 
       release_server_session();
-      t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+      t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
       do_api_callout();
       break;
     }
 
-  case HttpTransact::PROXY_INTERNAL_CACHE_UPDATE_HEADERS:
+  case HttpTransact::SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS:
     {
       issue_cache_update();
       cache_sm.close_read();
 
       release_server_session();
-      t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+      t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
       do_api_callout();
       break;
 
     }
 
-  case HttpTransact::PROXY_SEND_ERROR_CACHE_NOOP:
+  case HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP:
     {
       setup_error_transfer();
       break;
     }
 
 
-  case HttpTransact::PROXY_INTERNAL_REQUEST:
+  case HttpTransact::SM_ACTION_INTERNAL_REQUEST:
     {
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_handle_stat_page);
       Action *action_handle = statPagesManager.handle_http(this, &t_state.hdr_info.client_request);
@@ -7075,7 +7075,7 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::OS_RR_MARK_DOWN:
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN:
     {
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_mark_os_down);
 
@@ -7090,15 +7090,15 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::SSL_TUNNEL:
+  case HttpTransact::SM_ACTION_SSL_TUNNEL:
     {
       setup_blind_tunnel(true);
       break;
     }
 
-  case HttpTransact::ORIGIN_SERVER_RAW_OPEN:{
-      if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::STATE_MACHINE_ACTION_UNDEFINED)) {
-        t_state.congest_saved_next_action = HttpTransact::ORIGIN_SERVER_RAW_OPEN;
+  case HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN:{
+      if (congestionControlEnabled && (t_state.congest_saved_next_action == HttpTransact::SM_ACTION_UNDEFINED)) {
+        t_state.congest_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN;
         HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_congestion_control_lookup);
         if (!do_congestion_control_lookup())
           break;
@@ -7111,14 +7111,14 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::ICP_QUERY:
+  case HttpTransact::SM_ACTION_ICP_QUERY:
     {
       HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_icp_lookup);
       do_icp_lookup();
       break;
     }
 
-  case HttpTransact::CACHE_ISSUE_WRITE_TRANSFORM:
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM:
     {
       ink_assert(t_state.cache_info.transform_action == HttpTransact::CACHE_PREPARE_TO_WRITE);
 
@@ -7137,33 +7137,33 @@ HttpSM::set_next_state()
       break;
     }
 
-  case HttpTransact::TRANSFORM_READ:
+  case HttpTransact::SM_ACTION_TRANSFORM_READ:
     {
-      t_state.api_next_action = HttpTransact::HTTP_API_SEND_RESPONSE_HDR;
+      t_state.api_next_action = HttpTransact::SM_ACTION_API_SEND_RESPONSE_HDR;
       do_api_callout();
       break;
     }
 
-  case HttpTransact::READ_PUSH_HDR:
+  case HttpTransact::SM_ACTION_READ_PUSH_HDR:
     {
       setup_push_read_response_header();
       break;
     }
 
-  case HttpTransact::STORE_PUSH_BODY:
+  case HttpTransact::SM_ACTION_STORE_PUSH_BODY:
     {
       setup_push_transfer_to_cache();
       tunnel.tunnel_run();
       break;
     }
 
-  case HttpTransact::PREPARE_CACHE_UPDATE:
+  case HttpTransact::SM_ACTION_CACHE_PREPARE_UPDATE:
     {
       ink_assert(t_state.api_update_cached_object == HttpTransact::UPDATE_CACHED_OBJECT_CONTINUE);
       do_cache_prepare_update();
       break;
     }
-  case HttpTransact::ISSUE_CACHE_UPDATE:
+  case HttpTransact::SM_ACTION_CACHE_ISSUE_UPDATE:
     {
       if (t_state.api_update_cached_object == HttpTransact::UPDATE_CACHED_OBJECT_ERROR) {
         t_state.cache_info.object_read = NULL;
@@ -7175,15 +7175,14 @@ HttpSM::set_next_state()
     }
 
 #ifdef PROXY_DRAIN
-  case HttpTransact::PROXY_DRAIN_REQUEST_BODY:
+  case HttpTransact::SM_ACTION_DRAIN_REQUEST_BODY:
     {
       do_drain_request_body();
       break;
     }
 #endif /* PROXY_DRAIN */
 
-  case HttpTransact::SEND_QUERY_TO_INCOMING_ROUTER:
-  case HttpTransact::CONTINUE:
+  case HttpTransact::SM_ACTION_CONTINUE:
     {
       ink_release_assert(!"Not implemented");
     }
@@ -7230,9 +7229,9 @@ HttpSM::state_congestion_control_lookup(int event, void *data)
       pending_action->cancel();
       pending_action = NULL;
     }
-    if (t_state.congest_saved_next_action == HttpTransact::ORIGIN_SERVER_OPEN) {
+    if (t_state.congest_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN) {
       return state_http_server_open(event, data);
-    } else if (t_state.congest_saved_next_action == HttpTransact::ORIGIN_SERVER_RAW_OPEN) {
+    } else if (t_state.congest_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN) {
       return state_raw_http_server_open(event, data);
     }
   }
@@ -7351,7 +7350,7 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len)
   t_state.request_sent_time = 0;
   t_state.response_received_time = 0;
   t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_INIT;
-  t_state.next_action = HttpTransact::REDIRECT_READ;
+  t_state.next_action = HttpTransact::SM_ACTION_REDIRECT_READ;
   // we have a new OS and need to have DNS lookup the new OS
   t_state.dns_info.lookup_success = false;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/70599abf/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index da1776c..3e9ab51 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -481,7 +481,7 @@ how_to_open_connection(HttpTransact::State* s)
   case HttpTransact::CACHE_PREPARE_TO_UPDATE:
   case HttpTransact::CACHE_PREPARE_TO_WRITE:
     s->transact_return_point = HttpTransact::handle_cache_write_lock;
-    return HttpTransact::CACHE_ISSUE_WRITE;
+    return HttpTransact::SM_ACTION_CACHE_ISSUE_WRITE;
   default:
     // This covers:
     // CACHE_DO_UNDEFINED, CACHE_DO_NO_ACTION, CACHE_DO_DELETE,
@@ -492,14 +492,14 @@ how_to_open_connection(HttpTransact::State* s)
   }
 
   if (s->method == HTTP_WKSIDX_CONNECT && s->parent_result.r != PARENT_SPECIFIED) {
-    s->cdn_saved_next_action = HttpTransact::ORIGIN_SERVER_RAW_OPEN;
+    s->cdn_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN;
   } else {
-    s->cdn_saved_next_action = HttpTransact::ORIGIN_SERVER_OPEN;
+    s->cdn_saved_next_action = HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN;
   }
 
   // In the following, if url_remap_mode == 2 (URL_REMAP_FOR_OS)
   // then do remapping for requests to OS's.
-  // Whether there is CDN remapping or not, goto DNS_LOOKUP;
+  // Whether there is CDN remapping or not, goto SM_ACTION_DNS_LOOKUP;
   // after that, it'll goto ORIGIN_SERVER_(RAW_)OPEN as needed.
 
   if ((url_remap_mode == HttpTransact::URL_REMAP_FOR_OS) &&
@@ -556,7 +556,7 @@ how_to_open_connection(HttpTransact::State* s)
     s->transact_return_point = HttpTransact::OSDNSLookup;
     ink_assert(s->next_action);
     ink_assert(s->cdn_saved_next_action);
-    return HttpTransact::DNS_LOOKUP;
+    return HttpTransact::SM_ACTION_DNS_LOOKUP;
   }
 
   if (!s->already_downgraded) { //false unless downgraded previously (possibly due to HTTP 505)
@@ -564,8 +564,8 @@ how_to_open_connection(HttpTransact::State* s)
     HttpTransactHeaders::convert_request(s->current.server->http_version, &s->hdr_info.server_request);
   }
 
-  ink_assert(s->cdn_saved_next_action == HttpTransact::ORIGIN_SERVER_OPEN ||
-                    s->cdn_saved_next_action == HttpTransact::ORIGIN_SERVER_RAW_OPEN);
+  ink_assert(s->cdn_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_OPEN ||
+                    s->cdn_saved_next_action == HttpTransact::SM_ACTION_ORIGIN_SERVER_RAW_OPEN);
   return s->cdn_saved_next_action;
 }
 
@@ -587,7 +587,7 @@ HttpTransact::BadRequest(State* s)
   DebugTxn("http_trans", "[BadRequest]" "parser marked request bad");
   bootstrap_state_variables_from_request(s, &s->hdr_info.client_request);
   build_error_response(s, HTTP_STATUS_BAD_REQUEST, "Invalid HTTP Request", "request#syntax_error", "Bad request syntax", "");
-  TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+  TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
 }
 
 void
@@ -657,7 +657,7 @@ HttpTransact::HandleBlindTunnel(State* s)
     Log::error("Forwarded port error: request with destination %.*s:%d "
                "does not have a mapping", host_len, host, s->hdr_info.client_request.url_get()->port_get());
 
-    TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   }
   // Set the mode to tunnel so that we don't lookup the cache
   s->current.mode = TUNNELLING_PROXY;
@@ -759,10 +759,10 @@ HttpTransact::StartRemapRequest(State* s)
     Debug ("http_trans", "API request to skip remapping");
 
     if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
-      TRANSACT_RETURN(HTTP_POST_REMAP_SKIP, s->post_remap_upgrade_return_point);
+      TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP, s->post_remap_upgrade_return_point);
     }
 
-    TRANSACT_RETURN(HTTP_POST_REMAP_SKIP, HttpTransact::HandleRequest);
+    TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP, HttpTransact::HandleRequest);
   }
   
   DebugTxn("http_trans", "START HttpTransact::StartRemapRequest");
@@ -816,13 +816,13 @@ HttpTransact::StartRemapRequest(State* s)
   }
 
   DebugTxn("http_trans", "END HttpTransact::StartRemapRequest");
-  TRANSACT_RETURN(HTTP_API_PRE_REMAP, HttpTransact::PerformRemap);
+  TRANSACT_RETURN(SM_ACTION_API_PRE_REMAP, HttpTransact::PerformRemap);
 }
 
 void HttpTransact::PerformRemap(State *s)
 {
   DebugTxn("http_trans","Inside PerformRemap");
-  TRANSACT_RETURN(HTTP_REMAP_REQUEST, HttpTransact::EndRemapRequest);
+  TRANSACT_RETURN(SM_ACTION_REMAP_REQUEST, HttpTransact::EndRemapRequest);
 }
 
 void
@@ -947,7 +947,7 @@ done:
    **/
   if (handleIfRedirect(s)) {
     DebugTxn("http_trans", "END HttpTransact::RemapRequest");
-    TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
   }
 
   if (is_debug_tag_set("http_chdr_describe") || is_debug_tag_set("http_trans") || is_debug_tag_set("url_rewrite")) {
@@ -966,16 +966,16 @@ done:
   if (!s->reverse_proxy && s->state_machine->plugin_tunnel_type == HTTP_NO_PLUGIN_TUNNEL) {
     DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
     HTTP_INCREMENT_TRANS_STAT(http_invalid_client_requests_stat);
-    TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   } else {
     s->hdr_info.client_response.clear(); //anything previously set is invalid from this point forward
     DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
 
     if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
-      TRANSACT_RETURN(HTTP_API_POST_REMAP, s->post_remap_upgrade_return_point);
+      TRANSACT_RETURN(SM_ACTION_API_POST_REMAP, s->post_remap_upgrade_return_point);
     }
 
-    TRANSACT_RETURN(HTTP_API_POST_REMAP, HttpTransact::HandleRequest);
+    TRANSACT_RETURN(SM_ACTION_API_POST_REMAP, HttpTransact::HandleRequest);
   }
 
   ink_assert(!"not reached");
@@ -1067,7 +1067,7 @@ bool HttpTransact::handle_upgrade_request(State *s) {
 
   // we want our modify_request method to just return while we fail out from here.
   // this seems like the preferred option because the user wanted to do an upgrade but sent a bad protocol.
-  TRANSACT_RETURN_VAL(PROXY_SEND_ERROR_CACHE_NOOP, NULL, true);
+  TRANSACT_RETURN_VAL(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL, true);
 }
 
 void
@@ -1093,17 +1093,17 @@ HttpTransact::handle_websocket_upgrade_pre_remap(State *s) {
     DebugTxn("http_trans_websocket_upgrade_pre_remap", "Invalid scheme for websocket upgrade");
     build_error_response(s, HTTP_STATUS_BAD_REQUEST, "Invalid Upgrade Request", "request#syntax_error",
                           "Invalid Upgrade Request");
-    TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   }
 
-  TRANSACT_RETURN(HTTP_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
+  TRANSACT_RETURN(SM_ACTION_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
 }
 
 void
 HttpTransact::handle_websocket_upgrade_post_remap(State *s) {
   DebugTxn("http_trans_websocket_upgrade_post_remap", "Remap is complete, start websocket upgrade");
 
-  TRANSACT_RETURN(HTTP_API_POST_REMAP, HttpTransact::handle_websocket_connection);
+  TRANSACT_RETURN(SM_ACTION_API_POST_REMAP, HttpTransact::handle_websocket_connection);
 }
 
 void
@@ -1228,7 +1228,7 @@ HttpTransact::ModifyRequest(State* s)
     return;
   }
 
-  TRANSACT_RETURN(HTTP_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
+  TRANSACT_RETURN(SM_ACTION_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
 }
 
 // This function is supposed to figure out if this transaction is
@@ -1298,7 +1298,7 @@ HttpTransact::HandleRequest(State* s)
   if (!(is_request_valid(s, &s->hdr_info.client_request))) {
     HTTP_INCREMENT_TRANS_STAT(http_invalid_client_requests_stat);
     DebugTxn("http_seq", "[HttpTransact::HandleRequest] request invalid.");
-    s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+    s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
     //  s->next_action = HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
     return;
   }
@@ -1330,7 +1330,7 @@ HttpTransact::HandleRequest(State* s)
   // If the hostname is "$internal$" then this is a request for
   // internal proxy information.
   if (handle_internal_request(s, &s->hdr_info.client_request)) {
-    TRANSACT_RETURN(PROXY_INTERNAL_REQUEST, NULL);
+    TRANSACT_RETURN(SM_ACTION_INTERNAL_REQUEST, NULL);
   }
 
   // this needs to be called after initializing state variables from request
@@ -1368,7 +1368,7 @@ HttpTransact::HandleRequest(State* s)
   // appropriate action for trace/option. in this case this routine
   // is responsible for building the response.
   if (handle_trace_and_options_requests(s, &s->hdr_info.client_request)) {
-    TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
   }
 
   if (s->http_config_param->no_dns_forward_to_parent
@@ -1398,7 +1398,7 @@ HttpTransact::HandleRequest(State* s)
       build_error_response(s, HTTP_STATUS_BAD_GATEWAY, "Next Hop Connection Failed", "connect#failed_connect",
                            "Next Hop Connection Failed");
 
-      TRANSACT_RETURN(HttpTransact::PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+      TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
     }
   }
 
@@ -1415,12 +1415,12 @@ HttpTransact::HandleRequest(State* s)
   //Doing a Cache Lookup in case of a Redirection to ensure that
   //the newly requested object is not in the CACHE
   if (s->txn_conf->cache_http && s->redirect_info.redirect_in_process && s->state_machine->enable_redirection) {
-    TRANSACT_RETURN(CACHE_LOOKUP, NULL);
+    TRANSACT_RETURN(SM_ACTION_CACHE_LOOKUP, NULL);
   }
 
 
   if (s->force_dns) {
-    TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);   // After handling the request, DNS is done.
+    TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);   // After handling the request, DNS is done.
   } else {
     // After the requested is properly handled No need of requesting the DNS directly check the ACLs
     // if the request is authorized
@@ -1463,7 +1463,7 @@ HttpTransact::setup_plugin_request_intercept(State* s)
   //  NetVCs so nuke the connection header
   s->hdr_info.server_request.field_delete(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
 
-  TRANSACT_RETURN(ORIGIN_SERVER_OPEN, NULL);
+  TRANSACT_RETURN(SM_ACTION_ORIGIN_SERVER_OPEN, NULL);
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -1509,7 +1509,7 @@ HttpTransact::HandleApiErrorJump(State* s)
                    HTTP_STATUS_INTERNAL_SERVER_ERROR, "INKApi Error");
   }  
 
-  TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
+  TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
   return;
 }
 
@@ -1528,7 +1528,7 @@ HttpTransact::HandleApiErrorJump(State* s)
 //
 // Possible Next States From Here:
 
-// - HttpTransact::DNS_LOOKUP;
+// - HttpTransact::SM_ACTION_DNS_LOOKUP;
 // - HttpTransact::ORIGIN_SERVER_RAW_OPEN;
 // - HttpTransact::ORIGIN_SERVER_OPEN;
 //
@@ -1546,7 +1546,7 @@ HttpTransact::PPDNSLookup(State* s)
     find_server_and_update_current_info(s);
     if (!ats_is_ip(&s->current.server->addr)) {
       if (s->current.request_to == PARENT_PROXY) {
-        TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
       } else {
         // We could be out of parents here if all the parents
         // failed DNS lookup
@@ -1639,7 +1639,7 @@ HttpTransact::ReDNSRoundRobin(State* s)
                           "in the server name, or the server no longer exists.  Double-check the "
                           "name and try again.</B></FONT><HR></BODY></HTML>"), s->server_info.name);
     s->cache_info.action = CACHE_DO_NO_ACTION;
-    s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+    s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
     //  s->next_action = PROXY_INTERNAL_CACHE_NOOP;
   }
 
@@ -1669,7 +1669,7 @@ HttpTransact::ReDNSRoundRobin(State* s)
 // Possible Next States From Here:
 // - HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
 // - HttpTransact::CACHE_LOOKUP;
-// - HttpTransact::DNS_LOOKUP;
+// - HttpTransact::SM_ACTION_DNS_LOOKUP;
 // - HttpTransact::ORIGIN_SERVER_RAW_OPEN;
 // - HttpTransact::ORIGIN_SERVER_OPEN;
 //
@@ -1692,7 +1692,7 @@ HttpTransact::OSDNSLookup(State* s)
     if (will_this_request_self_loop(s)) {
       DebugTxn("http_trans", "[OSDNSLookup] request will selfloop - bailing out");
       SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_NO_FORWARD);
-      TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+      TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
     }
   }
 
@@ -1705,7 +1705,7 @@ HttpTransact::OSDNSLookup(State* s)
       // expansion successful, do a dns lookup on expanded name
       HTTP_RELEASE_ASSERT(s->dns_info.attempts < max_dns_lookups);
       HTTP_RELEASE_ASSERT(s->http_config_param->enable_url_expandomatic);
-      TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
+      TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);
       break;
     case EXPANSION_NOT_ALLOWED:
     case EXPANSION_FAILED:
@@ -1746,7 +1746,7 @@ HttpTransact::OSDNSLookup(State* s)
                               "name and try again.</B></FONT><HR></BODY></HTML>")
                              , s->server_info.name, host_name_expansion);
         // s->cache_info.action = CACHE_DO_NO_ACTION;
-        TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+        TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
       }
       break;
     default:
@@ -1808,19 +1808,19 @@ HttpTransact::OSDNSLookup(State* s)
     DebugTxn("http_seq", "[OSDNSLookup] DNS name resolution on expansion - returning");
     build_redirect_response(s);
     // s->cache_info.action = CACHE_DO_NO_ACTION;
-    TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
   }
   // everything succeeded with the DNS lookup so do an API callout
   //   that allows for filtering.  We'll do traffic_server internal
   //   filtering after API filtering
 
 
-  // After DNS_LOOKUP, goto the saved action/state ORIGIN_SERVER_(RAW_)OPEN.
+  // After SM_ACTION_DNS_LOOKUP, goto the saved action/state ORIGIN_SERVER_(RAW_)OPEN.
   // Should we skip the StartAccessControl()? why?
 
   if (s->cdn_remap_complete) {
     DebugTxn("cdn", "This is a late DNS lookup.  We are going to the OS, " "not to HandleFiltering.");
-    ink_assert(s->cdn_saved_next_action == ORIGIN_SERVER_OPEN || s->cdn_saved_next_action == ORIGIN_SERVER_RAW_OPEN);
+    ink_assert(s->cdn_saved_next_action == SM_ACTION_ORIGIN_SERVER_OPEN || s->cdn_saved_next_action == SM_ACTION_ORIGIN_SERVER_RAW_OPEN);
     DebugTxn("cdn", "outgoing version -- (pre  conversion) %d", s->hdr_info.server_request.m_http->m_version);
     (&s->hdr_info.server_request)->version_set(HTTPVersion(1, 1));
     HttpTransactHeaders::convert_request(s->current.server->http_version, &s->hdr_info.server_request);
@@ -1838,10 +1838,10 @@ HttpTransact::OSDNSLookup(State* s)
              !s->http_config_param->no_dns_forward_to_parent) {
     // note, broken logic: ACC fudges the OR stmt to always be true,
     // 'AuthHttpAdapter' should do the rev-dns if needed, not here .
-    TRANSACT_RETURN(REVERSE_DNS_LOOKUP, HttpTransact::StartAccessControl);
+    TRANSACT_RETURN(SM_ACTION_DNS_REVERSE_LOOKUP, HttpTransact::StartAccessControl);
   } else {
     //(s->state_machine->authAdapter).StartLookup (s);
-    // TRANSACT_RETURN(AUTH_LOOKUP, NULL);
+    // TRANSACT_RETURN(SM_ACTION_AUTH_LOOKUP, NULL);
 
     if (s->force_dns) {
       StartAccessControl(s);    // If skip_dns is enabled and no ip based rules in cache.config and parent.config
@@ -1849,23 +1849,23 @@ HttpTransact::OSDNSLookup(State* s)
     } else {
       if ((s->cache_info.action == CACHE_DO_NO_ACTION) &&
           (s->range_setup == RANGE_NOT_SATISFIABLE || s->range_setup == RANGE_NOT_HANDLED)) {
-        TRANSACT_RETURN(HttpTransact::HTTP_API_OS_DNS, HandleCacheOpenReadMiss);
+        TRANSACT_RETURN(SM_ACTION_API_OS_DNS, HandleCacheOpenReadMiss);
       } else if (s->cache_lookup_result == HttpTransact::CACHE_LOOKUP_SKIPPED) {
-        TRANSACT_RETURN(HttpTransact::HTTP_API_OS_DNS, LookupSkipOpenServer);
+        TRANSACT_RETURN(SM_ACTION_API_OS_DNS, LookupSkipOpenServer);
         // DNS Lookup is done after LOOKUP Skipped  and after we get response
         // from the DNS we need to call LookupSkipOpenServer
       } else if (s->cache_lookup_result == CACHE_LOOKUP_HIT_FRESH ||
                  s->cache_lookup_result == CACHE_LOOKUP_HIT_WARNING ||
                  s->cache_lookup_result == CACHE_LOOKUP_HIT_STALE) {
         //DNS lookup is done if the content is state need to call handle cache open read hit
-        TRANSACT_RETURN(HttpTransact::HTTP_API_OS_DNS, HandleCacheOpenReadHit);
+        TRANSACT_RETURN(SM_ACTION_API_OS_DNS, HandleCacheOpenReadHit);
       } else if (s->cache_lookup_result == CACHE_LOOKUP_MISS || s->cache_info.action == CACHE_DO_NO_ACTION) {
-        TRANSACT_RETURN(HttpTransact::HTTP_API_OS_DNS, HandleCacheOpenReadMiss);
+        TRANSACT_RETURN(SM_ACTION_API_OS_DNS, HandleCacheOpenReadMiss);
         //DNS lookup is done if the lookup failed and need to call Handle Cache Open Read Miss
       } else {
         build_error_response(s, HTTP_STATUS_INTERNAL_SERVER_ERROR, "Invalid Cache Lookup result", "default", "");
         Log::error("HTTP: Invalid CACHE LOOKUP RESULT : %d", s->cache_lookup_result);
-        TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+        TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
       }
     }
   }
@@ -1898,7 +1898,7 @@ HttpTransact::HandleRequestAuthorized(State* s)
   //(s->state_machine->authAdapter).UserAuthorized(NULL);
   //TRANSACT_RETURN(HTTP_API_OS_DNS, HandleFiltering);
    if (s->force_dns) {
-    TRANSACT_RETURN(HttpTransact::HTTP_API_OS_DNS, HttpTransact::DecideCacheLookup);
+    TRANSACT_RETURN(SM_ACTION_API_OS_DNS, HttpTransact::DecideCacheLookup);
   } else {
     HttpTransact::DecideCacheLookup(s);
   }
@@ -1920,7 +1920,7 @@ HttpTransact::HandleFiltering(State* s)
     build_error_response(s, HTTP_STATUS_FORBIDDEN, "Access Denied", "access#denied",
                          "You are not allowed to access the document at the URL location");
     // s->cache_info.action = CACHE_DO_NO_ACTION;
-    TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+    TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   }
 
   DebugTxn("http_seq", "[HttpTransact::HandleFiltering] Request Authorized.");
@@ -2007,7 +2007,7 @@ HttpTransact::DecideCacheLookup(State* s)
       ink_assert(s->cache_info.lookup_url->valid() == true);
     }
 
-    TRANSACT_RETURN(CACHE_LOOKUP, NULL);
+    TRANSACT_RETURN(SM_ACTION_CACHE_LOOKUP, NULL);
   } else {
     ink_assert(s->cache_info.action != CACHE_DO_LOOKUP && s->cache_info.action != CACHE_DO_SERVE);
 
@@ -2029,10 +2029,10 @@ HttpTransact::DecideCacheLookup(State* s)
       // lookup is skipped
       s->cache_lookup_result = HttpTransact::CACHE_LOOKUP_SKIPPED;
       if (s->force_dns) {
-        TRANSACT_RETURN(HTTP_API_CACHE_LOOKUP_COMPLETE, LookupSkipOpenServer);
+        TRANSACT_RETURN(SM_ACTION_API_CACHE_LOOKUP_COMPLETE, LookupSkipOpenServer);
       } else {
         // Returning to dns lookup as cache lookup is skipped
-        TRANSACT_RETURN(HTTP_API_CACHE_LOOKUP_COMPLETE, CallOSDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_API_CACHE_LOOKUP_COMPLETE, CallOSDNSLookup);
       }
     }
   }
@@ -2048,7 +2048,7 @@ HttpTransact::LookupSkipOpenServer(State* s)
   find_server_and_update_current_info(s);
 
   if (s->current.request_to == PARENT_PROXY) {
-    TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+    TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
   }
 
   ink_assert(s->current.request_to == ORIGIN_SERVER);
@@ -2058,7 +2058,7 @@ HttpTransact::LookupSkipOpenServer(State* s)
 
   StateMachineAction_t next = how_to_open_connection(s);
   s->next_action = next;
-  if (next == ORIGIN_SERVER_OPEN || next == ORIGIN_SERVER_RAW_OPEN) {
+  if (next == SM_ACTION_ORIGIN_SERVER_OPEN || next == SM_ACTION_ORIGIN_SERVER_RAW_OPEN) {
     TRANSACT_RETURN(next, HttpTransact::HandleResponse);
   }
 }
@@ -2081,7 +2081,7 @@ HttpTransact::HandleCacheOpenReadPush(State* s, bool read_successful)
     s->cache_info.action = CACHE_PREPARE_TO_WRITE;
   }
 
-  TRANSACT_RETURN(READ_PUSH_HDR, HandlePushResponseHdr);
+  TRANSACT_RETURN(SM_ACTION_READ_PUSH_HDR, HandlePushResponseHdr);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -2118,7 +2118,7 @@ HttpTransact::HandlePushResponseHdr(State* s)
   if (is_response_cacheable(s, &s->hdr_info.server_request, &s->hdr_info.server_response)) {
     ink_assert(s->cache_info.action == CACHE_PREPARE_TO_WRITE || s->cache_info.action == CACHE_PREPARE_TO_UPDATE);
 
-    TRANSACT_RETURN(CACHE_ISSUE_WRITE, HandlePushCacheWrite);
+    TRANSACT_RETURN(SM_ACTION_CACHE_ISSUE_WRITE, HandlePushCacheWrite);
   } else {
     HandlePushError(s, "Response Not Cachable");
   }
@@ -2147,7 +2147,7 @@ HttpTransact::HandlePushCacheWrite(State* s)
     }
     set_headers_for_cache_write(s, &s->cache_info.object_store, &s->hdr_info.server_request, &s->hdr_info.server_response);
 
-    TRANSACT_RETURN(STORE_PUSH_BODY, NULL);
+    TRANSACT_RETURN(SM_ACTION_STORE_PUSH_BODY, NULL);
     break;
 
   case CACHE_WL_FAIL:
@@ -2172,7 +2172,7 @@ HttpTransact::HandlePushTunnelSuccess(State* s)
 
   build_response(s, &s->hdr_info.client_response, s->client_info.http_version, resp_status);
 
-  TRANSACT_RETURN(PROXY_INTERNAL_CACHE_NOOP, NULL);
+  TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, NULL);
 }
 
 
@@ -2256,13 +2256,13 @@ HttpTransact::HandleCacheOpenRead(State* s)
       HandleCacheOpenReadMiss(s);
     } else {
       //Cache Lookup Unsuccessful ..calling dns lookup
-      TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
+      TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);
     }
   }
   else {
     // cache hit
     DebugTxn("http_trans", "CacheOpenRead -- hit");
-    TRANSACT_RETURN(HTTP_API_READ_CACHE_HDR, HandleCacheOpenReadHitFreshness);
+    TRANSACT_RETURN(SM_ACTION_API_READ_CACHE_HDR, HandleCacheOpenReadHitFreshness);
   }
 
   return;
@@ -2417,7 +2417,7 @@ HttpTransact::HandleCacheOpenReadHitFreshness(State* s)
   if (delete_all_document_alternates_and_return(s, true)) {
     DebugTxn("http_trans", "[HandleCacheOpenReadHitFreshness] Delete and return");
     s->cache_info.action = CACHE_DO_DELETE;
-    s->next_action = HttpTransact::PROXY_INTERNAL_CACHE_DELETE;
+    s->next_action = HttpTransact::SM_ACTION_INTERNAL_CACHE_DELETE;
     return;
   }
 
@@ -2470,25 +2470,25 @@ HttpTransact::HandleCacheOpenReadHitFreshness(State* s)
 
   if (!s->force_dns) {          // If DNS is not performed before
     if (need_to_revalidate(s)) {
-      TRANSACT_RETURN(HTTP_API_CACHE_LOOKUP_COMPLETE, CallOSDNSLookup); // content needs to be revalidated and we did not perform a dns ....calling DNS lookup
+      TRANSACT_RETURN(SM_ACTION_API_CACHE_LOOKUP_COMPLETE, CallOSDNSLookup); // content needs to be revalidated and we did not perform a dns ....calling DNS lookup
     } else {                    // document can be served can cache
-      TRANSACT_RETURN(HTTP_API_CACHE_LOOKUP_COMPLETE, HttpTransact::HandleCacheOpenReadHit);
+      TRANSACT_RETURN(SM_ACTION_API_CACHE_LOOKUP_COMPLETE, HttpTransact::HandleCacheOpenReadHit);
     }
   } else {                      // we have done dns . Its up to HandleCacheOpenReadHit to decide to go OS or serve from cache
-    TRANSACT_RETURN(HTTP_API_CACHE_LOOKUP_COMPLETE, HttpTransact::HandleCacheOpenReadHit);
+    TRANSACT_RETURN(SM_ACTION_API_CACHE_LOOKUP_COMPLETE, HttpTransact::HandleCacheOpenReadHit);
   }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // Name       : CallOSDNSLookup
-// Description: Moves in DNS_LOOKUP state and sets the transact return to OSDNSLookup
+// Description: Moves in SM_ACTION_DNS_LOOKUP state and sets the transact return to OSDNSLookup
 //
 // Details    :
 /////////////////////////////////////////////////////////////////////////////
 void
 HttpTransact::CallOSDNSLookup(State* s)
 {
-  TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
+  TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -2581,7 +2581,7 @@ HttpTransact::need_to_revalidate(State* s)
 //
 // Possible Next States From Here:
 // - HttpTransact::PROXY_INTERNAL_CACHE_DELETE;
-// - HttpTransact::DNS_LOOKUP;
+// - HttpTransact::SM_ACTION_DNS_LOOKUP;
 // - HttpTransact::ORIGIN_SERVER_OPEN;
 // - HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
 // - HttpTransact::SERVE_FROM_CACHE;
@@ -2743,9 +2743,9 @@ HttpTransact::HandleCacheOpenReadHit(State* s)
         //  missing ip but we won't take down the system
         //
         if (s->current.request_to == PARENT_PROXY) {
-          TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+          TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
         } else if (s->current.request_to == ORIGIN_SERVER) {
-          TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
+          TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);
         } else {
           handle_parent_died(s);
           return;
@@ -2760,10 +2760,11 @@ HttpTransact::HandleCacheOpenReadHit(State* s)
       // in other words, we would not have looked up the cache for a
       // connect request, so the next action can not be origin_server_raw_open.
       s->next_action = how_to_open_connection(s);
-      if (s->stale_icp_lookup && s->next_action == ORIGIN_SERVER_OPEN)
-        s->next_action = ICP_QUERY;
-      ink_release_assert(s->next_action != ORIGIN_SERVER_RAW_OPEN);
+      if (s->stale_icp_lookup && s->next_action == SM_ACTION_ORIGIN_SERVER_OPEN) {
+        s->next_action = SM_ACTION_ICP_QUERY;
+      }
 
+      ink_release_assert(s->next_action != SM_ACTION_ORIGIN_SERVER_RAW_OPEN);
       return;
     } else {                    // server is down but stale response is returnable
       SET_VIA_STRING(VIA_DETAIL_CACHE_TYPE, VIA_DETAIL_CACHE);
@@ -2810,7 +2811,7 @@ HttpTransact::HandleCacheOpenReadHit(State* s)
   if (s->api_update_cached_object == HttpTransact::UPDATE_CACHED_OBJECT_CONTINUE) {
     s->saved_update_next_action = s->next_action;
     s->saved_update_cache_action = s->cache_info.action;
-    s->next_action = HttpTransact::PREPARE_CACHE_UPDATE;
+    s->next_action = SM_ACTION_CACHE_PREPARE_UPDATE;
   }
 }
 
@@ -2862,7 +2863,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
 
     build_response(s, cached_response, &s->hdr_info.client_response, s->client_info.http_version, client_response_code);
     s->cache_info.action = CACHE_DO_NO_ACTION;
-    s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+    s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     break;
 
   case HTTP_STATUS_PRECONDITION_FAILED:
@@ -2873,7 +2874,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
 
     build_response(s, &s->hdr_info.client_response, s->client_info.http_version, client_response_code);
     s->cache_info.action = CACHE_DO_NO_ACTION;
-    s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+    s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     break;
 
   case HTTP_STATUS_RANGE_NOT_SATISFIABLE:
@@ -2897,7 +2898,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
         if (s->range_setup == RANGE_NOT_SATISFIABLE) {
           build_error_response(s, HTTP_STATUS_RANGE_NOT_SATISFIABLE, "Requested Range Not Satisfiable","","");
           s->cache_info.action = CACHE_DO_NO_ACTION;
-          s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+          s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
           break;
         } else if (s->range_setup == RANGE_NOT_HANDLED) {
           // we switch to tunneling for Range requests if it is out of order.
@@ -2908,7 +2909,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
           if (s->force_dns) {
             HandleCacheOpenReadMiss(s); // DNS is already completed no need of doing DNS
           } else {
-            TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);   // DNS not done before need to be done now as we are connecting to OS
+            TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);   // DNS not done before need to be done now as we are connecting to OS
           }
           return;
         }
@@ -2920,7 +2921,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
       } else {
         build_response(s, cached_response, &s->hdr_info.client_response, s->client_info.http_version);
       }
-      s->next_action = SERVE_FROM_CACHE;
+      s->next_action = SM_ACTION_SERVE_FROM_CACHE;
     }
     // If the client request is a HEAD, then serve the header from cache.
     else if (s->method == HTTP_WKSIDX_HEAD) {
@@ -2928,7 +2929,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
 
       build_response(s, cached_response, &s->hdr_info.client_response, s->client_info.http_version);
       s->cache_info.action = CACHE_DO_NO_ACTION;
-      s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+      s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     } else {
       // We handled the request but it's not GET or HEAD (eg. DELETE),
       // and server is not reacheable: 502
@@ -2936,7 +2937,7 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
       DebugTxn("http_trans", "[build_response_from_cache] No match! Connection failed.");
       build_error_response(s, HTTP_STATUS_BAD_GATEWAY, "Connection Failed", "connect#failed_connect", "Connection Failed");
       s->cache_info.action = CACHE_DO_NO_ACTION;
-      s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+      s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
       warning_code = HTTP_WARNING_CODE_NONE;
     }
     break;
@@ -3027,17 +3028,19 @@ HttpTransact::handle_cache_write_lock(State* s)
     StateMachineAction_t next;
     if (s->stale_icp_lookup == false) {
       next = how_to_open_connection(s);
-      if (next == ORIGIN_SERVER_OPEN || next == ORIGIN_SERVER_RAW_OPEN) {
+      if (next == SM_ACTION_ORIGIN_SERVER_OPEN || next == SM_ACTION_ORIGIN_SERVER_RAW_OPEN) {
         s->next_action = next;
         TRANSACT_RETURN(next, NULL);
       } else {
         // hehe!
         s->next_action = next;
-        ink_assert(s->next_action == DNS_LOOKUP);
+        ink_assert(s->next_action == SM_ACTION_DNS_LOOKUP);
         return;
       }
-    } else
-      next = HttpTransact::ICP_QUERY;
+    } else {
+      next = SM_ACTION_ICP_QUERY;
+    }
+
     TRANSACT_RETURN(next, NULL);
   }
 }
@@ -3052,7 +3055,7 @@ HttpTransact::handle_cache_write_lock(State* s)
 //
 // Possible Next States From Here:
 // - HttpTransact::ICP_QUERY;
-// - HttpTransact::DNS_LOOKUP;
+// - HttpTransact::SM_ACTION_DNS_LOOKUP;
 // - HttpTransact::ORIGIN_SERVER_OPEN;
 // - HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
 // - result of how_to_open_connection()
@@ -3067,7 +3070,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
   if (delete_all_document_alternates_and_return(s, false)) {
     DebugTxn("http_trans", "[HandleCacheOpenReadMiss] Delete and return");
     s->cache_info.action = CACHE_DO_NO_ACTION;
-    s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+    s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     return;
   }
   // reinitialize some variables to reflect cache miss state.
@@ -3104,7 +3107,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
   // does not have a no-cache, issue icp query to sibling cache.
   if (s->http_config_param->icp_enabled && icp_dynamic_enabled != 0 && (no_cache_in_request == false)) {
     DebugTxn("http_trans", "[HandleCacheOpenReadMiss] " "ICP is configured and no no-cache in request; checking ICP");
-    s->next_action = ICP_QUERY;
+    s->next_action = SM_ACTION_ICP_QUERY;
     return;
   }
   ///////////////////////////////////////////////////////////////
@@ -3122,7 +3125,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
       ink_release_assert(s->current.request_to == PARENT_PROXY ||
                   s->http_config_param->no_dns_forward_to_parent != 0);
       if (s->current.request_to == PARENT_PROXY) {
-        TRANSACT_RETURN(DNS_LOOKUP, HttpTransact::PPDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, HttpTransact::PPDNSLookup);
       } else {
         handle_parent_died(s);
         return;
@@ -3134,7 +3137,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
   } else {                      // miss, but only-if-cached is set
     build_error_response(s, HTTP_STATUS_GATEWAY_TIMEOUT, "Not Cached", "cache#not_in_cache", "%s",
                          "This document was not available in the cache, but the client only accepts cached copies.");
-    s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+    s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
   }
 
   return;
@@ -3150,7 +3153,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
 //
 //
 // Possible Next States From Here:
-// - HttpTransact::DNS_LOOKUP;
+// - HttpTransact::SM_ACTION_DNS_LOOKUP;
 // - HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
 // - result of how_to_open_connection()
 //
@@ -3197,7 +3200,7 @@ HttpTransact::HandleICPLookup(State* s)
     find_server_and_update_current_info(s);
     if (!ats_is_ip(&s->current.server->addr)) {
       if (s->current.request_to == PARENT_PROXY) {
-        TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
       } else {
         ink_release_assert(0);
       }
@@ -3252,13 +3255,13 @@ HttpTransact::OriginServerRawOpen(State* s)
     handle_server_died(s);
 
     ink_assert(s->cache_info.action == CACHE_DO_NO_ACTION);
-    s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+    s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     break;
   case CONNECTION_ALIVE:
     build_response(s, &s->hdr_info.client_response, s->client_info.http_version, HTTP_STATUS_OK);
 
     DebugTxn("http_trans", "[OriginServerRawOpen] connection alive. next action is ssl_tunnel");
-    s->next_action = SSL_TUNNEL;
+    s->next_action = SM_ACTION_SSL_TUNNEL;
     break;
   default:
     ink_assert(!("s->current.state is set to something unsupported"));
@@ -3368,9 +3371,9 @@ HttpTransact::HandleUpdateCachedObject(State* s)
     s->request_sent_time = s->cache_info.object_read->request_sent_time_get();
     s->response_received_time = s->cache_info.object_read->response_received_time_get();
     if (s->api_update_cached_object == UPDATE_CACHED_OBJECT_CONTINUE) {
-      TRANSACT_RETURN(HttpTransact::ISSUE_CACHE_UPDATE, HttpTransact::HandleUpdateCachedObjectContinue);
+      TRANSACT_RETURN(SM_ACTION_CACHE_ISSUE_UPDATE, HttpTransact::HandleUpdateCachedObjectContinue);
     } else {
-      TRANSACT_RETURN(HttpTransact::ISSUE_CACHE_UPDATE, HttpTransact::HandleApiErrorJump);
+      TRANSACT_RETURN(SM_ACTION_CACHE_ISSUE_UPDATE, HttpTransact::HandleApiErrorJump);
     }
   } else if (s->api_update_cached_object == UPDATE_CACHED_OBJECT_CONTINUE) {
     // even failed to update, continue to serve from cache
@@ -3424,7 +3427,7 @@ HttpTransact::HandleStatPage(State* s)
   }
 
   s->cache_info.action = CACHE_DO_NO_ACTION;
-  s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+  s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -3470,7 +3473,7 @@ HttpTransact::handle_response_from_icp_suggested_host(State* s)
     find_server_and_update_current_info(s);
     if (!ats_is_ip(&s->current.server->addr)) {
       if (s->current.request_to == PARENT_PROXY) {
-        TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
       } else {
         ink_release_assert(0);
       }
@@ -3580,7 +3583,7 @@ HttpTransact::handle_response_from_parent(State* s)
       switch (next_lookup) {
       case PARENT_PROXY:
         ink_assert(s->current.request_to == PARENT_PROXY);
-        TRANSACT_RETURN(DNS_LOOKUP, PPDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, PPDNSLookup);
         break;
       case ORIGIN_SERVER:
         s->current.attempts = 0;
@@ -3689,7 +3692,7 @@ HttpTransact::handle_response_from_server(State* s)
         // Because this is a transparent connection, we can't switch address
         // families - that is locked in by the client source address.
         s->state_machine->ua_session->host_res_style = ats_host_res_match(&s->current.server->addr.sa);
-        TRANSACT_RETURN(HttpTransact::DNS_LOOKUP, OSDNSLookup);
+        TRANSACT_RETURN(SM_ACTION_DNS_LOOKUP, OSDNSLookup);
       } else if ((s->dns_info.srv_lookup_success || s->server_info.dns_round_robin) &&
                  (s->txn_conf->connect_attempts_rr_retries > 0) &&
                  (s->current.attempts % s->txn_conf->connect_attempts_rr_retries == 0)) {
@@ -3749,7 +3752,7 @@ HttpTransact::delete_server_rr_entry(State* s, int max_retries)
   update_dns_info(&s->dns_info, &s->current, 0, &s->arena);
   s->current.attempts++;
   DebugTxn("http_trans", "[delete_server_rr_entry] attempts now: %d, max: %d", s->current.attempts, max_retries);
-  TRANSACT_RETURN(OS_RR_MARK_DOWN, ReDNSRoundRobin);
+  TRANSACT_RETURN(SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN, ReDNSRoundRobin);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -3874,7 +3877,7 @@ HttpTransact::handle_server_connection_not_open(State* s)
     build_response_from_cache(s, HTTP_WARNING_CODE_REVALIDATION_FAILED);
   } else {
     handle_server_died(s);
-    s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+    s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
   }
 
   return;
@@ -3909,7 +3912,7 @@ HttpTransact::handle_forward_server_connection_open(State* s)
 
     s->client_info.keep_alive = HTTP_NO_KEEPALIVE;
     s->cache_info.action = CACHE_DO_NO_ACTION;
-    s->next_action = SERVER_READ;
+    s->next_action = SM_ACTION_SERVER_READ;
     return;
 
   }
@@ -4016,9 +4019,9 @@ HttpTransact::handle_100_continue_response(State* s)
     //   the other build response functions insist on
     //   adding stuff
     build_response_copy(s, &s->hdr_info.server_response, &s->hdr_info.client_response, s->client_info.http_version);
-    TRANSACT_RETURN(PROXY_INTERNAL_100_RESPONSE, HandleResponse);
+    TRANSACT_RETURN(SM_ACTION_INTERNAL_100_RESPONSE, HandleResponse);
   } else {
-    TRANSACT_RETURN(SERVER_PARSE_NEXT_HDR, HandleResponse);
+    TRANSACT_RETURN(SM_ACTION_SERVER_PARSE_NEXT_HDR, HandleResponse);
   }
 }
 
@@ -4113,7 +4116,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       s->cache_info.action = CACHE_DO_SERVE;
       DebugTxn("http_trans", "[hcoofsr] not merging, cache action changed to: %s",
             HttpDebugNames::get_cache_action_name(s->cache_info.action));
-      s->next_action = HttpTransact::SERVE_FROM_CACHE;
+      s->next_action = SM_ACTION_SERVE_FROM_CACHE;
       client_response_code = base_response->status_get();
     } else if ((s->cache_info.action == CACHE_DO_DELETE) || ((s->cache_info.action == CACHE_DO_UPDATE) && !cacheable)) {
       if (is_request_conditional(&s->hdr_info.client_request)) {
@@ -4130,7 +4133,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
         base_response = &s->hdr_info.server_response;
         client_response_code = base_response->status_get();
         s->cache_info.action = CACHE_DO_DELETE;
-        s->next_action = PROXY_INTERNAL_CACHE_DELETE;
+        s->next_action = SM_ACTION_INTERNAL_CACHE_DELETE;
       } else {
         // We got screwed. The client did not send a conditional request,
         // but we had a cached copy which we revalidated. The server has
@@ -4138,10 +4141,10 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
         // We need to send the cached copy to the client, then delete it.
         if (s->method == HTTP_WKSIDX_HEAD) {
           s->cache_info.action = CACHE_DO_DELETE;
-          s->next_action = SERVER_READ;
+          s->next_action = SM_ACTION_SERVER_READ;
         } else {
           s->cache_info.action = CACHE_DO_SERVE_AND_DELETE;
-          s->next_action = SERVE_FROM_CACHE;
+          s->next_action = SM_ACTION_SERVE_FROM_CACHE;
         }
         base_response = s->cache_info.object_read->response_get();
         client_response_code = base_response->status_get();
@@ -4164,17 +4167,17 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
         // delete the cached copy unless configured to always verify IMS
         if (s->txn_conf->cache_when_to_revalidate != 4) {
           s->cache_info.action = CACHE_DO_UPDATE;
-          s->next_action = PROXY_INTERNAL_CACHE_UPDATE_HEADERS;
+          s->next_action = SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS;
           /* base_response will be set after updating headers below */
         } else {
           s->cache_info.action = CACHE_DO_NO_ACTION;
-          s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+          s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
           base_response = &s->hdr_info.server_response;
         }
       } else {
         if (s->method == HTTP_WKSIDX_HEAD) {
           s->cache_info.action = CACHE_DO_UPDATE;
-          s->next_action = SERVER_READ;
+          s->next_action = SM_ACTION_SERVER_READ;
         } else {
           if (s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
             s->state_machine->do_range_setup_if_necessary();
@@ -4183,7 +4186,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
             // a bad client, but allows us to avoid pegging the origin (e.g. abuse).
           }
           s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
-          s->next_action = SERVE_FROM_CACHE;
+          s->next_action = SM_ACTION_SERVE_FROM_CACHE;
         }
         /* base_response will be set after updating headers below */
       }
@@ -4195,7 +4198,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       // should not have been an conditional.
       DebugTxn("http_trans", "[hcoofsr] 304 for non-conditional request");
       s->cache_info.action = CACHE_DO_NO_ACTION;
-      s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+      s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
       client_response_code = s->hdr_info.server_response.status_get();
       base_response = &s->hdr_info.server_response;
 
@@ -4223,7 +4226,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       if (!HttpTransactHeaders::downgrade_request(&keep_alive, &s->hdr_info.server_request)) {
         build_error_response(s, HTTP_STATUS_HTTPVER_NOT_SUPPORTED, "HTTP Version Not Supported",
                              "response#bad_version", "");
-        s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+        s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
         s->already_downgraded = true;
       } else {
         if (!keep_alive) {
@@ -4275,15 +4278,15 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       if (is_request_conditional(&s->hdr_info.client_request) &&
           HttpTransactCache::match_response_to_request_conditionals(&s->hdr_info.client_request,
                                                                     s->cache_info.object_read->response_get()) == HTTP_STATUS_NOT_MODIFIED) {
-        s->next_action = HttpTransact::PROXY_INTERNAL_CACHE_UPDATE_HEADERS;
+        s->next_action = SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS;
         client_response_code = HTTP_STATUS_NOT_MODIFIED;
       } else {
         if (s->method == HTTP_WKSIDX_HEAD) {
           s->cache_info.action = CACHE_DO_UPDATE;
-          s->next_action = HttpTransact::PROXY_INTERNAL_CACHE_NOOP;
+          s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
         } else {
           s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
-          s->next_action = HttpTransact::SERVE_FROM_CACHE;
+          s->next_action = SM_ACTION_SERVE_FROM_CACHE;
         }
 
         client_response_code = s->cache_info.object_read->response_get()->status_get();
@@ -4301,7 +4304,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
 
       ink_assert(client_response_code != HTTP_STATUS_NONE);
 
-      if (s->next_action == HttpTransact::SERVE_FROM_CACHE && s->state_machine->do_transform_open()) {
+      if (s->next_action == SM_ACTION_SERVE_FROM_CACHE && s->state_machine->do_transform_open()) {
         set_header_for_transform(s, base_response);
       } else {
         build_response(s, base_response, &s->hdr_info.client_response, s->client_info.http_version, client_response_code);
@@ -4310,7 +4313,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       return;
     }
 
-    s->next_action = SERVER_READ;
+    s->next_action = SM_ACTION_SERVER_READ;
     client_response_code = server_response_code;
     base_response = &s->hdr_info.server_response;
 
@@ -4331,7 +4334,7 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
       s->cache_info.action = CACHE_DO_SERVE;
       DebugTxn("http_trans", "[hcoofsr] ignoring server response, "
             "cache action changed to: %s", HttpDebugNames::get_cache_action_name(s->cache_info.action));
-      s->next_action = HttpTransact::SERVE_FROM_CACHE;
+      s->next_action = SM_ACTION_SERVE_FROM_CACHE;
       client_response_code = base_response->status_get();
     } else if (s->cache_info.action == CACHE_DO_UPDATE) {
       if (s->www_auth_content == CACHE_AUTH_FRESH) {
@@ -4396,13 +4399,13 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
           switch (s->cache_info.action) {
           case CACHE_DO_WRITE:
           case CACHE_DO_REPLACE:
-            s->next_action = PROXY_INTERNAL_CACHE_WRITE;
+            s->next_action = SM_ACTION_INTERNAL_CACHE_WRITE;
             break;
           case CACHE_DO_DELETE:
-            s->next_action = PROXY_INTERNAL_CACHE_DELETE;
+            s->next_action = SM_ACTION_INTERNAL_CACHE_DELETE;
             break;
           default:
-            s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+            s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
             break;
           }
         } else {
@@ -4513,8 +4516,8 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
   }
   // all other responses (not 304, 412, 416) are handled here
   else {
-    if (((s->next_action == SERVE_FROM_CACHE) ||
-         (s->next_action == SERVER_READ)) && s->state_machine->do_transform_open()) {
+    if (((s->next_action == SM_ACTION_SERVE_FROM_CACHE) ||
+         (s->next_action == SM_ACTION_SERVER_READ)) && s->state_machine->do_transform_open()) {
       set_header_for_transform(s, base_response);
     } else {
       build_response(s, base_response, &s->hdr_info.client_response, s->client_info.http_version, client_response_code);
@@ -4552,12 +4555,12 @@ HttpTransact::handle_no_cache_operation_on_forward_server_response(State* s)
     SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVED);
     if (s->method == HTTP_WKSIDX_CONNECT) {
       DebugTxn("http_trans", "[hncoofsr] next action is SSL_TUNNEL");
-      s->next_action = SSL_TUNNEL;
+      s->next_action = SM_ACTION_SSL_TUNNEL;
     } else {
       DebugTxn("http_trans", "[hncoofsr] next action will be OS_READ_CACHE_NOOP");
 
       ink_assert(s->cache_info.action == CACHE_DO_NO_ACTION);
-      s->next_action = SERVER_READ;
+      s->next_action = SM_ACTION_SERVER_READ;
     }
     if (s->state_machine->redirect_url == NULL) {
       s->state_machine->enable_redirection = false;
@@ -4578,7 +4581,7 @@ HttpTransact::handle_no_cache_operation_on_forward_server_response(State* s)
     }
 
     ink_assert(s->cache_info.action == CACHE_DO_NO_ACTION);
-    s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+    s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP;
     break;
   case HTTP_STATUS_HTTPVER_NOT_SUPPORTED:
     s->next_action = how_to_open_connection(s);
@@ -4587,7 +4590,7 @@ HttpTransact::handle_no_cache_operation_on_forward_server_response(State* s)
     if (!HttpTransactHeaders::downgrade_request(&keep_alive, &s->hdr_info.server_request)) {
       s->already_downgraded = true;
       build_error_response(s, HTTP_STATUS_HTTPVER_NOT_SUPPORTED, "HTTP Version Not Supported", "response#bad_version", "");
-      s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+      s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
     } else {
       s->already_downgraded = true;
       s->next_action = how_to_open_connection(s);
@@ -4596,19 +4599,19 @@ HttpTransact::handle_no_cache_operation_on_forward_server_response(State* s)
   case HTTP_STATUS_PARTIAL_CONTENT:
     // If we get this back we should be just passing it through.
     ink_assert(s->cache_info.action == CACHE_DO_NO_ACTION);
-    s->next_action = SERVER_READ;
+    s->next_action = SM_ACTION_SERVER_READ;
     break;
   default:
     DebugTxn("http_trans", "[hncoofsr] server sent back something other than 100,304,200");
     /* Default behavior is to pass-through response to the client */
 
     ink_assert(s->cache_info.action == CACHE_DO_NO_ACTION);
-    s->next_action = SERVER_READ;
+    s->next_action = SM_ACTION_SERVER_READ;
     break;
   }
 
   HTTPHdr *to_warn;
-  if (s->next_action == SERVER_READ && s->state_machine->do_transform_open()) {
+  if (s->next_action == SM_ACTION_SERVER_READ && s->state_machine->do_transform_open()) {
     set_header_for_transform(s, &s->hdr_info.server_response);
     to_warn = &s->hdr_info.transform_response;
   } else {
@@ -4710,7 +4713,7 @@ HttpTransact::handle_transform_cache_write(State* s)
     ink_release_assert(0);
   }
 
-  TRANSACT_RETURN(TRANSFORM_READ, NULL);
+  TRANSACT_RETURN(SM_ACTION_TRANSFORM_READ, NULL);
 }
 
 void
@@ -4752,10 +4755,10 @@ HttpTransact::handle_transform_ready(State* s)
     }
 
     s->cache_info.transform_action = CACHE_PREPARE_TO_WRITE;
-    TRANSACT_RETURN(CACHE_ISSUE_WRITE_TRANSFORM, handle_transform_cache_write);
+    TRANSACT_RETURN(SM_ACTION_CACHE_ISSUE_WRITE_TRANSFORM, handle_transform_cache_write);
   } else {
     s->cache_info.transform_action = CACHE_DO_NO_ACTION;
-    TRANSACT_RETURN(TRANSFORM_READ, NULL);
+    TRANSACT_RETURN(SM_ACTION_TRANSFORM_READ, NULL);
   }
 }
 
@@ -7587,7 +7590,7 @@ HttpTransact::handle_parent_died(State* s)
 
   build_error_response(s, HTTP_STATUS_BAD_GATEWAY, "Next Hop Connection Failed", "connect#failed_connect",
                        "Next Hop Connection Failed");
-  TRANSACT_RETURN(PROXY_SEND_ERROR_CACHE_NOOP, NULL);
+  TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
 }
 
 void
@@ -8224,7 +8227,7 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
     s->arena.str_free(url_string);
   }
 
-  s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+  s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
   return;
 }
 


[09/50] [abbrv] git commit: doc: remove the redundant list of statistics accepted by traffic_line

Posted by zw...@apache.org.
doc: remove the redundant list of statistics accepted by traffic_line


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

Branch: refs/heads/lua_config
Commit: bba5f4a059e73551a424e7e8647f61e9b12581b2
Parents: 0389be3
Author: James Peach <jp...@apache.org>
Authored: Fri Mar 14 12:58:31 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Mar 14 12:58:31 2014 -0700

----------------------------------------------------------------------
 doc/reference/commands/traffic_line.en.rst | 768 ------------------------
 1 file changed, 768 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bba5f4a0/doc/reference/commands/traffic_line.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/commands/traffic_line.en.rst b/doc/reference/commands/traffic_line.en.rst
index b99be29..96bbd60 100644
--- a/doc/reference/commands/traffic_line.en.rst
+++ b/doc/reference/commands/traffic_line.en.rst
@@ -145,774 +145,6 @@ Options
 Performance Statistics
 ======================
 
-.. XXX: These variables need to be documented.. Volunteers? //igalic
-
-The :option:`traffic_line -r` option accepts the following variable names::
-
-  proxy.cluster.bandwidth_hit_ratio
-  proxy.cluster.bandwidth_hit_ratio_avg_10s
-  proxy.cluster.bandwidth_hit_ratio_int_pct
-  proxy.cluster.cache.bytes_free
-  proxy.cluster.cache.bytes_free_mb
-  proxy.cluster.cache.contents.num_docs
-  proxy.cluster.cache.percent_free
-  proxy.cluster.cache.percent_free_int_pct
-  proxy.cluster.cache_hit_mem_ratio
-  proxy.cluster.cache_hit_mem_ratio_avg_10s
-  proxy.cluster.cache_hit_mem_ratio_int_pct
-  proxy.cluster.cache_hit_ratio
-  proxy.cluster.cache_hit_ratio_avg_10s
-  proxy.cluster.cache_hit_ratio_int_pct
-  proxy.cluster.cache_total_hits
-  proxy.cluster.cache_total_hits_avg_10s
-  proxy.cluster.cache_total_hits_mem
-  proxy.cluster.cache_total_hits_mem_avg_10s
-  proxy.cluster.cache_total_misses
-  proxy.cluster.cache_total_misses_avg_10s
-  proxy.cluster.client_throughput_out
-  proxy.cluster.client_throughput_out_kbit
-  proxy.cluster.current_cache_connections
-  proxy.cluster.current_client_connections
-  proxy.cluster.current_server_connections
-  proxy.cluster.dns.lookups_per_second
-  proxy.cluster.dns.total_dns_lookups
-  proxy.cluster.hostdb.hit_ratio
-  proxy.cluster.hostdb.hit_ratio_avg_10s
-  proxy.cluster.hostdb.hit_ratio_int_pct
-  proxy.cluster.hostdb.total_hits_avg_10s
-  proxy.cluster.hostdb.total_lookups_avg_10s
-  proxy.cluster.http.cache_current_connections_count
-  proxy.cluster.http.current_parent_proxy_connections
-  proxy.cluster.http.origin_server_current_connections_count
-  proxy.cluster.http.origin_server_total_request_bytes
-  proxy.cluster.http.origin_server_total_response_bytes
-  proxy.cluster.http.origin_server_total_transactions_count
-  proxy.cluster.http.parent_proxy_total_request_bytes
-  proxy.cluster.http.parent_proxy_total_response_bytes
-  proxy.cluster.http.throughput
-  proxy.cluster.http.user_agent_current_connections_count
-  proxy.cluster.http.user_agent_total_request_bytes
-  proxy.cluster.http.user_agent_total_response_bytes
-  proxy.cluster.http.user_agent_xacts_per_second
-  proxy.cluster.http.user_agents_total_documents_served
-  proxy.cluster.http.user_agents_total_transactions_count
-
-  proxy.cluster.log.bytes_flush_to_disk
-  proxy.cluster.log.bytes_lost_before_flush_to_disk
-  proxy.cluster.log.bytes_lost_before_preproc
-  proxy.cluster.log.bytes_lost_before_sent_to_network
-  proxy.cluster.log.bytes_lost_before_written_to_disk
-  proxy.cluster.log.bytes_received_from_network
-  proxy.cluster.log.bytes_received_from_network_avg_10s
-  proxy.cluster.log.bytes_sent_to_network
-  proxy.cluster.log.bytes_sent_to_network_avg_10s
-  proxy.cluster.log.bytes_written_to_disk
-  proxy.cluster.log.event_log_access_aggr
-  proxy.cluster.log.event_log_access_fail
-  proxy.cluster.log.event_log_access_full
-  proxy.cluster.log.event_log_access_ok
-  proxy.cluster.log.event_log_access_skip
-  proxy.cluster.log.event_log_error_aggr
-  proxy.cluster.log.event_log_error_fail
-  proxy.cluster.log.event_log_error_full
-  proxy.cluster.log.event_log_error_ok
-  proxy.cluster.log.event_log_error_skip
-  proxy.cluster.log.num_flush_to_disk
-  proxy.cluster.log.num_lost_before_flush_to_disk
-  proxy.cluster.log.num_lost_before_sent_to_network
-  proxy.cluster.log.num_received_from_network
-  proxy.cluster.log.num_sent_to_network
-
-  proxy.cluster.origin_server_total_bytes_avg_10s
-  proxy.cluster.user_agent_total_bytes_avg_10s
-  proxy.cluster.user_agent_xacts_per_second
-
-  proxy.node.bandwidth_hit_ratio
-  proxy.node.bandwidth_hit_ratio_avg_10s
-  proxy.node.bandwidth_hit_ratio_avg_10s_int_pct
-  proxy.node.bandwidth_hit_ratio_int_pct
-
-  proxy.node.cache.bytes_free
-  proxy.node.cache.bytes_free_mb
-  proxy.node.cache.bytes_total
-  proxy.node.cache.bytes_total_mb
-  proxy.node.cache.contents.num_docs
-  proxy.node.cache.percent_free
-  proxy.node.cache.percent_free_int_pct
-  proxy.node.cache_hit_mem_ratio
-  proxy.node.cache_hit_mem_ratio_avg_10s
-  proxy.node.cache_hit_mem_ratio_avg_10s_int_pct
-  proxy.node.cache_hit_mem_ratio_int_pct
-  proxy.node.cache_hit_ratio
-  proxy.node.cache_hit_ratio_avg_10s
-  proxy.node.cache_hit_ratio_avg_10s_int_pct
-  proxy.node.cache_hit_ratio_int_pct
-  proxy.node.cache_total_hits
-  proxy.node.cache_total_hits_avg_10s
-  proxy.node.cache_total_hits_mem
-  proxy.node.cache_total_hits_mem_avg_10s
-  proxy.node.cache_total_misses
-  proxy.node.cache_total_misses_avg_10s
-
-  proxy.node.client_throughput_out
-  proxy.node.client_throughput_out_kbit
-  proxy.node.cluster.nodes
-
-  proxy.node.current_cache_connections
-  proxy.node.current_client_connections
-  proxy.node.current_server_connections
-
-  proxy.node.dns.lookup_avg_time_ms
-  proxy.node.dns.lookups_per_second
-  proxy.node.dns.total_dns_lookups
-
-  proxy.node.hostdb.hit_ratio
-  proxy.node.hostdb.hit_ratio_avg_10s
-  proxy.node.hostdb.hit_ratio_int_pct
-  proxy.node.hostdb.total_hits
-  proxy.node.hostdb.total_hits_avg_10s
-  proxy.node.hostdb.total_lookups
-  proxy.node.hostdb.total_lookups_avg_10s
-
-  proxy.node.hostname
-  proxy.node.hostname_FQ
-
-  proxy.node.http.cache_current_connections_count
-  proxy.node.http.cache_hit_fresh_avg_10s
-  proxy.node.http.cache_hit_ims_avg_10s
-  proxy.node.http.cache_hit_mem_fresh_avg_10s
-  proxy.node.http.cache_hit_revalidated_avg_10s
-  proxy.node.http.cache_hit_stale_served_avg_10s
-  proxy.node.http.cache_miss_changed_avg_10s
-  proxy.node.http.cache_miss_client_no_cache_avg_10s
-  proxy.node.http.cache_miss_cold_avg_10s
-  proxy.node.http.cache_miss_ims_avg_10s
-  proxy.node.http.cache_miss_not_cacheable_avg_10s
-  proxy.node.http.cache_read_error_avg_10s
-  proxy.node.http.current_parent_proxy_connections
-  proxy.node.http.origin_server_current_connections_count
-  proxy.node.http.origin_server_total_request_bytes
-  proxy.node.http.origin_server_total_response_bytes
-  proxy.node.http.origin_server_total_transactions_count
-  proxy.node.http.parent_proxy_total_request_bytes
-  proxy.node.http.parent_proxy_total_response_bytes
-  proxy.node.http.throughput
-  proxy.node.http.transaction_counts_avg_10s.errors.aborts
-  proxy.node.http.transaction_counts_avg_10s.errors.connect_failed
-  proxy.node.http.transaction_counts_avg_10s.errors.early_hangups
-  proxy.node.http.transaction_counts_avg_10s.errors.empty_hangups
-  proxy.node.http.transaction_counts_avg_10s.errors.other
-  proxy.node.http.transaction_counts_avg_10s.errors.possible_aborts
-  proxy.node.http.transaction_counts_avg_10s.errors.pre_accept_hangups
-  proxy.node.http.transaction_counts_avg_10s.hit_fresh
-  proxy.node.http.transaction_counts_avg_10s.hit_revalidated
-  proxy.node.http.transaction_counts_avg_10s.miss_changed
-  proxy.node.http.transaction_counts_avg_10s.miss_client_no_cache
-  proxy.node.http.transaction_counts_avg_10s.miss_cold
-  proxy.node.http.transaction_counts_avg_10s.miss_not_cacheable
-  proxy.node.http.transaction_counts_avg_10s.other.unclassified
-  proxy.node.http.transaction_frac_avg_10s.errors.aborts
-  proxy.node.http.transaction_frac_avg_10s.errors.aborts_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.connect_failed
-  proxy.node.http.transaction_frac_avg_10s.errors.connect_failed_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.early_hangups
-  proxy.node.http.transaction_frac_avg_10s.errors.early_hangups_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups
-  proxy.node.http.transaction_frac_avg_10s.errors.empty_hangups_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.other
-  proxy.node.http.transaction_frac_avg_10s.errors.other_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts
-  proxy.node.http.transaction_frac_avg_10s.errors.possible_aborts_int_pct
-  proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups
-  proxy.node.http.transaction_frac_avg_10s.errors.pre_accept_hangups_int_pct
-  proxy.node.http.transaction_frac_avg_10s.hit_fresh
-  proxy.node.http.transaction_frac_avg_10s.hit_fresh_int_pct
-  proxy.node.http.transaction_frac_avg_10s.hit_revalidated
-  proxy.node.http.transaction_frac_avg_10s.hit_revalidated_int_pct
-  proxy.node.http.transaction_frac_avg_10s.miss_changed
-  proxy.node.http.transaction_frac_avg_10s.miss_changed_int_pct
-  proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache
-  proxy.node.http.transaction_frac_avg_10s.miss_client_no_cache_int_pct
-  proxy.node.http.transaction_frac_avg_10s.miss_cold
-  proxy.node.http.transaction_frac_avg_10s.miss_cold_int_pct
-  proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable
-  proxy.node.http.transaction_frac_avg_10s.miss_not_cacheable_int_pct
-  proxy.node.http.transaction_frac_avg_10s.other.unclassified
-  proxy.node.http.transaction_frac_avg_10s.other.unclassified_int_pct
-  proxy.node.http.transaction_msec_avg_10s.errors.aborts
-  proxy.node.http.transaction_msec_avg_10s.errors.connect_failed
-  proxy.node.http.transaction_msec_avg_10s.errors.early_hangups
-  proxy.node.http.transaction_msec_avg_10s.errors.empty_hangups
-  proxy.node.http.transaction_msec_avg_10s.errors.other
-  proxy.node.http.transaction_msec_avg_10s.errors.possible_aborts
-  proxy.node.http.transaction_msec_avg_10s.errors.pre_accept_hangups
-  proxy.node.http.transaction_msec_avg_10s.hit_fresh
-  proxy.node.http.transaction_msec_avg_10s.hit_revalidated
-  proxy.node.http.transaction_msec_avg_10s.miss_changed
-  proxy.node.http.transaction_msec_avg_10s.miss_client_no_cache
-  proxy.node.http.transaction_msec_avg_10s.miss_cold
-  proxy.node.http.transaction_msec_avg_10s.miss_not_cacheable
-  proxy.node.http.transaction_msec_avg_10s.other.unclassified
-  proxy.node.http.user_agent_current_connections_count
-  proxy.node.http.user_agent_total_request_bytes
-  proxy.node.http.user_agent_total_response_bytes
-  proxy.node.http.user_agent_xacts_per_second
-  proxy.node.http.user_agents_total_documents_served
-  proxy.node.http.user_agents_total_transactions_count
-
-  proxy.node.log.bytes_flush_to_disk
-  proxy.node.log.bytes_lost_before_flush_to_disk
-  proxy.node.log.bytes_lost_before_preproc
-  proxy.node.log.bytes_lost_before_sent_to_network
-  proxy.node.log.bytes_lost_before_written_to_disk
-  proxy.node.log.bytes_received_from_network
-  proxy.node.log.bytes_received_from_network_avg_10s
-  proxy.node.log.bytes_sent_to_network
-  proxy.node.log.bytes_sent_to_network_avg_10s
-  proxy.node.log.bytes_written_to_disk
-  proxy.node.log.event_log_access_aggr
-  proxy.node.log.event_log_access_fail
-  proxy.node.log.event_log_access_full
-  proxy.node.log.event_log_access_ok
-  proxy.node.log.event_log_access_skip
-  proxy.node.log.event_log_error_aggr
-  proxy.node.log.event_log_error_fail
-  proxy.node.log.event_log_error_full
-  proxy.node.log.event_log_error_ok
-  proxy.node.log.event_log_error_skip
-  proxy.node.log.num_flush_to_disk
-  proxy.node.log.num_lost_before_flush_to_disk
-  proxy.node.log.num_lost_before_sent_to_network
-  proxy.node.log.num_received_from_network
-  proxy.node.log.num_sent_to_network
-
-  proxy.node.num_processes
-
-  proxy.node.origin_server_total_bytes
-  proxy.node.origin_server_total_bytes_avg_10s
-
-  proxy.node.proxy_running
-
-  proxy.node.restarts.manager.start_time
-  proxy.node.restarts.proxy.cache_ready_time
-  proxy.node.restarts.proxy.restart_count
-  proxy.node.restarts.proxy.start_time
-  proxy.node.restarts.proxy.stop_time
-
-  proxy.node.user_agent_total_bytes
-  proxy.node.user_agent_total_bytes_avg_10s
-  proxy.node.user_agent_xacts_per_second
-  proxy.node.user_agents_total_documents_served
-
-  proxy.node.version.manager.build_date
-  proxy.node.version.manager.build_machine
-  proxy.node.version.manager.build_number
-  proxy.node.version.manager.build_person
-  proxy.node.version.manager.build_time
-  proxy.node.version.manager.long
-  proxy.node.version.manager.short
-
-  proxy.process.cache.KB_read_per_sec
-  proxy.process.cache.KB_write_per_sec
-  proxy.process.cache.bytes_total
-  proxy.process.cache.bytes_used
-  proxy.process.cache.directory_collision
-  proxy.process.cache.direntries.total
-  proxy.process.cache.direntries.used
-  proxy.process.cache.evacuate.active
-  proxy.process.cache.evacuate.failure
-  proxy.process.cache.evacuate.success
-  proxy.process.cache.frags_per_doc.1
-  proxy.process.cache.frags_per_doc.2
-  proxy.process.cache.frags_per_doc.3+
-  proxy.process.cache.gc_bytes_evacuated
-  proxy.process.cache.gc_frags_evacuated
-  proxy.process.cache.hdr_marshal_bytes
-  proxy.process.cache.hdr_marshals
-  proxy.process.cache.lookup.active
-  proxy.process.cache.lookup.failure
-  proxy.process.cache.lookup.success
-  proxy.process.cache.percent_full
-  proxy.process.cache.pread_count
-  proxy.process.cache.ram_cache.bytes_used
-  proxy.process.cache.ram_cache.hits
-  proxy.process.cache.ram_cache.misses
-  proxy.process.cache.ram_cache.total_bytes
-  proxy.process.cache.read.active
-  proxy.process.cache.read.failure
-  proxy.process.cache.read.success
-  proxy.process.cache.read_busy.failure
-  proxy.process.cache.read_busy.success
-  proxy.process.cache.read_per_sec
-  proxy.process.cache.remove.active
-  proxy.process.cache.remove.failure
-  proxy.process.cache.remove.success
-  proxy.process.cache.scan.active
-  proxy.process.cache.scan.failure
-  proxy.process.cache.scan.success
-  proxy.process.cache.update.active
-  proxy.process.cache.update.failure
-  proxy.process.cache.update.success
-  proxy.process.cache.vector_marshals
-  proxy.process.cache.volume_{N}.bytes_total
-  proxy.process.cache.volume_{N}.bytes_used
-  proxy.process.cache.volume_{N}.directory_collision
-  proxy.process.cache.volume_{N}.direntries.total
-  proxy.process.cache.volume_{N}.direntries.used
-  proxy.process.cache.volume_{N}.evacuate.active
-  proxy.process.cache.volume_{N}.evacuate.failure
-  proxy.process.cache.volume_{N}.evacuate.success
-  proxy.process.cache.volume_{N}.frags_per_doc.1
-  proxy.process.cache.volume_{N}.frags_per_doc.2
-  proxy.process.cache.volume_{N}.frags_per_doc.3+
-  proxy.process.cache.volume_{N}.gc_bytes_evacuated
-  proxy.process.cache.volume_{N}.gc_frags_evacuated
-  proxy.process.cache.volume_{N}.hdr_marshal_bytes
-  proxy.process.cache.volume_{N}.hdr_marshals
-  proxy.process.cache.volume_{N}.lookup.active
-  proxy.process.cache.volume_{N}.lookup.failure
-  proxy.process.cache.volume_{N}.lookup.success
-  proxy.process.cache.volume_{N}.percent_full
-  proxy.process.cache.volume_{N}.pread_count
-  proxy.process.cache.volume_{N}.ram_cache.bytes_used
-  proxy.process.cache.volume_{N}.ram_cache.hits
-  proxy.process.cache.volume_{N}.ram_cache.misses
-  proxy.process.cache.volume_{N}.ram_cache.total_bytes
-  proxy.process.cache.volume_{N}.read.active
-  proxy.process.cache.volume_{N}.read.failure
-  proxy.process.cache.volume_{N}.read.success
-  proxy.process.cache.volume_{N}.read_busy.failure
-  proxy.process.cache.volume_{N}.read_busy.success
-  proxy.process.cache.volume_{N}.remove.active
-  proxy.process.cache.volume_{N}.remove.failure
-  proxy.process.cache.volume_{N}.remove.success
-  proxy.process.cache.volume_{N}.scan.active
-  proxy.process.cache.volume_{N}.scan.failure
-  proxy.process.cache.volume_{N}.scan.success
-  proxy.process.cache.volume_{N}.update.active
-  proxy.process.cache.volume_{N}.update.failure
-  proxy.process.cache.volume_{N}.update.success
-  proxy.process.cache.volume_{N}.vector_marshals
-  proxy.process.cache.volume_{N}.write.active
-  proxy.process.cache.volume_{N}.write.backlog.failure
-  proxy.process.cache.volume_{N}.write.failure
-  proxy.process.cache.volume_{N}.write.success
-  proxy.process.cache.volume_{N}.write_bytes_stat
-  proxy.process.cache.write.active
-  proxy.process.cache.write.backlog.failure
-  proxy.process.cache.write.failure
-  proxy.process.cache.write.success
-  proxy.process.cache.write_bytes_stat
-  proxy.process.cache.write_per_sec
-
-  proxy.process.cluster.alloc_data_news
-  proxy.process.cluster.byte_bank_used
-  proxy.process.cluster.cache_callback_time
-  proxy.process.cluster.cache_callbacks
-  proxy.process.cluster.cache_outstanding
-  proxy.process.cluster.chan_inuse
-  proxy.process.cluster.cluster_ping_time
-  proxy.process.cluster.configuration_changes
-  proxy.process.cluster.connections_avg_time
-  proxy.process.cluster.connections_bumped
-  proxy.process.cluster.connections_closed
-  proxy.process.cluster.connections_open
-  proxy.process.cluster.connections_opened
-  proxy.process.cluster.connections_read_locked
-  proxy.process.cluster.connections_write_locked
-  proxy.process.cluster.control_messages_avg_receive_time
-  proxy.process.cluster.control_messages_avg_send_time
-  proxy.process.cluster.control_messages_received
-  proxy.process.cluster.control_messages_sent
-  proxy.process.cluster.delayed_reads
-  proxy.process.cluster.level1_bank
-  proxy.process.cluster.lkrmt_cache_callback_time
-  proxy.process.cluster.lkrmt_cache_callbacks
-  proxy.process.cluster.local_connection_time
-  proxy.process.cluster.local_connections_closed
-  proxy.process.cluster.machines_allocated
-  proxy.process.cluster.machines_freed
-  proxy.process.cluster.multilevel_bank
-  proxy.process.cluster.net_backup
-  proxy.process.cluster.no_remote_space
-  proxy.process.cluster.nodes
-  proxy.process.cluster.op_delayed_for_lock
-  proxy.process.cluster.open_delay_time
-  proxy.process.cluster.open_delays
-  proxy.process.cluster.partial_reads
-  proxy.process.cluster.partial_writes
-  proxy.process.cluster.rdmsg_assemble_time
-  proxy.process.cluster.read_bytes
-  proxy.process.cluster.reads
-  proxy.process.cluster.remote_connection_time
-  proxy.process.cluster.remote_connections_closed
-  proxy.process.cluster.remote_op_reply_timeouts
-  proxy.process.cluster.remote_op_timeouts
-  proxy.process.cluster.rmt_cache_callback_time
-  proxy.process.cluster.rmt_cache_callbacks
-  proxy.process.cluster.setdata_no_cachevc
-  proxy.process.cluster.setdata_no_cluster
-  proxy.process.cluster.setdata_no_clustervc
-  proxy.process.cluster.setdata_no_tunnel
-  proxy.process.cluster.slow_ctrl_msgs_sent
-  proxy.process.cluster.vc_cache_insert_lock_misses
-  proxy.process.cluster.vc_cache_inserts
-  proxy.process.cluster.vc_cache_lookup_hits
-  proxy.process.cluster.vc_cache_lookup_lock_misses
-  proxy.process.cluster.vc_cache_lookup_misses
-  proxy.process.cluster.vc_cache_purges
-  proxy.process.cluster.vc_cache_scan_lock_misses
-  proxy.process.cluster.vc_cache_scans
-  proxy.process.cluster.vc_read_list_len
-  proxy.process.cluster.vc_write_list_len
-  proxy.process.cluster.vc_write_stall
-  proxy.process.cluster.write_bb_mallocs
-  proxy.process.cluster.write_bytes
-  proxy.process.cluster.write_lock_misses
-  proxy.process.cluster.writes
-
-  proxy.process.congestion.congested_on_conn_failures
-  proxy.process.congestion.congested_on_max_connection
-
-  proxy.process.dns.fail_avg_time
-  proxy.process.dns.in_flight
-  proxy.process.dns.lookup_avg_time
-  proxy.process.dns.lookup_failures
-  proxy.process.dns.lookup_successes
-  proxy.process.dns.max_retries_exceeded
-  proxy.process.dns.retries
-  proxy.process.dns.success_avg_time
-  proxy.process.dns.total_dns_lookups
-
-  proxy.process.hostdb.bytes
-  proxy.process.hostdb.re_dns_on_reload
-  proxy.process.hostdb.total_entries
-  proxy.process.hostdb.total_hits
-  proxy.process.hostdb.total_lookups
-  proxy.process.hostdb.ttl
-  proxy.process.hostdb.ttl_expires
-
-  proxy.process.http.100_responses
-  proxy.process.http.101_responses
-  proxy.process.http.1xx_responses
-  proxy.process.http.200_responses
-  proxy.process.http.201_responses
-  proxy.process.http.202_responses
-  proxy.process.http.203_responses
-  proxy.process.http.204_responses
-  proxy.process.http.205_responses
-  proxy.process.http.206_responses
-  proxy.process.http.2xx_responses
-  proxy.process.http.300_responses
-  proxy.process.http.301_responses
-  proxy.process.http.302_responses
-  proxy.process.http.303_responses
-  proxy.process.http.304_responses
-  proxy.process.http.305_responses
-  proxy.process.http.307_responses
-  proxy.process.http.3xx_responses
-  proxy.process.http.400_responses
-  proxy.process.http.401_responses
-  proxy.process.http.402_responses
-  proxy.process.http.403_responses
-  proxy.process.http.404_responses
-  proxy.process.http.405_responses
-  proxy.process.http.406_responses
-  proxy.process.http.407_responses
-  proxy.process.http.408_responses
-  proxy.process.http.409_responses
-  proxy.process.http.410_responses
-  proxy.process.http.411_responses
-  proxy.process.http.412_responses
-  proxy.process.http.413_responses
-  proxy.process.http.414_responses
-  proxy.process.http.415_responses
-  proxy.process.http.416_responses
-  proxy.process.http.4xx_responses
-  proxy.process.http.500_responses
-  proxy.process.http.501_responses
-  proxy.process.http.502_responses
-  proxy.process.http.503_responses
-  proxy.process.http.504_responses
-  proxy.process.http.505_responses
-  proxy.process.http.5xx_responses
-  proxy.process.http.avg_transactions_per_client_connection
-  proxy.process.http.avg_transactions_per_parent_connection
-  proxy.process.http.avg_transactions_per_server_connection
-  proxy.process.http.background_fill_bytes_aborted_stat
-  proxy.process.http.background_fill_bytes_completed_stat
-  proxy.process.http.background_fill_current_count
-  proxy.process.http.broken_server_connections
-  proxy.process.http.cache_connection_time
-  proxy.process.http.cache_deletes
-  proxy.process.http.cache_hit_fresh
-  proxy.process.http.cache_hit_ims
-  proxy.process.http.cache_hit_mem_fresh
-  proxy.process.http.cache_hit_revalidated
-  proxy.process.http.cache_hit_stale_served
-  proxy.process.http.cache_lookups
-  proxy.process.http.cache_miss_changed
-  proxy.process.http.cache_miss_client_no_cache
-  proxy.process.http.cache_miss_client_not_cacheable
-  proxy.process.http.cache_miss_cold
-  proxy.process.http.cache_miss_ims
-  proxy.process.http.cache_read_error
-  proxy.process.http.cache_read_errors
-  proxy.process.http.cache_updates
-  proxy.process.http.cache_write_errors
-  proxy.process.http.cache_writes
-  proxy.process.http.client_connection_time
-  proxy.process.http.client_no_cache_requests
-  proxy.process.http.client_transaction_time
-  proxy.process.http.client_write_time
-  proxy.process.http.completed_requests
-  proxy.process.http.connect_requests
-  proxy.process.http.current_active_client_connections
-  proxy.process.http.current_cache_connections
-  proxy.process.http.current_client_connections
-  proxy.process.http.current_client_transactions
-  proxy.process.http.current_icp_raw_transactions
-  proxy.process.http.current_icp_transactions
-  proxy.process.http.current_parent_proxy_connections
-  proxy.process.http.current_parent_proxy_raw_transactions
-  proxy.process.http.current_parent_proxy_transactions
-  proxy.process.http.current_server_connections
-  proxy.process.http.current_server_raw_transactions
-  proxy.process.http.current_server_transactions
-  proxy.process.http.delete_requests
-  proxy.process.http.err_client_abort_count_stat
-  proxy.process.http.err_client_abort_origin_server_bytes_stat
-  proxy.process.http.err_client_abort_user_agent_bytes_stat
-  proxy.process.http.err_connect_fail_count_stat
-  proxy.process.http.err_connect_fail_origin_server_bytes_stat
-  proxy.process.http.err_connect_fail_user_agent_bytes_stat
-  proxy.process.http.extension_method_requests
-  proxy.process.http.get_requests
-  proxy.process.http.head_requests
-  proxy.process.http.icp_raw_transaction_time
-  proxy.process.http.icp_suggested_lookups
-  proxy.process.http.icp_transaction_time
-  proxy.process.http.incoming_requests
-  proxy.process.http.incoming_responses
-  proxy.process.http.invalid_client_requests
-  proxy.process.http.misc_count_stat
-  proxy.process.http.misc_user_agent_bytes_stat
-  proxy.process.http.missing_host_hdr
-  proxy.process.http.options_requests
-  proxy.process.http.origin_server_request_document_total_size
-  proxy.process.http.origin_server_request_header_total_size
-  proxy.process.http.origin_server_response_document_total_size
-  proxy.process.http.origin_server_response_header_total_size
-  proxy.process.http.origin_server_speed_bytes_per_sec_100
-  proxy.process.http.origin_server_speed_bytes_per_sec_100K
-  proxy.process.http.origin_server_speed_bytes_per_sec_100M
-  proxy.process.http.origin_server_speed_bytes_per_sec_10K
-  proxy.process.http.origin_server_speed_bytes_per_sec_10M
-  proxy.process.http.origin_server_speed_bytes_per_sec_1K
-  proxy.process.http.origin_server_speed_bytes_per_sec_1M
-  proxy.process.http.outgoing_requests
-  proxy.process.http.parent_proxy_connection_time
-  proxy.process.http.parent_proxy_raw_transaction_time
-  proxy.process.http.parent_proxy_request_total_bytes
-  proxy.process.http.parent_proxy_response_total_bytes
-  proxy.process.http.parent_proxy_transaction_time
-  proxy.process.http.post_requests
-  proxy.process.http.purge_requests
-  proxy.process.http.push_requests
-  proxy.process.http.pushed_document_total_size
-  proxy.process.http.pushed_response_header_total_size
-  proxy.process.http.put_requests
-  proxy.process.http.request_document_size_100
-  proxy.process.http.request_document_size_10K
-  proxy.process.http.request_document_size_1K
-  proxy.process.http.request_document_size_1M
-  proxy.process.http.request_document_size_3K
-  proxy.process.http.request_document_size_5K
-  proxy.process.http.request_document_size_inf
-  proxy.process.http.request_taxonomy.i0_n0_m0
-  proxy.process.http.request_taxonomy.i0_n0_m1
-  proxy.process.http.request_taxonomy.i0_n1_m0
-  proxy.process.http.request_taxonomy.i0_n1_m1
-  proxy.process.http.request_taxonomy.i1_n0_m0
-  proxy.process.http.request_taxonomy.i1_n0_m1
-  proxy.process.http.request_taxonomy.i1_n1_m0
-  proxy.process.http.request_taxonomy.i1_n1_m1
-  proxy.process.http.response_document_size_100
-  proxy.process.http.response_document_size_10K
-  proxy.process.http.response_document_size_1K
-  proxy.process.http.response_document_size_1M
-  proxy.process.http.response_document_size_3K
-  proxy.process.http.response_document_size_5K
-  proxy.process.http.response_document_size_inf
-  proxy.process.http.server_connection_time
-  proxy.process.http.server_raw_transaction_time
-  proxy.process.http.server_read_time
-  proxy.process.http.server_transaction_time
-  proxy.process.http.tcp_client_refresh_count_stat
-  proxy.process.http.tcp_client_refresh_origin_server_bytes_stat
-  proxy.process.http.tcp_client_refresh_user_agent_bytes_stat
-  proxy.process.http.tcp_expired_miss_count_stat
-  proxy.process.http.tcp_expired_miss_origin_server_bytes_stat
-  proxy.process.http.tcp_expired_miss_user_agent_bytes_stat
-  proxy.process.http.tcp_hit_count_stat
-  proxy.process.http.tcp_hit_origin_server_bytes_stat
-  proxy.process.http.tcp_hit_user_agent_bytes_stat
-  proxy.process.http.tcp_ims_hit_count_stat
-  proxy.process.http.tcp_ims_hit_origin_server_bytes_stat
-  proxy.process.http.tcp_ims_hit_user_agent_bytes_stat
-  proxy.process.http.tcp_ims_miss_count_stat
-  proxy.process.http.tcp_ims_miss_origin_server_bytes_stat
-  proxy.process.http.tcp_ims_miss_user_agent_bytes_stat
-  proxy.process.http.tcp_miss_count_stat
-  proxy.process.http.tcp_miss_origin_server_bytes_stat
-  proxy.process.http.tcp_miss_user_agent_bytes_stat
-  proxy.process.http.tcp_refresh_hit_count_stat
-  proxy.process.http.tcp_refresh_hit_origin_server_bytes_stat
-  proxy.process.http.tcp_refresh_hit_user_agent_bytes_stat
-  proxy.process.http.tcp_refresh_miss_count_stat
-  proxy.process.http.tcp_refresh_miss_origin_server_bytes_stat
-  proxy.process.http.tcp_refresh_miss_user_agent_bytes_stat
-  proxy.process.http.throttled_proxy_only
-  proxy.process.http.total_client_connections
-  proxy.process.http.total_client_connections_ipv4
-  proxy.process.http.total_client_connections_ipv6
-  proxy.process.http.total_incoming_connections
-  proxy.process.http.total_parent_proxy_connections
-  proxy.process.http.total_server_connections
-  proxy.process.http.total_transactions_think_time
-  proxy.process.http.total_transactions_time
-  proxy.process.http.total_x_redirect_count
-  proxy.process.http.trace_requests
-  proxy.process.http.transaction_counts.errors.aborts
-  proxy.process.http.transaction_counts.errors.connect_failed
-  proxy.process.http.transaction_counts.errors.early_hangups
-  proxy.process.http.transaction_counts.errors.empty_hangups
-  proxy.process.http.transaction_counts.errors.other
-  proxy.process.http.transaction_counts.errors.possible_aborts
-  proxy.process.http.transaction_counts.errors.pre_accept_hangups
-  proxy.process.http.transaction_counts.hit_fresh
-  proxy.process.http.transaction_counts.hit_fresh.process
-  proxy.process.http.transaction_counts.hit_revalidated
-  proxy.process.http.transaction_counts.miss_changed
-  proxy.process.http.transaction_counts.miss_client_no_cache
-  proxy.process.http.transaction_counts.miss_cold
-  proxy.process.http.transaction_counts.miss_not_cacheable
-  proxy.process.http.transaction_counts.other.unclassified
-  proxy.process.http.transaction_totaltime.errors.aborts
-  proxy.process.http.transaction_totaltime.errors.connect_failed
-  proxy.process.http.transaction_totaltime.errors.early_hangups
-  proxy.process.http.transaction_totaltime.errors.empty_hangups
-  proxy.process.http.transaction_totaltime.errors.other
-  proxy.process.http.transaction_totaltime.errors.possible_aborts
-  proxy.process.http.transaction_totaltime.errors.pre_accept_hangups
-  proxy.process.http.transaction_totaltime.hit_fresh
-  proxy.process.http.transaction_totaltime.hit_fresh.process
-  proxy.process.http.transaction_totaltime.hit_revalidated
-  proxy.process.http.transaction_totaltime.miss_changed
-  proxy.process.http.transaction_totaltime.miss_client_no_cache
-  proxy.process.http.transaction_totaltime.miss_cold
-  proxy.process.http.transaction_totaltime.miss_not_cacheable
-  proxy.process.http.transaction_totaltime.other.unclassified
-  proxy.process.http.tunnels
-  proxy.process.http.user_agent_request_document_total_size
-  proxy.process.http.user_agent_request_header_total_size
-  proxy.process.http.user_agent_response_document_total_size
-  proxy.process.http.user_agent_response_header_total_size
-  proxy.process.http.user_agent_speed_bytes_per_sec_100
-  proxy.process.http.user_agent_speed_bytes_per_sec_100K
-  proxy.process.http.user_agent_speed_bytes_per_sec_100M
-  proxy.process.http.user_agent_speed_bytes_per_sec_10K
-  proxy.process.http.user_agent_speed_bytes_per_sec_10M
-  proxy.process.http.user_agent_speed_bytes_per_sec_1K
-  proxy.process.http.user_agent_speed_bytes_per_sec_1M
-  proxy.process.http.websocket.current_active_client_connections
-
-  proxy.process.log.bytes_flush_to_disk
-  proxy.process.log.bytes_lost_before_flush_to_disk
-  proxy.process.log.bytes_lost_before_preproc
-  proxy.process.log.bytes_lost_before_sent_to_network
-  proxy.process.log.bytes_lost_before_written_to_disk
-  proxy.process.log.bytes_received_from_network
-  proxy.process.log.bytes_sent_to_network
-  proxy.process.log.bytes_written_to_disk
-  proxy.process.log.event_log_access_aggr
-  proxy.process.log.event_log_access_fail
-  proxy.process.log.event_log_access_full
-  proxy.process.log.event_log_access_ok
-  proxy.process.log.event_log_access_skip
-  proxy.process.log.event_log_error_aggr
-  proxy.process.log.event_log_error_fail
-  proxy.process.log.event_log_error_full
-  proxy.process.log.event_log_error_ok
-  proxy.process.log.event_log_error_skip
-  proxy.process.log.log_files_open
-  proxy.process.log.log_files_space_used
-  proxy.process.log.num_flush_to_disk
-  proxy.process.log.num_lost_before_flush_to_disk
-  proxy.process.log.num_lost_before_sent_to_network
-  proxy.process.log.num_received_from_network
-  proxy.process.log.num_sent_to_network
-
-  proxy.process.net.accepts_currently_open
-  proxy.process.net.calls_to_read
-  proxy.process.net.calls_to_read_nodata
-  proxy.process.net.calls_to_readfromnet
-  proxy.process.net.calls_to_readfromnet_afterpoll
-  proxy.process.net.calls_to_write
-  proxy.process.net.calls_to_write_nodata
-  proxy.process.net.calls_to_writetonet
-  proxy.process.net.calls_to_writetonet_afterpoll
-  proxy.process.net.connections_currently_open
-  proxy.process.net.inactivity_cop_lock_acquire_failure
-  proxy.process.net.net_handler_run
-  proxy.process.net.read_bytes
-  proxy.process.net.write_bytes
-
-  proxy.process.socks.connections_currently_open
-  proxy.process.socks.connections_successful
-  proxy.process.socks.connections_unsuccessful
-
-  proxy.process.ssl.cipher.user_agent.{CIPHER}
-  proxy.process.ssl.origin_server_bad_cert
-  proxy.process.ssl.origin_server_cert_verify_failed
-  proxy.process.ssl.origin_server_decryption_failed
-  proxy.process.ssl.origin_server_expired_cert
-  proxy.process.ssl.origin_server_other_errors
-  proxy.process.ssl.origin_server_revoked_cert
-  proxy.process.ssl.origin_server_unknown_ca
-  proxy.process.ssl.origin_server_unknown_cert
-  proxy.process.ssl.origin_server_wrong_version
-  proxy.process.ssl.user_agent_bad_cert
-  proxy.process.ssl.user_agent_cert_verify_failed
-  proxy.process.ssl.user_agent_decryption_failed
-  proxy.process.ssl.user_agent_expired_cert
-  proxy.process.ssl.user_agent_other_errors
-  proxy.process.ssl.user_agent_revoked_cert
-  proxy.process.ssl.user_agent_session_hit
-  proxy.process.ssl.user_agent_session_miss
-  proxy.process.ssl.user_agent_session_timeout
-  proxy.process.ssl.user_agent_sessions
-  proxy.process.ssl.user_agent_unknown_ca
-  proxy.process.ssl.user_agent_unknown_cert
-  proxy.process.ssl.user_agent_wrong_version
-
-  proxy.process.update.fails
-  proxy.process.update.no_actions
-  proxy.process.update.state_machines
-  proxy.process.update.successes
-  proxy.process.update.unknown_status
-
-  proxy.process.version.server.build_date
-  proxy.process.version.server.build_machine
-  proxy.process.version.server.build_number
-  proxy.process.version.server.build_person
-  proxy.process.version.server.build_time
-  proxy.process.version.server.long
-  proxy.process.version.server.short
-
-Statistics Descriptions
-=======================
-
 proxy.process.ssl.user_agent_other_errors
   Total number of *other* ssl client connection errors (counts ssl
   errors that are not captured in other user agent stats below)


[10/50] [abbrv] git commit: TS-2639: make HttpClientSession allocation consistent

Posted by zw...@apache.org.
TS-2639: make HttpClientSession allocation consistent

The HttpClientSession is always allocated from the proxy allocator,
but ends up gettting released to the global class allocator. Make
sure that we use the proxy allocator all the time.


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

Branch: refs/heads/lua_config
Commit: ce6b5c7f40b56256f8236bc042fdf89e37ceb2a3
Parents: bba5f4a
Author: James Peach <jp...@apache.org>
Authored: Fri Mar 14 10:04:44 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Mar 14 13:39:51 2014 -0700

----------------------------------------------------------------------
 CHANGES                         | 2 ++
 proxy/http/HttpClientSession.cc | 7 ++-----
 proxy/http/HttpClientSession.h  | 1 -
 3 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce6b5c7f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 1afbde4..b68e5c3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2639] Release HttpClientSession objects back to the proxy allocator.
+
   *) [TS-2637] Add traffic_line records match option.
 
   *) [TS-2630] Add lib/ts/apidefs.h to place common types.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce6b5c7f/proxy/http/HttpClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc
index faaebb8..208ada6 100644
--- a/proxy/http/HttpClientSession.cc
+++ b/proxy/http/HttpClientSession.cc
@@ -64,7 +64,7 @@ HttpClientSession::HttpClientSession()
     read_buffer(NULL), current_reader(NULL), read_state(HCS_INIT),
     ka_vio(NULL), slave_ka_vio(NULL),
     cur_hook_id(TS_HTTP_LAST_HOOK), cur_hook(NULL),
-    cur_hooks(0), proxy_allocated(false), backdoor_connect(false),
+    cur_hooks(0), backdoor_connect(false),
     hooks_set(0),
     outbound_port(0), f_outbound_transparent(false),
     host_res_style(HOST_RES_IPV4), acl_method_mask(0),
@@ -107,10 +107,7 @@ void
 HttpClientSession::destroy()
 {
   this->cleanup();
-  if (proxy_allocated)
-    THREAD_FREE(this, httpClientSessionAllocator, this_thread());
-  else
-    httpClientSessionAllocator.free(this);
+  THREAD_FREE(this, httpClientSessionAllocator, this_thread());
 }
 
 HttpClientSession *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ce6b5c7f/proxy/http/HttpClientSession.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.h b/proxy/http/HttpClientSession.h
index e80743b..d41d5a5 100644
--- a/proxy/http/HttpClientSession.h
+++ b/proxy/http/HttpClientSession.h
@@ -133,7 +133,6 @@ private:
   TSHttpHookID cur_hook_id;
   APIHook *cur_hook;
   int cur_hooks;
-  bool proxy_allocated;
 
   // api_hooks must not be changed directly
   //  Use ssn_hook_{ap,pre}pend so hooks_set is


[14/50] [abbrv] git commit: [TS-2647] atscppapi: Bug fixes in headers and atscppapi]

Posted by zw...@apache.org.
[TS-2647] atscppapi: Bug fixes in headers and atscppapi]


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

Branch: refs/heads/lua_config
Commit: 0fc90363f8e4a7b023f1df653e1bd5f13857a408
Parents: 44eaddf
Author: Manjesh Nilange <mn...@linkedin.com>
Authored: Mon Mar 17 13:47:11 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Mon Mar 17 13:47:11 2014 -0700

----------------------------------------------------------------------
 lib/atscppapi/src/AsyncHttpFetch.cc           |  2 +-
 lib/atscppapi/src/Headers.cc                  | 13 ++++++
 lib/atscppapi/src/InterceptPlugin.cc          | 51 ++++++++++++++++++----
 lib/atscppapi/src/include/atscppapi/Headers.h |  8 +++-
 lib/atscppapi/src/include/utils_internal.h    |  1 +
 5 files changed, 65 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0fc90363/lib/atscppapi/src/AsyncHttpFetch.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc b/lib/atscppapi/src/AsyncHttpFetch.cc
index 1ea8b5f..34fb805 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -151,7 +151,7 @@ void AsyncHttpFetch::run(shared_ptr<AsyncDispatchControllerBase> sender) {
     snprintf(size_buf, sizeof(size_buf), "%zu", state_->request_body_.size());
     state_->request_.getHeaders().set("Content-Length", size_buf);
   }
-  request_str += headers.str();
+  request_str += headers.wireStr();
   request_str += "\r\n";
   request_str += state_->request_body_;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0fc90363/lib/atscppapi/src/Headers.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index f65ae1e..7be2a90 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -539,6 +539,18 @@ std::string Headers::str() {
   return oss.str();
 }
 
+std::string Headers::wireStr() {
+  string retval;
+  for (iterator iter = begin(), last = end(); iter != last; ++iter) {
+    HeaderField hf = *iter;
+    retval += hf.name().str();
+    retval += ": ";
+    retval += hf.values(", ");
+    retval += "\r\n";
+  }
+  return retval;
+}
+
 std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
   for(header_field_iterator it = obj.begin(); it != obj.end(); ++it) {
     HeaderField hf = *it;
@@ -546,5 +558,6 @@ std::ostream& operator<<(std::ostream &os, atscppapi::Headers &obj) {
   }
   return os;
 }
+
 } /* atscppapi namespace */
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0fc90363/lib/atscppapi/src/InterceptPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InterceptPlugin.cc b/lib/atscppapi/src/InterceptPlugin.cc
index dd7242f..c06e494 100644
--- a/lib/atscppapi/src/InterceptPlugin.cc
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -37,6 +37,17 @@
 using namespace atscppapi;
 using std::string;
 
+namespace {
+
+/** This contains info for the continuation callback to invoke the plugin */
+struct PluginHandle {
+  InterceptPlugin *plugin_;
+  shared_ptr<Mutex> mutex_;
+  PluginHandle(InterceptPlugin *plugin, shared_ptr<Mutex> mutex) : plugin_(plugin), mutex_(mutex) { }
+};
+
+}
+
 /**
  * @private
  */
@@ -72,9 +83,12 @@ struct InterceptPlugin::State {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   int num_bytes_written_;
+  PluginHandle *plugin_handle_;
+  bool shut_down_;
 
   State(TSCont cont) : cont_(cont), net_vc_(NULL), expected_body_size_(0), num_body_bytes_read_(0),
-                       hdr_parsed_(false), hdr_buf_(NULL), hdr_loc_(NULL), num_bytes_written_(0) {
+                       hdr_parsed_(false), hdr_buf_(NULL), hdr_loc_(NULL), num_bytes_written_(0), 
+                       plugin_handle_(NULL), shut_down_(false) {
     http_parser_ = TSHttpParserCreate();
   }
   
@@ -98,8 +112,9 @@ int handleEvents(TSCont cont, TSEvent event, void *edata);
 InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type type)
   : TransactionPlugin(transaction) {
   TSCont cont = TSContCreate(handleEvents, TSMutexCreate());
-  TSContDataSet(cont, this);
   state_ = new State(cont);
+  state_->plugin_handle_ = new PluginHandle(this, TransactionPlugin::getMutex());
+  TSContDataSet(cont, state_->plugin_handle_);
   TSHttpTxn txn = static_cast<TSHttpTxn>(transaction.getAtsHandle());
   if (type == SERVER_INTERCEPT) {
     TSHttpTxnServerIntercept(cont, txn);
@@ -130,7 +145,16 @@ InterceptPlugin::InterceptPlugin(Transaction &transaction, InterceptPlugin::Type
 }
 
 InterceptPlugin::~InterceptPlugin() {
-  TSContDestroy(state_->cont_);
+  if (!state_->shut_down_) {
+    // transaction is closing, but intercept hasn't finished. Indicate
+    // that plugin is dead (cleanup will be done by continuation
+    // callback)
+    state_->plugin_handle_->plugin_ = NULL;
+  }
+  else {
+    TSContDestroy(state_->cont_);
+    delete state_->plugin_handle_;
+  }
   delete state_;
 }
 
@@ -198,7 +222,6 @@ bool InterceptPlugin::doRead() {
           // remaining data in this block is body; 'data' will be pointing to first byte of the body
           num_body_bytes_in_block = endptr - data;
         }
-        ScopedSharedMutexLock scopedLock(getMutex());
         consume(string(startptr, data - startptr), InterceptPlugin::REQUEST_HEADER);
       }
       else {
@@ -206,7 +229,6 @@ bool InterceptPlugin::doRead() {
       }
       if (num_body_bytes_in_block) {
         state_->num_body_bytes_read_ += num_body_bytes_in_block;
-        ScopedSharedMutexLock scopedLock(getMutex());
         consume(string(data, num_body_bytes_in_block), InterceptPlugin::REQUEST_BODY);
       }
       consumed += data_len;
@@ -225,7 +247,6 @@ bool InterceptPlugin::doRead() {
       LOG_ERROR("Read more data than specified in request");
       // TODO: any further action required?
     }
-    ScopedSharedMutexLock scopedLock(getMutex());
     handleInputComplete();
   }
   else {
@@ -255,6 +276,10 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
     TSHttpHdrTypeSet(state_->hdr_buf_, state_->hdr_loc_, TS_HTTP_TYPE_REQUEST);
     break;
 
+  case TS_EVENT_VCONN_WRITE_READY: // nothing to do
+    LOG_DEBUG("Got write ready"); 
+    break;
+
   case TS_EVENT_VCONN_READ_READY:
     LOG_DEBUG("Handling read ready");  
     if (doRead()) {
@@ -277,6 +302,7 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
     if (state_->net_vc_) {
       TSVConnClose(state_->net_vc_);
     }
+    state_->shut_down_ = true;
     break;
 
   default:
@@ -287,8 +313,17 @@ void InterceptPlugin::handleEvent(int abstract_event, void *edata) {
 namespace {
 
 int handleEvents(TSCont cont, TSEvent event, void *edata) {
-  InterceptPlugin *plugin = static_cast<InterceptPlugin *>(TSContDataGet(cont));
-  utils::internal::dispatchInterceptEvent(plugin, event, edata);
+  PluginHandle *plugin_handle = static_cast<PluginHandle *>(TSContDataGet(cont));
+  ScopedSharedMutexLock scopedSharedMutexLock(plugin_handle->mutex_);
+  if (plugin_handle->plugin_) {
+    utils::internal::dispatchInterceptEvent(plugin_handle->plugin_, event, edata);
+  }
+  else {
+    // plugin is dead; cleanup
+    LOG_ERROR("Received event %d after plugin died!", event);
+    TSContDestroy(cont);
+    delete plugin_handle;
+  }
   return 0;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0fc90363/lib/atscppapi/src/include/atscppapi/Headers.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Headers.h b/lib/atscppapi/src/include/atscppapi/Headers.h
index 27c1f0a..98340d2 100644
--- a/lib/atscppapi/src/include/atscppapi/Headers.h
+++ b/lib/atscppapi/src/include/atscppapi/Headers.h
@@ -574,11 +574,17 @@ public:
   HeaderField operator[](const std::string &key);
 
   /**
-    * Get a string representing all the header fields.
+    * Get a human-readable/log-friendly string representing all the header fields.
     * @return a string representation of all the header fields
     */
   std::string str();
 
+  /**
+    * Get a string that can be put on the wire
+    * @return a string representation of all the header fields
+    */
+  std::string wireStr();
+
   friend std::ostream& operator<<(std::ostream &os, Headers &obj);
 
   ~Headers();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0fc90363/lib/atscppapi/src/include/utils_internal.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/utils_internal.h b/lib/atscppapi/src/include/utils_internal.h
index c6ead71..edc02c2 100644
--- a/lib/atscppapi/src/include/utils_internal.h
+++ b/lib/atscppapi/src/include/utils_internal.h
@@ -83,6 +83,7 @@ public:
   }
 
   static void dispatchInterceptEvent(InterceptPlugin *plugin, TSEvent event, void *edata) {
+    ScopedSharedMutexLock scopedSharedMutexLock(plugin->getMutex());
     plugin->handleEvent(static_cast<int>(event), edata);
   }
 


[32/50] [abbrv] git commit: TS-2431: Migrate Taobao SPDY plugin to ATS core

Posted by zw...@apache.org.
TS-2431: Migrate Taobao SPDY plugin to ATS core

This path depends on FetchSM, so seriously speaking, the migration
to ATS core is finished *partially*. I had tried to remove the dependency
of FetchSM and create a specific VC for each http request in spdy sm, but I
found it was not so easy, so I give up temporary. Let me push this
patch to community before it's perfect enough, at least, this series
patches can statisfy TAOBAO's current demand.

With this patch, ATS supports SPDY(v3/v3.1), the SPDY can run with/without
SSL:
 1) SPDY without SSL:
    It will share the same port number with HTTP, and ATS will recognize
    SPDY/HTTP by detecting the first byte of client request.

 2) SPDY with SSL:
    When running SPDY with SSL, the code needs OpenSSL(>=1.01), if this
    version of OpenSSL is installed in user-defined DIR, you may need to
    use '--with-openssl=<dir>' option to tell ATS where to search.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>


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

Branch: refs/heads/lua_config
Commit: 79dd5035f9d361b5e0c8a2b4f71d2bd8dc243fb3
Parents: f90f3a4
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Mar 17 02:58:50 2014 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Fri Mar 21 01:31:27 2014 +0800

----------------------------------------------------------------------
 iocore/net/SSLNextProtocolSet.cc  |   3 +-
 iocore/net/UnixNetAccept.cc       |   8 +-
 lib/ts/apidefs.h.in               |   1 +
 proxy/InkAPI.cc                   |   5 +-
 proxy/http/HttpProxyServerMain.cc |  13 +-
 proxy/spdy/Makefile.am            |  10 +
 proxy/spdy/P_SpdyCallbacks.h      | 248 ++++++++++++++++
 proxy/spdy/P_SpdyCommon.h         |  75 +++++
 proxy/spdy/P_SpdySM.h             | 129 +++++++++
 proxy/spdy/SpdyAcceptCont.cc      |  14 +-
 proxy/spdy/SpdyCallbacks.cc       | 513 +++++++++++++++++++++++++++++++++
 proxy/spdy/SpdyCommon.cc          | 136 +++++++++
 proxy/spdy/SpdySM.cc              | 415 ++++++++++++++++++++++++++
 13 files changed, 1562 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/iocore/net/SSLNextProtocolSet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index ed0a5e3..c0ff61c 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -185,7 +185,8 @@ SSLNextProtocolSet::NextProtocolEndpoint::NextProtocolEndpoint(
   if (proto == TS_NPN_PROTOCOL_HTTP_1_1 ||
       proto == TS_NPN_PROTOCOL_HTTP_1_0) {
     proto_stack = ((1u << TS_PROTO_TLS) | (1u << TS_PROTO_HTTP));
-  } else if (proto == TS_NPN_PROTOCOL_SPDY_3 ||
+  } else if (proto == TS_NPN_PROTOCOL_SPDY_3_1 ||
+             proto == TS_NPN_PROTOCOL_SPDY_3 ||
              proto == TS_NPN_PROTOCOL_SPDY_2 ||
              proto == TS_NPN_PROTOCOL_SPDY_1) {
     proto_stack = ((1u << TS_PROTO_TLS) | (1u << TS_PROTO_SPDY));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index af4d8f9..4962917 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -331,8 +331,10 @@ NetAccept::do_blocking_accept(EThread * t)
 
     // Use 'NULL' to Bypass thread allocator
     vc = createSuitableVC(NULL, con);
-    if (!vc)
+    if (!vc) {
+      con.close();
       return -1;
+    }
     vc->from_accept_thread = true;
     vc->id = net_next_connection_number();
     alloc_cache = NULL;
@@ -467,8 +469,10 @@ NetAccept::acceptFastEvent(int event, void *ep)
       } while (res < 0 && (errno == EAGAIN || errno == EINTR));
 
       vc = createSuitableVC(e->ethread, con);
-      if (!vc)
+      if (!vc) {
+        con.close();
         goto Ldone;
+      }
 
     } else {
       res = fd;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/lib/ts/apidefs.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index 0356921..ffd8cbb 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -1155,6 +1155,7 @@ extern "C"
   extern tsapi const char * TS_NPN_PROTOCOL_SPDY_1;
   extern tsapi const char * TS_NPN_PROTOCOL_SPDY_2;
   extern tsapi const char * TS_NPN_PROTOCOL_SPDY_3;
+  extern tsapi const char * TS_NPN_PROTOCOL_SPDY_3_1;
 
   /* --------------------------------------------------------------------------
      MLoc Constants */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 682f889..c5fb465 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -361,8 +361,9 @@ tsapi int TS_HTTP_LEN_PUSH;
 tsapi const char * TS_NPN_PROTOCOL_HTTP_1_0 = "http/1.0";
 tsapi const char * TS_NPN_PROTOCOL_HTTP_1_1 = "http/1.1";
 tsapi const char * TS_NPN_PROTOCOL_SPDY_1   = "spdy/1";   // obsolete
-tsapi const char * TS_NPN_PROTOCOL_SPDY_2   = "spdy/2";   // shipping
-tsapi const char * TS_NPN_PROTOCOL_SPDY_3   = "spdy/3";   // upcoming
+tsapi const char * TS_NPN_PROTOCOL_SPDY_2   = "spdy/2";
+tsapi const char * TS_NPN_PROTOCOL_SPDY_3   = "spdy/3";
+tsapi const char * TS_NPN_PROTOCOL_SPDY_3_1 = "spdy/3.1";
 
 /* MLoc Constants */
 tsapi const TSMLoc TS_NULL_MLOC = (TSMLoc)NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 8988253..449418a 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -173,10 +173,21 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned
   proto->registerEndpoint(TS_PROTO_SPDY, spdy);
 
   if (port.isSSL()) {
-    // ALPN selects the first server-offered protocol, so make sure that we offer HTTP/1.1 first.
+    //
+    // ALPN selects the first server-offered protocol,
+    // so make sure that we offer the newest protocol first.
+    //
+
+    // HTTP
     ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_1, http);
     ssl->registerEndpoint(TS_NPN_PROTOCOL_HTTP_1_0, http);
 
+    // SPDY
+#if TS_HAS_SPDY
+    ssl->registerEndpoint(TS_NPN_PROTOCOL_SPDY_3_1, spdy);
+    ssl->registerEndpoint(TS_NPN_PROTOCOL_SPDY_3, spdy);
+#endif
+
     ink_scoped_mutex lock(ssl_plugin_mutex);
     ssl_plugin_acceptors.push(ssl);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/spdy/Makefile.am b/proxy/spdy/Makefile.am
index 63911e1..a85dc61 100644
--- a/proxy/spdy/Makefile.am
+++ b/proxy/spdy/Makefile.am
@@ -36,3 +36,13 @@ noinst_LIBRARIES = libspdy.a
 libspdy_a_SOURCES = \
   P_SpdyAcceptCont.h \
   SpdyAcceptCont.cc
+
+if BUILD_SPDY
+  libspdy_a_SOURCES += \
+  P_SpdyCallbacks.h \
+  P_SpdyCommon.h \
+  P_SpdySM.h \
+  SpdyCallbacks.cc \
+  SpdyCommon.cc \
+  SpdySM.cc
+endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/P_SpdyCallbacks.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyCallbacks.h b/proxy/spdy/P_SpdyCallbacks.h
new file mode 100644
index 0000000..e2715f0
--- /dev/null
+++ b/proxy/spdy/P_SpdyCallbacks.h
@@ -0,0 +1,248 @@
+
+#ifndef __P_SPDY_CALLBACKS_H__
+#define __P_SPDY_CALLBACKS_H__
+
+#include <spdylay/spdylay.h>
+class SpdySM;
+
+void spdy_callbacks_init(spdylay_session_callbacks *callbacks);
+void spdy_prepare_status_response(SpdySM *sm, int stream_id, const char *status);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when |session| wants to send data to the
+ * remote peer. The implementation of this function must send at most
+ * |length| bytes of data stored in |data|. The |flags| is currently
+ * not used and always 0. It must return the number of bytes sent if
+ * it succeeds.  If it cannot send any single byte without blocking,
+ * it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. For other errors, it
+ * must return :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
+ */
+ssize_t spdy_send_callback
+(spdylay_session *session,
+ const uint8_t *data, size_t length, int flags, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when |session| wants to receive data from
+ * the remote peer. The implementation of this function must read at
+ * most |length| bytes of data and store it in |buf|. The |flags| is
+ * currently not used and always 0. It must return the number of bytes
+ * written in |buf| if it succeeds. If it cannot read any single byte
+ * without blocking, it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. If
+ * it gets EOF before it reads any single byte, it must return
+ * :enum:`SPDYLAY_ERR_EOF`. For other errors, it must return
+ * :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
+ */
+ssize_t spdy_recv_callback
+(spdylay_session *session,
+ uint8_t *buf, size_t length, int flags, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked by `spdylay_session_recv()` when a
+ * control frame is received.
+ */
+void spdy_on_ctrl_recv_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked by `spdylay_session_recv()` when an
+ * invalid control frame is received. The |status_code| is one of the
+ * :enum:`spdylay_status_code` and indicates the error. When this
+ * callback function is invoked, the library automatically submits
+ * either RST_STREAM or GOAWAY frame.
+ */
+void spdy_on_invalid_ctrl_recv_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ uint32_t status_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when a chunk of data in DATA frame is
+ * received. The |stream_id| is the stream ID this DATA frame belongs
+ * to. The |flags| is the flags of DATA frame which this data chunk is
+ * contained. ``(flags & SPDYLAY_DATA_FLAG_FIN) != 0`` does not
+ * necessarily mean this chunk of data is the last one in the
+ * stream. You should use :type:`spdylay_on_data_recv_callback` to
+ * know all data frames are received.
+ */
+void spdy_on_data_chunk_recv_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id,
+ const uint8_t *data, size_t len, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when DATA frame is received. The actual
+ * data it contains are received by
+ * :type:`spdylay_on_data_chunk_recv_callback`.
+ */
+void spdy_on_data_recv_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked before the control frame |frame| of type
+ * |type| is sent. This may be useful, for example, to know the stream
+ * ID of SYN_STREAM frame (see also
+ * `spdylay_session_get_stream_user_data()`), which is not assigned
+ * when it was queued.
+ */
+void spdy_before_ctrl_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after the control frame |frame| of type
+ * |type| is sent.
+ */
+void spdy_on_ctrl_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after the control frame |frame| of type
+ * |type| is not sent because of the error. The error is indicated by
+ * the |error_code|, which is one of the values defined in
+ * :type:`spdylay_error`.
+ */
+void spdy_on_ctrl_not_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ int error_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after DATA frame is sent.
+ */
+void spdy_on_data_send_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the stream |stream_id| is
+ * closed. The reason of closure is indicated by the
+ * |status_code|. The stream_user_data, which was specified in
+ * `spdylay_submit_request()` or `spdylay_submit_syn_stream()`, is
+ * still available in this function.
+ */
+void spdy_on_stream_close_callback
+(spdylay_session *session, int32_t stream_id, spdylay_status_code status_code,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the cryptographic
+ * proof that the client has possession of the private key associated
+ * with the certificate for the given |origin|.  If called with
+ * |prooflen| == 0, the implementation of this function must return
+ * the length of the proof in bytes. If called with |prooflen| > 0,
+ * write proof into |proof| exactly |prooflen| bytes and return 0.
+ *
+ * Because the client certificate vector has limited number of slots,
+ * the application code may be required to pass the same proof more
+ * than once.
+ */
+ssize_t spdy_get_credential_proof
+(spdylay_session *session, const spdylay_origin *origin,
+ uint8_t *proof, size_t prooflen, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the length of the
+ * client certificate chain for the given |origin|.  The
+ * implementation of this function must return the length of the
+ * client certificate chain.  If no client certificate is required for
+ * the given |origin|, return 0.  If positive integer is returned,
+ * :type:`spdylay_get_credential_proof` and
+ * :type:`spdylay_get_credential_cert` callback functions will be used
+ * to get the cryptographic proof and certificate respectively.
+ */
+ssize_t spdy_get_credential_ncerts
+(spdylay_session *session, const spdylay_origin *origin, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the client
+ * certificate for the given |origin|. The |idx| is the index of the
+ * certificate chain and 0 means the leaf certificate of the chain.
+ * If called with |certlen| == 0, the implementation of this function
+ * must return the length of the certificate in bytes. If called with
+ * |certlen| > 0, write certificate into |cert| exactly |certlen|
+ * bytes and return 0.
+ */
+ssize_t spdy_get_credential_cert
+(spdylay_session *session, const spdylay_origin *origin, size_t idx,
+ uint8_t *cert, size_t certlen, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the request from the remote peer is
+ * received.  In other words, the frame with FIN flag set is received.
+ * In HTTP, this means HTTP request, including request body, is fully
+ * received.
+ */
+void spdy_on_request_recv_callback
+(spdylay_session *session, int32_t stream_id, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the received control frame octets
+ * could not be parsed correctly. The |type| indicates the type of
+ * received control frame. The |head| is the pointer to the header of
+ * the received frame. The |headlen| is the length of the
+ * |head|. According to the SPDY spec, the |headlen| is always 8. In
+ * other words, the |head| is the first 8 bytes of the received frame.
+ * The |payload| is the pointer to the data portion of the received
+ * frame.  The |payloadlen| is the length of the |payload|. This is
+ * the data after the length field. The |error_code| is one of the
+ * error code defined in :enum:`spdylay_error` and indicates the
+ * error.
+ */
+void spdy_on_ctrl_recv_parse_error_callback
+(spdylay_session *session, spdylay_frame_type type,
+ const uint8_t *head, size_t headlen,
+ const uint8_t *payload, size_t payloadlen,
+ int error_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the received control frame type is
+ * unknown. The |head| is the pointer to the header of the received
+ * frame. The |headlen| is the length of the |head|. According to the
+ * SPDY spec, the |headlen| is always 8. In other words, the |head| is
+ * the first 8 bytes of the received frame.  The |payload| is the
+ * pointer to the data portion of the received frame.  The
+ * |payloadlen| is the length of the |payload|. This is the data after
+ * the length field.
+ */
+void spdy_on_unknown_ctrl_recv_callback
+(spdylay_session *session,
+ const uint8_t *head, size_t headlen,
+ const uint8_t *payload, size_t payloadlen,
+ void *user_data);
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/P_SpdyCommon.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyCommon.h b/proxy/spdy/P_SpdyCommon.h
new file mode 100644
index 0000000..87364df
--- /dev/null
+++ b/proxy/spdy/P_SpdyCommon.h
@@ -0,0 +1,75 @@
+
+#ifndef __P_SPDY_COMMON_H__
+#define __P_SPDY_COMMON_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <limits.h>
+#include <string.h>
+#include <string>
+#include <vector>
+#include <map>
+
+#include "P_Net.h"
+#include "ts/ts.h"
+#include "ts/libts.h"
+#include "ts/experimental.h"
+#include <spdylay/spdylay.h>
+using namespace std;
+
+#define STATUS_200      "200 OK"
+#define STATUS_304      "304 Not Modified"
+#define STATUS_400      "400 Bad Request"
+#define STATUS_404      "404 Not Found"
+#define STATUS_405      "405 Method Not Allowed"
+#define STATUS_500      "500 Internal Server Error"
+#define DEFAULT_HTML    "index.html"
+#define SPDYD_SERVER    "ATS Spdylay/" SPDYLAY_VERSION
+
+#define atomic_fetch_and_add(a, b)  __sync_fetch_and_add(&a, b)
+#define atomic_fetch_and_sub(a, b)  __sync_fetch_and_sub(&a, b)
+#define atomic_inc(a)   atomic_fetch_and_add(a, 1)
+#define atomic_dec(a)   atomic_fetch_and_sub(a, 1)
+
+struct SpdyConfig {
+  bool verbose;
+  bool enable_tls;
+  bool keep_host_port;
+  int serv_port;
+  int max_concurrent_streams;
+  int initial_window_size;
+  spdylay_session_callbacks callbacks;
+};
+
+struct Config {
+  SpdyConfig spdy;
+  int nr_accept_threads;
+  int accept_no_activity_timeout;
+  int no_activity_timeout_in;
+};
+
+// Spdy Name/Value pairs
+class SpdyNV {
+public:
+
+  SpdyNV(TSFetchSM fetch_sm);
+  ~SpdyNV();
+
+public:
+  const char **nv;
+
+private:
+  SpdyNV();
+  void *mime_hdr;
+  char status[64];
+  char version[64];
+};
+
+string http_date(time_t t);
+int spdy_config_load();
+
+extern Config SPDY_CFG;
+#endif
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/P_SpdySM.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdySM.h b/proxy/spdy/P_SpdySM.h
new file mode 100644
index 0000000..85395db
--- /dev/null
+++ b/proxy/spdy/P_SpdySM.h
@@ -0,0 +1,129 @@
+
+#ifndef __P_SPDY_SM_H__
+#define __P_SPDY_SM_H__
+
+#include "P_SpdyCommon.h"
+#include "P_SpdyCallbacks.h"
+#include <openssl/md5.h>
+
+
+class SpdySM;
+typedef int (*SpdySMHandler) (TSCont contp, TSEvent event, void *data);
+
+
+class SpdyRequest
+{
+public:
+  SpdyRequest():
+    spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
+    has_submitted_data(false), need_resume_data(false),
+    fetch_data_len(0), delta_window_size(0),
+    fetch_body_completed(false)
+  {
+  }
+
+  SpdyRequest(SpdySM *sm, int id):
+    spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
+    has_submitted_data(false), need_resume_data(false),
+    fetch_data_len(0), delta_window_size(0),
+    fetch_body_completed(false)
+  {
+    init(sm, id);
+  }
+
+  ~SpdyRequest()
+  {
+    clear();
+  }
+
+  void init(SpdySM *sm, int id)
+  {
+    spdy_sm = sm;
+    stream_id = id;
+    headers.clear();
+
+    MD5_Init(&recv_md5);
+    start_time = TShrtime();
+  }
+
+  void clear();
+
+  void append_nv(char **nv)
+  {
+    for(int i = 0; nv[i]; i += 2) {
+      headers.push_back(make_pair(nv[i], nv[i+1]));
+    }
+  }
+
+public:
+  int event;
+  SpdySM *spdy_sm;
+  int stream_id;
+  TSHRTime start_time;
+  TSFetchSM fetch_sm;
+  bool has_submitted_data;
+  bool need_resume_data;
+  int fetch_data_len;
+  int delta_window_size;
+  bool fetch_body_completed;
+  vector<pair<string, string> > headers;
+
+  string url;
+  string host;
+  string path;
+  string scheme;
+  string method;
+  string version;
+
+  MD5_CTX recv_md5;
+};
+
+class SpdySM
+{
+
+public:
+
+  SpdySM();
+  SpdySM(TSVConn conn);
+  ~SpdySM()
+  {
+    clear();
+  }
+
+  void init(TSVConn conn);
+  void clear();
+
+public:
+
+  int64_t sm_id;
+  uint64_t total_size;
+  TSHRTime start_time;
+
+  TSVConn net_vc;
+  TSCont  contp;
+
+  TSIOBuffer req_buffer;
+  TSIOBufferReader req_reader;
+
+  TSIOBuffer resp_buffer;
+  TSIOBufferReader resp_reader;
+
+  TSVIO   read_vio;
+  TSVIO   write_vio;
+
+  SpdySMHandler current_handler;
+
+  int event;
+  spdylay_session *session;
+
+  map<int32_t, SpdyRequest*> req_map;
+};
+
+
+void spdy_sm_create(TSVConn cont);
+
+extern ClassAllocator<SpdySM> spdySMAllocator;
+extern ClassAllocator<SpdyRequest> spdyRequestAllocator;
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/SpdyAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyAcceptCont.cc b/proxy/spdy/SpdyAcceptCont.cc
index b9efc80..95bfe03 100644
--- a/proxy/spdy/SpdyAcceptCont.cc
+++ b/proxy/spdy/SpdyAcceptCont.cc
@@ -22,16 +22,26 @@
  */
 
 #include "P_SpdyAcceptCont.h"
+#if TS_HAS_SPDY
+#include "P_SpdySM.h"
+#endif
 
 SpdyAcceptCont::SpdyAcceptCont(Continuation *ep)
     : AcceptCont(new_ProxyMutex()), endpoint(ep)
 {
+#if TS_HAS_SPDY
+  spdy_config_load();
+#endif
   SET_HANDLER(&SpdyAcceptCont::mainEvent);
 }
 
 int
-SpdyAcceptCont::mainEvent(int event, void *netvc)
+SpdyAcceptCont::mainEvent(int /* event */, void *netvc)
 {
-  printf("spdy accepted\n");
+#if TS_HAS_SPDY
+  spdy_sm_create((TSCont)netvc);
+#else
+  (void)(netvc);
+#endif
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/SpdyCallbacks.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.cc b/proxy/spdy/SpdyCallbacks.cc
new file mode 100644
index 0000000..2e1b1f5
--- /dev/null
+++ b/proxy/spdy/SpdyCallbacks.cc
@@ -0,0 +1,513 @@
+
+#include "P_SpdyCallbacks.h"
+#include "P_SpdySM.h"
+#include <arpa/inet.h>
+
+void
+spdy_callbacks_init(spdylay_session_callbacks *callbacks)
+{
+  memset(callbacks, 0, sizeof(spdylay_session_callbacks));
+
+  callbacks->send_callback = spdy_send_callback;
+  callbacks->recv_callback = spdy_recv_callback;
+  callbacks->on_ctrl_recv_callback = spdy_on_ctrl_recv_callback;
+  callbacks->on_invalid_ctrl_recv_callback = spdy_on_invalid_ctrl_recv_callback;
+  callbacks->on_data_chunk_recv_callback = spdy_on_data_chunk_recv_callback;
+  callbacks->on_data_recv_callback = spdy_on_data_recv_callback;
+  callbacks->before_ctrl_send_callback = spdy_before_ctrl_send_callback;
+  callbacks->on_ctrl_send_callback = spdy_on_ctrl_send_callback;
+  callbacks->on_ctrl_not_send_callback = spdy_on_ctrl_not_send_callback;
+  callbacks->on_data_send_callback = spdy_on_data_send_callback;
+  callbacks->on_stream_close_callback = spdy_on_stream_close_callback;
+  callbacks->on_request_recv_callback = spdy_on_request_recv_callback;
+  callbacks->get_credential_proof = spdy_get_credential_proof;
+  callbacks->get_credential_ncerts = spdy_get_credential_ncerts;
+  callbacks->get_credential_cert = spdy_get_credential_cert;
+  callbacks->on_ctrl_recv_parse_error_callback = spdy_on_ctrl_recv_parse_error_callback;
+  callbacks->on_unknown_ctrl_recv_callback = spdy_on_unknown_ctrl_recv_callback;
+}
+
+void
+spdy_prepare_status_response(SpdySM *sm, int stream_id, const char *status)
+{
+  SpdyRequest *req = sm->req_map[stream_id];
+  string date_str = http_date(time(0));
+  const char **nv = new const char*[8+req->headers.size()*2+1];
+
+  nv[0] = ":status";
+  nv[1] = status;
+  nv[2] = ":version";
+  nv[3] = "HTTP/1.1";
+  nv[4] = "server";
+  nv[5] = SPDYD_SERVER;
+  nv[6] = "date";
+  nv[7] = date_str.c_str();
+
+  for(size_t i = 0; i < req->headers.size(); ++i) {
+    nv[8+i*2] = req->headers[i].first.c_str();
+    nv[8+i*2+1] = req->headers[i].second.c_str();
+  }
+  nv[8+req->headers.size()*2] = 0;
+
+  int r = spdylay_submit_response(sm->session, stream_id, nv, NULL);
+  TSAssert(r == 0);
+
+  TSVIOReenable(sm->write_vio);
+  delete [] nv;
+}
+
+static void
+spdy_show_data_frame(const char *head_str, spdylay_session * /*session*/, uint8_t flags,
+                     int32_t stream_id, int32_t length, void *user_data)
+{
+  if (!is_debug_tag_set("spdy"))
+    return;
+
+  SpdySM *sm = (SpdySM *)user_data;
+
+  Debug("spdy", "%s DATA frame (sm_id:%"PRIu64", stream_id:%d, flag:%d, length:%d)\n",
+        head_str, sm->sm_id, stream_id, flags, length);
+}
+
+static void
+spdy_show_ctl_frame(const char *head_str, spdylay_session * /*session*/, spdylay_frame_type type,
+                    spdylay_frame *frame, void *user_data)
+{
+  if (!is_debug_tag_set("spdy"))
+    return;
+
+  SpdySM *sm = (SpdySM *)user_data;
+  switch (type) {
+  case SPDYLAY_SYN_STREAM: {
+    spdylay_syn_stream *f = (spdylay_syn_stream *)frame;
+    Debug("spdy", "%s SYN_STREAM (sm_id:%"PRIu64", stream_id:%d, flag:%d, length:%d)\n",
+          head_str, sm->sm_id, f->stream_id, f->hd.flags, f->hd.length);
+    int j, i;
+    j = i = 0;
+    while (f->nv[j]) {
+      Debug("spdy", "    %s: %s\n", f->nv[j], f->nv[j+1]);
+      i++;
+      j = 2*i;
+    }
+  }
+    break;
+  case SPDYLAY_SYN_REPLY: {
+    spdylay_syn_reply *f = (spdylay_syn_reply *)frame;
+    Debug("spdy", "%s SYN_REPLY (sm_id:%"PRIu64", stream_id:%d, flag:%d, length:%d)\n",
+          head_str, sm->sm_id, f->stream_id, f->hd.flags, f->hd.length);
+    int j, i;
+    j = i = 0;
+    while (f->nv[j]) {
+      Debug("spdy", "    %s: %s\n", f->nv[j], f->nv[j+1]);
+      i++;
+      j = 2*i;
+    }
+  }
+    break;
+  case SPDYLAY_WINDOW_UPDATE: {
+    spdylay_window_update *f = (spdylay_window_update *)frame;
+    Debug("spdy", "%s WINDOW_UPDATE (sm_id:%"PRIu64", stream_id:%d, flag:%d, delta_window_size:%d)\n",
+          head_str, sm->sm_id, f->stream_id, f->hd.flags, f->delta_window_size);
+  }
+    break;
+  case SPDYLAY_SETTINGS: {
+    spdylay_settings *f = (spdylay_settings *)frame;
+    Debug("spdy", "%s SETTINGS frame (sm_id:%"PRIu64", flag:%d, length:%d, niv:%zu)\n",
+          head_str, sm->sm_id, f->hd.flags, f->hd.length, f->niv);
+    for (size_t i = 0; i < f->niv; i++) {
+      Debug("spdy", "    (%d:%d)\n", f->iv[i].settings_id, f->iv[i].value);
+    }
+  }
+    break;
+  case SPDYLAY_HEADERS: {
+    spdylay_headers *f = (spdylay_headers *)frame;
+    Debug("spdy", "%s HEADERS frame (sm_id:%"PRIu64", stream_id:%d, flag:%d, length:%d)\n",
+          head_str, sm->sm_id, f->stream_id, f->hd.flags, f->hd.length);
+  }
+    break;
+  case SPDYLAY_RST_STREAM: {
+    spdylay_rst_stream *f = (spdylay_rst_stream *)frame;
+    Debug("spdy", "%s RST_STREAM (sm_id:%"PRIu64", stream_id:%d, flag:%d, length:%d, code:%d)\n",
+          head_str, sm->sm_id, f->stream_id, f->hd.flags, f->hd.length, f->status_code);
+  }
+    break;
+  case SPDYLAY_GOAWAY: {
+    spdylay_goaway *f = (spdylay_goaway *)frame;
+    Debug("spdy", "%s GOAWAY frame (sm_id:%"PRIu64", last_good_stream_id:%d, flag:%d, length:%d\n",
+          head_str, sm->sm_id, f->last_good_stream_id, f->hd.flags, f->hd.length);
+  }
+  default:
+    break;
+  }
+  return;
+}
+
+static int
+spdy_fetcher_launch(SpdyRequest *req, TSFetchMethod method)
+{
+  string url;
+  int fetch_flags;
+  const sockaddr *client_addr;
+  SpdySM *sm = req->spdy_sm;
+
+  url = req->scheme + "://" + req->host + req->path;
+  client_addr = TSNetVConnRemoteAddrGet(sm->net_vc);
+
+  req->url = url;
+  Debug("spdy", "++++Request[%" PRIu64 ":%d] %s\n", sm->sm_id, req->stream_id, req->url.c_str());
+
+  //
+  // HTTP content should be dechunked before packed into SPDY.
+  //
+  fetch_flags = TS_FETCH_FLAGS_DECHUNK;
+  req->fetch_sm = TSFetchCreate(sm->contp, method,
+                                url.c_str(), req->version.c_str(),
+                                client_addr, fetch_flags);
+  TSFetchUserDataSet(req->fetch_sm, req);
+
+  //
+  // Set header list
+  //
+  for (size_t i = 0; i < req->headers.size(); i++) {
+
+    if (*req->headers[i].first.c_str() == ':')
+      continue;
+
+    TSFetchHeaderAdd(req->fetch_sm,
+                     req->headers[i].first.c_str(), req->headers[i].first.size(),
+                     req->headers[i].second.c_str(), req->headers[i].second.size());
+  }
+
+  TSFetchLaunch(req->fetch_sm);
+  return 0;
+}
+
+ssize_t
+spdy_send_callback(spdylay_session * /*session*/, const uint8_t *data, size_t length,
+                   int /*flags*/, void *user_data)
+{
+  SpdySM  *sm = (SpdySM*)user_data;
+
+  sm->total_size += length;
+  TSIOBufferWrite(sm->resp_buffer, data, length);
+
+  Debug("spdy", "----spdy_send_callback, length:%zu\n", length);
+
+  return length;
+}
+
+ssize_t
+spdy_recv_callback(spdylay_session * /*session*/, uint8_t *buf, size_t length,
+                   int /*flags*/, void *user_data)
+{
+  const char *start;
+  TSIOBufferBlock blk, next_blk;
+  int64_t already, blk_len, need, wavail;
+
+  SpdySM  *sm = (SpdySM*)user_data;
+
+  already = 0;
+  blk = TSIOBufferReaderStart(sm->req_reader);
+
+  while (blk) {
+
+    wavail = length - already;
+
+    next_blk = TSIOBufferBlockNext(blk);
+    start = TSIOBufferBlockReadStart(blk, sm->req_reader, &blk_len);
+
+    need = blk_len > wavail ? wavail : blk_len;
+
+    memcpy(&buf[already], start, need);
+    already += need;
+
+    if (already >= (int64_t)length)
+      break;
+
+    blk = next_blk;
+  }
+
+  TSIOBufferReaderConsume(sm->req_reader, already);
+  TSVIOReenable(sm->read_vio);
+
+  if (!already)
+    return SPDYLAY_ERR_WOULDBLOCK;
+
+  return already;
+}
+
+static void
+spdy_process_syn_stream_frame(SpdySM *sm, SpdyRequest *req)
+{
+  // validate request headers
+  for(size_t i = 0; i < req->headers.size(); ++i) {
+    const std::string &field = req->headers[i].first;
+    const std::string &value = req->headers[i].second;
+
+    if(field == ":path")
+      req->path = value;
+    else if(field == ":method")
+      req->method = value;
+    else if(field == ":scheme")
+      req->scheme = value;
+    else if(field == ":version")
+      req->version = value;
+    else if(field == ":host")
+      req->host = value;
+  }
+
+  if(!req->path.size()|| !req->method.size() || !req->scheme.size()
+     || !req->version.size() || !req->host.size()) {
+    spdy_prepare_status_response(sm, req->stream_id, STATUS_400);
+    return;
+  }
+
+
+  if (req->method == "GET")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_GET);
+  else if (req->method == "POST")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_POST);
+  else if (req->method == "PURGE")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_PURGE);
+  else if (req->method == "PUT")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_PUT);
+  else if (req->method == "HEAD")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_HEAD);
+  else if (req->method == "CONNECT")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_CONNECT);
+  else if (req->method == "DELETE")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_DELETE);
+  else if (req->method == "LAST")
+    spdy_fetcher_launch(req, TS_FETCH_METHOD_LAST);
+  else
+    spdy_prepare_status_response(sm, req->stream_id, STATUS_405);
+
+}
+
+void
+spdy_on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
+                           spdylay_frame *frame, void *user_data)
+{
+  int         stream_id;
+  SpdyRequest *req;
+  SpdySM      *sm = (SpdySM*)user_data;
+
+  spdy_show_ctl_frame("++++RECV", session, type, frame, user_data);
+
+  switch (type) {
+
+  case SPDYLAY_SYN_STREAM:
+    stream_id = frame->syn_stream.stream_id;
+    req = spdyRequestAllocator.alloc();
+    req->init(sm, stream_id);
+    req->append_nv(frame->syn_stream.nv);
+    sm->req_map[stream_id] = req;
+    spdy_process_syn_stream_frame(sm, req);
+    break;
+
+  case SPDYLAY_HEADERS:
+    stream_id = frame->syn_stream.stream_id;
+    req = sm->req_map[stream_id];
+    req->append_nv(frame->headers.nv);
+    break;
+
+  case SPDYLAY_WINDOW_UPDATE:
+    TSVIOReenable(sm->write_vio);
+    break;
+
+  default:
+    break;
+  }
+  return;
+}
+
+void
+spdy_on_invalid_ctrl_recv_callback(spdylay_session * /*session*/,
+                                   spdylay_frame_type /*type*/,
+                                   spdylay_frame * /*frame*/,
+                                   uint32_t /*status_code*/,
+                                   void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+void
+spdy_on_data_chunk_recv_callback(spdylay_session * /*session*/, uint8_t /*flags*/,
+                                 int32_t stream_id, const uint8_t *data,
+                                 size_t len, void *user_data)
+{
+  SpdySM *sm = (SpdySM *)user_data;
+  SpdyRequest *req = sm->req_map[stream_id];
+
+  //
+  // SpdyRequest has been deleted on error, drop this data;
+  //
+  if (!req)
+    return;
+
+  Debug("spdy", "++++Fetcher Append Data, len:%zu\n", len);
+  TSFetchWriteData(req->fetch_sm, data, len);
+
+  return;
+}
+
+void
+spdy_on_data_recv_callback(spdylay_session *session, uint8_t flags,
+                           int32_t stream_id, int32_t length, void *user_data)
+{
+  SpdySM *sm = (SpdySM *)user_data;
+  SpdyRequest *req = sm->req_map[stream_id];
+
+  spdy_show_data_frame("++++RECV", session, flags, stream_id, length, user_data);
+
+  //
+  // After SpdyRequest has been deleted on error, the corresponding
+  // client might continue to send POST data, We should reenable
+  // sm->write_vio so that WINDOW_UPDATE has a chance to be sent.
+  //
+  if (!req) {
+    TSVIOReenable(sm->write_vio);
+    return;
+  }
+
+  req->delta_window_size += length;
+
+  Debug("spdy", "----sm_id:%"PRId64", stream_id:%d, delta_window_size:%d\n",
+        sm->sm_id, stream_id, req->delta_window_size);
+
+  if (req->delta_window_size >= SPDY_CFG.spdy.initial_window_size/2) {
+    Debug("spdy", "----Reenable write_vio for WINDOW_UPDATE frame, delta_window_size:%d\n",
+          req->delta_window_size);
+
+    //
+    // Need not to send WINDOW_UPDATE frame here, what we should
+    // do is to reenable sm->write_vio, and than spdylay_session_send()
+    // will be triggered and it'll send WINDOW_UPDATE frame automatically.
+    //
+    TSVIOReenable(sm->write_vio);
+
+    req->delta_window_size = 0;
+  }
+
+  return;
+}
+
+void
+spdy_before_ctrl_send_callback(spdylay_session * /*session*/,
+                               spdylay_frame_type /*type*/,
+                               spdylay_frame * /*frame*/,
+                               void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+void
+spdy_on_ctrl_send_callback(spdylay_session *session, spdylay_frame_type type,
+                           spdylay_frame *frame, void *user_data)
+{
+  spdy_show_ctl_frame("----SEND", session, type, frame, user_data);
+
+  return;
+}
+
+void
+spdy_on_ctrl_not_send_callback(spdylay_session * /*session*/,
+                               spdylay_frame_type /*type*/,
+                               spdylay_frame * /*frame*/,
+                               int /*error_code*/,
+                               void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+void
+spdy_on_data_send_callback(spdylay_session *session, uint8_t flags,
+                           int32_t stream_id, int32_t length, void *user_data)
+{
+  SpdySM *sm = (SpdySM *)user_data;
+
+  spdy_show_data_frame("----SEND", session, flags, stream_id, length, user_data);
+
+  TSVIOReenable(sm->read_vio);
+  return;
+}
+
+void
+spdy_on_stream_close_callback(spdylay_session * /*session*/,
+                              int32_t /*stream_id*/,
+                              spdylay_status_code /*status_code*/,
+                              void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+ssize_t
+spdy_get_credential_proof(spdylay_session * /*session*/,
+                          const spdylay_origin * /*origin*/,
+                          uint8_t * /*proof*/,
+                          size_t /*prooflen*/,
+                          void * /*user_data*/)
+{
+  //TODO
+  return 0;
+}
+
+ssize_t
+spdy_get_credential_ncerts(spdylay_session * /*session*/,
+                           const spdylay_origin * /*origin*/,
+                           void * /*user_data*/)
+{
+  //TODO
+  return 0;
+}
+
+ssize_t
+spdy_get_credential_cert(spdylay_session * /*session*/,
+                         const spdylay_origin * /*origin*/,
+                         size_t /*idx*/,
+                         uint8_t * /*cert*/,
+                         size_t /*certlen*/,
+                         void * /*user_data*/)
+{
+  //TODO
+  return 0;
+}
+
+void
+spdy_on_request_recv_callback(spdylay_session * /*session*/,
+                              int32_t /*stream_id*/,
+                              void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+void
+spdy_on_ctrl_recv_parse_error_callback(spdylay_session * /*session*/,
+                                       spdylay_frame_type /*type*/,
+                                       const uint8_t * /*head*/,
+                                       size_t /*headlen*/,
+                                       const uint8_t * /*payload*/,
+                                       size_t /*payloadlen*/,
+                                       int /*error_code*/,
+                                       void * /*user_data*/)
+{
+  //TODO
+  return;
+}
+
+void
+spdy_on_unknown_ctrl_recv_callback(spdylay_session * /*session*/,
+                                   const uint8_t * /*head*/,
+                                   size_t /*headlen*/,
+                                   const uint8_t * /*payload*/,
+                                   size_t /*payloadlen*/,
+                                   void * /*user_data*/)
+{
+  //TODO
+  return;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/SpdyCommon.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCommon.cc b/proxy/spdy/SpdyCommon.cc
new file mode 100644
index 0000000..8205360
--- /dev/null
+++ b/proxy/spdy/SpdyCommon.cc
@@ -0,0 +1,136 @@
+
+#include "P_SpdyCommon.h"
+#include "P_SpdyCallbacks.h"
+
+Config SPDY_CFG;
+
+string
+http_date(time_t t)
+{
+  char buf[32];
+  tm* tms = gmtime(&t); // returned struct is statically allocated.
+  size_t r = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S GMT", tms);
+  return std::string(&buf[0], &buf[r]);
+}
+
+
+int
+spdy_config_load()
+{
+  SPDY_CFG.nr_accept_threads = 1;
+  SPDY_CFG.accept_no_activity_timeout = 30;
+  SPDY_CFG.no_activity_timeout_in = 30;
+  SPDY_CFG.spdy.verbose = false;
+  SPDY_CFG.spdy.enable_tls = false;
+  SPDY_CFG.spdy.keep_host_port = false;
+  //
+  // SPDY plugin will share the same port number with
+  // http server, unless '--port' is given.
+  //
+  SPDY_CFG.spdy.serv_port = -1;
+  SPDY_CFG.spdy.max_concurrent_streams = 1000;
+  SPDY_CFG.spdy.initial_window_size = (64 << 10);
+
+  spdy_callbacks_init(&SPDY_CFG.spdy.callbacks);
+
+  return 0;
+}
+
+SpdyNV::SpdyNV(TSFetchSM fetch_sm)
+{
+  int i, len;
+  char *p;
+  const char *name, *value;
+  int name_len, value_len, hdr_len, nr_fields;
+  TSMLoc loc, field_loc, next_loc;
+  TSMBuffer bufp;
+
+  bufp = TSFetchRespHdrMBufGet(fetch_sm);
+  loc = TSFetchRespHdrMLocGet(fetch_sm);
+
+  hdr_len = TSMimeHdrLengthGet(bufp, loc);
+  mime_hdr = malloc(hdr_len);
+  TSReleaseAssert(mime_hdr);
+
+  nr_fields = TSMimeHdrFieldsCount(bufp, loc);
+  nv = (const char **)malloc((2*nr_fields + 5) * sizeof(char *));
+  TSReleaseAssert(nv);
+
+  //
+  // Process Status and Version
+  //
+  i = TSHttpHdrVersionGet(bufp, loc);
+  snprintf(version, sizeof(version), "HTTP/%d.%d", TS_HTTP_MAJOR(i), TS_HTTP_MINOR(i));
+
+  i = TSHttpHdrStatusGet(bufp, loc);
+  value = (char *)TSHttpHdrReasonGet(bufp, loc, &value_len);
+  snprintf(status, sizeof(version), "%d ", i);
+  i = strlen(status);
+  len = sizeof(status) - i;
+  len = value_len > len ? len : value_len;
+  strncpy(&status[i], value, len);
+  status[len + i] = '\0';;
+
+  i = 0;
+  nv[i++] = ":version";
+  nv[i++] = version;
+  nv[i++] = ":status";
+  nv[i++] = status;
+
+  //
+  // Process HTTP headers
+  //
+  p = (char *)mime_hdr;
+  field_loc = TSMimeHdrFieldGet(bufp, loc, 0);
+  while (field_loc) {
+    name = TSMimeHdrFieldNameGet(bufp, loc, field_loc, &name_len);
+    TSReleaseAssert(name && name_len);
+
+    //
+    // According SPDY v3 spec, in RESPONSE:
+    // The Connection, Keep-Alive, Proxy-Connection, and
+    // Transfer-Encoding headers are not valid and MUST not be sent.
+    //
+    if (!strncasecmp(name, "Connection", name_len))
+      goto next;
+
+    if (!strncasecmp(name, "Keep-Alive", name_len))
+      goto next;
+
+    if (!strncasecmp(name, "Proxy-Connection", name_len))
+      goto next;
+
+    if (!strncasecmp(name, "Transfer-Encoding", name_len))
+      goto next;
+
+    strncpy(p, name, name_len);
+    nv[i++] = p;
+    p += name_len;
+    *p++ = '\0';
+
+    value = TSMimeHdrFieldValueStringGet(bufp, loc, field_loc, -1, &value_len);
+    TSReleaseAssert(value && value_len);
+    strncpy(p, value, value_len);
+    nv[i++] = p;
+    p += value_len;
+    *p++ = '\0';
+
+next:
+    next_loc = TSMimeHdrFieldNext(bufp, loc, field_loc);
+    TSHandleMLocRelease(bufp, loc, field_loc);
+    field_loc = next_loc;
+  }
+  nv[i] = NULL;
+
+  if (field_loc)
+    TSHandleMLocRelease(bufp, loc, field_loc);
+}
+
+SpdyNV::~SpdyNV()
+{
+  if (nv)
+    free(nv);
+
+  if (mime_hdr)
+    free(mime_hdr);
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79dd5035/proxy/spdy/SpdySM.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySM.cc b/proxy/spdy/SpdySM.cc
new file mode 100644
index 0000000..9657aec
--- /dev/null
+++ b/proxy/spdy/SpdySM.cc
@@ -0,0 +1,415 @@
+
+
+#include "P_SpdySM.h"
+#include "I_Net.h"
+
+ClassAllocator<SpdySM> spdySMAllocator("SpdySMAllocator");
+ClassAllocator<SpdyRequest> spdyRequestAllocator("SpdyRequestAllocator");
+
+static int spdy_main_handler(TSCont contp, TSEvent event, void *edata);
+static int spdy_start_handler(TSCont contp, TSEvent event, void *edata);
+static int spdy_default_handler(TSCont contp, TSEvent event, void *edata);
+static int spdy_process_read(TSEvent event, SpdySM *sm);
+static int spdy_process_write(TSEvent event, SpdySM *sm);
+static int spdy_process_fetch(TSEvent event, SpdySM *sm, void *edata);
+static int spdy_process_fetch_header(TSEvent event, SpdySM *sm, TSFetchSM fetch_sm);
+static int spdy_process_fetch_body(TSEvent event, SpdySM *sm, TSFetchSM fetch_sm);
+static uint64_t g_sm_id;
+static uint64_t g_sm_cnt;
+
+void
+SpdyRequest::clear()
+{
+  if (fetch_sm)
+    TSFetchDestroy(fetch_sm);
+
+  headers.clear();
+
+  Debug("spdy", "****Delete Request[%" PRIu64 ":%d]\n", spdy_sm->sm_id, stream_id);
+}
+
+SpdySM::SpdySM():
+  net_vc(NULL), contp(NULL),
+  req_buffer(NULL), req_reader(NULL),
+  resp_buffer(NULL), resp_reader(NULL),
+  read_vio(NULL), write_vio(NULL), session(NULL)
+{}
+
+SpdySM::SpdySM(TSVConn conn):
+  net_vc(NULL), contp(NULL),
+  req_buffer(NULL), req_reader(NULL),
+  resp_buffer(NULL), resp_reader(NULL),
+  read_vio(NULL), write_vio(NULL), session(NULL)
+
+{
+  init(conn);
+}
+
+void
+SpdySM::init(TSVConn conn)
+{
+  int version, r;
+  UnixNetVConnection *vc;
+
+  net_vc = conn;
+  req_map.clear();
+  vc = (UnixNetVConnection *)(conn);
+
+  if (vc->selected_next_protocol == TS_NPN_PROTOCOL_SPDY_3_1)
+    version = SPDYLAY_PROTO_SPDY3_1;
+  else if (vc->selected_next_protocol == TS_NPN_PROTOCOL_SPDY_3)
+    version = SPDYLAY_PROTO_SPDY3;
+  else if (vc->selected_next_protocol == TS_NPN_PROTOCOL_SPDY_2)
+    version = SPDYLAY_PROTO_SPDY2;
+  else
+    version = SPDYLAY_PROTO_SPDY3;
+
+  r = spdylay_session_server_new(&session, version,
+                                 &SPDY_CFG.spdy.callbacks, this);
+  ink_release_assert(r == 0);
+  sm_id = atomic_inc(g_sm_id);
+  total_size = 0;
+  start_time = TShrtime();
+}
+
+void
+SpdySM::clear()
+{
+  uint64_t nr_pending;
+  int last_event = event;
+  //
+  // SpdyRequest depends on SpdySM,
+  // we should delete it firstly to avoid race.
+  //
+  map<int, SpdyRequest*>::iterator iter = req_map.begin();
+  map<int, SpdyRequest*>::iterator endIter = req_map.end();
+  for(; iter != endIter; ++iter) {
+    SpdyRequest *req = iter->second;
+    req->clear();
+    spdyRequestAllocator.free(req);
+  }
+  req_map.clear();
+
+  if (net_vc) {
+    TSVConnClose(net_vc);
+    net_vc = NULL;
+  }
+
+  if (contp) {
+    TSContDestroy(contp);
+    contp = NULL;
+  }
+
+  if (req_reader) {
+    TSIOBufferReaderFree(req_reader);
+    req_reader = NULL;
+  }
+
+  if (req_buffer) {
+    TSIOBufferDestroy(req_buffer);
+    req_buffer = NULL;
+  }
+
+  if (resp_reader) {
+    TSIOBufferReaderFree(resp_reader);
+    resp_reader = NULL;
+  }
+
+  if (resp_buffer) {
+    TSIOBufferDestroy(resp_buffer);
+    resp_buffer = NULL;
+  }
+
+  if (session) {
+    spdylay_session_del(session);
+    session = NULL;
+  }
+
+  nr_pending = atomic_dec(g_sm_cnt);
+  Debug("spdy-free", "****Delete SpdySM[%"PRIu64"], last event:%d, nr_pending:%"PRIu64"\n",
+        sm_id, last_event, --nr_pending);
+}
+
+void
+spdy_sm_create(TSVConn cont)
+{
+  SpdySM  *sm;
+  NetVConnection *netvc = (NetVConnection *)cont;
+
+  sm = spdySMAllocator.alloc();
+  sm->init(cont);
+  atomic_inc(g_sm_cnt);
+
+  sm->contp = TSContCreate(spdy_main_handler, TSMutexCreate());
+  TSContDataSet(sm->contp, sm);
+
+  netvc->set_inactivity_timeout(HRTIME_SECONDS(SPDY_CFG.accept_no_activity_timeout));
+
+  sm->current_handler = &spdy_start_handler;
+  TSContSchedule(sm->contp, 0, TS_THREAD_POOL_DEFAULT);       // schedule now
+}
+
+static int
+spdy_main_handler(TSCont contp, TSEvent event, void *edata)
+{
+  SpdySM          *sm;
+  SpdySMHandler   spdy_current_handler;
+
+  sm = (SpdySM*)TSContDataGet(contp);
+  spdy_current_handler = sm->current_handler;
+
+  return (*spdy_current_handler) (contp, event, edata);
+}
+
+static int
+spdy_start_handler(TSCont contp, TSEvent /*event*/, void * /*data*/)
+{
+  int     r;
+  spdylay_settings_entry entry;
+
+  SpdySM  *sm = (SpdySM*)TSContDataGet(contp);
+
+  sm->req_buffer = TSIOBufferCreate();
+  sm->req_reader = TSIOBufferReaderAlloc(sm->req_buffer);
+
+  sm->resp_buffer = TSIOBufferCreate();
+  sm->resp_reader = TSIOBufferReaderAlloc(sm->resp_buffer);
+
+  sm->read_vio = TSVConnRead(sm->net_vc, contp, sm->req_buffer, INT64_MAX);
+  sm->write_vio = TSVConnWrite(sm->net_vc, contp, sm->resp_reader, INT64_MAX);
+
+  sm->current_handler = &spdy_default_handler;
+
+  /* send initial settings frame */
+  entry.settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
+  entry.value = SPDY_CFG.spdy.max_concurrent_streams;
+  entry.flags = SPDYLAY_ID_FLAG_SETTINGS_NONE;
+
+  r = spdylay_submit_settings(sm->session, SPDYLAY_FLAG_SETTINGS_NONE, &entry, 1);
+  TSAssert(r == 0);
+
+  TSVIOReenable(sm->write_vio);
+  return 0;
+}
+
+static int
+spdy_default_handler(TSCont contp, TSEvent event, void *edata)
+{
+  int ret = 0;
+  bool from_fetch = false;
+  NetVConnection *netvc;
+  SpdySM  *sm = (SpdySM*)TSContDataGet(contp);
+  sm->event = event;
+  netvc = (NetVConnection *)sm->net_vc;
+
+  if (edata == sm->read_vio) {
+    Debug("spdy", "++++[READ EVENT]\n");
+    if (event != TS_EVENT_VCONN_READ_READY &&
+        event != TS_EVENT_VCONN_READ_COMPLETE) {
+      ret = -1;
+      goto out;
+    }
+    ret = spdy_process_read(event, sm);
+  } else if (edata == sm->write_vio) {
+    Debug("spdy", "----[WRITE EVENT]\n");
+    if (event != TS_EVENT_VCONN_WRITE_READY &&
+        event != TS_EVENT_VCONN_WRITE_COMPLETE) {
+      ret = -1;
+      goto out;
+    }
+    ret = spdy_process_write(event, sm);
+  } else {
+    from_fetch = true;
+    ret = spdy_process_fetch(event, sm, edata);
+  }
+
+  Debug("spdy-event", "++++SpdySM[%"PRIu64"], EVENT:%d, ret:%d, nr_pending:%"PRIu64"\n",
+        sm->sm_id, event, ret, g_sm_cnt);
+out:
+  if (ret) {
+    sm->clear();
+    spdySMAllocator.free(sm);
+  } else if (!from_fetch) {
+    netvc->set_inactivity_timeout(HRTIME_SECONDS(SPDY_CFG.no_activity_timeout_in));
+  }
+
+  return 0;
+}
+
+static int
+spdy_process_read(TSEvent event, SpdySM *sm)
+{
+  return spdylay_session_recv(sm->session);
+}
+
+static int
+spdy_process_write(TSEvent event, SpdySM *sm)
+{
+  int ret;
+
+  ret = spdylay_session_send(sm->session);
+
+  if (TSIOBufferReaderAvail(sm->resp_reader) > 0)
+    TSVIOReenable(sm->write_vio);
+  else {
+    Debug("spdy", "----TOTAL SEND (sm_id:%"PRIu64", total_size:%"PRIu64", total_send:%"PRId64")\n",
+          sm->sm_id, sm->total_size, TSVIONDoneGet(sm->write_vio));
+
+    //
+    // We should reenable read_vio when no data to be written,
+    // otherwise it could lead to hang issue when client POST
+    // data is waiting to be read.
+    //
+    TSVIOReenable(sm->read_vio);
+  }
+
+  return ret;
+}
+
+static int
+spdy_process_fetch(TSEvent event, SpdySM *sm, void *edata)
+{
+  int ret = -1;
+  TSFetchSM fetch_sm = (TSFetchSM)edata;
+  SpdyRequest *req = (SpdyRequest *)TSFetchUserDataGet(fetch_sm);
+
+  switch ((int)event) {
+
+  case TS_FETCH_EVENT_EXT_HEAD_DONE:
+    Debug("spdy", "----[FETCH HEADER DONE]\n");
+    ret = spdy_process_fetch_header(event, sm, fetch_sm);
+    break;
+
+  case TS_FETCH_EVENT_EXT_BODY_READY:
+    Debug("spdy", "----[FETCH BODY READY]\n");
+    ret = spdy_process_fetch_body(event, sm, fetch_sm);
+    break;
+
+  case TS_FETCH_EVENT_EXT_BODY_DONE:
+    Debug("spdy", "----[FETCH BODY DONE]\n");
+    req->fetch_body_completed = true;
+    ret = spdy_process_fetch_body(event, sm, fetch_sm);
+    break;
+
+  default:
+    Debug("spdy", "----[FETCH ERROR]\n");
+    if (req->fetch_body_completed)
+      ret = 0; // Ignore fetch errors after FETCH BODY DONE
+    else
+      req->fetch_sm = NULL;
+    break;
+  }
+
+  if (ret) {
+    spdy_prepare_status_response(sm, req->stream_id, STATUS_500);
+    sm->req_map.erase(req->stream_id);
+    req->clear();
+    spdyRequestAllocator.free(req);
+  }
+
+  return 0;
+}
+
+static int
+spdy_process_fetch_header(TSEvent /*event*/, SpdySM *sm, TSFetchSM fetch_sm)
+{
+  int ret;
+  SpdyRequest *req = (SpdyRequest *)TSFetchUserDataGet(fetch_sm);
+  SpdyNV spdy_nv(fetch_sm);
+
+  Debug("spdy", "----spdylay_submit_syn_reply\n");
+  ret = spdylay_submit_syn_reply(sm->session,
+                                 SPDYLAY_CTRL_FLAG_NONE, req->stream_id,
+                                 spdy_nv.nv);
+
+  TSVIOReenable(sm->write_vio);
+  return ret;
+}
+
+static ssize_t
+spdy_read_fetch_body_callback(spdylay_session * /*session*/, int32_t stream_id,
+                              uint8_t *buf, size_t length, int *eof,
+                              spdylay_data_source *source, void *user_data)
+{
+
+  static int g_call_cnt;
+  int64_t already;
+
+  SpdySM *sm = (SpdySM *)user_data;
+  SpdyRequest *req = (SpdyRequest *)source->ptr;
+
+  //
+  // req has been deleted, ignore this data.
+  //
+  if (req != sm->req_map[stream_id]) {
+    Debug("spdy", "    stream_id:%d, call:%d, req has been deleted, return 0\n",
+          stream_id, g_call_cnt);
+    *eof = 1;
+    return 0;
+  }
+
+  already = TSFetchReadData(req->fetch_sm, buf, length);
+
+  Debug("spdy", "    stream_id:%d, call:%d, length:%ld, already:%ld\n",
+        stream_id, g_call_cnt, length, already);
+  if (SPDY_CFG.spdy.verbose)
+    MD5_Update(&req->recv_md5, buf, already);
+
+  TSVIOReenable(sm->write_vio);
+  g_call_cnt++;
+
+  req->fetch_data_len += already;
+  if (already < (int64_t)length) {
+    if (req->event == TS_FETCH_EVENT_EXT_BODY_DONE) {
+      TSHRTime end_time = TShrtime();
+      Debug("spdy", "----Request[%" PRIu64 ":%d] %s %lld %d\n", sm->sm_id, req->stream_id,
+            req->url.c_str(), (end_time - req->start_time)/TS_HRTIME_MSECOND,
+            req->fetch_data_len);
+      unsigned char digest[MD5_DIGEST_LENGTH];
+      if (SPDY_CFG.spdy.verbose ) {
+        MD5_Final(digest, &req->recv_md5);
+        Debug("spdy", "----recv md5sum: ");
+        for (int i = 0; i < MD5_DIGEST_LENGTH; i++) {
+          Debug("spdy", "%02x", digest[i]);
+        }
+        Debug("spdy", "\n");
+      }
+      *eof = 1;
+      sm->req_map.erase(stream_id);
+      req->clear();
+      spdyRequestAllocator.free(req);
+    } else if (already == 0) {
+      req->need_resume_data = true;
+      return SPDYLAY_ERR_DEFERRED;
+    }
+  }
+
+  return already;
+}
+
+static int
+spdy_process_fetch_body(TSEvent event, SpdySM *sm, TSFetchSM fetch_sm)
+{
+  int ret = 0;
+  spdylay_data_provider data_prd;
+  SpdyRequest *req = (SpdyRequest *)TSFetchUserDataGet(fetch_sm);
+  req->event = event;
+
+  data_prd.source.ptr = (void *)req;
+  data_prd.read_callback = spdy_read_fetch_body_callback;
+
+  if (!req->has_submitted_data) {
+    req->has_submitted_data = true;
+    Debug("spdy", "----spdylay_submit_data\n");
+    ret = spdylay_submit_data(sm->session, req->stream_id,
+                              SPDYLAY_DATA_FLAG_FIN, &data_prd);
+  } else if (req->need_resume_data) {
+    Debug("spdy", "----spdylay_session_resume_data\n");
+    ret = spdylay_session_resume_data(sm->session, req->stream_id);
+    if (ret == SPDYLAY_ERR_INVALID_ARGUMENT)
+      ret = 0;
+  }
+
+  TSVIOReenable(sm->write_vio);
+  return ret;
+}


[15/50] [abbrv] git commit: [TS-2647] atscppapi: Bug fixes in headers and atscppapi] This closes #62

Posted by zw...@apache.org.
[TS-2647] atscppapi: Bug fixes in headers and atscppapi] This closes #62


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

Branch: refs/heads/lua_config
Commit: e2c69547fab28e002f2f1694e986fbc1d5dd3c1d
Parents: 0fc9036
Author: Manjesh Nilange <mn...@linkedin.com>
Authored: Mon Mar 17 13:47:45 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Mon Mar 17 13:47:45 2014 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e2c69547/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3b64258..ed049c7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2647] atscppapi: Bug fixes in headers and atscppapi
+
   *) [TS-2598] Expose HttpDebugNames to public plugin APIs.
 
   *) [TS-2639] Release HttpClientSession objects back to the proxy allocator.


[30/50] [abbrv] git commit: TS-2431: Add autoconf options for SPDY

Posted by zw...@apache.org.
TS-2431: Add autoconf options for SPDY

*) Add '--enable-spdy' opton.
*) Add 'TS_HAS_SPDY' macro.
*) Conditional checking spdylay library.

Signed-off-by: Yunkai Zhang <qi...@taobao.com>


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

Branch: refs/heads/lua_config
Commit: f1a005e8c882d716c39475079614530b9abc8de4
Parents: 89c7dae
Author: Yunkai Zhang <qi...@taobao.com>
Authored: Mon Dec 30 22:41:06 2013 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Fri Mar 21 01:29:16 2014 +0800

----------------------------------------------------------------------
 configure.ac           | 19 +++++++++++++++++++
 lib/ts/ink_config.h.in |  1 +
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1a005e8/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 75ec359..f87674d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -381,6 +381,20 @@ fi
 TS_ARG_ENABLE_VAR([use], [reclaimable_freelist])
 AC_SUBST(use_reclaimable_freelist)
 
+#
+# Options for SPDY
+#
+AC_MSG_CHECKING([whether to enable spdy])
+AC_ARG_ENABLE([spdy],
+	[AS_HELP_STRING([--enable-spdy], [turn on spdy protocol])],
+	[],
+	[enable_spdy="no"])
+AC_MSG_RESULT([$enable_spdy])
+TS_ARG_ENABLE_VAR([has], [spdy])
+AC_SUBST(has_spdy)
+AM_CONDITIONAL([BUILD_SPDY], [test 0 -ne $has_spdy])
+
+#
 # Configure how many stats to allocate for plugins. Default is 512.
 #
 AC_ARG_WITH([max-api-stats],
@@ -1468,6 +1482,11 @@ AC_SUBST(LUA_LUAJIT_LDFLAGS)
 # We should be able to build http_load if epoll(2) is available.
 AM_CONDITIONAL([BUILD_HTTP_LOAD], [test x"$ac_cv_func_epoll_ctl" = x"yes"])
 
+# Check for spdylay library
+if test "x${enable_spdy}" = "xyes"; then
+  PKG_CHECK_MODULES([SPDYLAY],[libspdylay])
+fi
+
 # -----------------------------------------------------------------------------
 # 5. CHECK FOR HEADER FILES
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1a005e8/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 44e4df3..9d88417 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -61,6 +61,7 @@
 #define TS_USE_POSIX_CAP               @use_posix_cap@
 #define TS_USE_TPROXY                  @use_tproxy@
 #define TS_HAS_SO_MARK                 @has_so_mark@
+#define TS_HAS_SPDY                    @has_spdy@
 #define TS_HAS_IP_TOS                  @has_ip_tos@
 #define TS_USE_HWLOC                   @use_hwloc@
 #define TS_USE_FREELIST                @use_freelist@