You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2010/11/30 02:43:06 UTC

svn commit: r1040383 [4/38] - in /trafficserver/traffic/branches/wccp: ./ build/ contrib/ contrib/perl/AdminClient/lib/Apache/TS/ example/ example/add-header/ example/app-template/ example/append-transform/ example/basic-auth/ example/blacklist-0/ exam...

Modified: trafficserver/traffic/branches/wccp/example/prefetch/test-hns-plugin.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/prefetch/test-hns-plugin.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/prefetch/test-hns-plugin.c (original)
+++ trafficserver/traffic/branches/wccp/example/prefetch/test-hns-plugin.c Tue Nov 30 01:42:55 2010
@@ -32,22 +32,22 @@ This plugin tests the Parent Traffic Ser
 rules. It prints information to 'stdout' at various stages to verify the
 correctness of the parse/prefetch module. It has the following options:
 
--p. If 0, the plugin returns INK_PREFETCH_DISCONTINUE when called at the
-    INK_PREFETCH_PRE_PARSE_HOOK. If 1, the plugin returns
-    INK_PREFETCH_CONTINUE.
-
--u. If 0, the plugin returns INK_PREFETCH_DISCONTINUE when called at the
-    INK_PREFETCH_EMBEDDED_URL_HOOK. If 1, the plugin returns
-    INK_PREFETCH_CONTINUE.
-
--o. If 1, the plugin sets 'object_buf_status' field in the INKPrefetchInfo to
-    INK_PREFETCH_OBJ_BUF_NEEDED and expects to be called back with the object.
-    If 2, this field is set to INK_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED
+-p. If 0, the plugin returns TS_PREFETCH_DISCONTINUE when called at the
+    TS_PREFETCH_PRE_PARSE_HOOK. If 1, the plugin returns
+    TS_PREFETCH_CONTINUE.
+
+-u. If 0, the plugin returns TS_PREFETCH_DISCONTINUE when called at the
+    TS_PREFETCH_EMBEDDED_URL_HOOK. If 1, the plugin returns
+    TS_PREFETCH_CONTINUE.
+
+-o. If 1, the plugin sets 'object_buf_status' field in the TSPrefetchInfo to
+    TS_PREFETCH_OBJ_BUF_NEEDED and expects to be called back with the object.
+    If 2, this field is set to TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED
     which implies the object is transmitted to the child as well.
 
 -i. If 0, the plugin sets the 'url_response_proto' field in the
-    INKPrefetchInfo to INK_PREFETCH_PROTO_UDP. If 1, it sets the
-    'url_response_proto' field to INK_PREFETCH_PROTO_TCP.
+    TSPrefetchInfo to TS_PREFETCH_PROTO_UDP. If 1, it sets the
+    'url_response_proto' field to TS_PREFETCH_PROTO_TCP.
 
 -d. Specifies the directory where the plugin will store all the prefetched
     objects. All prefetched objects are stored in the PkgPreload format in
@@ -61,75 +61,75 @@ correctness of the parse/prefetch module
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ts/ts.h>
-#include <ts/ts_private.h>
+#include <ts/experimental.h>
 
 /* We will register the following two hooks */
 
 #define TAG "test-hns-plugin"
 
-INKFile filep1 = NULL;
+TSFile filep1 = NULL;
 static int pre_parse_cont = 0;
 static int embedded_url_cont = 0;
 static int url_proto = 0;
 static int embedded_object = 0;
 
-static INKMutex file_write_mutex;
+static TSMutex file_write_mutex;
 
-int pre_parse_hook(int hook, INKPrefetchInfo * info);
-int embedded_url_hook(int hook, INKPrefetchInfo * info);
-int embedded_object_hook(int hook, INKPrefetchInfo * info);
+int pre_parse_hook(int hook, TSPrefetchInfo * info);
+int embedded_url_hook(int hook, TSPrefetchInfo * info);
+int embedded_object_hook(int hook, TSPrefetchInfo * info);
 
 
 int
-embedded_object_hook(int hook, INKPrefetchInfo * info)
+embedded_object_hook(int hook, TSPrefetchInfo * info)
 {
   int total_avail;
 
-  INKIOBufferBlock block;
+  TSIOBufferBlock block;
   const char *block_start;
   int block_avail;
 
-  INKMutexLock(file_write_mutex);
+  TSMutexLock(file_write_mutex);
 
-  printf("(%s) >>> INK_PREFETCH_EMBEDDED_OBJECT_HOOK (%d)\n", TAG, hook);
+  printf("(%s) >>> TS_PREFETCH_EMBEDDED_OBJECT_HOOK (%d)\n", TAG, hook);
 
   printf("(%s) \tobject size for: %s is %d\n",
-         TAG, info->embedded_url, INKIOBufferReaderAvail(info->object_buf_reader));
+         TAG, info->embedded_url, TSIOBufferReaderAvail(info->object_buf_reader));
 
   /* Get the embedded objects here */
-  total_avail = INKIOBufferReaderAvail(info->object_buf_reader);
+  total_avail = TSIOBufferReaderAvail(info->object_buf_reader);
 
 
-  block = INKIOBufferReaderStart(info->object_buf_reader);
+  block = TSIOBufferReaderStart(info->object_buf_reader);
   while (block) {
-    block_start = INKIOBufferBlockReadStart(block, info->object_buf_reader, &block_avail);
+    block_start = TSIOBufferBlockReadStart(block, info->object_buf_reader, &block_avail);
 
     if (block_avail == 0) {
       break;
     }
 
     /* Put the object fragment into the file */
-    INKfwrite(filep1, block_start, block_avail);
-    INKfflush(filep1);
-    INKIOBufferReaderConsume(info->object_buf_reader, block_avail);
-    block = INKIOBufferReaderStart(info->object_buf_reader);
+    TSfwrite(filep1, block_start, block_avail);
+    TSfflush(filep1);
+    TSIOBufferReaderConsume(info->object_buf_reader, block_avail);
+    block = TSIOBufferReaderStart(info->object_buf_reader);
   }
 
 
-  INKIOBufferDestroy(info->object_buf);
+  TSIOBufferDestroy(info->object_buf);
 
-  INKMutexUnlock(file_write_mutex);
+  TSMutexUnlock(file_write_mutex);
 
   return 0;
 }
 
 int
-embedded_url_hook(int hook, INKPrefetchInfo * info)
+embedded_url_hook(int hook, TSPrefetchInfo * info)
 {
 
   unsigned char *ip = (unsigned char *) &info->client_ip;
 
-  printf("(%s) >>> INK_PREFETCH_EMBEDDED_URL_HOOK (%d)\n", TAG, hook);
+  printf("(%s) >>> TS_PREFETCH_EMBEDDED_URL_HOOK (%d)\n", TAG, hook);
 
   printf("(%s) \tURL: %s %s Child IP: %u.%u.%u.%u\n",
          TAG, info->embedded_url, (info->present_in_cache) ? "(present in cache)" : "", ip[0], ip[1], ip[2], ip[3]);
@@ -137,65 +137,65 @@ embedded_url_hook(int hook, INKPrefetchI
   /* We will select UDP for sending url and TCP for sending object */
   if (embedded_object)
     info->object_buf_status = (embedded_object == 1)
-      ? INK_PREFETCH_OBJ_BUF_NEEDED : INK_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED;
+      ? TS_PREFETCH_OBJ_BUF_NEEDED : TS_PREFETCH_OBJ_BUF_NEEDED_N_TRANSMITTED;
   if (url_proto)
-    info->url_response_proto = INK_PREFETCH_PROTO_TCP;
+    info->url_response_proto = TS_PREFETCH_PROTO_TCP;
   else
-    info->url_response_proto = INK_PREFETCH_PROTO_UDP;
+    info->url_response_proto = TS_PREFETCH_PROTO_UDP;
 
 
   if (!embedded_url_cont) {
     /* This will cause parent TS not to parse the HTML page */
-    printf("(%s) \tPlugin returns - INK_PREFETCH_DISCONTINUE\n", TAG);
-    return INK_PREFETCH_DISCONTINUE;
+    printf("(%s) \tPlugin returns - TS_PREFETCH_DISCONTINUE\n", TAG);
+    return TS_PREFETCH_DISCONTINUE;
 
   } else {
     /* This will cause TS (MDE plugin) to prefetch the URL */
     printf("(%s) \tURL Response Protocol: %s\n", TAG,
-           (info->url_response_proto == INK_PREFETCH_PROTO_TCP) ? "INK_PREFETCH_PROTO_TCP" : "INK_PREFETCH_PROTO_UDP");
-    printf("(%s) \tPlugin returns - INK_PREFETCH_CONTINUE\n", TAG);
-    return INK_PREFETCH_CONTINUE;
+           (info->url_response_proto == TS_PREFETCH_PROTO_TCP) ? "TS_PREFETCH_PROTO_TCP" : "TS_PREFETCH_PROTO_UDP");
+    printf("(%s) \tPlugin returns - TS_PREFETCH_CONTINUE\n", TAG);
+    return TS_PREFETCH_CONTINUE;
   }
 }
 
 
 int
-pre_parse_hook(int hook, INKPrefetchInfo * info)
+pre_parse_hook(int hook, TSPrefetchInfo * info)
 {
   unsigned char *ip = (unsigned char *) &info->client_ip;
 
-  printf("(%s) >>> INK_PREFETCH_PRE_PARSE_HOOK (%d)\n", TAG, hook);
+  printf("(%s) >>> TS_PREFETCH_PRE_PARSE_HOOK (%d)\n", TAG, hook);
 
   printf("(%s) \tChild IP : %u.%u.%u.%u\n", TAG, ip[0], ip[1], ip[2], ip[3]);
 
   if (!pre_parse_cont) {
     /* This will cause parent TS not to parse the HTML page */
-    printf("(%s) \tPlugin returns - INK_PREFETCH_DISCONTINUE\n", TAG);
-    return INK_PREFETCH_DISCONTINUE;
+    printf("(%s) \tPlugin returns - TS_PREFETCH_DISCONTINUE\n", TAG);
+    return TS_PREFETCH_DISCONTINUE;
 
   } else {
     /* we will let TS parse the page */
-    printf("(%s) \tPlugin returns - INK_PREFETCH_CONTINUE\n", TAG);
-    return INK_PREFETCH_CONTINUE;
+    printf("(%s) \tPlugin returns - TS_PREFETCH_CONTINUE\n", TAG);
+    return TS_PREFETCH_CONTINUE;
   }
 }
 
 
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
   int c, arg;
   extern char *optarg;
   extern int optind, opterr, optopt;
-  INKPluginRegistrationInfo plugin_info;
+  TSPluginRegistrationInfo plugin_info;
   char file_name[512] = { 0 };
   plugin_info.plugin_name = "test-prefetch";
   plugin_info.vendor_name = "MyCompany";
   plugin_info.support_email = "ts-api-support@MyCompany.com";
 
-  if (!INKPluginRegister(INK_SDK_VERSION_2_0, &plugin_info)) {
-    INKError("Plugin registration failed.\n");
+  if (!TSPluginRegister(TS_SDK_VERSION_2_0, &plugin_info)) {
+    TSError("Plugin registration failed.\n");
     return;
   }
 
@@ -212,7 +212,7 @@ INKPluginInit(int argc, const char *argv
       else if (!strcmp(optarg, "2"))
         arg = 2;
       else {
-        INKError("Invalid argument specified for option: %c\n", c);
+        TSError("Invalid argument specified for option: %c\n", c);
         return;
       }
       if (c == 'p')
@@ -229,25 +229,25 @@ INKPluginInit(int argc, const char *argv
       sprintf(file_name, "%s/prefetched.objects", optarg);
       break;
     case '?':
-      INKError("Invalid argument specified\n");
+      TSError("Invalid argument specified\n");
       return;
     }
   }
 
   if (embedded_object) {
-    filep1 = INKfopen(file_name, "w");
+    filep1 = TSfopen(file_name, "w");
     if (!filep1) {
-      INKError("Cannot open file %d for writing\n", file_name);
+      TSError("Cannot open file %d for writing\n", file_name);
       return;
     }
-    INKfwrite(filep1, "", 1);
-    INKfflush(filep1);
+    TSfwrite(filep1, "", 1);
+    TSfflush(filep1);
 
-    file_write_mutex = INKMutexCreate();
+    file_write_mutex = TSMutexCreate();
   }
 
   /* register our hooks */
-  INKPrefetchHookSet(INK_PREFETCH_PRE_PARSE_HOOK, &pre_parse_hook);
-  INKPrefetchHookSet(INK_PREFETCH_EMBEDDED_URL_HOOK, &embedded_url_hook);
-  INKPrefetchHookSet(INK_PREFETCH_EMBEDDED_OBJECT_HOOK, &embedded_object_hook);
+  TSPrefetchHookSet(TS_PREFETCH_PRE_PARSE_HOOK, &pre_parse_hook);
+  TSPrefetchHookSet(TS_PREFETCH_EMBEDDED_URL_HOOK, &embedded_url_hook);
+  TSPrefetchHookSet(TS_PREFETCH_EMBEDDED_OBJECT_HOOK, &embedded_object_hook);
 }

Propchange: trafficserver/traffic/branches/wccp/example/protocol/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 30 01:42:55 2010
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+.deps

Modified: trafficserver/traffic/branches/wccp/example/protocol/Protocol.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/protocol/Protocol.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/protocol/Protocol.c (original)
+++ trafficserver/traffic/branches/wccp/example/protocol/Protocol.c Tue Nov 30 01:42:55 2010
@@ -26,86 +26,86 @@
 #include <math.h>
 
 /* global variable */
-INKTextLogObject protocol_plugin_log;
+TSTextLogObject protocol_plugin_log;
 
 /* static variable */
-static INKAction pending_action;
+static TSAction pending_action;
 static int accept_port;
 static int server_port;
 
 /* Functions only seen in this file, should be static. */
 static void protocol_init(int accept_port, int server_port);
-static int accept_handler(INKCont contp, INKEvent event, void *edata);
+static int accept_handler(TSCont contp, TSEvent event, void *edata);
 
 
 /* When the handle is called, the net_vc is returned. */
 static int
-accept_handler(INKCont contp, INKEvent event, void *edata)
+accept_handler(TSCont contp, TSEvent event, void *edata)
 {
-  INKCont txn_sm;
-  INKMutex pmutex;
+  TSCont txn_sm;
+  TSMutex pmutex;
   int lock;
 
   switch (event) {
-  case INK_EVENT_NET_ACCEPT:
+  case TS_EVENT_NET_ACCEPT:
     /* Create a new mutex for the TxnSM, which is going
        to handle the incoming request. */
-    pmutex = (INKMutex) INKMutexCreate();
-    txn_sm = (INKCont) TxnSMCreate(pmutex, (INKVConn) edata, server_port);
+    pmutex = (TSMutex) TSMutexCreate();
+    txn_sm = (TSCont) TxnSMCreate(pmutex, (TSVConn) edata, server_port);
 
     /* This is no reason for not grabbing the lock.
        So skip the routine which handle LockTry failure case. */
-    if (INKMutexLockTry(pmutex, &lock) == INK_SUCCESS) {
-      INKContCall(txn_sm, 0, NULL);
-      INKMutexUnlock(pmutex);
+    if (TSMutexLockTry(pmutex, &lock) == TS_SUCCESS) {
+      TSContCall(txn_sm, 0, NULL);
+      TSMutexUnlock(pmutex);
     }
     break;
 
   default:
     /* Something wrong with the network, if there are any
        pending NetAccept, cancel them. */
-    if (pending_action && !INKActionDone(pending_action))
-      INKActionCancel(pending_action);
+    if (pending_action && !TSActionDone(pending_action))
+      TSActionCancel(pending_action);
 
-    INKContDestroy(contp);
+    TSContDestroy(contp);
     break;
   }
 
-  return INK_EVENT_NONE;
+  return TS_EVENT_NONE;
 }
 
 static void
 protocol_init(int accept_port, int server_port)
 {
-  INKCont contp;
+  TSCont contp;
   int ret_val;
 
   /* create customized log */
-  ret_val = INKTextLogObjectCreate("protocol", INK_LOG_MODE_ADD_TIMESTAMP, &protocol_plugin_log);
-  if (ret_val != INK_SUCCESS) {
-    INKError("failed to create log");
+  ret_val = TSTextLogObjectCreate("protocol", TS_LOG_MODE_ADD_TIMESTAMP, &protocol_plugin_log);
+  if (ret_val != TS_SUCCESS) {
+    TSError("failed to create log");
   }
 
   /* format of the log entries, for caching_status, 1 for HIT and 0 for MISS */
-  ret_val = INKTextLogObjectWrite(protocol_plugin_log, "timestamp filename servername caching_status\n\n");
-  if (ret_val != INK_SUCCESS) {
-    INKError("failed to write into log");
+  ret_val = TSTextLogObjectWrite(protocol_plugin_log, "timestamp filename servername caching_status\n\n");
+  if (ret_val != TS_SUCCESS) {
+    TSError("failed to write into log");
   }
 
-  contp = INKContCreate(accept_handler, INKMutexCreate());
+  contp = TSContCreate(accept_handler, TSMutexCreate());
 
   /* Accept network traffic from the accept_port.
      When there are requests coming in, contp's handler
      should be called, in this case, contp's handler
      is accept_event, see AcceptSM.c */
-  pending_action = INKNetAccept(contp, accept_port);
+  pending_action = TSNetAccept(contp, accept_port);
 }
 
 int
 check_ts_version()
 {
 
-  const char *ts_version = INKTrafficServerVersionGet();
+  const char *ts_version = TSTrafficServerVersionGet();
   int result = 0;
 
   if (ts_version) {
@@ -128,21 +128,21 @@ check_ts_version()
 
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
-  INKPluginRegistrationInfo info;
+  TSPluginRegistrationInfo info;
 
   info.plugin_name = "output-header";
   info.vendor_name = "MyCompany";
   info.support_email = "ts-api-support@MyCompany.com";
 
-  if (!INKPluginRegister(INK_SDK_VERSION_2_0, &info)) {
-    INKError("[PluginInit] Plugin registration failed.\n");
+  if (!TSPluginRegister(TS_SDK_VERSION_2_0, &info)) {
+    TSError("[PluginInit] Plugin registration failed.\n");
     goto error;
   }
 
   if (!check_ts_version()) {
-    INKError("[PluginInit] Plugin requires Traffic Server 2.0 or later\n");
+    TSError("[PluginInit] Plugin requires Traffic Server 2.0 or later\n");
     goto error;
   }
 
@@ -152,13 +152,13 @@ INKPluginInit(int argc, const char *argv
   server_port = 4666;
 
   if (argc < 3) {
-    INKDebug("protocol", "Usage: protocol.so accept_port server_port");
+    TSDebug("protocol", "Usage: protocol.so accept_port server_port");
     printf("[protocol_plugin] Usage: protocol.so accept_port server_port\n");
     printf("[protocol_plugin] Wrong arguments. Using deafult ports.\n");
   } else {
     if (!isnan(atoi(argv[1]))) {
       accept_port = atoi(argv[1]);
-      INKDebug("protocol", "using accept_port %d", accept_port);
+      TSDebug("protocol", "using accept_port %d", accept_port);
       printf("[protocol_plugin] using accept_port %d\n", accept_port);
     } else {
       printf("[protocol_plugin] Wrong argument for accept_port.");
@@ -167,7 +167,7 @@ INKPluginInit(int argc, const char *argv
 
     if (!isnan(atoi(argv[2]))) {
       server_port = atoi(argv[2]);
-      INKDebug("protocol", "using server_port %d", server_port);
+      TSDebug("protocol", "using server_port %d", server_port);
       printf("[protocol_plugin] using server_port %d\n", server_port);
     } else {
       printf("[protocol_plugin] Wrong argument for server_port.");
@@ -178,5 +178,5 @@ INKPluginInit(int argc, const char *argv
   protocol_init(accept_port, server_port);
 
 error:
-  INKError("[PluginInit] Plugin not initialized");
+  TSError("[PluginInit] Plugin not initialized");
 }

Modified: trafficserver/traffic/branches/wccp/example/protocol/TxnSM.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/protocol/TxnSM.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/protocol/TxnSM.c (original)
+++ trafficserver/traffic/branches/wccp/example/protocol/TxnSM.c Tue Nov 30 01:42:55 2010
@@ -23,87 +23,87 @@
 
 #include "TxnSM.h"
 
-extern INKTextLogObject protocol_plugin_log;
+extern TSTextLogObject protocol_plugin_log;
 
 /* Fix me: currently, tunnelling server_response from OS to both cache and
    client doesn't work for client_vc. So write data first to cache and then
    write cached data to client. */
 
 /* static functions */
-int main_handler(INKCont contp, INKEvent event, void *data);
+int main_handler(TSCont contp, TSEvent event, void *data);
 
 /* functions for clients */
-int state_start(INKCont contp, INKEvent event, void *data);
-int state_interface_with_client(INKCont contp, INKEvent event, INKVIO vio);
-int state_read_request_from_client(INKCont contp, INKEvent event, INKVIO vio);
-int state_send_response_to_client(INKCont contp, INKEvent event, INKVIO vio);
+int state_start(TSCont contp, TSEvent event, void *data);
+int state_interface_with_client(TSCont contp, TSEvent event, TSVIO vio);
+int state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio);
+int state_send_response_to_client(TSCont contp, TSEvent event, TSVIO vio);
 
 /* functions for cache operation */
-int state_handle_cache_lookup(INKCont contp, INKEvent event, INKVConn vc);
-int state_handle_cache_read_response(INKCont contp, INKEvent event, INKVIO vio);
-int state_handle_cache_prepare_for_write(INKCont contp, INKEvent event, INKVConn vc);
-int state_write_to_cache(INKCont contp, INKEvent event, INKVIO vio);
+int state_handle_cache_lookup(TSCont contp, TSEvent event, TSVConn vc);
+int state_handle_cache_read_response(TSCont contp, TSEvent event, TSVIO vio);
+int state_handle_cache_prepare_for_write(TSCont contp, TSEvent event, TSVConn vc);
+int state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio);
 
 /* functions for servers */
-int state_build_and_send_request(INKCont contp, INKEvent event, void *data);
-int state_dns_lookup(INKCont contp, INKEvent event, INKHostLookupResult host_info);
-int state_connect_to_server(INKCont contp, INKEvent event, INKVConn vc);
-int state_interface_with_server(INKCont contp, INKEvent event, INKVIO vio);
-int state_send_request_to_server(INKCont contp, INKEvent event, INKVIO vio);
-int state_read_response_from_server(INKCont contp, INKEvent event, INKVIO vio);
+int state_build_and_send_request(TSCont contp, TSEvent event, void *data);
+int state_dns_lookup(TSCont contp, TSEvent event, TSHostLookupResult host_info);
+int state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc);
+int state_interface_with_server(TSCont contp, TSEvent event, TSVIO vio);
+int state_send_request_to_server(TSCont contp, TSEvent event, TSVIO vio);
+int state_read_response_from_server(TSCont contp, TSEvent event, TSVIO vio);
 
 /* misc functions */
-int state_done(INKCont contp, INKEvent event, INKVIO vio);
+int state_done(TSCont contp, TSEvent event, TSVIO vio);
 
-int send_response_to_client(INKCont contp);
-int prepare_to_die(INKCont contp);
+int send_response_to_client(TSCont contp);
+int prepare_to_die(TSCont contp);
 
-char *get_info_from_buffer(INKIOBufferReader the_reader);
+char *get_info_from_buffer(TSIOBufferReader the_reader);
 int is_request_end(char *buf);
 int parse_request(char *request, char *server_name, char *file_name);
-INKCacheKey CacheKeyCreate(char *file_name);
+TSCacheKey CacheKeyCreate(char *file_name);
 
 /* Continuation handler is a function pointer, this function
    is to assign the continuation handler to a specific function. */
 int
-main_handler(INKCont contp, INKEvent event, void *data)
+main_handler(TSCont contp, TSEvent event, void *data)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
   TxnSMHandler q_current_handler = txn_sm->q_current_handler;
 
-  INKDebug("protocol", "main_handler (contp %X event %d)", contp, event);
+  TSDebug("protocol", "main_handler (contp %X event %d)", contp, event);
 
   /* handle common cases errors */
-  if (event == INK_EVENT_ERROR) {
+  if (event == TS_EVENT_ERROR) {
     return prepare_to_die(contp);
   }
 
   if (q_current_handler != &state_interface_with_server) {
-    if (event == INK_EVENT_VCONN_EOS) {
+    if (event == TS_EVENT_VCONN_EOS) {
       return prepare_to_die(contp);
     }
   }
 
-  INKDebug("protocol", "current_handler (%p)", q_current_handler);
+  TSDebug("protocol", "current_handler (%p)", q_current_handler);
 
   return (*q_current_handler) (contp, event, data);
 }
 
 /* Create the Txn data structure and the continuation for the Txn. */
-INKCont
-TxnSMCreate(INKMutex pmutex, INKVConn client_vc, int server_port)
+TSCont
+TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port)
 {
-  INKCont contp;
+  TSCont contp;
   TxnSM *txn_sm;
 
-  txn_sm = (TxnSM *) INKmalloc(sizeof(TxnSM));
+  txn_sm = (TxnSM *) TSmalloc(sizeof(TxnSM));
 
   txn_sm->q_mutex = pmutex;
   txn_sm->q_pending_action = NULL;
 
   /* Txn will use this server port to connect to the origin server. */
   txn_sm->q_server_port = server_port;
-  /* The client_vc is returned by INKNetAccept, refer to Protocol.c. */
+  /* The client_vc is returned by TSNetAccept, refer to Protocol.c. */
   txn_sm->q_client_vc = client_vc;
   /* The server_vc will be created if Txn connects to the origin server. */
   txn_sm->q_server_vc = NULL;
@@ -122,7 +122,7 @@ TxnSMCreate(INKMutex pmutex, INKVConn cl
   txn_sm->q_server_request_buffer_reader = NULL;
 
   /* Char buffers to store client request and server response. */
-  txn_sm->q_client_request = (char *) INKmalloc(sizeof(char) * (MAX_REQUEST_LENGTH + 1));
+  txn_sm->q_client_request = (char *) TSmalloc(sizeof(char) * (MAX_REQUEST_LENGTH + 1));
   memset(txn_sm->q_client_request, '\0', (sizeof(char) * (MAX_REQUEST_LENGTH + 1)));
   txn_sm->q_server_response = NULL;
   txn_sm->q_server_response_length = 0;
@@ -132,8 +132,8 @@ TxnSMCreate(INKMutex pmutex, INKVConn cl
   txn_sm->q_cache_read_buffer = NULL;
   txn_sm->q_cache_read_buffer_reader = NULL;
 
-  txn_sm->q_server_name = (char *) INKmalloc(sizeof(char) * (MAX_SERVER_NAME_LENGTH + 1));
-  txn_sm->q_file_name = (char *) INKmalloc(sizeof(char) * (MAX_FILE_NAME_LENGTH + 1));
+  txn_sm->q_server_name = (char *) TSmalloc(sizeof(char) * (MAX_SERVER_NAME_LENGTH + 1));
+  txn_sm->q_file_name = (char *) TSmalloc(sizeof(char) * (MAX_FILE_NAME_LENGTH + 1));
 
   txn_sm->q_key = NULL;
   txn_sm->q_magic = TXN_SM_ALIVE;
@@ -141,23 +141,23 @@ TxnSMCreate(INKMutex pmutex, INKVConn cl
   /* Set the current handler to be state_start. */
   set_handler(txn_sm->q_current_handler, &state_start);
 
-  contp = INKContCreate(main_handler, txn_sm->q_mutex);
-  INKContDataSet(contp, txn_sm);
+  contp = TSContCreate(main_handler, txn_sm->q_mutex);
+  TSContDataSet(contp, txn_sm);
   return contp;
 }
 
 /* This function starts to read incoming client request data from client_vc */
 int
-state_start(INKCont contp, INKEvent event, void *data)
+state_start(TSCont contp, TSEvent event, void *data)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
   if (!txn_sm->q_client_vc) {
     return prepare_to_die(contp);
   }
 
-  txn_sm->q_client_request_buffer = INKIOBufferCreate();
-  txn_sm->q_client_request_buffer_reader = INKIOBufferReaderAlloc(txn_sm->q_client_request_buffer);
+  txn_sm->q_client_request_buffer = TSIOBufferCreate();
+  txn_sm->q_client_request_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_client_request_buffer);
 
   if (!txn_sm->q_client_request_buffer || !txn_sm->q_client_request_buffer_reader) {
     return prepare_to_die(contp);
@@ -166,28 +166,28 @@ state_start(INKCont contp, INKEvent even
   /* Now the IOBuffer and IOBufferReader is ready, the data from
      client_vc can be read into the IOBuffer. Since we don't know
      the size of the client request, set the expecting size to be
-     INT_MAX, so that we will always get INK_EVENT_VCONN_READ_READY
-     event, but never INK_EVENT_VCONN_READ_COMPLETE event. */
+     INT_MAX, so that we will always get TS_EVENT_VCONN_READ_READY
+     event, but never TS_EVENT_VCONN_READ_COMPLETE event. */
   set_handler(txn_sm->q_current_handler, &state_interface_with_client);
-  txn_sm->q_client_read_vio = INKVConnRead(txn_sm->q_client_vc, (INKCont) contp,
+  txn_sm->q_client_read_vio = TSVConnRead(txn_sm->q_client_vc, (TSCont) contp,
                                            txn_sm->q_client_request_buffer, INT_MAX);
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* This function is to call proper functions according to the
    VIO argument. If it's read_vio, which means reading request from
    client_vc, call state_read_request_from_client. If it's write_vio,
    which means sending response to client_vc, call
-   state_send_response_to_client. If the event is INK_EVENT_VCONN_EOS,
+   state_send_response_to_client. If the event is TS_EVENT_VCONN_EOS,
    which means the client closed socket and thus implies the client
    drop all jobs between TxnSM and the client, so go to die. */
 int
-state_interface_with_client(INKCont contp, INKEvent event, INKVIO vio)
+state_interface_with_client(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_interface_with_client");
+  TSDebug("protocol", "enter state_interface_with_client");
 
   txn_sm->q_pending_action = NULL;
 
@@ -201,90 +201,90 @@ state_interface_with_client(INKCont cont
 /* Data is read from client_vc, if all data for the request is in,
    parse it and do cache lookup. */
 int
-state_read_request_from_client(INKCont contp, INKEvent event, INKVIO vio)
+state_read_request_from_client(TSCont contp, TSEvent event, TSVIO vio)
 {
   int bytes_read, parse_result;
   char *temp_buf;
 
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_read_request_from_client");
+  TSDebug("protocol", "enter state_read_request_from_client");
 
   switch (event) {
-  case INK_EVENT_VCONN_READ_READY:
-    bytes_read = INKIOBufferReaderAvail(txn_sm->q_client_request_buffer_reader);
+  case TS_EVENT_VCONN_READ_READY:
+    bytes_read = TSIOBufferReaderAvail(txn_sm->q_client_request_buffer_reader);
 
     if (bytes_read > 0) {
       temp_buf = (char *) get_info_from_buffer(txn_sm->q_client_request_buffer_reader);
       strcat(txn_sm->q_client_request, temp_buf);
-      INKfree(temp_buf);
+      TSfree(temp_buf);
 
       /* Check if the request is fully read, if so, do cache lookup. */
       if (strstr(txn_sm->q_client_request, "\r\n\r\n") != NULL) {
-        temp_buf = (char *) INKmalloc(sizeof(char) * (strlen(txn_sm->q_client_request) + 1));
+        temp_buf = (char *) TSmalloc(sizeof(char) * (strlen(txn_sm->q_client_request) + 1));
         memcpy(temp_buf, txn_sm->q_client_request, strlen(txn_sm->q_client_request));
         temp_buf[strlen(txn_sm->q_client_request)] = '\0';
         parse_result = parse_request(temp_buf, txn_sm->q_server_name, txn_sm->q_file_name);
-        INKfree(temp_buf);
+        TSfree(temp_buf);
 
         if (parse_result != 1)
           return prepare_to_die(contp);
 
         /* Start to do cache lookup */
-        INKDebug("protocol", "Key material: file name is %d, %s*****", txn_sm->q_file_name, txn_sm->q_file_name);
-        txn_sm->q_key = (INKCacheKey) CacheKeyCreate(txn_sm->q_file_name);
+        TSDebug("protocol", "Key material: file name is %d, %s*****", txn_sm->q_file_name, txn_sm->q_file_name);
+        txn_sm->q_key = (TSCacheKey) CacheKeyCreate(txn_sm->q_file_name);
 
         set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
-        txn_sm->q_pending_action = INKCacheRead(contp, txn_sm->q_key);
+        txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
 
-        return INK_SUCCESS;
+        return TS_SUCCESS;
       }
     }
 
     /* The request is not fully read, reenable the read_vio. */
-    INKVIOReenable(txn_sm->q_client_read_vio);
+    TSVIOReenable(txn_sm->q_client_read_vio);
     break;
 
   default:                     /* Shouldn't get here, prepare to die. */
     return prepare_to_die(contp);
 
   }
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* This function handle the cache lookup result. If MISS, try to
    open cache write_vc for writing. Otherwise, use the vc returned
    by the cache to read the data from the cache. */
 int
-state_handle_cache_lookup(INKCont contp, INKEvent event, INKVConn vc)
+state_handle_cache_lookup(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
-  int response_size;
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
+  int64 response_size;
   int ret_val;
 
-  INKDebug("protocol", "enter state_handle_cache_lookup");
+  TSDebug("protocol", "enter state_handle_cache_lookup");
 
   switch (event) {
-  case INK_EVENT_CACHE_OPEN_READ:
-    INKDebug("protocol", "cache hit!!!");
+  case TS_EVENT_CACHE_OPEN_READ:
+    TSDebug("protocol", "cache hit!!!");
     /* Cache hit. */
 
     /* Write log */
-    ret_val = INKTextLogObjectWrite(protocol_plugin_log, "%s %s %d \n", txn_sm->q_file_name, txn_sm->q_server_name, 1);
-    if (ret_val != INK_SUCCESS)
-      INKError("fail to write into log");
+    ret_val = TSTextLogObjectWrite(protocol_plugin_log, "%s %s %d \n", txn_sm->q_file_name, txn_sm->q_server_name, 1);
+    if (ret_val != TS_SUCCESS)
+      TSError("fail to write into log");
 
     txn_sm->q_cache_vc = vc;
     txn_sm->q_pending_action = NULL;
 
     /* Get the size of the cached doc. */
-    INKVConnCacheObjectSizeGet(txn_sm->q_cache_vc, &response_size);
+    TSVConnCacheObjectSizeGet(txn_sm->q_cache_vc, &response_size);
 
     /* Allocate IOBuffer to store data from the cache. */
-    txn_sm->q_client_response_buffer = INKIOBufferCreate();
-    txn_sm->q_client_response_buffer_reader = INKIOBufferReaderAlloc(txn_sm->q_client_response_buffer);
-    txn_sm->q_cache_read_buffer = INKIOBufferCreate();
-    txn_sm->q_cache_read_buffer_reader = INKIOBufferReaderAlloc(txn_sm->q_cache_read_buffer);
+    txn_sm->q_client_response_buffer = TSIOBufferCreate();
+    txn_sm->q_client_response_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_client_response_buffer);
+    txn_sm->q_cache_read_buffer = TSIOBufferCreate();
+    txn_sm->q_cache_read_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_cache_read_buffer);
 
     if (!txn_sm->q_client_response_buffer ||
         !txn_sm->q_client_response_buffer_reader ||
@@ -294,21 +294,21 @@ state_handle_cache_lookup(INKCont contp,
 
     /* Read doc from the cache. */
     set_handler(txn_sm->q_current_handler, &state_handle_cache_read_response);
-    txn_sm->q_cache_read_vio = INKVConnRead(txn_sm->q_cache_vc, contp, txn_sm->q_cache_read_buffer, response_size);
+    txn_sm->q_cache_read_vio = TSVConnRead(txn_sm->q_cache_vc, contp, txn_sm->q_cache_read_buffer, response_size);
 
     break;
 
-  case INK_EVENT_CACHE_OPEN_READ_FAILED:
+  case TS_EVENT_CACHE_OPEN_READ_FAILED:
     /* Cache miss or error, open cache write_vc. */
-    INKDebug("protocol", "cache miss or error!!!");
+    TSDebug("protocol", "cache miss or error!!!");
     /* Write log */
-    ret_val = INKTextLogObjectWrite(protocol_plugin_log, "%s %s %d \n", txn_sm->q_file_name, txn_sm->q_server_name, 0);
+    ret_val = TSTextLogObjectWrite(protocol_plugin_log, "%s %s %d \n", txn_sm->q_file_name, txn_sm->q_server_name, 0);
 
-    if (ret_val != INK_SUCCESS)
-      INKError("fail to write into log");
+    if (ret_val != TS_SUCCESS)
+      TSError("fail to write into log");
 
     set_handler(txn_sm->q_current_handler, &state_handle_cache_prepare_for_write);
-    txn_sm->q_pending_action = INKCacheWrite(contp, txn_sm->q_key);
+    txn_sm->q_pending_action = TSCacheWrite(contp, txn_sm->q_key);
     break;
 
   default:
@@ -316,7 +316,7 @@ state_handle_cache_lookup(INKCont contp,
     return prepare_to_die(contp);
   }
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 static void
@@ -325,18 +325,18 @@ load_buffer_cache_data(TxnSM * txn_sm)
   /* transfer the data from the cache buffer (which must
      fully be consumed on a VCONN_READY event, to the
      server response buffer */
-  int rdr_avail = INKIOBufferReaderAvail(txn_sm->q_cache_read_buffer_reader);
+  int rdr_avail = TSIOBufferReaderAvail(txn_sm->q_cache_read_buffer_reader);
 
-  INKDebug("protocol", "entering buffer_cache_data");
-  INKDebug("protocol", "loading %d bytes to buffer reader", rdr_avail);
+  TSDebug("protocol", "entering buffer_cache_data");
+  TSDebug("protocol", "loading %d bytes to buffer reader", rdr_avail);
 
-  INKAssert(rdr_avail > 0);
+  TSAssert(rdr_avail > 0);
 
-  INKIOBufferCopy(txn_sm->q_client_response_buffer,     /* (cache response buffer) */
+  TSIOBufferCopy(txn_sm->q_client_response_buffer,     /* (cache response buffer) */
                   txn_sm->q_cache_read_buffer_reader,   /* (transient buffer)      */
                   rdr_avail, 0);
 
-  INKIOBufferReaderConsume(txn_sm->q_cache_read_buffer_reader, rdr_avail);
+  TSIOBufferReaderConsume(txn_sm->q_cache_read_buffer_reader, rdr_avail);
 }
 
 /* If the document is fully read out of the cache, close the
@@ -345,37 +345,37 @@ load_buffer_cache_data(TxnSM * txn_sm)
    occurs, close the read_vc, open write_vc for writing the doc
    into the cache.*/
 int
-state_handle_cache_read_response(INKCont contp, INKEvent event, INKVIO vio)
+state_handle_cache_read_response(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_handle_cache_read_response");
+  TSDebug("protocol", "enter state_handle_cache_read_response");
 
   txn_sm->q_pending_action = NULL;
 
   switch (event) {
-  case INK_EVENT_VCONN_READ_COMPLETE:
+  case TS_EVENT_VCONN_READ_COMPLETE:
     load_buffer_cache_data(txn_sm);
-    INKVConnClose(txn_sm->q_cache_vc);
+    TSVConnClose(txn_sm->q_cache_vc);
     txn_sm->q_cache_vc = NULL;
     txn_sm->q_cache_read_vio = NULL;
     txn_sm->q_cache_write_vio = NULL;
-    INKIOBufferReaderFree(txn_sm->q_cache_read_buffer_reader);
-    INKIOBufferDestroy(txn_sm->q_cache_read_buffer);
+    TSIOBufferReaderFree(txn_sm->q_cache_read_buffer_reader);
+    TSIOBufferDestroy(txn_sm->q_cache_read_buffer);
     txn_sm->q_cache_read_buffer_reader = NULL;
     txn_sm->q_cache_read_buffer = NULL;
     return send_response_to_client(contp);
 
-  case INK_EVENT_VCONN_READ_READY:
+  case TS_EVENT_VCONN_READ_READY:
     load_buffer_cache_data(txn_sm);
 
-    INKVIOReenable(txn_sm->q_cache_read_vio);
+    TSVIOReenable(txn_sm->q_cache_read_vio);
     break;
 
   default:
     /* Error */
     if (txn_sm->q_cache_vc) {
-      INKVConnClose(txn_sm->q_cache_vc);
+      TSVConnClose(txn_sm->q_cache_vc);
       txn_sm->q_cache_vc = NULL;
       txn_sm->q_cache_read_vio = NULL;
       txn_sm->q_cache_write_vio = NULL;
@@ -384,32 +384,32 @@ state_handle_cache_read_response(INKCont
     /* Open the write_vc, after getting doc from the origin server,
        write the doc into the cache. */
     set_handler(txn_sm->q_current_handler, &state_handle_cache_prepare_for_write);
-    INKAssert(txn_sm->q_pending_action == NULL);
-    txn_sm->q_pending_action = INKCacheWrite(contp, txn_sm->q_key);
+    TSAssert(txn_sm->q_pending_action == NULL);
+    txn_sm->q_pending_action = TSCacheWrite(contp, txn_sm->q_key);
     break;
 
   }
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* The cache processor call us back with the vc to use for writing
    data into the cache.
    In case of error, abort txn. */
 int
-state_handle_cache_prepare_for_write(INKCont contp, INKEvent event, INKVConn vc)
+state_handle_cache_prepare_for_write(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_handle_cache_prepare_for_write");
+  TSDebug("protocol", "enter state_handle_cache_prepare_for_write");
 
   txn_sm->q_pending_action = NULL;
 
   switch (event) {
-  case INK_EVENT_CACHE_OPEN_WRITE:
+  case TS_EVENT_CACHE_OPEN_WRITE:
     txn_sm->q_cache_vc = vc;
     break;
   default:
-    INKError("can't open cache write_vc, aborting txn");
+    TSError("can't open cache write_vc, aborting txn");
     txn_sm->q_cache_vc = NULL;
     return prepare_to_die(contp);
     break;
@@ -420,19 +420,19 @@ state_handle_cache_prepare_for_write(INK
 /* Cache miss or error case. Start the process to send the request
    the origin server. */
 int
-state_build_and_send_request(INKCont contp, INKEvent event, void *data)
+state_build_and_send_request(TSCont contp, TSEvent event, void *data)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_build_and_send_request");
+  TSDebug("protocol", "enter state_build_and_send_request");
 
   txn_sm->q_pending_action = NULL;
 
-  txn_sm->q_server_request_buffer = INKIOBufferCreate();
-  txn_sm->q_server_request_buffer_reader = INKIOBufferReaderAlloc(txn_sm->q_server_request_buffer);
+  txn_sm->q_server_request_buffer = TSIOBufferCreate();
+  txn_sm->q_server_request_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_server_request_buffer);
 
-  txn_sm->q_server_response_buffer = INKIOBufferCreate();
-  txn_sm->q_cache_response_buffer_reader = INKIOBufferReaderAlloc(txn_sm->q_server_response_buffer);
+  txn_sm->q_server_response_buffer = TSIOBufferCreate();
+  txn_sm->q_cache_response_buffer_reader = TSIOBufferReaderAlloc(txn_sm->q_server_response_buffer);
 
   if (!txn_sm->q_server_request_buffer ||
       !txn_sm->q_server_request_buffer_reader ||
@@ -441,58 +441,58 @@ state_build_and_send_request(INKCont con
   }
 
   /* Marshal request */
-  INKIOBufferWrite(txn_sm->q_server_request_buffer, txn_sm->q_client_request, strlen(txn_sm->q_client_request));
+  TSIOBufferWrite(txn_sm->q_server_request_buffer, txn_sm->q_client_request, strlen(txn_sm->q_client_request));
 
   /* First thing to do is to get the server IP from the server host name. */
   set_handler(txn_sm->q_current_handler, &state_dns_lookup);
-  INKAssert(txn_sm->q_pending_action == NULL);
-  txn_sm->q_pending_action = INKHostLookup(contp, txn_sm->q_server_name, strlen(txn_sm->q_server_name));
+  TSAssert(txn_sm->q_pending_action == NULL);
+  txn_sm->q_pending_action = TSHostLookup(contp, txn_sm->q_server_name, strlen(txn_sm->q_server_name));
 
-  INKAssert(txn_sm->q_pending_action);
-  INKDebug("protocol", "initiating host lookup");
+  TSAssert(txn_sm->q_pending_action);
+  TSDebug("protocol", "initiating host lookup");
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* If Host lookup is successfully, connect to that IP. */
 int
-state_dns_lookup(INKCont contp, INKEvent event, INKHostLookupResult host_info)
+state_dns_lookup(TSCont contp, TSEvent event, TSHostLookupResult host_info)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_dns_lookup");
+  TSDebug("protocol", "enter state_dns_lookup");
 
   /* Can't find the server IP. */
-  if (event != INK_EVENT_HOST_LOOKUP || !host_info) {
+  if (event != TS_EVENT_HOST_LOOKUP || !host_info) {
     return prepare_to_die(contp);
   }
   txn_sm->q_pending_action = NULL;
 
-  /* Get the server IP from data structure INKHostLookupResult. */
-  INKHostLookupResultIPGet(host_info, &(txn_sm->q_server_ip));
+  /* Get the server IP from data structure TSHostLookupResult. */
+  TSHostLookupResultIPGet(host_info, &(txn_sm->q_server_ip));
 
   /* Connect to the server using its IP. */
   set_handler(txn_sm->q_current_handler, &state_connect_to_server);
-  INKAssert(txn_sm->q_pending_action == NULL);
-  txn_sm->q_pending_action = INKNetConnect(contp, txn_sm->q_server_ip, txn_sm->q_server_port);
+  TSAssert(txn_sm->q_pending_action == NULL);
+  txn_sm->q_pending_action = TSNetConnect(contp, txn_sm->q_server_ip, txn_sm->q_server_port);
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* Net Processor calls back, if succeeded, the net_vc is returned.
-   Note here, even if the event is INK_EVENT_NET_CONNECT, it doesn't
-   mean the net connection is set up because INKNetConnect is non-blocking.
+   Note here, even if the event is TS_EVENT_NET_CONNECT, it doesn't
+   mean the net connection is set up because TSNetConnect is non-blocking.
    Do VConnWrite to the net_vc, if fails, that means there is no net
    connection. */
 int
-state_connect_to_server(INKCont contp, INKEvent event, INKVConn vc)
+state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_connect_to_server");
+  TSDebug("protocol", "enter state_connect_to_server");
 
-  /* INKNetConnect failed. */
-  if (event != INK_EVENT_NET_CONNECT) {
+  /* TSNetConnect failed. */
+  if (event != TS_EVENT_NET_CONNECT) {
     return prepare_to_die(contp);
   }
   txn_sm->q_pending_action = NULL;
@@ -503,67 +503,67 @@ state_connect_to_server(INKCont contp, I
   set_handler(txn_sm->q_current_handler, &state_send_request_to_server);
 
   /* Actively write the request to the net_vc. */
-  txn_sm->q_server_write_vio = INKVConnWrite(txn_sm->q_server_vc, contp,
+  txn_sm->q_server_write_vio = TSVConnWrite(txn_sm->q_server_vc, contp,
                                              txn_sm->q_server_request_buffer_reader, strlen(txn_sm->q_client_request));
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* Net Processor calls back, if write complete, wait for the response
    coming in, otherwise, reenable the write_vio. */
 int
-state_send_request_to_server(INKCont contp, INKEvent event, INKVIO vio)
+state_send_request_to_server(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_send_request_to_server");
+  TSDebug("protocol", "enter state_send_request_to_server");
 
   switch (event) {
-  case INK_EVENT_VCONN_WRITE_READY:
-    INKVIOReenable(vio);
+  case TS_EVENT_VCONN_WRITE_READY:
+    TSVIOReenable(vio);
     break;
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
     vio = NULL;
 
     /* Waiting for the incoming response. */
     set_handler(txn_sm->q_current_handler, &state_interface_with_server);
-    txn_sm->q_server_read_vio = INKVConnRead(txn_sm->q_server_vc, contp, txn_sm->q_server_response_buffer, INT_MAX);
+    txn_sm->q_server_read_vio = TSVConnRead(txn_sm->q_server_vc, contp, txn_sm->q_server_response_buffer, INT_MAX);
     break;
 
-    /* it could be failure of INKNetConnect */
+    /* it could be failure of TSNetConnect */
   default:
     return prepare_to_die(contp);
   }
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* Call correct handler according to the vio type. */
 int
-state_interface_with_server(INKCont contp, INKEvent event, INKVIO vio)
+state_interface_with_server(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_interface_with_server");
+  TSDebug("protocol", "enter state_interface_with_server");
 
   txn_sm->q_pending_action = NULL;
 
   switch (event) {
     /* This is returned from cache_vc. */
-  case INK_EVENT_VCONN_WRITE_READY:
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
+  case TS_EVENT_VCONN_WRITE_READY:
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
     return state_write_to_cache(contp, event, vio);
     /* Otherwise, handle events from server. */
-  case INK_EVENT_VCONN_READ_READY:
+  case TS_EVENT_VCONN_READ_READY:
     /* Actually, we shouldn't get READ_COMPLETE because we set bytes
        count to be INT_MAX. */
-  case INK_EVENT_VCONN_READ_COMPLETE:
+  case TS_EVENT_VCONN_READ_COMPLETE:
     return state_read_response_from_server(contp, event, vio);
 
     /* all data of the response come in. */
-  case INK_EVENT_VCONN_EOS:
-    INKDebug("protocol", "get server eos");
+  case TS_EVENT_VCONN_EOS:
+    TSDebug("protocol", "get server eos");
     /* There is no more use of server_vc, close it. */
     if (txn_sm->q_server_vc) {
-      INKVConnClose(txn_sm->q_server_vc);
+      TSVConnClose(txn_sm->q_server_vc);
       txn_sm->q_server_vc = NULL;
     }
     txn_sm->q_server_read_vio = NULL;
@@ -573,7 +573,7 @@ state_interface_with_server(INKCont cont
     if (txn_sm->q_server_response_length == 0) {
       /* This is the bad response. Close client_vc. */
       if (txn_sm->q_client_vc) {
-        INKVConnClose(txn_sm->q_client_vc);
+        TSVConnClose(txn_sm->q_client_vc);
         txn_sm->q_client_vc = NULL;
       }
       txn_sm->q_client_read_vio = NULL;
@@ -581,7 +581,7 @@ state_interface_with_server(INKCont cont
 
       /* Close cache_vc as well. */
       if (txn_sm->q_cache_vc) {
-        INKVConnClose(txn_sm->q_cache_vc);
+        TSVConnClose(txn_sm->q_cache_vc);
         txn_sm->q_cache_vc = NULL;
       }
       txn_sm->q_cache_write_vio = NULL;
@@ -590,56 +590,56 @@ state_interface_with_server(INKCont cont
 
     if (txn_sm->q_cache_response_length >= txn_sm->q_server_response_length) {
       /* Write is complete, close the cache_vc. */
-      INKVConnClose(txn_sm->q_cache_vc);
+      TSVConnClose(txn_sm->q_cache_vc);
       txn_sm->q_cache_vc = NULL;
       txn_sm->q_cache_write_vio = NULL;
-      INKIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
+      TSIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
 
       /* Open cache_vc to read data and send to client. */
       set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
-      txn_sm->q_pending_action = INKCacheRead(contp, txn_sm->q_key);
+      txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
     } else {                    /* not done with writing into cache */
 
-      INKDebug("protocol", "cache_response_length is %d, server response length is %d", txn_sm->q_cache_response_length,
+      TSDebug("protocol", "cache_response_length is %d, server response length is %d", txn_sm->q_cache_response_length,
                txn_sm->q_server_response_length);
-      INKVIOReenable(txn_sm->q_cache_write_vio);
+      TSVIOReenable(txn_sm->q_cache_write_vio);
     }
 
   default:
     break;
   }
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* The response comes in. If the origin server finishes writing, it
    will close the socket, so the event returned from the net_vc is
-   INK_EVENT_VCONN_EOS. By this event, TxnSM knows all data of the
+   TS_EVENT_VCONN_EOS. By this event, TxnSM knows all data of the
    response arrives and so parse it, save a copy in the cache and
    send the doc to the client. If reading is not done, reenable the
    read_vio. */
 int
-state_read_response_from_server(INKCont contp, INKEvent event, INKVIO vio)
+state_read_response_from_server(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
   int bytes_read = 0;
 
-  INKDebug("protocol", "enter state_read_response_from_server");
+  TSDebug("protocol", "enter state_read_response_from_server");
 
-  bytes_read = INKIOBufferReaderAvail(txn_sm->q_cache_response_buffer_reader);
+  bytes_read = TSIOBufferReaderAvail(txn_sm->q_cache_response_buffer_reader);
 
   if ((bytes_read > 0) && (txn_sm->q_cache_vc)) {
-    /* If this is the first write, do INKVConnWrite, otherwise, simply
+    /* If this is the first write, do TSVConnWrite, otherwise, simply
        reenable q_cache_write_vio. */
     if (txn_sm->q_server_response_length == 0) {
-      txn_sm->q_cache_write_vio = INKVConnWrite(txn_sm->q_cache_vc,
+      txn_sm->q_cache_write_vio = TSVConnWrite(txn_sm->q_cache_vc,
                                                 contp, txn_sm->q_cache_response_buffer_reader, bytes_read);
     } else {
-      INKAssert(txn_sm->q_server_response_length > 0);
-      INKVIOReenable(txn_sm->q_cache_write_vio);
+      TSAssert(txn_sm->q_server_response_length > 0);
+      TSVIOReenable(txn_sm->q_cache_write_vio);
       txn_sm->q_block_bytes_read = bytes_read;
 /*
-	    txn_sm->q_cache_write_vio = INKVConnWrite (txn_sm->q_cache_vc,
+	    txn_sm->q_cache_write_vio = TSVConnWrite (txn_sm->q_cache_vc,
 						       contp,
 						       txn_sm->q_cache_response_buffer_reader,
 						       bytes_read);
@@ -648,59 +648,59 @@ state_read_response_from_server(INKCont 
   }
 
   txn_sm->q_server_response_length += bytes_read;
-  INKDebug("protocol", "bytes read is %d, total response length is %d", bytes_read, txn_sm->q_server_response_length);
+  TSDebug("protocol", "bytes read is %d, total response length is %d", bytes_read, txn_sm->q_server_response_length);
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* If the whole doc has been written into the cache, send the response
    to the client, otherwise, reenable the read_vio. */
 int
-state_write_to_cache(INKCont contp, INKEvent event, INKVIO vio)
+state_write_to_cache(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_write_to_cache");
+  TSDebug("protocol", "enter state_write_to_cache");
 
   switch (event) {
-  case INK_EVENT_VCONN_WRITE_READY:
-    INKVIOReenable(txn_sm->q_cache_write_vio);
-    return INK_SUCCESS;
-
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
-    INKDebug("protocol", "nbytes %d, ndone %d", INKVIONBytesGet(vio), INKVIONDoneGet(vio));
-    /* Since the first write is through INKVConnWrite, which aleady consume
+  case TS_EVENT_VCONN_WRITE_READY:
+    TSVIOReenable(txn_sm->q_cache_write_vio);
+    return TS_SUCCESS;
+
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
+    TSDebug("protocol", "nbytes %d, ndone %d", TSVIONBytesGet(vio), TSVIONDoneGet(vio));
+    /* Since the first write is through TSVConnWrite, which aleady consume
        the data in cache_buffer_reader, don't consume it again. */
     if (txn_sm->q_cache_response_length > 0 && txn_sm->q_block_bytes_read > 0)
-      INKIOBufferReaderConsume(txn_sm->q_cache_response_buffer_reader, txn_sm->q_block_bytes_read);
+      TSIOBufferReaderConsume(txn_sm->q_cache_response_buffer_reader, txn_sm->q_block_bytes_read);
 
-    txn_sm->q_cache_response_length += INKVIONBytesGet(vio);
+    txn_sm->q_cache_response_length += TSVIONBytesGet(vio);
 
     /* If not all data have been read in, we have to reenable the read_vio */
     if (txn_sm->q_server_vc != NULL) {
-      INKDebug("protocol", "reenable server_read_vio");
-      INKVIOReenable(txn_sm->q_server_read_vio);
-      return INK_SUCCESS;
+      TSDebug("protocol", "reenable server_read_vio");
+      TSVIOReenable(txn_sm->q_server_read_vio);
+      return TS_SUCCESS;
     }
 
     if (txn_sm->q_cache_response_length >= txn_sm->q_server_response_length) {
       /* Write is complete, close the cache_vc. */
-      INKDebug("protocol", "close cache_vc, cache_response_length is %d, server_response_lenght is %d",
+      TSDebug("protocol", "close cache_vc, cache_response_length is %d, server_response_lenght is %d",
                txn_sm->q_cache_response_length, txn_sm->q_server_response_length);
-      INKVConnClose(txn_sm->q_cache_vc);
+      TSVConnClose(txn_sm->q_cache_vc);
       txn_sm->q_cache_vc = NULL;
       txn_sm->q_cache_write_vio = NULL;
-      INKIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
+      TSIOBufferReaderFree(txn_sm->q_cache_response_buffer_reader);
 
       /* Open cache_vc to read data and send to client. */
       set_handler(txn_sm->q_current_handler, &state_handle_cache_lookup);
-      txn_sm->q_pending_action = INKCacheRead(contp, txn_sm->q_key);
+      txn_sm->q_pending_action = TSCacheRead(contp, txn_sm->q_key);
     } else {                    /* not done with writing into cache */
 
-      INKDebug("protocol", "reenable cache_write_vio");
-      INKVIOReenable(txn_sm->q_cache_write_vio);
+      TSDebug("protocol", "reenable cache_write_vio");
+      TSVIOReenable(txn_sm->q_cache_write_vio);
     }
-    return INK_SUCCESS;
+    return TS_SUCCESS;
   default:
     break;
   }
@@ -713,25 +713,25 @@ state_write_to_cache(INKCont contp, INKE
    which means this txn is done, close the client_vc. Otherwise,
    reenable the write_vio. */
 int
-state_send_response_to_client(INKCont contp, INKEvent event, INKVIO vio)
+state_send_response_to_client(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_send_response_to_client");
+  TSDebug("protocol", "enter state_send_response_to_client");
 
   switch (event) {
-  case INK_EVENT_VCONN_WRITE_READY:
-    INKDebug("protocol", " . wr ready");
-    INKDebug("protocol", "write_ready: nbytes %d, ndone %d", INKVIONBytesGet(vio), INKVIONDoneGet(vio));
-    INKVIOReenable(txn_sm->q_client_write_vio);
+  case TS_EVENT_VCONN_WRITE_READY:
+    TSDebug("protocol", " . wr ready");
+    TSDebug("protocol", "write_ready: nbytes %d, ndone %d", TSVIONBytesGet(vio), TSVIONDoneGet(vio));
+    TSVIOReenable(txn_sm->q_client_write_vio);
     break;
 
-  case INK_EVENT_VCONN_WRITE_COMPLETE:
-    INKDebug("protocol", " . wr complete");
-    INKDebug("protocol", "write_complete: nbytes %d, ndone %d", INKVIONBytesGet(vio), INKVIONDoneGet(vio));
+  case TS_EVENT_VCONN_WRITE_COMPLETE:
+    TSDebug("protocol", " . wr complete");
+    TSDebug("protocol", "write_complete: nbytes %d, ndone %d", TSVIONBytesGet(vio), TSVIONDoneGet(vio));
     /* Finished sending all data to client, close client_vc. */
     if (txn_sm->q_client_vc) {
-      INKVConnClose(txn_sm->q_client_vc);
+      TSVConnClose(txn_sm->q_client_vc);
       txn_sm->q_client_vc = NULL;
     }
     txn_sm->q_client_read_vio = NULL;
@@ -740,41 +740,41 @@ state_send_response_to_client(INKCont co
     return state_done(contp, 0, NULL);
 
   default:
-    INKDebug("protocol", " . default handler");
+    TSDebug("protocol", " . default handler");
     return prepare_to_die(contp);
 
   }
 
-  INKDebug("protocol", "leaving send_response_to_client");
+  TSDebug("protocol", "leaving send_response_to_client");
 
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 
 /* There is something wrong, abort client, server and cache vc
    if they exist. */
 int
-prepare_to_die(INKCont contp)
+prepare_to_die(TSCont contp)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter prepare_to_die");
+  TSDebug("protocol", "enter prepare_to_die");
   if (txn_sm->q_client_vc) {
-    INKVConnAbort(txn_sm->q_client_vc, 1);
+    TSVConnAbort(txn_sm->q_client_vc, 1);
     txn_sm->q_client_vc = NULL;
   }
   txn_sm->q_client_read_vio = NULL;
   txn_sm->q_client_write_vio = NULL;
 
   if (txn_sm->q_server_vc) {
-    INKVConnAbort(txn_sm->q_server_vc, 1);
+    TSVConnAbort(txn_sm->q_server_vc, 1);
     txn_sm->q_server_vc = NULL;
   }
   txn_sm->q_server_read_vio = NULL;
   txn_sm->q_server_write_vio = NULL;
 
   if (txn_sm->q_cache_vc) {
-    INKVConnAbort(txn_sm->q_cache_vc, 1);
+    TSVConnAbort(txn_sm->q_cache_vc, 1);
     txn_sm->q_cache_vc = NULL;
   }
   txn_sm->q_cache_read_vio = NULL;
@@ -784,17 +784,17 @@ prepare_to_die(INKCont contp)
 }
 
 int
-state_done(INKCont contp, INKEvent event, INKVIO vio)
+state_done(TSCont contp, TSEvent event, TSVIO vio)
 {
-  TxnSM *txn_sm = (TxnSM *) INKContDataGet(contp);
+  TxnSM *txn_sm = (TxnSM *) TSContDataGet(contp);
 
-  INKDebug("protocol", "enter state_done");
+  TSDebug("protocol", "enter state_done");
 
-  if (txn_sm->q_pending_action && !INKActionDone(txn_sm->q_pending_action)) {
-    INKDebug("protocol", "cancelling pending action %p", txn_sm->q_pending_action);
-    INKActionCancel(txn_sm->q_pending_action);
+  if (txn_sm->q_pending_action && !TSActionDone(txn_sm->q_pending_action)) {
+    TSDebug("protocol", "cancelling pending action %p", txn_sm->q_pending_action);
+    TSActionCancel(txn_sm->q_pending_action);
   } else if (txn_sm->q_pending_action) {
-    INKDebug("protocol", "action is done %p", txn_sm->q_pending_action);
+    TSDebug("protocol", "action is done %p", txn_sm->q_pending_action);
   }
 
   txn_sm->q_pending_action = NULL;
@@ -802,121 +802,121 @@ state_done(INKCont contp, INKEvent event
 
   if (txn_sm->q_client_request_buffer) {
     if (txn_sm->q_client_request_buffer_reader)
-      INKIOBufferReaderFree(txn_sm->q_client_request_buffer_reader);
-    INKIOBufferDestroy(txn_sm->q_client_request_buffer);
+      TSIOBufferReaderFree(txn_sm->q_client_request_buffer_reader);
+    TSIOBufferDestroy(txn_sm->q_client_request_buffer);
     txn_sm->q_client_request_buffer = NULL;
     txn_sm->q_client_request_buffer_reader = NULL;
   }
 
   if (txn_sm->q_client_response_buffer) {
     if (txn_sm->q_client_response_buffer_reader)
-      INKIOBufferReaderFree(txn_sm->q_client_response_buffer_reader);
+      TSIOBufferReaderFree(txn_sm->q_client_response_buffer_reader);
 
-    INKIOBufferDestroy(txn_sm->q_client_response_buffer);
+    TSIOBufferDestroy(txn_sm->q_client_response_buffer);
     txn_sm->q_client_response_buffer = NULL;
     txn_sm->q_client_response_buffer_reader = NULL;
   }
 
   if (txn_sm->q_cache_read_buffer) {
     if (txn_sm->q_cache_read_buffer_reader)
-      INKIOBufferReaderFree(txn_sm->q_cache_read_buffer_reader);
-    INKIOBufferDestroy(txn_sm->q_cache_read_buffer);
+      TSIOBufferReaderFree(txn_sm->q_cache_read_buffer_reader);
+    TSIOBufferDestroy(txn_sm->q_cache_read_buffer);
     txn_sm->q_cache_read_buffer = NULL;
     txn_sm->q_cache_read_buffer_reader = NULL;
   }
 
   if (txn_sm->q_server_request_buffer) {
     if (txn_sm->q_server_request_buffer_reader)
-      INKIOBufferReaderFree(txn_sm->q_server_request_buffer_reader);
-    INKIOBufferDestroy(txn_sm->q_server_request_buffer);
+      TSIOBufferReaderFree(txn_sm->q_server_request_buffer_reader);
+    TSIOBufferDestroy(txn_sm->q_server_request_buffer);
     txn_sm->q_server_request_buffer = NULL;
     txn_sm->q_server_request_buffer_reader = NULL;
   }
 
   if (txn_sm->q_server_response_buffer) {
-    INKIOBufferDestroy(txn_sm->q_server_response_buffer);
+    TSIOBufferDestroy(txn_sm->q_server_response_buffer);
     txn_sm->q_server_response_buffer = NULL;
   }
 
   if (txn_sm->q_server_name) {
-    INKfree(txn_sm->q_server_name);
+    TSfree(txn_sm->q_server_name);
     txn_sm->q_server_name = NULL;
   }
 
   if (txn_sm->q_file_name) {
-    INKfree(txn_sm->q_file_name);
+    TSfree(txn_sm->q_file_name);
     txn_sm->q_file_name = NULL;
   }
 
   if (txn_sm->q_key)
-    INKCacheKeyDestroy(txn_sm->q_key);
+    TSCacheKeyDestroy(txn_sm->q_key);
 
   if (txn_sm->q_client_request) {
-    INKfree(txn_sm->q_client_request);
+    TSfree(txn_sm->q_client_request);
     txn_sm->q_client_request = NULL;
   }
 
   if (txn_sm->q_server_response) {
-    INKfree(txn_sm->q_server_response);
+    TSfree(txn_sm->q_server_response);
     txn_sm->q_server_response = NULL;
   }
 
   if (txn_sm) {
     txn_sm->q_magic = TXN_SM_DEAD;
-    INKfree(txn_sm);
+    TSfree(txn_sm);
   }
-  INKContDestroy(contp);
-  return INK_EVENT_NONE;
+  TSContDestroy(contp);
+  return TS_EVENT_NONE;
 }
 
 /* Write the data into the client_vc. */
 int
-send_response_to_client(INKCont contp)
+send_response_to_client(TSCont contp)
 {
   TxnSM *txn_sm;
   int response_len;
 
-  INKDebug("protocol", "enter send_response_to_client");
+  TSDebug("protocol", "enter send_response_to_client");
 
-  txn_sm = (TxnSM *) INKContDataGet(contp);
-  response_len = INKIOBufferReaderAvail(txn_sm->q_client_response_buffer_reader);
+  txn_sm = (TxnSM *) TSContDataGet(contp);
+  response_len = TSIOBufferReaderAvail(txn_sm->q_client_response_buffer_reader);
 
-  INKDebug("protocol", " . resp_len is %d, response_len");
+  TSDebug("protocol", " . resp_len is %d, response_len");
 
   set_handler(txn_sm->q_current_handler, &state_interface_with_client);
-  txn_sm->q_client_write_vio = INKVConnWrite(txn_sm->q_client_vc, (INKCont) contp,
+  txn_sm->q_client_write_vio = TSVConnWrite(txn_sm->q_client_vc, (TSCont) contp,
                                              txn_sm->q_client_response_buffer_reader, response_len);
-  return INK_SUCCESS;
+  return TS_SUCCESS;
 }
 
 /* Read data out through the_reader and save it in a char buffer. */
 char *
-get_info_from_buffer(INKIOBufferReader the_reader)
+get_info_from_buffer(TSIOBufferReader the_reader)
 {
   char *info;
   char *info_start;
 
-  int read_avail, read_done;
-  INKIOBufferBlock blk;
+  int64 read_avail, read_done;
+  TSIOBufferBlock blk;
   char *buf;
 
   if (!the_reader)
     return NULL;
 
-  read_avail = INKIOBufferReaderAvail(the_reader);
+  read_avail = TSIOBufferReaderAvail(the_reader);
 
-  info = (char *) INKmalloc(sizeof(char) * read_avail);
+  info = (char *) TSmalloc(sizeof(char) * read_avail);
   if (info == NULL)
     return NULL;
   info_start = info;
 
   /* Read the data out of the reader */
   while (read_avail > 0) {
-    blk = INKIOBufferReaderStart(the_reader);
-    buf = (char *) INKIOBufferBlockReadStart(blk, the_reader, &read_done);
+    blk = TSIOBufferReaderStart(the_reader);
+    buf = (char *) TSIOBufferBlockReadStart(blk, the_reader, &read_done);
     memcpy(info, buf, read_done);
     if (read_done > 0) {
-      INKIOBufferReaderConsume(the_reader, read_done);
+      TSIOBufferReaderConsume(the_reader, read_done);
       read_avail -= read_done;
       info += read_done;
     }
@@ -956,20 +956,20 @@ parse_request(char *request, char *serve
 
 /* Create 128-bit cache key based on the input string, in this case,
    the file_name of the requested doc. */
-INKCacheKey
+TSCacheKey
 CacheKeyCreate(char *file_name)
 {
-  INKCacheKey key;
-  INKReturnCode return_code;
+  TSCacheKey key;
+  TSReturnCode return_code;
 
-  /* INKCacheKeyCreate is to allocate memory space for the key */
-  return_code = INKCacheKeyCreate(&key);
-  if (return_code != INK_SUCCESS) {
-    INKError("Can't create cache key");
-    return (INKCacheKey) INK_ERROR_PTR;
+  /* TSCacheKeyCreate is to allocate memory space for the key */
+  return_code = TSCacheKeyCreate(&key);
+  if (return_code != TS_SUCCESS) {
+    TSError("Can't create cache key");
+    return (TSCacheKey) TS_ERROR_PTR;
   }
 
-  /* INKCacheKeyDigestSet is to compute INKCackeKey from the input string */
-  INKCacheKeyDigestSet(key, (unsigned char *) file_name, strlen(file_name));
+  /* TSCacheKeyDigestSet is to compute TSCackeKey from the input string */
+  TSCacheKeyDigestSet(key, file_name, strlen(file_name));
   return key;
 }

Modified: trafficserver/traffic/branches/wccp/example/protocol/TxnSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/protocol/TxnSM.h?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/protocol/TxnSM.h (original)
+++ trafficserver/traffic/branches/wccp/example/protocol/TxnSM.h Tue Nov 30 01:42:55 2010
@@ -26,9 +26,9 @@
 
 #include "Protocol.h"
 
-typedef int (*TxnSMHandler) (INKCont contp, INKEvent event, void *data);
+typedef int (*TxnSMHandler) (TSCont contp, TSEvent event, void *data);
 
-INKCont TxnSMCreate(INKMutex pmutex, INKVConn client_vc, int server_port);
+TSCont TxnSMCreate(TSMutex pmutex, TSVConn client_vc, int server_port);
 
 #define TXN_SM_ALIVE 0xAAAA0123
 #define TXN_SM_DEAD  0xFEE1DEAD
@@ -39,12 +39,12 @@ typedef struct _TxnSM
 {
   unsigned int q_magic;
 
-  INKMutex q_mutex;
-  INKAction q_pending_action;
+  TSMutex q_mutex;
+  TSAction q_pending_action;
   TxnSMHandler q_current_handler;
 
-  INKVConn q_client_vc;
-  INKVConn q_server_vc;
+  TSVConn q_client_vc;
+  TSVConn q_server_vc;
 
   char *q_client_request;
   char *q_server_response;
@@ -53,32 +53,32 @@ typedef struct _TxnSM
   char *q_key;
 
   char *q_server_name;
-  INKU32 q_server_ip;
+  uint32 q_server_ip;
   int q_server_port;
 
-  INKVIO q_client_read_vio;
-  INKVIO q_client_write_vio;
-  INKIOBuffer q_client_request_buffer;
-  INKIOBuffer q_client_response_buffer;
-  INKIOBufferReader q_client_request_buffer_reader;
-  INKIOBufferReader q_client_response_buffer_reader;
-
-  INKVIO q_server_read_vio;
-  INKVIO q_server_write_vio;
-  INKIOBuffer q_server_request_buffer;
-  INKIOBuffer q_server_response_buffer;
-  INKIOBufferReader q_server_request_buffer_reader;
+  TSVIO q_client_read_vio;
+  TSVIO q_client_write_vio;
+  TSIOBuffer q_client_request_buffer;
+  TSIOBuffer q_client_response_buffer;
+  TSIOBufferReader q_client_request_buffer_reader;
+  TSIOBufferReader q_client_response_buffer_reader;
+
+  TSVIO q_server_read_vio;
+  TSVIO q_server_write_vio;
+  TSIOBuffer q_server_request_buffer;
+  TSIOBuffer q_server_response_buffer;
+  TSIOBufferReader q_server_request_buffer_reader;
   int q_server_response_length;
   int q_block_bytes_read;
   int q_cache_response_length;
 
   /* Cache related */
-  INKVConn q_cache_vc;
-  INKIOBufferReader q_cache_response_buffer_reader;
-  INKVIO q_cache_read_vio;
-  INKVIO q_cache_write_vio;
-  INKIOBuffer q_cache_read_buffer;
-  INKIOBufferReader q_cache_read_buffer_reader;
+  TSVConn q_cache_vc;
+  TSIOBufferReader q_cache_response_buffer_reader;
+  TSVIO q_cache_read_vio;
+  TSVIO q_cache_write_vio;
+  TSIOBuffer q_cache_read_buffer;
+  TSIOBufferReader q_cache_read_buffer_reader;
 
 } TxnSM;
 

Propchange: trafficserver/traffic/branches/wccp/example/query_remap/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 30 01:42:55 2010
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+.deps

Modified: trafficserver/traffic/branches/wccp/example/query_remap/query_remap.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/query_remap/query_remap.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/query_remap/query_remap.c (original)
+++ trafficserver/traffic/branches/wccp/example/query_remap/query_remap.c Tue Nov 30 01:42:55 2010
@@ -43,7 +43,7 @@ typedef struct _query_remap_info {
 int tsremap_init(TSRemapInterface *api_info,char *errbuf,int errbuf_size)
 {
   /* Called at TS startup. Nothing needed for this plugin */
-  INKDebug(PLUGIN_NAME , "remap plugin initialized");
+  TSDebug(PLUGIN_NAME , "remap plugin initialized");
   return 0;
 }
 
@@ -52,10 +52,10 @@ int tsremap_new_instance(int argc,char *
 {
   /* Called for each remap rule using this plugin. The parameters are parsed here */
   int i;
-  INKDebug(PLUGIN_NAME, "new instance fromURL: %s toURL: %s", argv[0], argv[1]);
+  TSDebug(PLUGIN_NAME, "new instance fromURL: %s toURL: %s", argv[0], argv[1]);
 
   if (argc < 4) {
-    INKError("Missing parameters for " PLUGIN_NAME);
+    TSError("Missing parameters for " PLUGIN_NAME);
     return -1;
   }
 
@@ -66,23 +66,23 @@ int tsremap_new_instance(int argc,char *
        2: query param to hash
        3,4,... : server hostnames
   */
-  query_remap_info *qri = (query_remap_info*) INKmalloc(sizeof(query_remap_info));
+  query_remap_info *qri = (query_remap_info*) TSmalloc(sizeof(query_remap_info));
 
-  qri->param_name = INKstrdup(argv[2]);
+  qri->param_name = TSstrdup(argv[2]);
   qri->param_len = strlen(qri->param_name);
   qri->num_hosts = argc - 3;
-  qri->hosts = (char**) INKmalloc(qri->num_hosts*sizeof(char*));
+  qri->hosts = (char**) TSmalloc(qri->num_hosts*sizeof(char*));
 
-  INKDebug(PLUGIN_NAME, " - Hash using query parameter [%s] with %d hosts",
+  TSDebug(PLUGIN_NAME, " - Hash using query parameter [%s] with %d hosts",
            qri->param_name, qri->num_hosts);
 
   for (i=0; i < qri->num_hosts; ++i) {
-    qri->hosts[i] = INKstrdup(argv[i+3]);
-    INKDebug(PLUGIN_NAME, " - Host %d: %s", i, qri->hosts[i]);
+    qri->hosts[i] = TSstrdup(argv[i+3]);
+    TSDebug(PLUGIN_NAME, " - Host %d: %s", i, qri->hosts[i]);
   }
 
   *ih = (ihandle)qri;
-  INKDebug(PLUGIN_NAME, "created instance %p", *ih);
+  TSDebug(PLUGIN_NAME, "created instance %p", *ih);
   return 0;
 }
 
@@ -90,19 +90,19 @@ void tsremap_delete_instance(ihandle ih)
 {
   /* Release instance memory allocated in tsremap_new_instance */
   int i;
-  INKDebug(PLUGIN_NAME, "deleting instance %p", ih);
+  TSDebug(PLUGIN_NAME, "deleting instance %p", ih);
 
   if (ih) {
     query_remap_info *qri = (query_remap_info*)ih;
     if (qri->param_name)
-      INKfree(qri->param_name);
+      TSfree(qri->param_name);
     if (qri->hosts) {
       for (i=0; i < qri->num_hosts; ++i) {
-        INKfree(qri->hosts[i]);
+        TSfree(qri->hosts[i]);
       }
-      INKfree(qri->hosts);
+      TSfree(qri->hosts);
     }
-    INKfree(qri);
+    TSfree(qri);
   }
 }
 
@@ -113,18 +113,18 @@ int tsremap_remap(ihandle ih, rhandle rh
   query_remap_info *qri = (query_remap_info*)ih;
 
   if (!qri) {
-    INKError(PLUGIN_NAME "NULL ihandle");
+    TSError(PLUGIN_NAME "NULL ihandle");
     return 0;
   }
 
-  INKDebug(PLUGIN_NAME, "tsremap_remap request: %.*s", rri->orig_url_size, rri->orig_url);
+  TSDebug(PLUGIN_NAME, "tsremap_remap request: %.*s", rri->orig_url_size, rri->orig_url);
 
   if (rri && rri->request_query && rri->request_query_size > 0) {
     char *q, *key;
     char *s = NULL;
 
     /* make a copy of the query, as it is read only */
-    q = (char*) INKmalloc(rri->request_query_size+1);
+    q = (char*) TSmalloc(rri->request_query_size+1);
     strncpy(q, rri->request_query, rri->request_query_size);
     q[rri->request_query_size] = '\0';
 
@@ -137,13 +137,13 @@ int tsremap_remap(ihandle ih, rhandle rh
         /* the param key matched the configured param_name
            hash the param value to pick a host */
         hostidx = hash_fnv32(val, strlen(val)) % (uint32_t)qri->num_hosts;
-        INKDebug(PLUGIN_NAME, "modifying host based on %s", key);
+        TSDebug(PLUGIN_NAME, "modifying host based on %s", key);
         break;
       }
       key = strtok_r(NULL, "&", &s);
     }
 
-    INKfree(q);
+    TSfree(q);
 
     if (hostidx >= 0) {
       rri->new_host_size = strlen(qri->hosts[hostidx]);
@@ -151,7 +151,7 @@ int tsremap_remap(ihandle ih, rhandle rh
         /* copy the chosen host into rri */
         memcpy(rri->new_host, qri->hosts[hostidx], rri->new_host_size);
 
-        INKDebug(PLUGIN_NAME, "host changed from [%.*s] to [%.*s]",
+        TSDebug(PLUGIN_NAME, "host changed from [%.*s] to [%.*s]",
                  rri->request_host_size, rri->request_host,
                  rri->new_host_size, rri->new_host);
         return 1; /* host has been modified */
@@ -160,7 +160,7 @@ int tsremap_remap(ihandle ih, rhandle rh
   }
 
   /* the request was not modified, TS will use the toURL from the remap rule */
-  INKDebug(PLUGIN_NAME, "request not modified");
+  TSDebug(PLUGIN_NAME, "request not modified");
   return 0;
 }
 

Propchange: trafficserver/traffic/branches/wccp/example/redirect-1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 30 01:42:55 2010
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+.deps

Modified: trafficserver/traffic/branches/wccp/example/redirect-1/redirect-1.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/wccp/example/redirect-1/redirect-1.c?rev=1040383&r1=1040382&r2=1040383&view=diff
==============================================================================
--- trafficserver/traffic/branches/wccp/example/redirect-1/redirect-1.c (original)
+++ trafficserver/traffic/branches/wccp/example/redirect-1/redirect-1.c Tue Nov 30 01:42:55 2010
@@ -80,7 +80,7 @@ static INKStat requests_redirects;
 static INKStat requests_unchanged;
 
 
-void update_redirected_method_stats(INKMBuffer bufp, INKMLoc hdr_loc);
+void update_redirected_method_stats(TSMBuffer bufp, TSMLoc hdr_loc);
 
 static char *url_redirect;
 static char *uri_redirect;
@@ -88,10 +88,10 @@ static char *block_ip;
 
 
 static void
-handle_client_lookup(INKHttpTxn txnp, INKCont contp)
+handle_client_lookup(TSHttpTxn txnp, TSCont contp)
 {
-  INKMBuffer bufp;
-  INKMLoc hdr_loc, url_loc;
+  TSMBuffer bufp;
+  TSMLoc hdr_loc, url_loc;
   int host_length;
 
 #if !defined (_WIN32)
@@ -138,33 +138,33 @@ handle_client_lookup(INKHttpTxn txnp, IN
 
 
 #if !defined (_WIN32)
-  clientip = (in_addr_t) INKHttpTxnClientIPGet(txnp);
+  clientip = (in_addr_t) TSHttpTxnClientIPGet(txnp);
 #else
-  clientip = INKHttpTxnClientIPGet(txnp);
+  clientip = TSHttpTxnClientIPGet(txnp);
 #endif
 
 
   tempstruct.s_addr = clientip;
   clientstring = inet_ntoa(tempstruct);
-  INKDebug("redirect", "clientip is %s and block_ip is %s", clientstring, block_ip);
+  TSDebug("redirect", "clientip is %s and block_ip is %s", clientstring, block_ip);
 
-  if (!INKHttpTxnClientReqGet(txnp, &bufp, &hdr_loc)) {
-    INKError("couldn't retrieve client request header\n");
+  if (!TSHttpTxnClientReqGet(txnp, &bufp, &hdr_loc)) {
+    TSError("couldn't retrieve client request header\n");
     goto done;
   }
 
-  url_loc = INKHttpHdrUrlGet(bufp, hdr_loc);
+  url_loc = TSHttpHdrUrlGet(bufp, hdr_loc);
   if (!url_loc) {
-    INKError("couldn't retrieve request url\n");
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSError("couldn't retrieve request url\n");
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     goto done;
   }
 
-  host = INKUrlHostGet(bufp, url_loc, &host_length);
+  host = TSUrlHostGet(bufp, url_loc, &host_length);
   if (!host) {
-    INKError("couldn't retrieve request hostname\n");
-    INKHandleMLocRelease(bufp, hdr_loc, url_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSError("couldn't retrieve request hostname\n");
+    TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     goto done;
   }
 
@@ -172,21 +172,21 @@ handle_client_lookup(INKHttpTxn txnp, IN
    *   Check to see if the client is already headed to the redirect site.
    */
   if (strncmp(host, url_redirect, host_length) == 0) {
-    INKHandleStringRelease(bufp, url_loc, host);
-    INKHandleMLocRelease(bufp, hdr_loc, url_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSHandleStringRelease(bufp, url_loc, host);
+    TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     goto done;
   }
 
   if (ip_deny == clientip) {
 
-    INKHttpTxnHookAdd(txnp, INK_HTTP_SEND_RESPONSE_HDR_HOOK, contp);
-    INKHandleStringRelease(bufp, url_loc, host);
+    TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_RESPONSE_HDR_HOOK, contp);
+    TSHandleStringRelease(bufp, url_loc, host);
 
     update_redirected_method_stats(bufp, hdr_loc);
 
-    INKHandleMLocRelease(bufp, hdr_loc, url_loc);
-    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
     /*
      *   Increment the local redirect stat and do global update:
@@ -195,7 +195,7 @@ handle_client_lookup(INKHttpTxn txnp, IN
     INKStatsCoupledUpdate(local_request_outcomes);
     INKStatCoupledLocalCopyDestroy(local_request_outcomes);
 
-    INKHttpTxnReenable(txnp, INK_EVENT_HTTP_ERROR);
+    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_ERROR);
     return;
   }
 
@@ -207,64 +207,64 @@ done:
   INKStatsCoupledUpdate(local_request_outcomes);
   INKStatCoupledLocalCopyDestroy(local_request_outcomes);
 
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 }
 
 
 
 static void
-handle_response(INKHttpTxn txnp)
+handle_response(TSHttpTxn txnp)
 {
-  INKMBuffer bufp;
-  INKMLoc hdr_loc, newfield_loc;
+  TSMBuffer bufp;
+  TSMLoc hdr_loc, newfield_loc;
   char *errormsg_body = "All requests from this IP address are redirected.\n";
   char *tmp_body;
 
-  if (!INKHttpTxnClientRespGet(txnp, &bufp, &hdr_loc)) {
-    INKError("couldn't retrieve client response header\n");
+  if (!TSHttpTxnClientRespGet(txnp, &bufp, &hdr_loc)) {
+    TSError("couldn't retrieve client response header\n");
     goto done;
   }
 
-  INKHttpHdrStatusSet(bufp, hdr_loc, INK_HTTP_STATUS_MOVED_PERMANENTLY);
-  INKHttpHdrReasonSet(bufp, hdr_loc,
-                      INKHttpHdrReasonLookup(INK_HTTP_STATUS_MOVED_PERMANENTLY),
-                      strlen(INKHttpHdrReasonLookup(INK_HTTP_STATUS_MOVED_PERMANENTLY)));
-
-  newfield_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
-  INKMimeHdrFieldNameSet(bufp, hdr_loc, newfield_loc, INK_MIME_FIELD_LOCATION, INK_MIME_LEN_LOCATION);
-  INKMimeHdrFieldValueStringInsert(bufp, hdr_loc, newfield_loc, -1, uri_redirect, strlen(uri_redirect));
-  INKMimeHdrFieldAppend(bufp, hdr_loc, newfield_loc);
+  TSHttpHdrStatusSet(bufp, hdr_loc, TS_HTTP_STATUS_MOVED_PERMANENTLY);
+  TSHttpHdrReasonSet(bufp, hdr_loc,
+                      TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY),
+                      strlen(TSHttpHdrReasonLookup(TS_HTTP_STATUS_MOVED_PERMANENTLY)));
+
+  newfield_loc = TSMimeHdrFieldCreate(bufp, hdr_loc);
+  TSMimeHdrFieldNameSet(bufp, hdr_loc, newfield_loc, TS_MIME_FIELD_LOCATION, TS_MIME_LEN_LOCATION);
+  TSMimeHdrFieldValueStringInsert(bufp, hdr_loc, newfield_loc, -1, uri_redirect, strlen(uri_redirect));
+  TSMimeHdrFieldAppend(bufp, hdr_loc, newfield_loc);
 
 
   /*
-   *  Note that we can't directly use errormsg_body, as INKHttpTxnErrorBodySet()
-   *  will try to free the passed buffer with INKfree().
+   *  Note that we can't directly use errormsg_body, as TSHttpTxnErrorBodySet()
+   *  will try to free the passed buffer with TSfree().
    */
-  tmp_body = INKstrdup(errormsg_body);
-  INKHttpTxnErrorBodySet(txnp, tmp_body, strlen(tmp_body), NULL);
-  INKHandleMLocRelease(bufp, hdr_loc, newfield_loc);
-  INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+  tmp_body = TSstrdup(errormsg_body);
+  TSHttpTxnErrorBodySet(txnp, tmp_body, strlen(tmp_body), NULL);
+  TSHandleMLocRelease(bufp, hdr_loc, newfield_loc);
+  TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
 
 
 done:
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 }
 
 
 
 static int
-redirect_plugin(INKCont contp, INKEvent event, void *edata)
+redirect_plugin(TSCont contp, TSEvent event, void *edata)
 {
 
-  INKHttpTxn txnp = (INKHttpTxn) edata;
+  TSHttpTxn txnp = (TSHttpTxn) edata;
 
   switch (event) {
-  case INK_EVENT_HTTP_READ_REQUEST_HDR:
+  case TS_EVENT_HTTP_READ_REQUEST_HDR:
 
     handle_client_lookup(txnp, contp);
     return 0;
 
-  case INK_EVENT_HTTP_SEND_RESPONSE_HDR:
+  case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
 
     handle_response(txnp);
     return 0;
@@ -309,50 +309,50 @@ init_stats(void)
 /*
  *	This function is only called for redirected requests.  It illustrates
  *	several different ways of updating INT64 stats.  Some may consider
- *	the particular use of INKDecrementStat() shown below somewhat contrived.
+ *	the particular use of TSDecrementStat() shown below somewhat contrived.
  */
 void
-update_redirected_method_stats(INKMBuffer bufp, INKMLoc hdr_loc)
+update_redirected_method_stats(TSMBuffer bufp, TSMLoc hdr_loc)
 {
   const char *txn_method;
   int length;
-  INK64 tempint;
+  int64 tempint;
 
-  txn_method = INKHttpHdrMethodGet(bufp, hdr_loc, &length);
+  txn_method = TSHttpHdrMethodGet(bufp, hdr_loc, &length);
 
   if (NULL != txn_method) {
-    if (0 == strncmp(txn_method, INK_HTTP_METHOD_CONNECT, length))
+    if (0 == strncmp(txn_method, TS_HTTP_METHOD_CONNECT, length))
       INKStatIncrement(method_count_redirected_connect);
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_DELETE, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_DELETE, length))
       INKStatIncrement(method_count_redirected_delete);
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_GET, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_GET, length))
       INKStatIncrement(method_count_redirected_get);
 
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_HEAD, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_HEAD, length))
       INKStatFloatAddTo(method_count_redirected_head, 1);
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_ICP_QUERY, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_ICP_QUERY, length))
       INKStatFloatAddTo(method_count_redirected_icp_query, 1);
 
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_OPTIONS, length)) {
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_OPTIONS, length)) {
       INKStatIntGet(method_count_redirected_options, &tempint);
       tempint++;
       INKStatIntSet(method_count_redirected_options, tempint);
-    } else if (0 == strncmp(txn_method, INK_HTTP_METHOD_POST, length)) {
+    } else if (0 == strncmp(txn_method, TS_HTTP_METHOD_POST, length)) {
       INKStatDecrement(method_count_redirected_post);
       INKStatIncrement(method_count_redirected_post);
       INKStatIncrement(method_count_redirected_post);
     }
 
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PURGE, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_PURGE, length))
       INKStatIncrement(method_count_redirected_purge);
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PUT, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_PUT, length))
       INKStatIncrement(method_count_redirected_put);
-    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_TRACE, length))
+    else if (0 == strncmp(txn_method, TS_HTTP_METHOD_TRACE, length))
       INKStatIncrement(method_count_redirected_trace);
     else
       INKStatIncrement(method_count_redirected_unknown);
   }
-  INKHandleStringRelease(bufp, hdr_loc, txn_method);
+  TSHandleStringRelease(bufp, hdr_loc, txn_method);
 
 }
 
@@ -360,7 +360,7 @@ int
 check_ts_version()
 {
 
-  const char *ts_version = INKTrafficServerVersionGet();
+  const char *ts_version = TSTrafficServerVersionGet();
   int result = 0;
 
   if (ts_version) {
@@ -383,52 +383,52 @@ check_ts_version()
 }
 
 void
-INKPluginInit(int argc, const char *argv[])
+TSPluginInit(int argc, const char *argv[])
 {
   const char prefix[] = "http://";
   int uri_len;
-  INKPluginRegistrationInfo info;
+  TSPluginRegistrationInfo info;
 
   info.plugin_name = "redirect-1";
   info.vendor_name = "MyCompany";
   info.support_email = "ts-api-support@MyCompany.com";
 
-  if (!INKPluginRegister(INK_SDK_VERSION_2_0, &info)) {
-    INKError("Plugin registration failed.\n");
+  if (!TSPluginRegister(TS_SDK_VERSION_2_0, &info)) {
+    TSError("Plugin registration failed.\n");
   }
 
   if (!check_ts_version()) {
-    INKError("Plugin requires Traffic Server 2.0 or later\n");
+    TSError("Plugin requires Traffic Server 2.0 or later\n");
     return;
   }
 
   if (argc == 3) {
-    block_ip = INKstrdup(argv[1]);
+    block_ip = TSstrdup(argv[1]);
 
     /*
      *   The Location header must contain an absolute URI:
      */
 
-    url_redirect = INKstrdup(argv[2]);
+    url_redirect = TSstrdup(argv[2]);
     uri_len = strlen(prefix) + strlen(url_redirect) + 1;
-    uri_redirect = INKmalloc(uri_len);
+    uri_redirect = TSmalloc(uri_len);
     strcpy(uri_redirect, prefix);
     strcat(uri_redirect, url_redirect);
 
   } else {
-    INKError("Incorrect syntax in plugin.conf:  correct usage is" "redirect-1.so ip_deny url_redirect");
+    TSError("Incorrect syntax in plugin.conf:  correct usage is" "redirect-1.so ip_deny url_redirect");
     return;
   }
 
   ip_deny = inet_addr(block_ip);
 
-  INKDebug("redirect_init", "initializing stats...");
+  TSDebug("redirect_init", "initializing stats...");
   init_stats();
-  INKHttpHookAdd(INK_HTTP_READ_REQUEST_HDR_HOOK, INKContCreate(redirect_plugin, NULL));
+  TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(redirect_plugin, NULL));
 
-  INKDebug("redirect_init", "block_ip is %s, url_redirect is %s, and uri_redirect is %s",
+  TSDebug("redirect_init", "block_ip is %s, url_redirect is %s, and uri_redirect is %s",
            block_ip, url_redirect, uri_redirect);
-  INKDebug("redirect_init", "ip_deny is %ld\n", ip_deny);
+  TSDebug("redirect_init", "ip_deny is %ld\n", ip_deny);
 
   /*
    *  Demonstrate another tracing function.  This can be used to
@@ -436,8 +436,8 @@ INKPluginInit(int argc, const char *argv
    *  be done in debug mode.
    */
 
-  if (INKIsDebugTagSet("redirect_demo"))
-    INKDebug("redirect_init", "The redirect_demo tag is set");
+  if (TSIsDebugTagSet("redirect_demo"))
+    TSDebug("redirect_init", "The redirect_demo tag is set");
   else
-    INKDebug("redirect_init", "The redirect_demo tag is not set");
+    TSDebug("redirect_init", "The redirect_demo tag is not set");
 }

Propchange: trafficserver/traffic/branches/wccp/example/remap/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 30 01:42:55 2010
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+.deps